mirror of
https://github.com/harry0703/MoneyPrinterTurbo.git
synced 2026-02-21 08:27:22 +08:00
perf: validate Azure speech key and region before creating speech
This commit is contained in:
parent
fec3a8b6bd
commit
4d5ca7f6f4
@ -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.
|
# Creates an instance of a speech config with specified subscription key and service region.
|
||||||
speech_key = config.azure.get("speech_key", "")
|
speech_key = config.azure.get("speech_key", "")
|
||||||
service_region = config.azure.get("speech_region", "")
|
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(
|
audio_config = speechsdk.audio.AudioOutputConfig(
|
||||||
filename=voice_file, use_default_speaker=True
|
filename=voice_file, use_default_speaker=True
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user