Fix compaction message rendering to go through addMessageToChat
Both auto_compaction_end and executeCompaction were manually adding CompactionSummaryMessageComponent instead of using addMessageToChat, which caused missing spacers. Now both use addMessageToChat for consistent spacing and expansion state handling.
This commit is contained in:
@@ -992,15 +992,13 @@ export class InteractiveMode {
|
|||||||
// Rebuild chat to show compacted state
|
// Rebuild chat to show compacted state
|
||||||
this.chatContainer.clear();
|
this.chatContainer.clear();
|
||||||
this.rebuildChatFromMessages();
|
this.rebuildChatFromMessages();
|
||||||
// Add compaction component (same as manual /compact)
|
// Add compaction component at bottom so user sees it without scrolling
|
||||||
const compactionComponent = new CompactionSummaryMessageComponent({
|
this.addMessageToChat({
|
||||||
role: "compactionSummary",
|
role: "compactionSummary",
|
||||||
tokensBefore: event.result.tokensBefore,
|
tokensBefore: event.result.tokensBefore,
|
||||||
summary: event.result.summary,
|
summary: event.result.summary,
|
||||||
timestamp: Date.now(),
|
timestamp: Date.now(),
|
||||||
});
|
});
|
||||||
compactionComponent.setExpanded(this.toolOutputExpanded);
|
|
||||||
this.chatContainer.addChild(compactionComponent);
|
|
||||||
this.footer.updateState(this.session.state);
|
this.footer.updateState(this.session.state);
|
||||||
}
|
}
|
||||||
this.ui.requestRender();
|
this.ui.requestRender();
|
||||||
@@ -2128,11 +2126,9 @@ export class InteractiveMode {
|
|||||||
// Rebuild UI
|
// Rebuild UI
|
||||||
this.rebuildChatFromMessages();
|
this.rebuildChatFromMessages();
|
||||||
|
|
||||||
// Add compaction component
|
// Add compaction component at bottom so user sees it without scrolling
|
||||||
const msg = createCompactionSummaryMessage(result.summary, result.tokensBefore, new Date().toISOString());
|
const msg = createCompactionSummaryMessage(result.summary, result.tokensBefore, new Date().toISOString());
|
||||||
const compactionComponent = new CompactionSummaryMessageComponent(msg);
|
this.addMessageToChat(msg);
|
||||||
compactionComponent.setExpanded(this.toolOutputExpanded);
|
|
||||||
this.chatContainer.addChild(compactionComponent);
|
|
||||||
|
|
||||||
this.footer.updateState(this.session.state);
|
this.footer.updateState(this.session.state);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user