From c325c17bd9e08255bb616224084979d5324c6f01 Mon Sep 17 00:00:00 2001 From: lyon Date: Thu, 18 Jun 2026 01:25:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=AF=86=E5=88=AB=20terminal=20assistan?= =?UTF-8?q?t=20trace=20=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/hwlab-cloud-web/scripts/workbench-r1-parity.test.ts | 2 +- web/hwlab-cloud-web/src/composables/useTraceSubscription.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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); }