From f78aca7752552a718763dd360020f2fc54a4adb0 Mon Sep 17 00:00:00 2001 From: NanoRocky <76585834+NanoRocky@users.noreply.github.com> Date: Sun, 11 May 2025 02:15:37 +0800 Subject: [PATCH] Fix provider_config by sourcery-ai --- astrbot/core/provider/sources/azure_tts_source.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/astrbot/core/provider/sources/azure_tts_source.py b/astrbot/core/provider/sources/azure_tts_source.py index 54ee2125c..18d9bfbac 100644 --- a/astrbot/core/provider/sources/azure_tts_source.py +++ b/astrbot/core/provider/sources/azure_tts_source.py @@ -91,7 +91,7 @@ class OTTSProvider: class AzureNativeProvider(TTSProvider): def __init__(self, provider_config: dict, provider_settings: dict): super().__init__(provider_config, provider_settings) - self.subscription_key = provider_config["azure_tts_subscription_key"].strip() + self.subscription_key = provider_config.get("azure_tts_subscription_key", "").strip() if not re.fullmatch(r'^[a-zA-Z0-9]{32}$', self.subscription_key): raise ValueError("无效的Azure订阅密钥") self.region = provider_config.get("azure_tts_region", "eastus").strip() @@ -207,4 +207,4 @@ class AzureTTSProvider(TTSProvider): ) else: async with self.provider as provider: - return await provider.get_audio(text) \ No newline at end of file + return await provider.get_audio(text)