[bugfix] Fix multimodal_output property to check completion outputs where audio data is attached (#1203)
Signed-off-by: linyueqian <linyueqian@outlook.com>
This commit is contained in:
1 parent
53a44c56fe
commit
accf334112
2 files changed
+15
-4
No files matched your search
@@ -111,9 +111,14 @@ def run_tts_generation(args) -> None:
|
||||
print(response.text)
|
||||
return
|
||||
|
||||
if response.content.decode("utf-8").startswith('{"error"'):
|
||||
print(f"Error: {response.content.decode('utf-8')}")
|
||||
return
|
||||
# Check for JSON error response (only if content is valid UTF-8 text)
|
||||
try:
|
||||
text = response.content.decode("utf-8")
|
||||
if text.startswith('{"error"'):
|
||||
print(f"Error: {text}")
|
||||
return
|
||||
except UnicodeDecodeError:
|
||||
pass # Binary audio data, not an error
|
||||
|
||||
# Save audio response
|
||||
output_path = args.output or "tts_output.wav"
|
||||
|
||||
Reference in new issue
Block a user