Skip to content

Conversation

@zeroliu
Copy link
Collaborator

@zeroliu zeroliu commented Sep 8, 2025

Enhanced Chat Input with Rich Context Support

2025-09-22 01 28 47

Summary

This PR introduces a completely redesigned chat input experience with rich context support through an intuitive typeahead system. Users can now seamlessly reference notes, folders, tags, URLs, and tools directly in their messages using familiar syntax like @note, #tag, and /command.

Key Features

🎯 Smart Typeahead System

  • @ mentions: Use @ to reference notes, folders, tags, URLs, or tools with intelligent autocomplete
  • [[ for notes: Type [[ to search and insert notes into your message as interactive pills
  • # for tags: Type # to quickly add Obsidian tags to provide context
  • / commands: Access slash commands for quick actions and custom prompts

📝 Enhanced Message Editing

  • Full context preservation: When editing messages, all context (notes, URLs, tags, folders) is preserved and editable
  • Rich inline editor: Edit messages with the same powerful input experience as composing new ones
  • Visual context badges: See all attached context at a glance with removable badges

🎬 YouTube Integration

  • New "Download YouTube Transcript" command: Easily download transcripts from YouTube videos
  • One-click transcript copy: Copy transcripts to clipboard for easy sharing

🎨 Visual Improvements

  • Interactive pills: Notes, URLs, tags, and folders appear as clickable pills that can be easily removed
  • Context badges: Clean visual representation of all attached context below the input
  • Improved typeahead menu: Better styled dropdown with clear categories and keyboard navigation

🚀 Performance & UX Enhancements

  • Smart context detection: Automatically detects and processes notes and URLs in custom commands
  • Keyboard shortcuts: Full keyboard support for navigating typeahead menus
  • Paste support: Paste notes directly into the input to add them as context

User Benefits

  1. Faster context addition: No more modal dialogs - add context directly while typing
  2. Better discoverability: Typeahead helps users discover available notes, tags, and commands
  3. Cleaner interface: Pills and badges provide a cleaner way to see and manage context
  4. Preserved editing experience: Edit messages without losing any attached context
  5. Improved workflow: Natural typing patterns ([[, @, #, /) match user expectations

Technical Improvements

  • Migrated from textarea to Lexical editor for rich text capabilities
  • Implemented custom Lexical nodes for pills (notes, URLs, tags, folders, tools)
  • Added comprehensive plugin system for typeahead behaviors
  • Improved context synchronization between UI and backend
  • Better separation of concerns with dedicated context management

Breaking Changes

None - all existing functionality is preserved with enhanced capabilities.

Testing

  • Typeahead functionality works across all context types
  • Message editing preserves all context correctly
  • Keyboard navigation works smoothly
  • Pills can be deleted individually or with keyboard
  • Context syncs properly with project changes

@korbit-ai
Copy link

korbit-ai bot commented Sep 8, 2025

Based on your review schedule, I'll hold off on reviewing this PR until it's marked as ready for review. If you'd like me to take a look now, comment /korbit-review.

Your admin can change your review schedule in the Korbit Console

@zeroliu zeroliu changed the title Zero/new chat input Enhanced chat input Sep 8, 2025
@logancyang
Copy link
Owner

bugbot run

cursor[bot]

This comment was marked as outdated.

@zeroliu
Copy link
Collaborator Author

zeroliu commented Sep 11, 2025

bugbot run

@logancyang please hold on bugbot for now. The PR is not done yet

@zeroliu zeroliu marked this pull request as ready for review September 23, 2025 06:58
@logancyang
Copy link
Owner

bugbot run

@zeroliu zeroliu requested a review from logancyang September 24, 2025 04:36
@logancyang logancyang changed the base branch from master to 3.1.0-preview September 24, 2025 05:07
@zeroliu
Copy link
Collaborator Author

zeroliu commented Sep 24, 2025

@logancyang I realize the pdf context support is broken. Let me fix it

@zeroliu
Copy link
Collaborator Author

zeroliu commented Sep 24, 2025

@logancyang it's good now

@logancyang
Copy link
Owner

logancyang commented Sep 24, 2025

@zeroliu This is a HUGE upgrade to our chat input, thanks for the hard work!! 🔥🔥🔥

I clicked around a bit and here are some initial findings:

  1. Seems I can't add a url as plain text. When i paste, it becomes a badge; when i backspace, it gets removed completely as a badge.
SCR-20250924-okjv
  1. Typing @ can enter the tool in the input, but clicking by mouse doesn't work.
SCR-20250924-okcj
  1. Adding notes or urls makes the "@ Add Context" button collapse to just "@", but Folders or Tags don't
SCR-20250924-ojkx SCR-20250924-ojrc
  1. When i type [[ the popup shows 4-5 candidates with previews, this search works differently from the @ Add Context button. For example, if i type [[pdf it won't find pdf files, but @ Add Context can find them.

  2. If i open the settings UI while having the context picker and preview on, they stay there like this

SCR-20250924-opic
  1. Could you remind me what we have settled on for the old @youtube <url> behavior - getting full raw transcript? How do we achieve it now?

@logancyang
Copy link
Owner

These are the only problems i can find now. Overall superb stuff!! 🔥🔥🔥

PS there's a conflict to be resolve since the memory change has been merged to that 3.1.0 branch.

@zeroliu zeroliu force-pushed the zero/new-chat-input branch from 2127345 to 655d13e Compare September 25, 2025 06:43
@zeroliu
Copy link
Collaborator Author

zeroliu commented Sep 25, 2025

@zeroliu This is a HUGE upgrade to our chat input, thanks for the hard work!! 🔥🔥🔥

I clicked around a bit and here are some initial findings:

  1. Seems I can't add a url as plain text. When i paste, it becomes a badge; when i backspace, it gets removed completely as a badge.
SCR-20250924-okjv

This one is intentional. I checked the latest cursor and it doesn't contain the old behavior of converting a URL pill to plain text any more. I suspect that if a URL is removed from the context, most likely you want to remove it from the context too because the URL itself doesn't add much value to the context. If we decide in the future to process the chat content and fetch the plain text URL, the current behavior is future-proof, too. WDYT?

  1. Typing @ can enter the tool in the input, but clicking by mouse doesn't work.
SCR-20250924-okcj

It's actually working. The tool is toggled and the tool button is updated. This is intentional because I don't want the tool pill to show up in the context menu since the bottom tool button already shows that. I understand why it's misleading though. In the latest version, when you click on a tool option in the context menu, it will add a tool pill in the chat. This would work for @memory where there is no tool button. It's still a bit different from other type of context but I think it's the best option so far.

  1. Adding notes or urls makes the "@ Add Context" button collapse to just "@", but Folders or Tags don't

SCR-20250924-ojkx SCR-20250924-ojrc

Fixed!

  1. When i type [[ the popup shows 4-5 candidates with previews, this search works differently from the @ Add Context button. For example, if i type [[pdf it won't find pdf files, but @ Add Context can find them.
  2. If i open the settings UI while having the context picker and preview on, they stay there like this
SCR-20250924-opic

Fixed!

  1. Could you remind me what we have settled on for the old @youtube <url> behavior - getting full raw transcript? How do we achieve it now?

We decided to introduce a new download youtube video script command.

Screenshot 2025-09-25 at 1 01 30 AM Screenshot 2025-09-25 at 1 01 49 AM

@logancyang logancyang merged commit fd6a154 into 3.1.0-preview Sep 25, 2025
2 checks passed
@logancyang logancyang deleted the zero/new-chat-input branch September 25, 2025 19:54
@logancyang
Copy link
Owner

@zeroliu Merged! Made it to the 3.1.0 preview 🔥

About the literal url, Cursor has the "unlink" option to pass url as plain text. But let's ship this for now and see if people actually complain about it.
SCR-20250925-llno

logancyang pushed a commit that referenced this pull request Sep 25, 2025
@Emt-lin
Copy link
Collaborator

Emt-lin commented Sep 26, 2025

  1. This should be a display bug. When I hover over an item and then use the arrow keys to move up or down, the hover state of the item under the mouse remains.
Obsidian 2025-09-26 23 37 42
  1. on mobile, there are some UI issues for the @ portal.
CleanShot 2025-09-27 at 00 02 49
  1. for the @ context portal, maybe It is a little wide. Is it to previe the note content?
CleanShot 2025-09-27 at 00 10 37

logancyang added a commit that referenced this pull request Oct 11, 2025
* Building persistent memory for copilot (#1848)

* Implement chat input v3 (#1794)

* Fix chat crash React 409 (#1849)

* Fix mobile typeahead menu size (#1853)

* Enhance progress bar and bug fix (#1814)

* feat: Add edit context for progress card.
* fix: When adding a model, do not set the key in the single model setting.
* fix: fix the width of the popover on mobile.

* Refactor Brevilabs API integration to use models base URL (#1855)

- Updated constants to switch from BREVILABS_API_BASE_URL to BREVILABS_MODELS_BASE_URL for model-related API calls.
- Adjusted ChatModelManager and EmbeddingManager to utilize the new models base URL for configuration settings.

* feat: Add new chat history popover. (#1850)

* feat: Add new chat history popover.

* feat: Add open source file button to chat history popover

- Add ArrowUpRight button to each chat history item
- Implement openChatSourceFile method in main.ts
- Add onOpenSourceFile callback prop chain through components
- Open chat files in new Obsidian tabs when clicked
- Optimize error handling to prevent duplicate notices

* feat: Implement localSearch CiC prompting flow in CopilotPlusChainRunner (#1856)

* Properly extract response text in UserMemoryManager (#1857)

* feat: Temporarily disable autocomplete features (#1858)

* chore: Update version to 3.1.0-preview-250927 in manifest.json

* Support space in typeahead trigger and improve search (#1859)

* More chat input enhancement (#1864)

* Fix dropdown color
* Fix badge border in light theme
* Increase search result number
* support paste image
* fix folder context

* Enhance ChatPersistenceManager with filename sanitization tests (#1865)

- Added tests to ensure proper sanitization of wiki link brackets and illegal characters in filenames when saving chat messages.
- Updated filename generation logic to handle empty sanitized topics by defaulting to 'Untitled Chat'.
- Refactored imports in ChatPersistenceManager for better organization.

* Update ApplyView accept button styles for improved visibility and interaction (#1866)

- Adjusted the positioning of the action button to be further from the bottom of the viewport for better accessibility.
- Increased the z-index to ensure the button is always on top of other elements.
- Added a shadow effect to enhance the button's visibility against the background.

* Expose add selection to chat context to free users (#1867)

* New chat input improvements (#1868)

* Improve search logic in at mention search
* Subscribe to file changes
* Detect changes for folders and tags
* Make context badge tooltip always show
* Add full note path in preview
* Fix enter being blocked when no search result

* Rebuild "Active Note" and more chat input improvement (#1873)

* Performance improvement and extend "active note" to note typeahead menu (#1875)

* Add better agent prompt logging (#1882)

* Add read tool (#1883)

* Add readNote tool for reading notes in chunks

* Enhance readNote tool to support dynamic note path display and linked note extraction

* Refine readNote tool instructions for improved clarity and efficiency in note content retrieval

* Add support for readNote tool: integrate emoji, format results, and refine instructions

* Add inline citation reminder functionality to user questions

* Add an alert when user hits the maxToken limit (#1884)

* Refactor AutonomousAgentChainRunner (#1887)

* Refactor AutonomousAgentChainRunner to enhance agent workflow, streamline context preparation, and improve response handling

* Enhance type safety in addChatHistoryToMessages by specifying message structure

* Improve max iteration limit message for clarity and formatting

* Refactor tool display name handling for improved clarity and maintainability

* Refactor tool call ID generation and visibility handling for improved clarity and uniqueness

* Fix agent tool call ID (#1890)

* Enhance tool call ID generation and improve readNote handling in prompts

Update readNote description for clarity and improve prompt instructions

* Update instructions for registerFileTreeTool to clarify usage guidelines

* Clarify instructions for readNote tool to improve context inference and handling of partial note titles

* Add token counter (#1889)

* Fix index rebuild on semantic search toggle (#1891)

* Update token counter label (#1892)

* Implement tag search v3 (#1893)

* feat: Enhance TieredLexicalRetriever to support tag-based retrieval and improve search scoring

- Added support for returning all matching tags in TieredLexicalRetriever.
- Introduced new options for tag terms and returnAllTags in the retriever.
- Updated FullTextEngine to prioritize tag matches and improve scoring for documents with tags.
- Enhanced tokenization to handle hierarchical tags and prevent splitting hyphenated tags.
- Improved handling of frontmatter tags in documents.
- Updated search tools to accommodate new tag handling features.
- Added tests to verify the functionality of tag-based retrieval and scoring improvements.

* fix: Improve logging for query expansion in SearchCore

* feat: Add explanation for non-tag matches in FullTextEngine search results

* feat: Enhance QueryExpander to preserve standalone terms in tag handling and improve term validation

* feat: Enhance QueryExpander and TieredLexicalRetriever to improve tag handling and standalone term extraction

* Update version to 3.1.0-preview-251006 in manifest.json

* Normalize tag queries for case-insensitive matching and improve search functionality (#1894)

* Implement merge retriever (#1896)

* Fix note read (#1897)

* Enhance note resolution logic and add tests for wiki-linked notes and basename matching

* Implement note resolution outcome types and enhance readNoteTool tests for ambiguous matches

* Add deriveReadNoteDisplayName function and enhance readNoteTool tests for edge cases

* Fix note tool UI freeze (#1898)

* Update how tags work in context (#1895)

* Enhance file creation instructions in modelAdapter and update tool usage guidelines in builtinTools (#1901)

- Added instructions for confirming folder existence before creating new files in modelAdapter.
- Updated custom prompt instructions in builtinTools to clarify the use of getFileTree for folder lookups when creating new notes.

* Do not add url context for youtube url (#1899)

* Update YouTube Script command and modal title to indicate Plus feature (#1903)

* Enhance ChatPersistenceManager to handle file save conflicts (#1904)

* Enhance ChatPersistenceManager to handle file save conflicts and improve epoch handling

* Fix type checking for existing files in ChatPersistenceManager to prevent errors

* Fix verify add (#1905)

- Rename "Verify" button to "Test" in Add Model dialog
- Make verification not required for adding model in Set Keys
- Upgrade chatAnthropic client to fix the Top P -1 error for Claude Opus models

* Enhance XML parsing to handle tool calls missing closing tags

---------

Co-authored-by: Wenzheng Jiang <[email protected]>
Co-authored-by: Zero Liu <[email protected]>
Co-authored-by: Emt-lin <[email protected]>
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.

4 participants