Skip to content

feat: improve composer mentions and connector account selection#1439

Merged
MODSetter merged 10 commits into
MODSetter:devfrom
AnishSarkar22:fix/mention-documents
May 26, 2026
Merged

feat: improve composer mentions and connector account selection#1439
MODSetter merged 10 commits into
MODSetter:devfrom
AnishSarkar22:fix/mention-documents

Conversation

@AnishSarkar22
Copy link
Copy Markdown
Contributor

@AnishSarkar22 AnishSarkar22 commented May 26, 2026

Description

  • Added a cleaner @ mention picker for documents, folders, SurfSense docs, and connected accounts.
  • Improved / prompt suggestions with smoother loading states and more consistent popup behavior.
  • Added recent mention support so users can quickly reuse recently selected context.
  • Improved mention chips and composer styling for a more polished chat experience.
  • Added support for selecting a specific connector account, so the agent can use the intended account when tools need one.

Motivation and Context

FIX #

Screenshots

API Changes

  • This PR includes API changes

Change Type

  • Bug fix
  • New feature
  • Performance improvement
  • Refactoring
  • Documentation
  • Dependency/Build system
  • Breaking change
  • Other (specify):

Testing Performed

  • Tested locally
  • Manual/QA verification

Checklist

  • Follows project coding standards and conventions
  • Documentation updated as needed
  • Dependencies updated as needed
  • No lint/build errors or new warnings
  • All relevant tests are passing

High-level PR Summary

This PR extends the chat composer's @-mention system to support connector account selection alongside the existing documents and folders. Users can now explicitly select which connected account (e.g., specific Google Drive or Notion account) to use when mentioning context, allowing the backend to route tool calls to the exact account the user intended. The frontend composer suggestion popup has been redesigned with a hierarchical browse UI (root → category → items) and supports recent mentions. The backend accepts connector mentions as separate payload fields (mentioned_connector_ids and mentioned_connectors) and embeds them in the LLM context so tools can prefer the selected account when a connector_id parameter is available. The changes include schema updates to support a three-way discriminated union (doc, folder, connector), UI components for the new suggestion popover with keyboard navigation, and recents tracking in localStorage.

⏱️ Estimated Review Time: 30-90 minutes

💡 Review Order Suggestion
Order File Path
1 surfsense_backend/app/schemas/new_chat.py
2 surfsense_backend/app/agents/new_chat/context.py
3 surfsense_web/atoms/chat/mentioned-documents.atom.ts
4 surfsense_web/lib/chat/mention-doc-key.ts
5 surfsense_web/components/new-chat/composer-suggestion-popup.tsx
6 surfsense_web/components/new-chat/use-composer-suggestion-navigator.ts
7 surfsense_web/components/assistant-ui/inline-mention-editor.tsx
8 surfsense_web/components/new-chat/document-mention-picker.tsx
9 surfsense_web/components/assistant-ui/thread.tsx
10 surfsense_backend/app/agents/new_chat/mention_resolver.py
11 surfsense_backend/app/routes/new_chat_routes.py
12 surfsense_backend/app/tasks/chat/persistence.py
13 surfsense_backend/app/tasks/chat/stream_new_chat.py
14 surfsense_web/app/dashboard/[search_space_id]/new-chat/[[...chat_id]]/page.tsx
15 surfsense_web/components/assistant-ui/user-message.tsx
16 surfsense_web/components/assistant-ui/mention-chip.tsx
17 surfsense_web/components/assistant-ui/connector-popup/constants/connector-constants.ts
18 surfsense_web/components/new-chat/prompt-picker.tsx
19 surfsense_web/components/documents/FolderTreeView.tsx
20 surfsense_web/components/layout/ui/sidebar/DocumentsSidebar.tsx
21 surfsense_web/components/auth/sign-in-button.tsx
22 surfsense_web/lib/connector-telemetry.ts

Need help? Join our Discord

@vercel
Copy link
Copy Markdown

vercel Bot commented May 26, 2026

@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.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 26, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b34a6b27-e61c-4f99-908d-221075c68401

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@AnishSarkar22 AnishSarkar22 changed the title fix: mention document impr: Composer mentions and connector account selection May 26, 2026
@AnishSarkar22 AnishSarkar22 changed the title impr: Composer mentions and connector account selection feat: improve composer mentions and connector account selection May 26, 2026
@AnishSarkar22 AnishSarkar22 marked this pull request as ready for review May 26, 2026 19:17
@MODSetter MODSetter merged commit 820f541 into MODSetter:dev May 26, 2026
7 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants