fix: enhance mention documents#1319
Conversation
…ention handling in the editor
…nedDocumentsAtom and remove sidebarSelectedDocumentsAtom references
…or referenced documents
…nd mentioned documents
|
@AnishSarkar22 is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…edDocumentsAtom and introduce getMentionDocKey utility for consistent document key generation
…keys for consistency across components
Description
Motivation and Context
FIX #
Screenshots
API Changes
Change Type
Testing Performed
Checklist
High-level PR Summary
This PR unifies document mention handling by consolidating the
sidebarSelectedDocumentsAtomandmentionedDocumentsAtominto a single source of truth. The sidebar checkbox selection now updates the same atom as the inline@mentioneditor, eliminating duplicate state tracking. The editor has been enhanced with selection persistence to handle chip insertion when focus shifts (e.g., clicking a sidebar checkbox), and user messages now render inline mention chips instead of displaying them as separate badges. A newsyncEditorStatefunction ensures the editor state and mentioned documents stay synchronized throughout the user interaction lifecycle.⏱️ Estimated Review Time: 30-90 minutes
💡 Review Order Suggestion
surfsense_web/atoms/chat/mentioned-documents.atom.tssurfsense_web/components/assistant-ui/inline-mention-editor.tsxsurfsense_web/components/assistant-ui/thread.tsxsurfsense_web/components/assistant-ui/user-message.tsxsurfsense_web/components/layout/ui/sidebar/DocumentsSidebar.tsxsurfsense_web/app/dashboard/[search_space_id]/new-chat/[[...chat_id]]/page.tsx