fix: user voice should update when global voice updates

This commit is contained in:
Timothy J. Baek 2024-08-02 22:28:39 +02:00
parent 9d5e3e2a91
commit 0c6284be02
2 changed files with 11 additions and 2 deletions

View File

@ -253,7 +253,9 @@
for (const [idx, sentence] of sentences.entries()) {
const res = await synthesizeOpenAISpeech(
localStorage.token,
$settings?.audio?.tts?.voice ?? $config?.audio?.tts?.voice,
$settings?.audio?.tts?.defaultVoice === $config.audio.tts.voice
? $settings?.audio?.tts?.voice ?? $config?.audio?.tts?.voice
: $config?.audio?.tts?.voice,
sentence
).catch((error) => {
toast.error(error);

View File

@ -61,7 +61,13 @@
responseAutoPlayback = $settings.responseAutoPlayback ?? false;
STTEngine = $settings?.audio?.stt?.engine ?? '';
voice = $settings?.audio?.tts?.voice ?? $config.audio.tts.voice ?? '';
if ($settings?.audio?.tts?.defaultVoice === $config.audio.tts.voice) {
voice = $settings?.audio?.tts?.voice ?? $config.audio.tts.voice ?? '';
} else {
voice = $config.audio.tts.voice ?? '';
}
nonLocalVoices = $settings.audio?.tts?.nonLocalVoices ?? false;
await getVoices();
@ -78,6 +84,7 @@
},
tts: {
voice: voice !== '' ? voice : undefined,
defaultVoice: $config?.audio?.tts?.voice ?? '',
nonLocalVoices: $config.audio.tts.engine === '' ? nonLocalVoices : undefined
}
}