From 67192a794604ed98241f319f4ed4a1608758f0e3 Mon Sep 17 00:00:00 2001 From: dakai Date: Mon, 14 Oct 2024 03:46:51 +0800 Subject: [PATCH] follow the rabbit to fix potential issues --- app/components/tts-config.tsx | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/app/components/tts-config.tsx b/app/components/tts-config.tsx index 30c1424d6..091f55445 100644 --- a/app/components/tts-config.tsx +++ b/app/components/tts-config.tsx @@ -31,8 +31,7 @@ export function TTSConfigList(props: { ttsPlayer.stop(); setSpeechStatus(false); } else { - var api: ClientApi; - api = new ClientApi(ModelProvider.GPT); + const api = new ClientApi(ModelProvider.GPT); const config = useAppConfig.getState(); setSpeechLoading(true); ttsPlayer.init(); @@ -141,23 +140,25 @@ export function TTSConfigList(props: { : Locale.Chat.Actions.Speech } onClick={() => { - speechStatus - ? (ttsPlayer.stop(), setSpeechStatus(false)) - : openaiSpeech( - "NextChat,Unleash your imagination, experience the future of AI conversation.", - ); + if (speechStatus) { + ttsPlayer.stop(); + setSpeechStatus(false); + } else { + openaiSpeech( + "NextChat,Unleash your imagination, experience the future of AI conversation.", + ); + } }} />