jan
jan copied to clipboard
feat: quick change assistant with mention @ on chat input
Describe Your Changes
This pull request adds an assistant mention feature to the ChatInput component, allowing users to type @ to trigger a dropdown for selecting an assistant. The implementation includes detection of @ mentions, keyboard and mouse navigation for the dropdown, and integration with the assistant selection logic. The dropdown UI is rendered using the Popover component and displays available assistants with avatars.
Assistant mention feature:
- Added state and logic to detect
@mentions in the chat input, filter assistants based on the query, and show a dropdown for selection. [1] [2] - Implemented keyboard navigation (arrow keys, enter, escape) and mouse interactions for the assistant dropdown, allowing users to select an assistant efficiently.
- Rendered the assistant selection dropdown using the
Popovercomponent, displaying filtered assistants with avatars and handling dropdown visibility and focus. - Integrated the assistant selection logic to update the current assistant and thread context when an assistant is chosen from the dropdown.
Imports and dependencies:
- Added imports for
Popover,useAssistant, andAvatarEmojito support the new dropdown UI and assistant data. [1] [2]
Fixes Issues
https://github.com/user-attachments/assets/32b1015b-ed61-4231-b611-1f18fd63edf8
- Closes #6157
- Closes #
Self Checklist
- [ ] Added relevant comments, esp in complex areas
- [ ] Updated docs (for bug fixes / features)
- [ ] Created issues for follow-up changes or refactoring needed