diff --git a/web/hwlab-cloud-web/scripts/workbench-r1-parity.test.ts b/web/hwlab-cloud-web/scripts/workbench-r1-parity.test.ts index 3177488d..1591a7cc 100644 --- a/web/hwlab-cloud-web/scripts/workbench-r1-parity.test.ts +++ b/web/hwlab-cloud-web/scripts/workbench-r1-parity.test.ts @@ -107,7 +107,7 @@ test("R1 trace event assistant text prefers authoritative final assistant messag const events: TraceEvent[] = [ { seq: 1, label: "agentrun:backend:resource-bundle-materialized", message: "bundle ready" }, { seq: 2, label: "agentrun:assistant:message", type: "assistant", status: "running", replyAuthority: false, final: false, message: "我先检查当前状态。" }, - { seq: 3, label: "agentrun:assistant:message", type: "assistant", status: "completed", replyAuthority: true, final: true, terminal: true, message: "OK" } + { seq: 3, label: "agentrun:assistant:message", type: "assistant", status: "completed", terminal: true, message: "OK" } ]; assert.equal(assistantTextFromTraceEvents(events), "OK"); diff --git a/web/hwlab-cloud-web/src/composables/useTraceSubscription.ts b/web/hwlab-cloud-web/src/composables/useTraceSubscription.ts index 5ad23c3d..30832c63 100644 --- a/web/hwlab-cloud-web/src/composables/useTraceSubscription.ts +++ b/web/hwlab-cloud-web/src/composables/useTraceSubscription.ts @@ -381,6 +381,6 @@ function isAssistantTraceEvent(event: TraceEvent): boolean { function isTerminalAssistantTraceEvent(event: TraceEvent): boolean { const label = String(event.label ?? ""); if (label === "assistant:completed") return true; - if (label === "agentrun:assistant:message") return event.replyAuthority === true || event.final === true; + if (label === "agentrun:assistant:message") return event.replyAuthority === true || event.final === true || event.terminal === true || String(event.status ?? "") === "completed"; return event.type === "assistant_message" && (event.status === "completed" || event.final === true || event.terminal === true); }