fix: issue where an error occurs when invoking TTS without selecting a voice (#5046)
This commit is contained in:
parent
2573b138bf
commit
5986841e27
3 changed files with 9 additions and 2 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue