feat(app): add compact ui#15578
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found several related PRs but no exact duplicates of PR #15578. Here are the potentially related PRs: Most Related:
These recent PRs are working on similar compaction-related features and should be reviewed for any potential conflicts or integration points with PR #15578's compact UI addition. The other results are older compaction-related PRs (from 2022-2024) that provide context on the existing compaction system but are unlikely to be duplicates. |
1eb17dc to
0897ab2
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds a visual compaction indicator to the web/desktop UI, matching the existing TUI (terminal UI) behavior. When /compact is run in a session, a horizontal divider with the label "History compacted" (localized) is now shown in the session turn UI.
Changes:
- Added
CompactionPartDisplaycomponent registered toPART_MAPPING["compaction"]with matching CSS styles for a centered divider label - Added
compactionmemo and rendering inSessionTurnto show the compaction indicator after the user message content, using thePartcomponent - Refactored
workingandSessionRetry.showfromisLastUserMessage()to the newactive()memo which more precisely identifies which turn currently has an in-progress assistant message - Added the
ui.messagePart.compactioni18n key across all 17 supported locales
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
packages/ui/src/components/message-part.tsx |
Adds CompactionPartDisplay component registered in PART_MAPPING |
packages/ui/src/components/message-part.css |
Adds styles for the compaction divider component |
packages/ui/src/components/session-turn.tsx |
Adds pending/active memos, compaction memo, renders the Part component for compaction; replaces isLastUserMessage with active() |
packages/ui/src/components/session-turn.css |
Adds styles for the session-turn-compaction slot |
packages/ui/src/i18n/en.ts + 16 locale files |
Adds ui.messagePart.compaction translation key to all locales |
Comments suppressed due to low confidence (1)
packages/ui/src/components/session-turn.tsx:214
- The
lastUserMessageIDmemo (lines 203–212) andisLastUserMessagememo (line 214) are now dead code: bothworkingandSessionRetry.showwere switched fromisLastUserMessage()toactive(), so neither memo is referenced anywhere in the component anymore. These unused memos create unnecessary reactive overhead and add confusion. They should be removed along with theprops.lastUserMessageIDprop (or at least the memos), since the prop itself is also now unused internally.
const lastUserMessageID = createMemo(() => {
if (props.lastUserMessageID) return props.lastUserMessageID
const messages = allMessages() ?? emptyMessages
for (let i = messages.length - 1; i >= 0; i--) {
const msg = messages[i]
if (msg?.role === "user") return msg.id
}
return undefined
})
const isLastUserMessage = createMemo(() => props.messageID === lastUserMessageID())
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Issue for this PR
Closes #15576
Type of change
What does this PR do?
Adds compaction logic matching the tui
If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!
How did you verify your code works?
Screenshots / recordings
2026-03-01.15-06-06.mp4
Checklist
If you do not follow this template your PR will be automatically rejected.