---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.6
alternate:
  - https://sourcecraft.dev/portal/docs/en/code-assistant/operations/chat.md
  - https://sourcecraft.dev/portal/docs/ru/code-assistant/operations/chat.md
title: Running SourceCraft Code Assistant in chat mode
description: How to use Code Assistant in chat mode in the JetBrains IDE to send messages, view chat history, and work with code blocks.
---
> **Documentation Index:** Fetch the complete configuration index at https://sourcecraft.dev/portal/docs/en/llms.txt


# SourceCraft Code Assistant chat interface in the JetBrains IDE

{% note warning %}

This page describes the chat features in the JetBrains IDE. To learn about the chat features in Visual Studio Code, see [SourceCraft Code Assistant chat interface in Visual Studio Code](https://sourcecraft.dev/portal/docs/en/code-assistant/operations/agent/chat-interface.md).

{% endnote %}

<!-- source: en/_includes/code-assistant/chat-description.md -->
The Code Assistant plugin has a built-in chat you can use to interact with the AI assistant right from the IDE interface. 

The following scenarios are supported:
* Generating code snippets.
* Explaining code in project files or individual file sections, including code in [markdown](https://en.wikipedia.org/wiki/Markdown) syntax intended for documentation.
* Help with debugging and troubleshooting.
* [Generating tests for your code](https://sourcecraft.dev/portal/docs/en/code-assistant/operations/quick-actions.md#test).
* [Generating documentation](https://sourcecraft.dev/portal/docs/en/code-assistant/operations/quick-actions.md#docs).
* Scanning code for potential issues.
* Generating charts.

The chat supports [context](https://sourcecraft.dev/portal/docs/en/code-assistant/operations/chat-context.md) management.
<!-- endsource: en/_includes/code-assistant/chat-description.md -->

{% note tip %}

There is also the [agent mode](https://sourcecraft.dev/portal/docs/en/code-assistant/operations/jb-agent.md) based on the [SourceCraft CLI](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/cli-quickstart.md) with editor integration, available at the _Preview stage_.

{% endnote %}

## Sending messages {#sending}

### Opening a chat {#open-chat-jb}

<!-- source: en/_includes/code-assistant/open-chat-jb.md -->
In the editor's right-hand panel, click <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path fill="#868686" d="M21 23H2l.9-4.5h1.53l-.6 3h15.94l1.2-6H21L22.5 8H24l-3 15Zm-2.75-7h-6l-3.375 3L7 16H0L3 1h18.25l-3 15ZM1.83 14.5h6l.441.705.934 1.493 2.048-1.82.426-.378h5.34l2.4-12H4.23l-2.4 12Zm7.17-2H7l5.5-8h2l-5.5 8Z"/></svg> **SourceCraft Code Assistant Chat**.
<!-- endsource: en/_includes/code-assistant/open-chat-jb.md -->

### Sending a message {#send-message-jb}

Write your request to the AI assistant in the message input window and click <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="none" stroke="#7a8183" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.2" d="M10.5 12H5m-.084.291L2.58 19.266c-.184.548-.275.822-.21.99a.5.5 0 0 0 .332.3c.174.05.438-.07.965-.306l16.711-7.52c.515-.232.772-.348.851-.509a.5.5 0 0 0 0-.443c-.08-.16-.336-.276-.85-.508L3.661 3.748c-.525-.237-.788-.355-.962-.307a.5.5 0 0 0-.332.3c-.066.168.025.441.206.988l2.342 7.056a.967.967 0 0 1 .053.19.5.5 0 0 1 0 .127c-.006.049-.022.095-.053.19Z"/></svg> or press **Enter**.

For a line break in the message, press **Shift** + **Enter**. 

<!-- source: en/_includes/code-assistant/context-chat.md -->
You can ask questions in any language.

{% note info %}

The AI assistant uses the open editor tab or selected code block for context.

[Learn more about context](https://sourcecraft.dev/portal/docs/en/code-assistant/operations/chat-context.md)

{% endnote %}
<!-- endsource: en/_includes/code-assistant/context-chat.md -->

### Stopping response generation {#stop-generation-jb}

<!-- source: en/_includes/code-assistant/stop-generating.md -->
If, for example, you change your mind and want to rephrase your question, click <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="M11.5 3h-7A1.5 1.5 0 0 0 3 4.5v7A1.5 1.5 0 0 0 4.5 13h7a1.5 1.5 0 0 0 1.5-1.5v-7A1.5 1.5 0 0 0 11.5 3m-7-1.5a3 3 0 0 0-3 3v7a3 3 0 0 0 3 3h7a3 3 0 0 0 3-3v-7a3 3 0 0 0-3-3z" clip-rule="evenodd"/></svg> in the message input window.
<!-- endsource: en/_includes/code-assistant/stop-generating.md -->

### Rating the response {#rate-answer-jb}

<!-- source: en/_includes/code-assistant/thumbs-up-down.md -->
Click <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="m4 7 2.94-5.041a1.932 1.932 0 0 1 3.56 1.378L10.25 4.5 9.93 6h2.94a2 2 0 0 1 1.927 2.535l-.879 3.162A4 4 0 0 1 9.596 14.6L4.5 14zm5.771 6.11-3.863-.455-.379-5.3 2.708-4.64a.432.432 0 0 1 .796.308l-.571 2.663L8.073 7.5h4.796a.5.5 0 0 1 .482.634l-.879 3.162a2.5 2.5 0 0 1-2.7 1.814M2.748 7.447a.75.75 0 1 0-1.496.106l.5 7a.75.75 0 0 0 1.496-.106z" clip-rule="evenodd"/></svg> or <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="m12 9-2.94 5.041a1.932 1.932 0 0 1-3.56-1.378l.25-1.163.321-1.5h-2.94a2 2 0 0 1-1.927-2.535l.879-3.162A4 4 0 0 1 6.404 1.4L11.5 2zM6.229 2.89l3.863.455.379 5.3-2.708 4.64a.432.432 0 0 1-.796-.308l.571-2.663.389-1.814H3.13a.5.5 0 0 1-.482-.634l.879-3.162a2.5 2.5 0 0 1 2.7-1.814m7.023 5.663a.75.75 0 1 0 1.496-.106l-.5-7a.75.75 0 0 0-1.496.106z" clip-rule="evenodd"/></svg> in the bottom-right corner of the AI assistant's response.
<!-- endsource: en/_includes/code-assistant/thumbs-up-down.md -->

## Chat history {#chat-history}

Click <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path d="m10 12.6.7.7 1.6-1.6 1.6 1.6.8-.7L13 11l1.7-1.6-.8-.8-1.6 1.7-1.6-1.7-.7.8 1.6 1.6-1.6 1.6zM1 4h14V3H1v1zm0 3h14V6H1v1zm8 2.5V9H1v1h8v-.5zM9 13v-1H1v1h8z"/></svg> **Clean Chat** in the chat's top panel to clear your chat.

## Code blocks {#codeblocks}

Click <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path d="M11.2 14.72h-8a.32.32 0 0 1-.32-.32V3.2a.32.32 0 0 1 .32-.32h8a.32.32 0 0 1 .32.32v11.2a.32.32 0 0 1-.32.32zm-7.68-.64h7.36V3.52H3.52z"/><path d="M12.8 13.12a.32.32 0 0 1-.32-.32V2.08h-8.4a.32.32 0 1 1 0-.64h8a.32.32 0 0 1 .32.32v11.36a.32.32 0 0 1-.32.32zm-8-6.72h4.8"/><path d="M9.6 6.72H4.8a.32.32 0 1 1 0-.64h4.8a.32.32 0 0 1 0 .64zM4.8 8h4.8m0 .32H4.8a.32.32 0 0 1 0-.64h4.8a.32.32 0 1 1 0 .64zM4.8 9.6h4.8m0 .32H4.8a.32.32 0 1 1 0-.64h4.8a.32.32 0 1 1 0 .64z"/></svg> in the top-right corner of the code block to copy the code from your chat.

#### Useful links {#see-also}

* [Getting started with SourceCraft Code Assistant](https://sourcecraft.dev/portal/docs/en/code-assistant/index.md)
* [SourceCraft Code Assistant overview](https://sourcecraft.dev/portal/docs/en/code-assistant/concepts/index.md)
* [Managing SourceCraft Code Assistant chat context in the JetBrains IDE](https://sourcecraft.dev/portal/docs/en/code-assistant/operations/chat-context.md)
* [Quick actions in SourceCraft Code Assistant](https://sourcecraft.dev/portal/docs/en/code-assistant/operations/quick-actions.md)