Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
xquanluu committed Oct 14, 2023
1 parent 67d813e commit ac4422c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/routes/api/speech-credentials.js
Original file line number Diff line number Diff line change
Expand Up @@ -809,15 +809,20 @@ const getTtsVoices = async(vendor, label, service_provider_sid, account_sid) =>
});
const resp = await get('/v1/voices');
return resp ? resp.voices.map((v) => {
return {
value: v.voice_id,
name: `${v.name}${v.category !== 'premade' ? ` (${v.category})` : ''} -
let name = `${v.name}${v.category !== 'premade' ? ` (${v.category})` : ''} -
${v.labels.accent ? ` ${v.labels.accent},` : ''}
${v.labels.description ? ` ${v.labels.description},` : ''}
${v.labels.age ? ` ${v.labels.age},` : ''}
${v.labels.gender ? ` ${v.labels.gender},` : ''}
${v.labels['use case'] ? ` ${v.labels['use case']},` : ''}
`.slice(0, -2)
`;
const lastIndex = name.lastIndexOf(',');
if (lastIndex !== -1) {
name = name.substring(0, lastIndex);
}
return {
value: v.voice_id,
name
};
}).sort((a, b) => a.name.localeCompare(b.name)) : [];
}
Expand Down

0 comments on commit ac4422c

Please sign in to comment.