support elevenlabs api_uri

This commit is contained in:
Hoan HL
2025-10-08 10:26:17 +07:00
parent 8d8195be9a
commit fb754ca101

View File

@@ -877,7 +877,7 @@ const synthCustomVendor = async(logger, {credentials, stats, language, voice,
const synthElevenlabs = async(logger, { const synthElevenlabs = async(logger, {
credentials, options, stats, voice, key, text, renderForCaching, disableTtsStreaming, disableTtsCache credentials, options, stats, voice, key, text, renderForCaching, disableTtsStreaming, disableTtsCache
}) => { }) => {
const {api_key, model_id, options: credOpts} = credentials; const {api_key, model_id, api_uri, options: credOpts} = credentials;
const opts = !!options && Object.keys(options).length !== 0 ? options : JSON.parse(credOpts || '{}'); const opts = !!options && Object.keys(options).length !== 0 ? options : JSON.parse(credOpts || '{}');
/* default to using the streaming interface, unless disabled by env var OR we want just a cache file */ /* default to using the streaming interface, unless disabled by env var OR we want just a cache file */
@@ -889,6 +889,7 @@ const synthElevenlabs = async(logger, {
params += `,voice=${voice}`; params += `,voice=${voice}`;
params += `,model_id=${model_id}`; params += `,model_id=${model_id}`;
params += `,write_cache_file=${disableTtsCache ? 0 : 1}`; params += `,write_cache_file=${disableTtsCache ? 0 : 1}`;
if (api_uri) params += `,api_uri=${api_uri}`;
if (opts.optimize_streaming_latency !== null && opts.optimize_streaming_latency !== undefined) { if (opts.optimize_streaming_latency !== null && opts.optimize_streaming_latency !== undefined) {
params += `,optimize_streaming_latency=${opts.optimize_streaming_latency}`; params += `,optimize_streaming_latency=${opts.optimize_streaming_latency}`;
} }