diff --git a/skills/voice-message/scripts/voice_message.py b/skills/voice-message/scripts/voice_message.py index 9716a55..d713d0a 100644 --- a/skills/voice-message/scripts/voice_message.py +++ b/skills/voice-message/scripts/voice_message.py @@ -667,7 +667,14 @@ def _read_mimo_non_stream_response(response, audio_format: str) -> tuple[bytes, try: payload = json.loads(raw_body) except json.JSONDecodeError as exc: - raise RuntimeError(f"解析 mimo 响应失败: {exc}, 响应内容: {raw_body}") from exc + snippet = raw_body[:300] + if " tuple[bytes, str]: if not api_key: raise RuntimeError("mimo api_key 不能为空") + # 兼容用户把 base_url 配成不带 /v1 的根地址(如 New API / OneAPI 等网关), + # 避免请求被前端 SPA 兜底返回 index.html。 + parsed_base = urllib.parse.urlsplit(base_url) + base_path = parsed_base.path or "" + if not base_path or base_path == "/": + base_url = f"{base_url}/v1" + url = f"{base_url}/chat/completions" payload, audio_format, stream = _build_mimo_payload(config, params) request_data = json.dumps(payload, ensure_ascii=False).encode("utf-8")