GitLab Duo Chat

History

GitLab Duo Chat is your personal AI-powered assistant for boosting productivity. It can assist various tasks of your daily work with the AI-generated content.

Supported editor extensions

You can use GitLab Duo Chat in:

If you have GitLab Self-Managed: GitLab Duo requires GitLab 17.2 and later for the best user experience and results. Earlier versions may continue to work, however the experience may be degraded.

The context Chat is aware of

GitLab Duo Chat is sometimes aware of the context you’re working in. Other times, you must be more specific with your request.

The context Chat is aware of also depends on your subscription tier:

  • In the GitLab UI:
    • Chat is aware of code files if you have either Premium with GitLab Duo Pro, or Ultimate with GitLab Duo Pro or Enterprise.
    • For all other areas, you must have Ultimate with GitLab Duo Enterprise.
  • In the IDEs:
    • Chat is aware of selected lines in the editor if you have either Premium with GitLab Duo Pro, or Ultimate with GitLab Duo Pro or Enterprise.
    • For all other areas, you must have Ultimate with GitLab Duo Enterprise.

In the GitLab UI, GitLab Duo Chat knows about these areas:

AreaHow to ask Chat
EpicsFrom the epic, ask about this epic, this, or the URL. From any UI area, ask about the URL.
IssuesFrom the issue, ask about this issue, this, or the URL. From any UI area, ask about the URL.
Code filesFrom the single file, ask about this code or this file.
Merge requestsFrom the merge request, ask about this merge request, this, or the URL. For more information, see Ask about a specific merge request.
CommitsFrom the commit, ask about this commit or this. From any UI area, ask about the URL.
Pipeline jobsFrom the pipeline job, ask about this pipeline job or this. From any UI area, ask about the URL.

In the IDEs, GitLab Duo Chat knows about these areas:

AreaHow to ask Chat
Selected lines in the editorWith the lines selected, ask about this code or this file. Chat is not aware of the file; you must select the lines you want to ask about.
EpicsAsk about the URL.
IssuesAsk about the URL.
FilesUse the /include command to search for project files to add to Duo Chat’s context. After you’ve added the files, you can ask Duo Chat questions about the file contents. Available for VS Code and JetBrains IDEs. For more information, see Ask about specific files.

In addition, in the IDEs, when you use any of the slash commands, like /explain, /refactor, /fix, or /tests, Duo Chat has access to the code you selected.

Duo Chat always has access to:

  • GitLab documentation.
  • General programming and coding knowledge.

We are continuously working to expand contextual awareness of Chat to include more types of content.

Additional features

Repository X-Ray automatically enriches code generation requests for GitLab Duo Code Suggestions. If your project has access to Code Suggestions, then the /refactor, /fix, and /tests slash commands also have access to the latest Repository X-Ray report, and include that report as context for Duo.

The extensions for GitLab Duo scan for secrets and sensitive values matching known formats. The extensions redact this sensitive content locally before sending it to Duo Chat, or using it for code generation. This applies to files added via /include, and all generation commands.

Use GitLab Duo Chat in the GitLab UI

  1. In the upper-right corner, select GitLab Duo Chat. A drawer opens on the right side of your screen.

    The GitLab Duo Chat button is not visible in the following sections:

  2. Enter your question in the chat input box and press Enter or select Send. It may take a few seconds for the interactive AI chat to produce an answer.

  3. Optional. Ask a follow-up question.

To ask a new question unrelated to the previous conversation, you might receive better answers if you clear the context by typing /reset or /clear and selecting Send.

Only the last 50 messages are retained in the chat history. The chat history expires 3 days after last use.

Use GitLab Duo Chat in the Web IDE

History

To use GitLab Duo Chat in the Web IDE on GitLab:

  1. Open the Web IDE:
    1. In the GitLab UI, on the left sidebar, select Search or go to and find your project.
    2. Select a file. Then in the upper right, select Edit > Open in Web IDE.
  2. Then open Chat by using one of the following methods:
    • On the left sidebar, select GitLab Duo Chat.
    • In the file that you have open in the editor, select some code.
      1. Right-click and select GitLab Duo Chat.
      2. Select Explain selected code, Generate Tests, or Refactor.
    • Use the keyboard shortcut: ALT+d (on Windows and Linux) or Option+d (on Mac)
  3. In the message box, enter your question and press Enter or select Send.

If you have selected code in the editor, this selection is sent along with your question to the AI. This way you can ask questions about this code selection. For instance, Could you simplify this?.

Use GitLab Duo Chat in VS Code

History

Prerequisites:

To use GitLab Duo Chat in GitLab Workflow extension for VS Code:

  1. In VS Code, open a file. The file does not need to be a file in a Git repository.
  2. On the left sidebar, select GitLab Duo Chat ( duo-chat ).
  3. In the message box, enter your question and press Enter or select Send.
  4. In the chat pane, on the top right corner, select Show Status to show information in the Command Palette.

