tabby
tabby copied to clipboard
feat(vscode): support client selected context
Context
We want to enable users to manually select context. For example, users can select a piece of code and add it to the context so that it will be included with their message next time.
User selected context as shown in the following screenshots:
Screen record
For testing purposes, adding client context is triggered via the command palette. https://jam.dev/c/8477d02f-9e37-4ac7-8bad-ae87d1b11778
Overview of adding client context
-
Editor adds new context: By using the new method exposed on the tabby-chat-panel,
this.client?.addClientSelectedContext(Context) -
Receiving context: tabby-ui receives the context and saves it into its new state
clientSelectedContext - Displaying context: tabby-ui displays the clientSelectedContext (as shown in the above screenshot)
-
Removing context: tabby-ui can remove the context using its own method
removeClientSelectedContext -
Submitting the message: When a message is submitted, tabby-ui will send the context to the Editor using
onSubmitMessage(value, clientSelectedContext). The Editor will then add these clientSelectedContext entries intorelevantContextbefore sending them to the server.
Note
Currently, there is no way to addClientSelectedContext from the user interface, so from the user's perspective, there will be no difference after merging this PR.
\cc @liangfung