-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ai): Enable Context Variables for Chat Requests (#14787)
This PR introduces support for adding context elements (e.g., files, symbols, or domain-specific concepts) to chat requests, allowing chat agents to leverage additional context without embedding it directly in user input. - Extended the existing *variable* concept with `AIContextVariable`. - Context variables can provide a dedicated `contextValue` that agents can use separately from the chat request text. - Context variables can be included in chat requests in two ways: 1. Providing `AIVariableResolutionRequest` alongside the `ChatRequest`. 2. Mentioning a context variable directly in the chat request text (e.g., `#file:abc.txt`). - Extended the chat input widget to display and manage context variables. - Users can add context variables via: 1. A `+` button, opening a quick pick list of available context variables. 2. Typing a context variable (`#` prefix), with auto-completion support. - Theia’s label provider is used to display context variables in a user-friendly format. - Enhanced support for variable arguments when adding context variables via the UI. - Introduced: - `AIVariableArgPicker` for UI-based argument selection. - `AIVariableArgCompletionProvider` for auto-completion of variable arguments. - Added a new context variable `#file` that accepts a file path as an argument. - Refactored `QuickFileSelectService` for consistent file path selection across argument pickers and completion providers. - `ChatService` now resolves context variables and attaches `ResolvedAIContextVariable` objects to `ChatRequestModel`. - Variables can both: - Replace occurrences in chat text (`ResolvedAIVariable.value`). - Provide a separate `contextValue` for the chat model. * Make context variable completion more flexible Don't have the chat-view-language-contribution prefix the completion item, but give the provider full control. This enables triggering the completion also on : and #. Fixes #14839 Co-authored-by: Stefan Dirix <[email protected]>
- Loading branch information
Showing
29 changed files
with
1,446 additions
and
329 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.