MVC: Implementing Slash Commands and Code Context in Chat Interface in IDE aka "Code Tasks"
### Problem Statement The goal is to enhance the functionality of our chat interface by extending the API to accept the current file as an additional part of a chat request, implementing a feature in the IDE that sends selected code to the API, adding a code context part to the main chat prompt, and adding a list of slash commands to the Chat UI. ![Screenshot 2023-12-18 at 9.45.38 AM.png](/uploads/90d1efebcef4cdeac5c50410e1baec60/Screenshot_2023-12-18_at_9.45.38_AM.png){width=328 height=181} ## MVC Steps 1. Extend the API to accept the current file as an additional part of a chat request. This task is currently in progress by @jprovaznik. The API should be able to accept the selected text, complete file content, content before selection, content after selection, and active file name. 2. Implement a feature in the IDE that sends selected code to the API. This task is assigned to @nicolasdular. The IDE should be able to send the selected code to the API when a user selects code in a file. 3. Add a code context part to the main chat prompt. This task is next for @jprovaznik. The main chat prompt should support free-form code questions/tasks in the first iteration, such as "Refactor it by using XYZ". 4. Add a list of slash commands to the Chat UI. The Chat UI should display a list of slash commands from the Slash command epic. These commands should be part of free text, with no extra API attribute required. The server should parse these commands, allowing for the support of a Slash command and additional description in a future iteration. The initial set of slash commands to be added - are `/explain, /refactor`, and `/tests` - ~Stretch goal: support the possibility to add additional free-form text after the slash command to let users further refine what they want. See [proposal](https://gitlab.com/groups/gitlab-org/-/epics/11978#proposal "GitLab Duo Chat slash commands (IDEs/in product)") in parent epic. 5. Implement a special tool/prompt for slash commands in free text. If a user includes a slash command in free text, a special tool or prompt should be used for that task. ### Tasks - [x] https://gitlab.com/gitlab-org/gitlab/-/issues/429911+s =\> https://gitlab.com/gitlab-org/gitlab/-/merge_requests/135717+s - [x] https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/issues/1084+s =\> https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/merge_requests/1147+s - [ ] https://gitlab.com/gitlab-org/gitlab/-/issues/429914+s =\> TBA - [ ] https://gitlab.com/gitlab-org/gitlab/-/issues/429915+s =\> TBA Additional Context - The additional context in the Web UI will be considered in the next round when we have the full flow working. - **Please note, these commands and MVC are Chat-in-IDE specific and are not applicable to the Web UI as we will need time to investigate the parity and if we want to apply the same standards i.e. slash commands.** ### Exit Criteria The MVC will be considered complete when the API has been extended to accept the current file as an additional part of a chat request, the IDE can send selected code to the API, the main chat prompt supports free-form code questions/tasks, the Chat UI displays a list of slash commands, and a special tool or prompt is used for slash commands in free text.
epic