fix(web): 会话进度行时长从本轮开始算到结论正文,不再显示 0 秒(FIX-9)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
41a39f3cc8
commit
c5987a9db3
3 files changed
+74
-12
No files matched your search
@@ -19,7 +19,13 @@ import {
|
||||
import { OptionsCard, optionPoint, orderOptions } from "./agent-interaction.tsx";
|
||||
import { goalFromInput, RunStatsLine } from "./agent-run-panel.tsx";
|
||||
import { arrangeHistory } from "./agent-session-list.tsx";
|
||||
import { type ActivityItem, activitySummary, buildConversation, deniedReason } from "./conversation-model.ts";
|
||||
import {
|
||||
type ActivityItem,
|
||||
activitySpan,
|
||||
activitySummary,
|
||||
buildConversation,
|
||||
deniedReason,
|
||||
} from "./conversation-model.ts";
|
||||
import { parseCommand, RUN_COMMANDS } from "./slash-commands.ts";
|
||||
import {
|
||||
type AgentStreamState,
|
||||
@@ -539,3 +545,29 @@ describe("实际结果行(FIX-9):只列系统核实的事实", () => {
|
||||
expect(resultFacts(null)).toEqual([{ text: "汇总中…" }]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("进度行时长(FIX-9):从这一轮开始算到结论正文", () => {
|
||||
const quick: ActivityItem[] = [
|
||||
{ kind: "tool", key: "c1", call: call({ capabilityId: "site.list", startedAt: at(6), endedAt: at(6) }) },
|
||||
];
|
||||
it("只有一个瞬时工具调用时不再是 0 秒", () => {
|
||||
expect(activitySpan(quick)).toBe(0);
|
||||
expect(activitySpan(quick, { since: at(0), until: at(7) })).toBe(7000);
|
||||
const t = text(render(createElement(StepSummary, { activity: quick, running: false, since: at(0), until: at(7) })));
|
||||
expect(t).toContain("· 7 秒");
|
||||
});
|
||||
it("没有工具调用、只有思考时也有时长;没有步骤为 null", () => {
|
||||
expect(activitySpan([{ kind: "thinking", key: "k", text: "想", at: at(2) }], { since: at(0) })).toBe(2000);
|
||||
expect(activitySpan([])).toBeNull();
|
||||
});
|
||||
it("整段会话:第一轮从会话开始算", () => {
|
||||
const events = [
|
||||
ev(0, { type: "run_started", goal: "g", resumed: false }),
|
||||
...tool(5, "t1", "site.list", '{"items":[]}'),
|
||||
ev(7, { type: "text_delta", delta: "都正常。" }),
|
||||
ev(8, { type: "run_completed", finalText: "", usage: {} }),
|
||||
];
|
||||
const t = text(render(createElement(AgentConversation, { run: RUN, live: liveOf(events) })));
|
||||
expect(t).toMatch(/· 7 秒/);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user