Skip to content

利用 AI 大模型和自动化工作流,根据主题或关键词一键生成高清短视频。Generate HD short videos from a topic or keyword with an automated AI workflow.

perf: validate Azure speech key and region before creating speech

harry4d5ca7f6f4f5
diff --git a/app/services/voice.py b/app/services/voice.py
index 8e9d8248..e6b4d597 100644
--- a/app/services/voice.py
+++ b/app/services/voice.py
@@ -1337,6 +1337,10 @@ def azure_tts_v2(text: str, voice_name: str, voice_file: str) -> Union[SubMaker,
# Creates an instance of a speech config with specified subscription key and service region.
speech_key = config.azure.get("speech_key", "")
service_region = config.azure.get("speech_region", "")
+ if not speech_key or not service_region:
+ logger.error("Azure speech key or region is not set")
+ return None
+
audio_config = speechsdk.audio.AudioOutputConfig(
filename=voice_file, use_default_speaker=True
)