Select code and use Duo Chat

You can interact with Duo Chat while you’re working with a subset of code.

  1. In VS Code, open a file. The file does not need to be a file in a Git repository.
  2. In the file, select some code.
  3. Right-click and select GitLab Duo Chat.
  4. Select an option, or Open Quick Chat and ask a question, like Can you simplify this code? and press Enter.

Close Duo Chat

To close Duo Chat:

  • For Duo Chat on the left sidebar, select GitLab Duo Chat ( duo-chat ).
  • For the quick chat window that’s embedded in your file, in the upper-right corner, select Collapse ( chevron-lg-up ).

In the editor window

History

To open GitLab Duo Chat in the editor window, use any of these methods:

  • From a keyboard shortcut, by pressing:
    • MacOS: Option + c
    • Windows and Linux: ALT + c
  • Right-clicking in the currently open file in your IDE, then selecting GitLab Duo Chat > Open Quick Chat. Optionally, select some code to provide additional context.
  • Opening the Command Palette, then selecting GitLab Duo Chat: Open Quick Chat.

After Quick Chat opens:

  1. In the message box, enter your question. The available commands are shown while you enter text:
    • Enter / to display all available commands.
    • Enter /re to display /refactor.
  2. To send your question, select Send, or press Command + Enter.
  3. Use the Copy Snippet and Insert Snippet links above code blocks in the responses to interact with them.
  4. To exit chat, either select the chat icon in the gutter, or press Escape while focused on the chat.

Use GitLab Duo Chat in Visual Studio for Windows

Prerequisites:

To use GitLab Duo Chat in the GitLab extension for Visual Studio:

  1. In Visual Studio, open a file. The file does not need to be a file in a Git repository.
  2. Open Chat by using one of the following methods:
    • In the top menu bar, click on Extensions and then select Open Duo Chat.
    • In the file that you have open in the editor, select some code.
      1. Right-click and select GitLab Duo Chat.
      2. Select Explain selected code or Generate Tests.
  3. In the message box, enter your question and press Enter or select Send.

If you have selected code in the editor, this selection is sent along with your question to the AI. This way you can ask questions about this code selection. For instance, Could you refactor this?.

Use GitLab Duo Chat in JetBrains IDEs

History

Prerequisites:

To use GitLab Duo Chat in the GitLab plugin for JetBrains IDEs:

  1. In a JetBrains IDE, open a project.
  2. Open GitLab Duo Chat in either a chat window or an editor window.

In a chat window

To open GitLab Duo Chat in a chat window, use any of these methods:

  • On the right tool window bar, by selecting GitLab Duo Chat.
  • From a keyboard shortcut, by pressing:
    • MacOS: Option + d
    • Windows and Linux: ALT + d
  • In the file that you have open in the editor:
    1. Optional. Select some code.
    2. Right-click and select GitLab Duo Chat.
    3. Select Open Chat Window.
    4. Select Explain Code, Generate Tests, or Refactor Code.
  • Adding keyboard or mouse shortcuts for each action under Keymap in the Settings.

After GitLab Duo Chat opens:

  1. In the message box, enter your question. The available commands are shown while you enter text:
    • Enter / to display all available commands.
    • Enter /re to display /refactor and /reset.
  2. To send your question, press Enter or select Send.
  3. Use the buttons within code blocks in the responses to interact with them.

In GitLab Duo Quick Chat in the editor view

History

To open GitLab Duo Chat Quick Chat in the editor window, use any of these methods:

  • From a keyboard shortcut, by pressing:
    • MacOS: Option + c
    • Windows and Linux: ALT + c
  • In the currently open file in your IDE, by selecting some code, then, in the floating toolbar, selecting GitLab Duo Quick Chat ( tanuki-ai ).
  • Right-clicking, then selecting GitLab Duo Chat > Open Quick Chat.

After Quick Chat opens:

  1. In the message box, enter your question. The available commands are shown while you enter text:
    • Enter / to display all available commands.
    • Enter /re to display /refactor and /reset.
  2. To send your question, press Enter.
  3. Use the buttons around code blocks in the responses to interact with them.
  4. To exit chat, either select Escape to close, or press Escape while focused on the chat.

Watch a demo and get tips

For tips and tricks about integrating GitLab Duo Chat into your AI-powered DevSecOps workflows, read the blog post: 10 best practices for using AI-powered GitLab Duo Chat.

View examples of how to use GitLab Duo Chat.

Give feedback

Your feedback is important to us as we continually enhance your GitLab Duo Chat experience. Leaving feedback helps us customize the Chat for your needs and improve its performance for everyone.

To give feedback about a specific response, use the feedback buttons in the response message. Or, you can add a comment in the feedback issue.