Updating
This commit is contained in:
-6
@@ -8,7 +8,6 @@ namespace LCU.Webapps.Marketing.SPIT.Model
|
|||||||
public string AppName { get; set; }
|
public string AppName { get; set; }
|
||||||
public string SeqApiKey { get; set; }
|
public string SeqApiKey { get; set; }
|
||||||
public string SeqUrl { get; set; }
|
public string SeqUrl { get; set; }
|
||||||
public string SubscriptionKey { get; set; }
|
|
||||||
public string SpeechApiKey { get; set; }
|
public string SpeechApiKey { get; set; }
|
||||||
public string SpeechEndpoint { get; set; }
|
public string SpeechEndpoint { get; set; }
|
||||||
public string FetchTokenUri { get; set; }
|
public string FetchTokenUri { get; set; }
|
||||||
@@ -21,11 +20,6 @@ namespace LCU.Webapps.Marketing.SPIT.Model
|
|||||||
public string DefaultLanguageWithCountryCode { get; set; }
|
public string DefaultLanguageWithCountryCode { get; set; }
|
||||||
public List<string> EnabledLanguageOptionCodes { get; set; }
|
public List<string> EnabledLanguageOptionCodes { get; set; }
|
||||||
|
|
||||||
public string ResolveSpeechSubscriptionKey()
|
|
||||||
{
|
|
||||||
return string.IsNullOrWhiteSpace(SpeechApiKey) ? SubscriptionKey : SpeechApiKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool HasSpeechEndpoint()
|
public bool HasSpeechEndpoint()
|
||||||
{
|
{
|
||||||
return !string.IsNullOrWhiteSpace(SpeechEndpoint);
|
return !string.IsNullOrWhiteSpace(SpeechEndpoint);
|
||||||
|
|||||||
+1
-1
@@ -216,7 +216,7 @@
|
|||||||
|
|
||||||
await JSRuntime.InvokeVoidAsync(
|
await JSRuntime.InvokeVoidAsync(
|
||||||
"synthesizeSpeech",
|
"synthesizeSpeech",
|
||||||
spitConfiguration.ResolveSpeechSubscriptionKey(),
|
spitConfiguration.SpeechApiKey,
|
||||||
spitConfiguration.Region,
|
spitConfiguration.Region,
|
||||||
spitConfiguration.SpeechEndpoint,
|
spitConfiguration.SpeechEndpoint,
|
||||||
_textToSpeech.Ssml);
|
_textToSpeech.Ssml);
|
||||||
|
|||||||
+1
-6
@@ -20,19 +20,14 @@ public class AuthenticationService
|
|||||||
var uri = BuildTokenUri();
|
var uri = BuildTokenUri();
|
||||||
|
|
||||||
var client = _lcuHttpClient.CreateClient(uri);
|
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);
|
var result = await client.PostAsync(uri.AbsoluteUri, null);
|
||||||
return await result.Content.ReadAsStringAsync();
|
return await result.Content.ReadAsStringAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Uri BuildTokenUri()
|
private Uri BuildTokenUri()
|
||||||
{
|
|
||||||
if (_spitConfiguration.HasSpeechEndpoint())
|
|
||||||
{
|
{
|
||||||
return new Uri(_spitConfiguration.ResolveSpeechEndpointUri(), "/sts/v1.0/issueToken");
|
return new Uri(_spitConfiguration.ResolveSpeechEndpointUri(), "/sts/v1.0/issueToken");
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Uri($"https://{_spitConfiguration.Region}.{_spitConfiguration.FetchTokenUri}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-8
@@ -107,14 +107,9 @@ namespace LCU.Webapps.Marketing.SPIT.Services
|
|||||||
|
|
||||||
private SpeechConfig BuildSpeechConfig()
|
private SpeechConfig BuildSpeechConfig()
|
||||||
{
|
{
|
||||||
var subscriptionKey = _spitConfiguration.ResolveSpeechSubscriptionKey();
|
return SpeechConfig.FromEndpoint(
|
||||||
|
_spitConfiguration.ResolveSpeechEndpointUri(),
|
||||||
if (_spitConfiguration.HasSpeechEndpoint())
|
_spitConfiguration.SpeechApiKey);
|
||||||
{
|
|
||||||
return SpeechConfig.FromEndpoint(_spitConfiguration.ResolveSpeechEndpointUri(), subscriptionKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
return SpeechConfig.FromSubscription(subscriptionKey, _spitConfiguration.Region);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-5
@@ -49,13 +49,8 @@ namespace LCU.Webapps.Marketing.SPIT.Services
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Uri BuildVoicesUri()
|
private Uri BuildVoicesUri()
|
||||||
{
|
|
||||||
if (_spitConfiguration.HasSpeechEndpoint())
|
|
||||||
{
|
{
|
||||||
return new Uri(_spitConfiguration.ResolveSpeechEndpointUri(), "/cognitiveservices/voices/list");
|
return new Uri(_spitConfiguration.ResolveSpeechEndpointUri(), "/cognitiveservices/voices/list");
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Uri($"https://{_spitConfiguration.Region}{_spitConfiguration.VoicesUrl}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-1
@@ -4,7 +4,6 @@
|
|||||||
"AppName": "Speech Production Interface Tool",
|
"AppName": "Speech Production Interface Tool",
|
||||||
"SeqApiKey": "VALUE-IN-KEYVAULT",
|
"SeqApiKey": "VALUE-IN-KEYVAULT",
|
||||||
"SeqUrl": "https://qa-seq.lcu-internal.com",
|
"SeqUrl": "https://qa-seq.lcu-internal.com",
|
||||||
"SubscriptionKey": "VALUE-IN-KEYVAULT",
|
|
||||||
"SpeechApiKey": "VALUE-IN-KEYVAULT",
|
"SpeechApiKey": "VALUE-IN-KEYVAULT",
|
||||||
"SpeechEndpoint": "VALUE-IN-KEYVAULT",
|
"SpeechEndpoint": "VALUE-IN-KEYVAULT",
|
||||||
"FetchTokenUri": "api.cognitive.microsoft.com/sts/v1.0/issueToken",
|
"FetchTokenUri": "api.cognitive.microsoft.com/sts/v1.0/issueToken",
|
||||||
|
|||||||
Reference in New Issue
Block a user