mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 11:51:23 +00:00
Web UI: show Compaction divider in chat history (#11341)
This commit is contained in:
@@ -28,6 +28,23 @@ export function readSessionMessages(
|
||||
const parsed = JSON.parse(line);
|
||||
if (parsed?.message) {
|
||||
messages.push(parsed.message);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Compaction entries are not "message" records, but they're useful context for debugging.
|
||||
// Emit a lightweight synthetic message that the Web UI can render as a divider.
|
||||
if (parsed?.type === "compaction") {
|
||||
const ts = typeof parsed.timestamp === "string" ? Date.parse(parsed.timestamp) : Number.NaN;
|
||||
const timestamp = Number.isFinite(ts) ? ts : Date.now();
|
||||
messages.push({
|
||||
role: "system",
|
||||
content: [{ type: "text", text: "Compaction" }],
|
||||
timestamp,
|
||||
__openclaw: {
|
||||
kind: "compaction",
|
||||
id: typeof parsed.id === "string" ? parsed.id : undefined,
|
||||
},
|
||||
});
|
||||
}
|
||||
} catch {
|
||||
// ignore bad lines
|
||||
|
||||
Reference in New Issue
Block a user