Fix live activity streaming and replay summary
This commit is contained in:
@@ -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[] = [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user