Skip to content

Commit

Permalink
fix: loop until voice list available
Browse files Browse the repository at this point in the history
  • Loading branch information
tjbck committed Jan 25, 2024
1 parent 9101c17 commit 3b7f7c6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/lib/components/chat/SettingsModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3b7f7c6

Please sign in to comment.