fix: loop until voice list available

This commit is contained in:
Timothy J. Baek 2024-01-25 00:07:27 -08:00
parent 9101c174d8
commit 3b7f7c6e32

View File

@ -618,7 +618,17 @@
gravatarEmail = settings.gravatarEmail ?? '';
speakVoice = settings.speakVoice ?? '';
await voices.set(await speechSynthesis.getVoices());
// await voices.set(await speechSynthesis.getVoices());
const getVoicesLoop = setInterval(async () => {
const _voices = await speechSynthesis.getVoices();
await voices.set(_voices);
// do your loop
if (_voices.length > 0) {
clearInterval(getVoicesLoop);
}
}, 100);
saveChatHistory = settings.saveChatHistory ?? true;