---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.6
alternate:
  - https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/ca-chat.md
  - https://sourcecraft.dev/portal/docs/ru/sourcecraft/operations/ca-chat.md
title: Chat with Code Assistant in SourceCraft
description: How to use SourceCraft Code Assistant chat in the SourceCraft interface for communicating with the AI assistant and solving various tasks.
---
> **Documentation Index:** Fetch the complete configuration index at https://sourcecraft.dev/portal/docs/en/llms.txt


# Chat with Code Assistant in SourceCraft

<!-- source: en/_includes/sourcecraft/disable-ai-features-note.md -->
{% note warning %}

SourceCraft uses the capabilities of AI models within Yandex. For this to work, some of your [organization's](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/index.md#org) data needs to be sent to Yandex.

In private organizations, you can [disable](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/disable-ai-features.md) data transfers to Yandex, but this will limit [Code Assistant](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/code-assistant.md)'s capabilities.

{% endnote %}
<!-- endsource: en/_includes/sourcecraft/disable-ai-features-note.md -->

<!-- source: en/_includes/sourcecraft/ai-chat-description.md -->
The SourceCraft interface has a built-in chat with Code Assistant you can use to interact with the AI assistant.

The following scenarios are supported:
* SourceCraft user help, FAQ.
* Searching through the documentation.
* 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.
* Generating documentation.
* Scanning code for potential issues.
* Suggesting improvements and alternative solutions.
* Generating charts.
* Writing commit messages.

The page in the SourceCraft interface you view defines the context for Code Assistant, e.g., [repository](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/index.md#repos) files, current open file, [pull request](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/index.md#pr) or [issue](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/index.md#issues) content, etc.
<!-- endsource: en/_includes/sourcecraft/ai-chat-description.md -->

{% note tip %}

To switch to an earlier Code Assistant model:
1. In the left-hand panel, 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="M7.199 2H8.8a.2.2 0 0 1 .2.2c0 1.808 1.958 2.939 3.524 2.034a.2.2 0 0 1 .271.073l.802 1.388a.2.2 0 0 1-.073.272c-1.566.904-1.566 3.164 0 4.069a.2.2 0 0 1 .073.271l-.802 1.388a.2.2 0 0 1-.271.073C10.958 10.863 9 11.993 9 13.8a.2.2 0 0 1-.199.2H7.2a.2.2 0 0 1-.2-.2c0-1.808-1.958-2.938-3.524-2.034a.2.2 0 0 1-.272-.073l-.8-1.388a.2.2 0 0 1 .072-.271c1.566-.905 1.566-3.165 0-4.07a.2.2 0 0 1-.073-.27l.801-1.389a.2.2 0 0 1 .272-.072C5.042 5.138 7 4.007 7 2.199c0-.11.089-.199.199-.199M5.5 2.2c0-.94.76-1.7 1.699-1.7H8.8c.94 0 1.7.76 1.7 1.7a.85.85 0 0 0 1.274.735 1.7 1.7 0 0 1 2.32.622l.802 1.388c.469.813.19 1.851-.622 2.32a.85.85 0 0 0 0 1.472 1.7 1.7 0 0 1 .622 2.32l-.802 1.388a1.7 1.7 0 0 1-2.32.622.85.85 0 0 0-1.274.735c0 .939-.76 1.7-1.699 1.7H7.2a1.7 1.7 0 0 1-1.699-1.7.85.85 0 0 0-1.274-.735 1.7 1.7 0 0 1-2.32-.622l-.802-1.388a1.7 1.7 0 0 1 .622-2.32.85.85 0 0 0 0-1.471 1.7 1.7 0 0 1-.622-2.32l.801-1.389a1.7 1.7 0 0 1 2.32-.622A.85.85 0 0 0 5.5 2.2m4 5.8a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M11 8a3 3 0 1 1-6 0 3 3 0 0 1 6 0" clip-rule="evenodd"/></svg> **Settings**.
1. Under **Appearance**, enable the **Use legacy AI model** option.

{% endnote %}

## Opening a chat {#open}

1. Open the SourceCraft [home page](https://sourcecraft.dev).
1. If you need Code Assistant to have a specific context without explicitly stating it in a chat message, navigate to the relevant page, such as opening a repository, a specific file, or a task.
1. In the panel on the left, click <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" aria-hidden="true" viewBox="0 0 36 36"><path fill="#9D9FA5" d="M31.501 34.875H3.375l1.237-6.187h3.826l2.813 4.5 5.063-4.5h12.093l3.263-16.313H36z"/><path d="M25.875 23.625h-9l-5.062 4.5L9 23.625H0l4.5-22.5h25.875zm-5.687-9.248a.75.75 0 0 0-.682.438l-.043.118a2.37 2.37 0 0 1-1.72 1.72.75.75 0 0 0 0 1.449 2.37 2.37 0 0 1 1.72 1.72.75.75 0 0 0 1.45 0 2.37 2.37 0 0 1 1.719-1.72.75.75 0 0 0 0-1.45 2.37 2.37 0 0 1-1.72-1.72.75.75 0 0 0-.724-.555m-6-10a1 1 0 0 0-.968.747l-.019.089c-.278 1.67-.814 2.8-1.596 3.582-.78.781-1.912 1.317-3.582 1.596a1 1 0 0 0 0 1.972c1.67.279 2.801.815 3.582 1.596.782.781 1.318 1.912 1.596 3.582a1 1 0 0 0 1.973 0c.278-1.67.814-2.8 1.596-3.582.78-.781 1.912-1.317 3.582-1.596a1 1 0 0 0 0-1.972c-1.67-.279-2.801-.815-3.582-1.596-.782-.781-1.318-1.912-1.596-3.582a1 1 0 0 0-.986-.836"/></svg> **Code Assistant Chat**.

## Sending a message {#send}

Write your request to the AI assistant in the message input field and 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="M8 14.75a.75.75 0 0 1-.75-.75V3.81L4.53 6.53a.75.75 0 0 1-1.06-1.06l4-4a.75.75 0 0 1 1.06 0l4 4a.75.75 0 0 1-1.06 1.06L8.75 3.81V14a.75.75 0 0 1-.75.75" clip-rule="evenodd"/></svg> or press **Enter**.

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

{% note info %}

Additional context provided in Code Assistant, such as a pull request or task, is displayed in the message input field.

{% endnote %}

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

If you changed 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="M13.5 8a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0M15 8A7 7 0 1 1 1 8a7 7 0 0 1 14 0M5.25 6.25a1 1 0 0 1 1-1h3.5a1 1 0 0 1 1 1v3.5a1 1 0 0 1-1 1h-3.5a1 1 0 0 1-1-1z" clip-rule="evenodd"/></svg> **Stop** in the message input window.

## Opening a new chat {#new-chat}

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="M8 1.75a.75.75 0 0 1 .75.75v4.75h4.75a.75.75 0 0 1 0 1.5H8.75v4.75a.75.75 0 0 1-1.5 0V8.75H2.5a.75.75 0 0 1 0-1.5h4.75V2.5A.75.75 0 0 1 8 1.75" clip-rule="evenodd"/></svg> in the chat's top panel.

## Viewing the list of chats {#list-chat}

1. 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="M1.5 8a6.5 6.5 0 1 1 7.348 6.445.75.75 0 1 1-.194-1.487A5.001 5.001 0 1 0 4.5 11.57v-1.32a.75.75 0 0 1 1.5 0v3a.75.75 0 0 1-.75.75h-3a.75.75 0 0 1 0-1.5h1.06A6.48 6.48 0 0 1 1.5 8M8 4.25a.75.75 0 0 1 .75.75v2.625l1.033.775a.75.75 0 1 1-.9 1.2l-1.333-1a.75.75 0 0 1-.3-.6V5A.75.75 0 0 1 8 4.25" clip-rule="evenodd"/></svg> in the chat's top panel.
1. From the list that opens, select the chat you want to go back to.

To delete a chat from the list, click the <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="M9 2H7a.5.5 0 0 0-.5.5V3h3v-.5A.5.5 0 0 0 9 2m2 1v-.5a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2V3H2.251a.75.75 0 0 0 0 1.5h.312l.317 7.625A3 3 0 0 0 5.878 15h4.245a3 3 0 0 0 2.997-2.875l.318-7.625h.312a.75.75 0 0 0 0-1.5zm.936 1.5H4.064l.315 7.562A1.5 1.5 0 0 0 5.878 13.5h4.245a1.5 1.5 0 0 0 1.498-1.438zm-6.186 2v5a.75.75 0 0 0 1.5 0v-5a.75.75 0 0 0-1.5 0m3.75-.75a.75.75 0 0 1 .75.75v5a.75.75 0 0 1-1.5 0v-5a.75.75 0 0 1 .75-.75" clip-rule="evenodd"/></svg> button next to it.

## Code blocks {#codeblocks}

Code Assistant answers may contain code examples. Above the code block, you will see the programming language it was written in.

### Copying code from a chat {#copy-code}

In the right-hand corner of the panel above the code block, 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="M12 2.5H8A1.5 1.5 0 0 0 6.5 4v1H8a3 3 0 0 1 3 3v1.5h1A1.5 1.5 0 0 0 13.5 8V4A1.5 1.5 0 0 0 12 2.5M11 11h1a3 3 0 0 0 3-3V4a3 3 0 0 0-3-3H8a3 3 0 0 0-3 3v1H4a3 3 0 0 0-3 3v4a3 3 0 0 0 3 3h4a3 3 0 0 0 3-3zM4 6.5h4A1.5 1.5 0 0 1 9.5 8v4A1.5 1.5 0 0 1 8 13.5H4A1.5 1.5 0 0 1 2.5 12V8A1.5 1.5 0 0 1 4 6.5" clip-rule="evenodd"/></svg>.

### Expanding and collapsing a code block {#open-code}

To make it easier to navigate the chat, the system automatically collapses large blocks of code. To expand or collapse a code block, 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="M2.903 3.617a.75.75 0 1 0-.806 1.266l5.5 3.5a.75.75 0 0 0 .806 0l5.5-3.5a.75.75 0 1 0-.806-1.266L8 6.861zm0 4.5a.75.75 0 1 0-.806 1.266l5.5 3.5a.75.75 0 0 0 .806 0l5.5-3.5a.75.75 0 1 0-.806-1.266L8 11.361z" 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="M13.097 12.383a.75.75 0 0 0 .806-1.266l-5.5-3.5a.75.75 0 0 0-.806 0l-5.5 3.5a.75.75 0 1 0 .806 1.266L8 9.139zm0-4.5a.75.75 0 0 0 .806-1.266l-5.5-3.5a.75.75 0 0 0-.806 0l-5.5 3.5a.75.75 0 0 0 .806 1.266L8 4.639z" clip-rule="evenodd"/></svg> under it.

## Closing a chat {#close}

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="M3.47 3.47a.75.75 0 0 1 1.06 0L8 6.94l3.47-3.47a.75.75 0 1 1 1.06 1.06L9.06 8l3.47 3.47a.75.75 0 1 1-1.06 1.06L8 9.06l-3.47 3.47a.75.75 0 0 1-1.06-1.06L6.94 8 3.47 4.53a.75.75 0 0 1 0-1.06" clip-rule="evenodd"/></svg> in the chat's top panel.

{% note tip %}

Chat history is saved. You can return to a specific chat later.

{% endnote %}

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

* [Using AI skills in SourceCraft](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/ai-skills.md)
* [Getting started with SourceCraft Code Assistant](https://sourcecraft.dev/portal/docs/en/code-assistant/index.md)
* [AI in SourceCraft](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/code-assistant.md)
* [Editing code in SourceCraft Code Assistant](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/code-edit.md)
* [AI code review of a pull request in SourceCraft](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/ca-review.md)
