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:
@@ -75,12 +75,8 @@
|
||||
}
|
||||
|
||||
const RESULT_UNAVAILABLE_LABELS = {
|
||||
SURGERY_NOT_STARTED: "手术未开始",
|
||||
SURGERY_STARTING: "手术启动中,算法尚未就绪",
|
||||
SURGERY_IN_PROGRESS_NO_DETAILS: "手术进行中,尚无消耗明细",
|
||||
SURGERY_ENDED_NO_CONSUMPTION: "手术已结束,无消耗明细",
|
||||
SURGERY_ALREADY_RECORDING: "该手术已在录制中",
|
||||
RESULT_NOT_READY: "结果尚不可查询",
|
||||
SURGERY_ALREADY_RECORDING: "该手术已在录制中",
|
||||
};
|
||||
|
||||
function formatResultUnavailable(body) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user