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.", + ); + } }} />