From ce7775dc43eb8bbd69d1b84b262f73bd24763ecc Mon Sep 17 00:00:00 2001 From: Zeeshaun Date: Wed, 22 Apr 2026 19:54:26 +0000 Subject: [PATCH] Updating --- .../Pages/_Host.cshtml | 4 +-- .../wwwroot/js/SpeechFunctions.js | 25 ++++++++++++++----- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/Pages/_Host.cshtml b/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/Pages/_Host.cshtml index 2e0f431..7815890 100644 --- a/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/Pages/_Host.cshtml +++ b/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/Pages/_Host.cshtml @@ -48,7 +48,7 @@ System.Text.RegularExpressions.Regex.IsMatch(userAgent, @"MSIE \d|Trident.*rv:") - - + + diff --git a/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/wwwroot/js/SpeechFunctions.js b/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/wwwroot/js/SpeechFunctions.js index f5aee3e..6cd5a1f 100644 --- a/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/wwwroot/js/SpeechFunctions.js +++ b/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/wwwroot/js/SpeechFunctions.js @@ -46,18 +46,31 @@ function synthesizeSpeech(subscriptionKey, region, endpoint, ssml) { } function createSpeechConfig(SpeechSDK, subscriptionKey, region, endpoint) { - const trimmedRegion = typeof region === "string" ? region.trim() : ""; const trimmedEndpoint = typeof endpoint === "string" ? endpoint.trim() : ""; + const trimmedRegion = typeof region === "string" ? region.trim() : ""; + + if (trimmedRegion) { + if (!trimmedEndpoint) { + return SpeechSDK.SpeechConfig.fromSubscription(subscriptionKey, trimmedRegion); + } + } + + if (trimmedEndpoint) { + const endpointUrl = new URL(trimmedEndpoint); + const hasCustomPath = endpointUrl.pathname && endpointUrl.pathname !== "/"; + + if (hasCustomPath) { + return SpeechSDK.SpeechConfig.fromEndpoint(endpointUrl, subscriptionKey); + } + + return SpeechSDK.SpeechConfig.fromHost(endpointUrl, subscriptionKey); + } if (trimmedRegion) { return SpeechSDK.SpeechConfig.fromSubscription(subscriptionKey, trimmedRegion); } - if (trimmedEndpoint) { - return SpeechSDK.SpeechConfig.fromEndpoint(new URL(trimmedEndpoint), subscriptionKey); - } - - throw new Error("Speech configuration is missing both region and endpoint."); + throw new Error("Speech configuration is missing both endpoint and region."); } function buildSynthesisErrorMessage(SpeechSDK, result, region, endpoint) {