File tree Expand file tree Collapse file tree 5 files changed +26
-30
lines changed Expand file tree Collapse file tree 5 files changed +26
-30
lines changed Original file line number Diff line number Diff line change @@ -5,8 +5,8 @@ export { useAudioVisualizer } from './hooks/useAudioVisualizer';
5
5
export { useBlobUrl } from './hooks/useBlobUrl' ;
6
6
export { useStreamAudioPlayer } from './hooks/useStreamAudioPlayer' ;
7
7
export { useAudioRecorder } from './useAudioRecorder' ;
8
- export { type EdgeSpeechOptions , useEdgeSpeech } from './useEdgeSpeech' ;
9
- export { type MicrosoftSpeechOptions , useMicrosoftSpeech } from './useMicrosoftSpeech' ;
8
+ export { type EdgeSpeechOptions , useEdgeSpeech } from './useEdgeSpeech' ;
9
+ export { type MicrosoftSpeechOptions , useMicrosoftSpeech } from './useMicrosoftSpeech' ;
10
10
export {
11
11
type OpenaiSpeechRecognitionOptions ,
12
12
type OpenAISTTConfig ,
@@ -21,4 +21,4 @@ export {
21
21
type SpeechRecognitionOptions ,
22
22
useSpeechRecognition ,
23
23
} from './useSpeechRecognition/useSpeechRecognition' ;
24
- export { type SpeechSynthesOptions , useSpeechSynthes } from './useSpeechSynthes' ;
24
+ export { type SpeechSynthesOptions , useSpeechSynthes } from './useSpeechSynthes' ;
Original file line number Diff line number Diff line change 1
1
export { type OpenAISTTConfig , useOpenaiSTT } from './useOpenaiSTT' ;
2
2
export { useOpenaiSTTWithPSR } from './useOpenaiSTTWithPSR' ;
3
- export {
4
- type OpenaiSpeechRecognitionOptions ,
5
- useOpenaiSTTWithRecord ,
6
- } from './useOpenaiSTTWithRecord' ;
3
+ export { type STTConfig , useOpenaiSTTWithRecord } from './useOpenaiSTTWithRecord' ;
7
4
export { useOpenaiSTTWithSR } from './useOpenaiSTTWithSR' ;
Original file line number Diff line number Diff line change @@ -3,11 +3,10 @@ import { useCallback, useState } from 'react';
3
3
import { useOpenaiSTT } from '@/react/useOpenaiSTT/useOpenaiSTT' ;
4
4
import { usePersistedSpeechRecognition } from '@/react/useSpeechRecognition' ;
5
5
6
- import { OpenaiSpeechRecognitionOptions , STTConfig } from './useOpenaiSTTWithRecord' ;
6
+ import { STTConfig } from './useOpenaiSTTWithRecord' ;
7
7
8
8
export const useOpenaiSTTWithPSR = (
9
9
locale : string ,
10
- config : OpenaiSpeechRecognitionOptions ,
11
10
{
12
11
onBlobAvailable,
13
12
onTextChange,
@@ -16,6 +15,7 @@ export const useOpenaiSTTWithPSR = (
16
15
onFinished,
17
16
onStart,
18
17
onStop,
18
+ options,
19
19
...restConfig
20
20
} : STTConfig = { } ,
21
21
) => {
@@ -68,7 +68,7 @@ export const useOpenaiSTTWithPSR = (
68
68
handleStop ( ) ;
69
69
onFinished ?.( data , ...rest ) ;
70
70
} ,
71
- options : config . options ! ,
71
+ options : options ! ,
72
72
shouldFetch,
73
73
speech : blob as Blob ,
74
74
...restConfig ,
Original file line number Diff line number Diff line change @@ -7,27 +7,26 @@ import { SpeechRecognitionOptions } from '@/react/useSpeechRecognition/useSpeech
7
7
8
8
import { OpenAISTTConfig } from './useOpenaiSTT' ;
9
9
10
- export type OpenaiSpeechRecognitionOptions = SpeechRecognitionOptions & Partial < OpenAISTTConfig > ;
11
-
12
- export interface STTConfig extends SpeechRecognitionOptions , SWRConfiguration {
10
+ export interface STTConfig
11
+ extends SpeechRecognitionOptions ,
12
+ SWRConfiguration ,
13
+ Partial < OpenAISTTConfig > {
13
14
onFinished ?: SWRConfiguration [ 'onSuccess' ] ;
14
15
onStart ?: ( ) => void ;
15
16
onStop ?: ( ) => void ;
16
17
}
17
18
18
- export const useOpenaiSTTWithRecord = (
19
- config : Partial < OpenAISTTConfig > ,
20
- {
21
- onBlobAvailable,
22
- onTextChange,
23
- onSuccess,
24
- onError,
25
- onFinished,
26
- onStart,
27
- onStop,
28
- ...restConfig
29
- } : STTConfig = { } ,
30
- ) => {
19
+ export const useOpenaiSTTWithRecord = ( {
20
+ onBlobAvailable,
21
+ onTextChange,
22
+ onSuccess,
23
+ onError,
24
+ onFinished,
25
+ onStart,
26
+ onStop,
27
+ options,
28
+ ...restConfig
29
+ } : STTConfig = { } ) => {
31
30
const [ isGlobalLoading , setIsGlobalLoading ] = useState < boolean > ( false ) ;
32
31
const [ shouldFetch , setShouldFetch ] = useState < boolean > ( false ) ;
33
32
const [ text , setText ] = useState < string > ( ) ;
@@ -65,7 +64,7 @@ export const useOpenaiSTTWithRecord = (
65
64
handleStop ( ) ;
66
65
onFinished ?.( data , ...rest ) ;
67
66
} ,
68
- options : config . options ! ,
67
+ options : options ! ,
69
68
shouldFetch,
70
69
speech : blob as Blob ,
71
70
...restConfig ,
Original file line number Diff line number Diff line change @@ -3,11 +3,10 @@ import { useCallback, useState } from 'react';
3
3
import { useOpenaiSTT } from '@/react/useOpenaiSTT/useOpenaiSTT' ;
4
4
import { useSpeechRecognition } from '@/react/useSpeechRecognition' ;
5
5
6
- import { OpenaiSpeechRecognitionOptions , STTConfig } from './useOpenaiSTTWithRecord' ;
6
+ import { STTConfig } from './useOpenaiSTTWithRecord' ;
7
7
8
8
export const useOpenaiSTTWithSR = (
9
9
locale : string ,
10
- config : OpenaiSpeechRecognitionOptions ,
11
10
{
12
11
onBlobAvailable,
13
12
onTextChange,
@@ -16,6 +15,7 @@ export const useOpenaiSTTWithSR = (
16
15
onFinished,
17
16
onStart,
18
17
onStop,
18
+ options,
19
19
...restConfig
20
20
} : STTConfig = { } ,
21
21
) => {
@@ -68,7 +68,7 @@ export const useOpenaiSTTWithSR = (
68
68
handleStop ( ) ;
69
69
onFinished ?.( data , ...rest ) ;
70
70
} ,
71
- options : config . options ! ,
71
+ options : options ! ,
72
72
shouldFetch,
73
73
speech : blob as Blob ,
74
74
...restConfig ,
You can’t perform that action at this time.
0 commit comments