diff --git a/lib/utils/speech-utils.js b/lib/utils/speech-utils.js index 77470de..827f16d 100644 --- a/lib/utils/speech-utils.js +++ b/lib/utils/speech-utils.js @@ -988,19 +988,17 @@ async function getLanguagesVoicesForRimelabs(credential) { const get = bent('https://users.rime.ai', 'GET', 'json', { 'Accept': 'application/json' }); - const voices = await get('/data/voices/all.json'); - let selectedVoices = model_id ? voices[model_id] : Object.values(voices).reduce((acc, val) => [...acc, ...val], []); - selectedVoices = selectedVoices.map((v) => ({ - name: v.charAt(0).toUpperCase() + v.slice(1), - value: v + const voices = await get('/data/voices/all-v2.json'); + const modelVoices = model_id ? voices[model_id] : + Object.keys(voices).length > 0 ? voices[Object.keys(voices)[0]] : []; + const ttsVoices = Object.entries(modelVoices).map(([key, voices]) => ({ + value: key, + name: key.charAt(0).toUpperCase() + key.slice(1), + voices: voices.map((v) => ({ + name: v.charAt(0).toUpperCase() + v.slice(1), + value: v + })) })); - const ttsVoices = [ - { - value: 'en-US', - name: 'English (US)', - voices: selectedVoices - } - ]; return tranform(ttsVoices, undefined, TtsModelRimelabs); }