diff --git a/Content.Server/White/TTS/TTSManager.cs b/Content.Server/White/TTS/TTSManager.cs index 9ec02ac509..a7f2dbe144 100644 --- a/Content.Server/White/TTS/TTSManager.cs +++ b/Content.Server/White/TTS/TTSManager.cs @@ -41,7 +41,7 @@ public sealed class TTSManager private readonly HttpClient _httpClient = new(); private ISawmill _sawmill = default!; - private readonly Dictionary _cache = new(); + private readonly Dictionary _cache = new(); public void Initialize() { @@ -55,7 +55,7 @@ public sealed class TTSManager /// SSML formatted text /// OGG audio bytes /// Throws if url or token CCVar not set or http request failed - public async Task ConvertTextToSpeech(string speaker, string text, string pitch, string rate) + public async Task ConvertTextToSpeech(string speaker, string text, string pitch, string rate) { var url = _cfg.GetCVar(WhiteCVars.TTSApiUrl); var maxCacheSize = _cfg.GetCVar(WhiteCVars.TTSMaxCacheSize); @@ -111,14 +111,14 @@ public sealed class TTSManager catch (TaskCanceledException) { RequestTimings.WithLabels("Timeout").Observe((DateTime.UtcNow - reqTime).TotalSeconds); - _sawmill.Error($"Timeout of request generation new sound for '{text}' speech by '{speaker}' speaker"); - throw new Exception("TTS request timeout"); + _sawmill.Warning($"Timeout of request generation new sound for '{text}' speech by '{speaker}' speaker"); + return null; } catch (Exception e) { RequestTimings.WithLabels("Error").Observe((DateTime.UtcNow - reqTime).TotalSeconds); - _sawmill.Error($"Failed of request generation new sound for '{text}' speech by '{speaker}' speaker\n{e}"); - throw new Exception("TTS request failed"); + _sawmill.Warning($"Failed of request generation new sound for '{text}' speech by '{speaker}' speaker\n{e}"); + return null; } } diff --git a/Content.Server/White/TTS/TTSSystem.cs b/Content.Server/White/TTS/TTSSystem.cs index 22338555c9..6d9a609f57 100644 --- a/Content.Server/White/TTS/TTSSystem.cs +++ b/Content.Server/White/TTS/TTSSystem.cs @@ -43,6 +43,10 @@ public sealed partial class TTSSystem : EntitySystem private async void OnRequestTTS(MsgRequestTTS ev) { + var url = _cfg.GetCVar(WhiteCVars.TTSApiUrl); + if (string.IsNullOrWhiteSpace(url)) + return; + if (!_playerManager.TryGetSessionByChannel(ev.MsgChannel, out var session) || !_prototypeManager.TryIndex(ev.VoiceId, out var protoVoice)) return; diff --git a/Content.Shared/White/TTS/TTSPitchRateSystem.cs b/Content.Shared/White/TTS/TTSPitchRateSystem.cs index 295ca4e85b..bf9446b6c4 100644 --- a/Content.Shared/White/TTS/TTSPitchRateSystem.cs +++ b/Content.Shared/White/TTS/TTSPitchRateSystem.cs @@ -39,7 +39,7 @@ public sealed class TTSPitchRateSystem : EntitySystem pitchRate[0] = "high"; pitchRate[1] = "slow"; } - else if (humanoid.SkinColor.R >= 0.6) // Niggers + else if (humanoid.SkinColor.R >= 0.6) { pitchRate[0] = "x-low"; pitchRate[1] = "medium";