fix private azure link with credential

This commit is contained in:
Quan HL
2024-05-14 14:01:25 +07:00
parent e5985620c0
commit 90d6048f52
+3 -2
View File
@@ -380,7 +380,7 @@ async function _synthOnPremMicrosoft(logger, {
text,
filePath
}) {
const {use_custom_tts, custom_tts_endpoint_url} = credentials;
const {use_custom_tts, custom_tts_endpoint_url, api_key} = credentials;
let content = text;
if (use_custom_tts && !content.startsWith('<speak')) {
@@ -404,7 +404,8 @@ async function _synthOnPremMicrosoft(logger, {
const post = bent('POST', 'buffer', {
'X-Microsoft-OutputFormat': trimSilence ? 'raw-8khz-16bit-mono-pcm' : 'audio-16khz-32kbitrate-mono-mp3',
'Content-Type': 'application/ssml+xml',
'User-Agent': 'Jambonz'
'User-Agent': 'Jambonz',
...(api_key && {'Ocp-Apim-Subscription-Key': api_key})
});
const mp3 = await post(custom_tts_endpoint_url, content);
return mp3;