diff --git a/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/Model/SpitConfiguration.cs b/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/Model/SpitConfiguration.cs index 299dcc4..ffe50fd 100644 --- a/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/Model/SpitConfiguration.cs +++ b/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/Model/SpitConfiguration.cs @@ -8,7 +8,6 @@ namespace LCU.Webapps.Marketing.SPIT.Model public string AppName { get; set; } public string SeqApiKey { get; set; } public string SeqUrl { get; set; } - public string SubscriptionKey { get; set; } public string SpeechApiKey { get; set; } public string SpeechEndpoint { get; set; } public string FetchTokenUri { get; set; } @@ -21,11 +20,6 @@ namespace LCU.Webapps.Marketing.SPIT.Model public string DefaultLanguageWithCountryCode { get; set; } public List EnabledLanguageOptionCodes { get; set; } - public string ResolveSpeechSubscriptionKey() - { - return string.IsNullOrWhiteSpace(SpeechApiKey) ? SubscriptionKey : SpeechApiKey; - } - public bool HasSpeechEndpoint() { return !string.IsNullOrWhiteSpace(SpeechEndpoint); diff --git a/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/Pages/Index.razor b/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/Pages/Index.razor index 39679d3..8d0daa6 100644 --- a/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/Pages/Index.razor +++ b/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/Pages/Index.razor @@ -216,7 +216,7 @@ await JSRuntime.InvokeVoidAsync( "synthesizeSpeech", - spitConfiguration.ResolveSpeechSubscriptionKey(), + spitConfiguration.SpeechApiKey, spitConfiguration.Region, spitConfiguration.SpeechEndpoint, _textToSpeech.Ssml); diff --git a/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/Services/AuthenticationService.cs b/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/Services/AuthenticationService.cs index 4fed640..b8bf152 100644 --- a/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/Services/AuthenticationService.cs +++ b/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/Services/AuthenticationService.cs @@ -20,7 +20,7 @@ public class AuthenticationService var uri = BuildTokenUri(); var client = _lcuHttpClient.CreateClient(uri); - client.DefaultRequestHeaders.Add(_spitConfiguration.OcpApimSubscriptionKey, _spitConfiguration.ResolveSpeechSubscriptionKey()); + client.DefaultRequestHeaders.Add(_spitConfiguration.OcpApimSubscriptionKey, _spitConfiguration.SpeechApiKey); var result = await client.PostAsync(uri.AbsoluteUri, null); return await result.Content.ReadAsStringAsync(); @@ -28,11 +28,6 @@ public class AuthenticationService private Uri BuildTokenUri() { - if (_spitConfiguration.HasSpeechEndpoint()) - { - return new Uri(_spitConfiguration.ResolveSpeechEndpointUri(), "/sts/v1.0/issueToken"); - } - - return new Uri($"https://{_spitConfiguration.Region}.{_spitConfiguration.FetchTokenUri}"); + return new Uri(_spitConfiguration.ResolveSpeechEndpointUri(), "/sts/v1.0/issueToken"); } } diff --git a/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/Services/TextToSpeechService.cs b/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/Services/TextToSpeechService.cs index 4978bf5..a7d27f3 100644 --- a/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/Services/TextToSpeechService.cs +++ b/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/Services/TextToSpeechService.cs @@ -107,14 +107,9 @@ namespace LCU.Webapps.Marketing.SPIT.Services private SpeechConfig BuildSpeechConfig() { - var subscriptionKey = _spitConfiguration.ResolveSpeechSubscriptionKey(); - - if (_spitConfiguration.HasSpeechEndpoint()) - { - return SpeechConfig.FromEndpoint(_spitConfiguration.ResolveSpeechEndpointUri(), subscriptionKey); - } - - return SpeechConfig.FromSubscription(subscriptionKey, _spitConfiguration.Region); + return SpeechConfig.FromEndpoint( + _spitConfiguration.ResolveSpeechEndpointUri(), + _spitConfiguration.SpeechApiKey); } } } diff --git a/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/Services/VoiceService.cs b/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/Services/VoiceService.cs index e38b537..07e18c4 100644 --- a/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/Services/VoiceService.cs +++ b/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/Services/VoiceService.cs @@ -50,12 +50,7 @@ namespace LCU.Webapps.Marketing.SPIT.Services private Uri BuildVoicesUri() { - if (_spitConfiguration.HasSpeechEndpoint()) - { - return new Uri(_spitConfiguration.ResolveSpeechEndpointUri(), "/cognitiveservices/voices/list"); - } - - return new Uri($"https://{_spitConfiguration.Region}{_spitConfiguration.VoicesUrl}"); + return new Uri(_spitConfiguration.ResolveSpeechEndpointUri(), "/cognitiveservices/voices/list"); } } } diff --git a/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/appsettings.json b/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/appsettings.json index d69447c..4a697d8 100644 --- a/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/appsettings.json +++ b/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/appsettings.json @@ -4,7 +4,6 @@ "AppName": "Speech Production Interface Tool", "SeqApiKey": "VALUE-IN-KEYVAULT", "SeqUrl": "https://qa-seq.lcu-internal.com", - "SubscriptionKey": "VALUE-IN-KEYVAULT", "SpeechApiKey": "VALUE-IN-KEYVAULT", "SpeechEndpoint": "VALUE-IN-KEYVAULT", "FetchTokenUri": "api.cognitive.microsoft.com/sts/v1.0/issueToken",