fix(webui): preserve range selection and turn timing

This commit is contained in:
Xubin Ren
2026-08-15 15:40:52 +08:00
parent 4de728a555
commit e630e78075
9 changed files with 262 additions and 16 deletions
+60
View File
@@ -547,6 +547,66 @@ describe("ThreadMessages", () => {
expect(screen.queryByText("Working for 10s")).not.toBeInTheDocument();
});
it("keeps a guided run's timer on its original activity cluster", () => {
vi.useFakeTimers();
const startedAt = 1_700_000_000_000;
vi.setSystemTime(startedAt + 215_000);
const messages: UIMessage[] = [
{
id: "u-original",
role: "user",
content: "research this",
turnId: "turn-original",
turnPhase: "user",
turnSeq: 0,
createdAt: startedAt,
},
{
id: "t-original",
role: "tool",
kind: "trace",
content: "web_search()",
traces: ["web_search()"],
turnId: "turn-original",
turnPhase: "activity",
turnSeq: 1,
createdAt: startedAt + 500,
},
{
id: "a-original",
role: "assistant",
content: "Continuing the search.",
latencyMs: 1_000,
turnId: "turn-original",
turnPhase: "answer",
turnSeq: 2,
createdAt: startedAt + 1_000,
},
{
id: "u-guidance",
role: "user",
content: "How is it going?",
turnId: "turn-guidance",
turnPhase: "user",
turnSeq: 0,
createdAt: startedAt + 215_000,
},
];
render(
<ThreadMessages
messages={messages}
isStreaming
activeTurnId="turn-original"
runStartedAt={startedAt / 1000}
/>,
);
expect(screen.getByText("Working for 3m 35s")).toBeInTheDocument();
expect(screen.queryByText("Worked for 1s")).not.toBeInTheDocument();
expect(screen.queryByText("Thinking for 3m 35s")).not.toBeInTheDocument();
});
it("folds final answer reasoning into the preceding activity timeline", () => {
const messages: UIMessage[] = [
{