alessandro trinca tornidor commited on
Commit
fe7b9b7
·
1 Parent(s): 89dc4a6

feat: exec an alert with an error message in case of missing TTS voices

Browse files
Files changed (1) hide show
  1. aip_trainer/lambdas/js.py +3 -3
aip_trainer/lambdas/js.py CHANGED
@@ -65,9 +65,9 @@ function playAudio(text, language) {
65
  voicesSynth = voices.filter(voice => voice.lang.startsWith(language));
66
  }
67
  if (voicesSynth.length === 0) {
68
- console.error(`No voice found for language ${voice_lang}/${language}, you should use the Text-To-Speech backend feature...`)
69
- throw new Error(`No voice found for language ${voice_lang}/${language}, you should use the Text-To-Speech backend feature...`)
70
- alert(`No voice found for language ${voice_lang}/${language}, you should use the Text-To-Speech backend feature...`)
71
  }
72
  var utterThis = new SpeechSynthesisUtterance(text);
73
  utterThis.voice = voicesSynth[0];
 
65
  voicesSynth = voices.filter(voice => voice.lang.startsWith(language));
66
  }
67
  if (voicesSynth.length === 0) {
68
+ msg = `Error: no voice found for language ${voice_lang} / ${language}, you should use the Text-To-Speech backend feature...`
69
+ alert(msg)
70
+ throw new Error(msg)
71
  }
72
  var utterThis = new SpeechSynthesisUtterance(text);
73
  utterThis.voice = voicesSynth[0];