feat(message): show past chat references and files in user message bubble#3338
feat(message): show past chat references and files in user message bubble#3338SuMuxi66 wants to merge 3 commits into
Conversation
SivanCola
left a comment
There was a problem hiding this comment.
Thanks, this is directionally useful, but I cannot approve it yet.
Required changes:
-
The send path waits for
PreviewSession/buildSessionContextbefore callingonSendor clearing the composer. While that await is pending, the input and send button remain enabled, so pressing Enter or clicking send again can submit duplicate turns with the same referenced sessions. It also breaks the PR's stated "display immediately after send" behavior for referenced sends. Please snapshot/lock/clear the composer before the async session reads, or add an explicit sending guard that makes duplicate submission impossible. -
The new
past:chatsUI is not wired into the existing keyboard menu state.menuModeonly opens the@menu whenatMatches.length > 0,countstill excludes the special/session rows, andpickActive()always callspickEntry(atMatches[active]). This means the past-chat option can disappear when there are no file matches, and Enter/Tab cannot select a highlighted past-chat session. Please make past-chat rows first-class menu items for open/active/count/pick handling. -
New visible UI strings are hard-coded in Chinese in
Composer.tsxandMessage.tsx. The desktop frontend has an existing en/zh dictionary contract, so English locale users will see mixed Chinese. Please add the required i18n keys in both locale files and uset(...)/useT()for visible text. -
git diff --check origin/main-v2...origin/pr/3338currently fails becausedocs/SESSION_REFERENCE_ARCHITECTURE.mdcontains trailing whitespace. Please clean that up before merge.
Integration notes:
- This PR is still draft and stacked on #3336; it should be rebased after the core past-chats PR is finalized.
- It also overlaps #3356 on user-message bubble styling, so one of the two PRs should become the integration source for that layout.
Verified locally:
wails generate modulepassed after creating the expected temporaryfrontend/distplaceholder in a throwaway worktree.npm run buildpassed indesktop/frontend.go test . -run 'TestPreviewSession|TestListSessions|TestHistory|TestSession'passed indesktop.git merge-tree --write-tree origin/main-v2 origin/pr/3338produced an auto-merge tree with no textual conflicts.
eeb7324 to
850e36d
Compare
850e36d to
a9d4bd3
Compare
SivanCola
left a comment
There was a problem hiding this comment.
Thanks for the follow-up changes. I re-reviewed the current head and the earlier blockers around duplicate sends, menu state, i18n, and diff --check look addressed now.
I still found a couple of issues that should be fixed before merge:
-
The referenced-session cards are not persisted.
send()only passesreferencesinto the frontend reducer, while the backend history/display sidecar still stores only strings, andhistoryMessagesToItems()rebuilds user messages without references. So the cards appear right after sending, but disappear after reload/resume/history replay. Please persist the structured session refs alongside the display content and restore them when mapping history back toItems. -
Message.tsxwraps a block<div className="msg__reference-item">insideTooltip, which defaults to a<span>trigger. That creates invalid DOM / React nesting warnings and can affect layout. Please use the Tooltip block mode here or change the child to an inline-compatible element. -
A selected past-chat reference alone cannot be sent: the submit guard and send-button disabled condition still only count text, attachments, and workspace refs. If a session ref is meant to be usable as context by itself, include
sessionRefs.lengthin those checks; if not, the UI should make the “question required” state explicit instead of showing an attached chip with a disabled send button.
Verified: git diff --check origin/main-v2...origin/pr/3338 passes on the current PR head.
ae0057a to
177bd8b
Compare
|
感谢 review,我已经按反馈修复了这三个 blocker。 本次更新:
验证结果:
|
177bd8b to
d9e2c66
Compare
d9e2c66 to
ad3615c
Compare
概述
本 PR 是 #3336 合并后的 follow-up。
#3336 已经完成
past:chats的选择、预览和上下文注入流程。本 PR 只补充发送后的展示能力:当用户消息引用了历史会话时,在用户消息气泡中展示对应的引用卡片。改动内容
past:chatsreferences 随用户消息一起传入 transcript范围说明
本 PR 只处理“发送后如何展示引用”的问题。
不修改:
past:chats菜单选择逻辑@文件引用逻辑验证
past:chats引用的消息后,用户消息气泡中可以看到引用卡片