tabby icon indicating copy to clipboard operation
tabby copied to clipboard

feat(vscode): support client selected context

Open wwayne opened this issue 1 year ago • 0 comments

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: 1

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

  1. Editor adds new context: By using the new method exposed on the tabby-chat-panel, this.client?.addClientSelectedContext(Context)
  2. Receiving context: tabby-ui receives the context and saves it into its new state clientSelectedContext
  3. Displaying context: tabby-ui displays the clientSelectedContext (as shown in the above screenshot)
  4. Removing context: tabby-ui can remove the context using its own method removeClientSelectedContext
  5. 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 into relevantContext before 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

wwayne avatar Jul 23 '24 12:07 wwayne