Skip to content

UI for code snippets in the GitLab Duo

Denys Mishunov requested to merge 413210-code-snippets into master

What does this MR do and why?

The MR introduces several things related to presenting the code snippets in particular and messages in general in GitLab Duo Chat. The whole presentation of the Markdown is now delegated to the single component (ai_genie_chat_message) to keep the architecture DRY and easier maintainable.

Screenshots or screen recordings

Before After
GitLab Duo Chat Screenshot_2023-07-06_at_10.29.44 Screenshot_2023-07-06_at_10.22.18
Explain Code Screenshot_2023-07-06_at_10.30.54 Screenshot_2023-07-06_at_10.24.00

How to set up and validate locally

  1. Follow the instructions to enable the AI features in your local GDK
  2. Follow the instructions on setting up the GitLab chat locally
  3. Enable the :super_sidebar_nav feature flag (Feature.enable(:anthropic_experimentation) in your rails console
  4. Enable the new super sidebar in your settings via the web interface: Screenshot_2023-05-26_at_11.20.04
  5. Open the GitLab chat in Help -> Ask GitLab Chat
  6. Ask a question that intends a response with a code snippet in it. For example:
I have a function:

```javascript
function(a) {
  return a +2;
};
```
Write Jest test spec for it

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #413210

Edited by Denys Mishunov

Merge request reports