mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-11 11:56:53 +08:00
fix: issue where an error occurs when invoking TTS without selecting a voice (#5046)
This commit is contained in:
@@ -93,6 +93,13 @@ class AudioService:
|
||||
raise ProviderNotSupportTextToSpeechServiceError()
|
||||
|
||||
try:
|
||||
if not voice:
|
||||
voices = model_instance.get_tts_voices()
|
||||
if voices:
|
||||
voice = voices[0].get('value')
|
||||
else:
|
||||
raise ValueError("Sorry, no voice available.")
|
||||
|
||||
return model_instance.invoke_tts(
|
||||
content_text=text.strip(),
|
||||
user=end_user,
|
||||
|
||||
Reference in New Issue
Block a user