get elevenlabs options from syntheizier.options

This commit is contained in:
Quan HL
2023-11-30 15:48:26 +07:00
parent be3c484527
commit 689fab6857
+5 -5
View File
@@ -76,7 +76,7 @@ const trimTrailingSilence = (buffer) => {
* the synthesized audio, and a variable indicating whether it was served from cache
*/
async function synthAudio(client, logger, stats, { account_sid,
vendor, language, voice, gender, text, engine, salt, model, credentials, deploymentId, disableTtsCache
vendor, language, voice, gender, text, engine, salt, model, credentials, deploymentId, disableTtsCache, options
}) {
let audioBuffer;
let servedFromCache = false;
@@ -194,7 +194,7 @@ async function synthAudio(client, logger, stats, { account_sid,
audioBuffer = await synthWellSaid(logger, {credentials, stats, language, voice, text, filePath});
break;
case 'elevenlabs':
audioBuffer = await synthElevenlabs(logger, {credentials, stats, language, voice, text, filePath});
audioBuffer = await synthElevenlabs(logger, {credentials, options, stats, language, voice, text, filePath});
break;
case 'whisper':
audioBuffer = await synthWhisper(logger, {credentials, stats, voice, text});
@@ -585,9 +585,9 @@ const synthCustomVendor = async(logger, {credentials, stats, language, voice, te
}
};
const synthElevenlabs = async(logger, {credentials, stats, language, voice, text}) => {
const {api_key, model_id, options} = credentials;
const opts = JSON.parse(options || '{}');
const synthElevenlabs = async(logger, {credentials, options, stats, language, voice, text}) => {
const {api_key, model_id, options: credOpts} = credentials;
const opts = JSON.parse(options || credOpts || '{}');
const optimize_streaming_latency = opts.optimize_streaming_latency ?
`?optimize_streaming_latency=${opts.optimize_streaming_latency}` : '';
try {