Align client surgery API with documented contract and support consumable codes.

Unify result 503 to RESULT_NOT_READY, restore resolve ASR failures as HTTP 422, accept label_id-only candidate_consumables, and document the changelog for integrators.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Kevin
2026-05-25 09:36:09 +08:00
parent aae0340a1b
commit 0917109d6a
10 changed files with 157 additions and 83 deletions

View File

@@ -772,15 +772,6 @@ class VoiceMonitorEngine {
this._emitState("待机");
return;
}
if (rstatus === "failed") {
this._emitResolveResult({ ...baseMeta, body: res });
const code = res.error_code || "";
const msg = String(res.message || "");
this._log("语音未通过(可重试)" + (code ? "[" + code + "] " : "") + msg);
this._state.failed_resolve_cid = cid;
this._emitState("请重试录音或检查麦克风");
return;
}
}
if (st === 422 && typeof res === "object" && res && res.detail) {
const d = res.detail;
@@ -788,7 +779,7 @@ class VoiceMonitorEngine {
const c = d.code;
if (c === "VOICE_ASR_FAILED" || c === "VOICE_TEXT_EMPTY" || c === "VOICE_PARSE_FAILED") {
this._emitResolveResult({ ...baseMeta, body: res });
this._log("语音未通过(可重试,旧接口[" + c + "]: " + (d.message || ""));
this._log("语音未通过(可重试)[" + c + "]: " + (d.message || ""));
this._state.failed_resolve_cid = cid;
this._emitState("请重试录音或检查麦克风");
return;