diff --git a/Components/Layout/NavMenu.razor b/Components/Layout/NavMenu.razor index 5e02743..fa232e4 100644 --- a/Components/Layout/NavMenu.razor +++ b/Components/Layout/NavMenu.razor @@ -1,5 +1,6 @@  + + @code { private string Menu = "Tanulás, Gyakorlás, Tesztelés, Vizsgázás"; diff --git a/Components/Pages/Index.razor b/Components/Pages/Index.razor index 160239e..dd31367 100644 --- a/Components/Pages/Index.razor +++ b/Components/Pages/Index.razor @@ -28,7 +28,7 @@
-
+
Home @* @@ -63,7 +63,17 @@ if(TTSEnabled) { - + if (!AiVoicePermitted) + { + + } + else + { + + } } } @@ -78,7 +88,7 @@

-
+
@{ if (!string.IsNullOrEmpty(HtmlContent.ToString())) { @@ -184,22 +194,27 @@ private bool STTEnabled; private bool _initVoicePending = false; private bool welcomeStage = true; + private bool AiVoicePermitted = false; private string GetApiKey() => configuration?.GetSection("ElevenLabsAPI")?.GetValue("ApiKey") ?? string.Empty; + private void AllowAIVoice() + { + AiVoicePermitted = true; + } private void MuteAI() { - TTSEnabled = false; + AiVoicePermitted = false; } private async Task ConvertTextToSpeech() { // string plainText = WebUtility.HtmlDecode(HtmlContent.ToString()); - if (string.IsNullOrWhiteSpace(TextContent) || VoiceEnabled == false || TTSEnabled == false || welcomeStage) + if (string.IsNullOrWhiteSpace(TextContent) || VoiceEnabled == false || TTSEnabled == false || welcomeStage || !AiVoicePermitted) return; Console.WriteLine("------------------------------OMGOMGOMG TTS call!!!!-------------"); @@ -218,7 +233,15 @@ }; var requestJson = JsonSerializer.Serialize(requestContent); - string voiceId = "rE22Kc7UGoQj4zdHNYvd"; + string voiceId; + if(SiteInfo.voiceId != null) + { + voiceId = SiteInfo.voiceId; + } + else + { + voiceId = "rE22Kc7UGoQj4zdHNYvd"; + } // string voiceId = "yyPLNYHg3CvjlSdSOdLh"; var httpRequest = new HttpRequestMessage(HttpMethod.Post, $"https://api.elevenlabs.io/v1/text-to-speech/{voiceId}/stream") diff --git a/Components/Pages/ManageSiteInfo.razor b/Components/Pages/ManageSiteInfo.razor index 8973ce5..dc13f66 100644 --- a/Components/Pages/ManageSiteInfo.razor +++ b/Components/Pages/ManageSiteInfo.razor @@ -17,7 +17,7 @@ +