fix: tts tool must choose a voice

pull/21877/head
hjlarry 11 months ago
parent 06c3deff11
commit f12a1a2afc

@ -31,6 +31,14 @@ class TTSTool(BuiltinTool):
model_type=ModelType.TTS, model_type=ModelType.TTS,
model=model, model=model,
) )
if not voice:
voices = model_instance.get_tts_voices()
if voices:
voice = voices[0].get("value")
if not voice:
raise ValueError("Sorry, no voice available.")
else:
raise ValueError("Sorry, no voice available.")
tts = model_instance.invoke_tts( tts = model_instance.invoke_tts(
content_text=tool_parameters.get("text"), # type: ignore content_text=tool_parameters.get("text"), # type: ignore
user=user_id, user=user_id,

Loading…
Cancel
Save