mirror of
https://github.com/openclaw/openclaw.git
synced 2026-10-03 01:29:56 +00:00
fix(ui): keep chat history idle when run status changes (#146802)
This commit is contained in:
parent
dee64cddf3
commit
50eefaed0b
2 changed files with 38 additions and 2 deletions
|
|
@ -280,6 +280,44 @@ describe("chat transcript invalidation", () => {
|
|||
},
|
||||
);
|
||||
|
||||
it.each(["done", "interrupted"] as const)(
|
||||
"keeps settled history idle when %s status appears, refreshes or clears",
|
||||
async (phase) => {
|
||||
vi.spyOn(Date, "now").mockReturnValue(60_000);
|
||||
const props = threadProps(`pane-terminal-status-${phase}`);
|
||||
const transcript = createTestTranscript();
|
||||
const container = document.body.appendChild(document.createElement("div"));
|
||||
const rerender = () => {
|
||||
render(renderChatThread(props, transcript), container);
|
||||
transcript.hostUpdated();
|
||||
};
|
||||
try {
|
||||
rerender();
|
||||
transcript.hostConnected();
|
||||
await flushDeferredRowPrune();
|
||||
const bubbles = Array.from(container.querySelectorAll(".chat-bubble"));
|
||||
expect(bubbles).toHaveLength(4);
|
||||
const renderGroup = vi.spyOn(chatMessage, "renderMessageGroup");
|
||||
|
||||
for (const occurredAt of [59_000, 59_500, null]) {
|
||||
props.runStatus =
|
||||
occurredAt === null
|
||||
? null
|
||||
: { phase, runId: "finished-run", sessionKey: props.sessionKey, occurredAt };
|
||||
rerender();
|
||||
|
||||
expect(renderGroup).not.toHaveBeenCalled();
|
||||
const currentBubbles = Array.from(container.querySelectorAll(".chat-bubble"));
|
||||
expect(currentBubbles).toHaveLength(bubbles.length);
|
||||
currentBubbles.forEach((bubble, index) => expect(bubble).toBe(bubbles[index]));
|
||||
expect(container.textContent).toContain("reply two");
|
||||
}
|
||||
} finally {
|
||||
transcript.hostDisconnected();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
it("keeps built row identities across an A to B to A presentation reset", () => {
|
||||
const paneId = "pane-session-items";
|
||||
const messagesA = [{ role: "assistant", content: "session A", timestamp: 1_000 }];
|
||||
|
|
|
|||
|
|
@ -692,8 +692,6 @@ export function projectChatTranscript(
|
|||
props.replyMessageAccess?.revision ?? 0,
|
||||
props.replyMessageAccess?.navigationId ?? "",
|
||||
turnRecap === null ? "" : `${turnRecap.runtimeMs}:${turnRecap.outputTokens ?? ""}`,
|
||||
props.runStatus?.phase ?? "",
|
||||
props.runStatus?.occurredAt ?? 0,
|
||||
]);
|
||||
state.transcriptRenderContext.onSetReply = props.onSetReply;
|
||||
state.transcriptRenderContext.onAsyncQuestionSubmit = props.onAsyncQuestionSubmit;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue