fix: handle audio generation failure by raising an exception

This commit is contained in:
CaptainB 2025-03-26 17:13:18 +08:00 committed by 刘瑞斌
parent 2971406909
commit 1e8e3a90aa

View File

@ -46,6 +46,8 @@ class AliyunBaiLianTextToSpeech(MaxKBBaseModel, BaseTextToSpeech):
from dashscope.audio.tts_v2 import SpeechSynthesizer
synthesizer = SpeechSynthesizer(model=self.model, **self.params)
audio = synthesizer.call(text)
if audio is None:
raise Exception('Failed to generate audio')
if type(audio) == str:
print(audio)
raise Exception(audio)