From 5680944393895f76dc53856bba8d81446cfdcf08 Mon Sep 17 00:00:00 2001 From: canisminor1990 Date: Tue, 5 Dec 2023 21:57:04 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20Fix=20types?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/react/index.ts | 1 + src/react/useTTS/index.ts | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) 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); }