follow the rabbit to fix potential issues

This commit is contained in:
dakai 2024-10-14 03:46:51 +08:00
parent bcd50b89c8
commit 67192a7946

View File

@ -31,8 +31,7 @@ export function TTSConfigList(props: {
ttsPlayer.stop(); ttsPlayer.stop();
setSpeechStatus(false); setSpeechStatus(false);
} else { } else {
var api: ClientApi; const api = new ClientApi(ModelProvider.GPT);
api = new ClientApi(ModelProvider.GPT);
const config = useAppConfig.getState(); const config = useAppConfig.getState();
setSpeechLoading(true); setSpeechLoading(true);
ttsPlayer.init(); ttsPlayer.init();
@ -141,23 +140,25 @@ export function TTSConfigList(props: {
: Locale.Chat.Actions.Speech : Locale.Chat.Actions.Speech
} }
onClick={() => { onClick={() => {
speechStatus if (speechStatus) {
? (ttsPlayer.stop(), setSpeechStatus(false)) ttsPlayer.stop();
: openaiSpeech( setSpeechStatus(false);
"NextChat,Unleash your imagination, experience the future of AI conversation.", } else {
); openaiSpeech(
"NextChat,Unleash your imagination, experience the future of AI conversation.",
);
}
}} }}
/> />
<Select <Select
value={props.ttsConfig.voice} value={props.ttsConfig.voice}
onChange={(e) => { onChange={(e) => {
props.updateConfig( props.updateConfig((config) => {
(config) => config.voice = TTSConfigValidator.voice(
(config.voice = TTSConfigValidator.voice( e.currentTarget.value,
e.currentTarget.value, );
)), });
);
}} }}
> >
{DEFAULT_TTS_VOICES.map((v, i) => ( {DEFAULT_TTS_VOICES.map((v, i) => (