support rimelabs new voices (#387)

This commit is contained in:
Hoan Luu Huu
2025-02-07 19:22:42 +07:00
committed by GitHub
parent 6c7d2c9074
commit 9cfe990bb8

View File

@@ -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);
}