mirror of https://github.com/openclaw/openclaw.git
UI: reload history after terminal tool runs
This commit is contained in:
parent
d1c6458e5a
commit
fabd5ad5e1
|
|
@ -380,6 +380,42 @@ describe("connectGateway", () => {
|
||||||
|
|
||||||
expect(loadChatHistoryMock).toHaveBeenCalledTimes(1);
|
expect(loadChatHistoryMock).toHaveBeenCalledTimes(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("reloads chat history after an error chat event when tool output was used", () => {
|
||||||
|
const host = createHost();
|
||||||
|
|
||||||
|
connectGateway(host);
|
||||||
|
const client = gatewayClientInstances[0];
|
||||||
|
expect(client).toBeDefined();
|
||||||
|
|
||||||
|
client.emitEvent({
|
||||||
|
event: "agent",
|
||||||
|
payload: {
|
||||||
|
runId: "engine-run-1",
|
||||||
|
seq: 1,
|
||||||
|
stream: "tool",
|
||||||
|
ts: 1,
|
||||||
|
sessionKey: "main",
|
||||||
|
data: {
|
||||||
|
toolCallId: "tool-1",
|
||||||
|
name: "fetch",
|
||||||
|
phase: "result",
|
||||||
|
result: { text: "ok" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
client.emitEvent({
|
||||||
|
event: "chat",
|
||||||
|
payload: {
|
||||||
|
runId: "engine-run-1",
|
||||||
|
sessionKey: "main",
|
||||||
|
state: "error",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(loadChatHistoryMock).toHaveBeenCalledTimes(1);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("resolveControlUiClientVersion", () => {
|
describe("resolveControlUiClientVersion", () => {
|
||||||
|
|
|
||||||
|
|
@ -301,7 +301,7 @@ function handleTerminalChatEvent(
|
||||||
}
|
}
|
||||||
// Reload history when tools were used so the persisted tool results
|
// Reload history when tools were used so the persisted tool results
|
||||||
// replace the now-cleared streaming state.
|
// replace the now-cleared streaming state.
|
||||||
if (hadToolEvents && state === "final") {
|
if (hadToolEvents) {
|
||||||
void loadChatHistory(host as unknown as OpenClawApp);
|
void loadChatHistory(host as unknown as OpenClawApp);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue