fix microsoft fetch list voice from hardcode westus region (#459)

This commit is contained in:
Hoan Luu Huu
2025-05-29 21:07:58 +07:00
committed by GitHub
parent c51b7bab82
commit 3e1b383284

View File

@@ -822,9 +822,10 @@ async function getLanguagesVoicesForAws(credential, getTtsVoices, logger) {
async function getLanguagesVoicesForMicrosoft(credential, getTtsVoices, logger) { async function getLanguagesVoicesForMicrosoft(credential, getTtsVoices, logger) {
if (credential) { if (credential) {
const response = await fetch('https://westus.tts.speech.microsoft.com/cognitiveservices/voices/list', { const {region, api_key} = credential;
const response = await fetch(`https://${region}.tts.speech.microsoft.com/cognitiveservices/voices/list`, {
headers: { headers: {
'Ocp-Apim-Subscription-Key': credential.api_key 'Ocp-Apim-Subscription-Key': api_key
} }
}); });
if (!response.ok) { if (!response.ok) {