diff --git a/src/react/index.ts b/src/react/index.ts index 1837447..0484b33 100644 --- a/src/react/index.ts +++ b/src/react/index.ts @@ -11,3 +11,4 @@ export { type OpenAISTTOptions, useOpenAISTT } from './useOpenAISTT'; export { type OpenAITTSOptions, useOpenAITTS } from './useOpenAITTS'; export { type SpeechRecognitionOptions, useSpeechRecognition } from './useSpeechRecognition'; export { type SpeechSynthesOptions, useSpeechSynthes } from './useSpeechSynthes'; +export { type TTSHook } from './useTTS'; diff --git a/src/react/useTTS/index.ts b/src/react/useTTS/index.ts index 1e30d61..e78af98 100644 --- a/src/react/useTTS/index.ts +++ b/src/react/useTTS/index.ts @@ -7,7 +7,9 @@ import { type AudioProps } from '@/react/AudioPlayer'; import { useStreamAudioPlayer } from '@/react/hooks/useStreamAudioPlayer'; export interface TTSHook extends SWRConfiguration, Pick { - audio: AudioProps; + audio: AudioProps & { + arrayBuffers: ArrayBuffer[]; + }; canStart: boolean; isGlobalLoading: boolean; isLoading: boolean; @@ -61,7 +63,7 @@ export const useTTS = ( if (index < textArray.length - 1) { setIndex(index + 1); } else { - onFinish?.(restAudio.arrayBuffers, ...rest); + onFinish?.([...restAudio.arrayBuffers, data].filter(Boolean), ...rest); setShouldFetch(false); setIsGlobalLoading(false); }