Fix live activity streaming and replay summary

This commit is contained in:
wuyang6
2026-05-13 20:58:35 +08:00
parent 0eb57f3f42
commit d7c62a4929
4 changed files with 59 additions and 4 deletions
@@ -979,6 +979,10 @@ function summarizeLiveRunEvents(
if (event.type === "run_started") {
lines.push("后端已开始执行本轮任务。");
}
if (event.type === "content_delta" && event.delta) {
const note = event.delta.trim();
if (note && !isNoisyLiveDelta(note)) lines.push(note);
}
if (event.type === "tool_start") {
const stageNote =
typeof event.assistant_content === "string"
@@ -994,6 +998,9 @@ function summarizeLiveRunEvents(
event.tool_name ? `工具完成 ${event.tool_name}` : "工具调用完成",
);
}
if (event.type === "tool_delta") {
lines.push(event.tool_name ? `${event.tool_name} 输出中` : "工具输出中");
}
if (event.type === "final_text_start") {
lines.push("正在整理回复");
}
@@ -1011,6 +1018,10 @@ function summarizeLiveRunEvents(
return lines.slice(-40);
}
function isNoisyLiveDelta(value: string) {
return value === "。" || value === "" || value === "," || value.length <= 1;
}
function collectActivityItems(messages: readonly MessageState[]) {
const items: ActivityItem[] = [];