fix(tools): add raise_for_status for MiniMax t2a_v2 TTS path

The MiniMax t2a_v2 code path calls response.json() without first
checking the HTTP status code. If the API returns HTTP 4xx/5xx with
non-JSON content (e.g. HTML error page), response.json() raises an
opaque JSONDecodeError instead of a clear HTTPError.

The non-t2a_v2 path already has response.raise_for_status() at line
1299. Add the same check before response.json() in the t2a_v2 path
for consistent error handling.
This commit is contained in:
annguyenNous
2026-06-03 18:00:43 +07:00
committed by Teknium
parent dd4ba4c2c4
commit 4cca7f569d

View File

@ -1261,6 +1261,7 @@ def _generate_minimax_tts(text: str, output_path: str, tts_config: Dict[str, Any
if is_t2a_v2: if is_t2a_v2:
# t2a_v2 returns JSON with hex-encoded audio # t2a_v2 returns JSON with hex-encoded audio
response.raise_for_status()
result = response.json() result = response.json()
base_resp = result.get("base_resp", {}) base_resp = result.get("base_resp", {})
status_code = base_resp.get("status_code", -1) status_code = base_resp.get("status_code", -1)