# AI Assistant

## Overview

**UI Bakery AI Assistant** is an AI-based chatbot that can quickly help you with technical questions and code generation. The chatbot window is flexible - you can easily resize it and drag to any place on the screen. It also remembers you current settings - so next time you open it, window size and place will be the same. You can toggle AI Assistant with `Cmd + I/Ctrl + I`*.*

### Chats and chat history

You can also access **chat history** to browse through, search, or select any chat you want to pick up right where you left off.\
Or if you prefer, you can start a **new chat** - once your first message is sent, the chat will automatically rename itself based on the conversation topic. Any chat you don't need any more can be deleted from the chat window as well.

{% @arcade/embed flowId="lH0V2hCEafyzbaN42BxY" url="<https://app.arcade.software/share/lH0V2hCEafyzbaN42BxY>" %}

### Context and modes

AI Assistant also understands your current context - whether you're creating an action, writing an SQL query, or checking the Logs. The chat context will vary accordingly, and AI Assistant will offer tailored solutions to help you move forward with building your app.

The AI Assistant works in two modes - [Documentation](#documentation-mode) and [Code generation](#code-generation-mode).

{% @arcade/embed flowId="NjaSc548ixYNWc0ym3pw" url="<https://app.arcade.software/share/NjaSc548ixYNWc0ym3pw>" %}

#### Documentation mode

In this mode, the AI Assistant refers to UI Bakery documentation. When you ask a technical question, it explores the docs and gets back to you with an answer.&#x20;

The Assistant also has access to the currently used *action context* and, based on that, can troubleshoot the action. Simply click the **Debug with AI** button in the action's *Result* section if you need chatbot's assistance in troubleshooting an action.

<figure><img src="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2FgUvEy6WlFyTYbFcEVol4%2FCleanShot%202025-03-25%20at%2017.00.14%402x-min.png?alt=media&#x26;token=985b1bb8-86e3-4c10-83d9-fdff68961464" alt=""><figcaption></figcaption></figure>

The Assistant's answer can be rated with **Like/Dislike** buttons. This allows to educate the chatbot in the best way possible so we highly encourage you to use these rating options.

{% hint style="info" %}
If you notice that the Assistant's reply is not correct, contact us in the live chat or via email at <support@uibakery.io>.
{% endhint %}

#### Code generation mode

Code generation mode can help with generating SQL queries or JavaScript code. This is especially useful for the execution of repetitive code, data transformations, or simply handling the not-so-well-known programming language.

To activate the Assistant in this mode, simply click on the chatbot's icon in the code field, specify the details of the query, and hit *Enter*. The AI Assistant has access to the current action context making code generation easier.

<figure><img src="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2FtjoJuOqM89tV3DLUbMdG%2FCleanShot%202025-03-25%20at%2017.10.23%402x-min.png?alt=media&#x26;token=91c49a6e-0305-49e0-b19e-8e11a6a852d6" alt=""><figcaption></figcaption></figure>

## Activating AI Assistant on a self-hosted version

The AI assistant is hidden under a feature flag on a self-hosted version. To activate it on your instance, follow these steps:

1. Activate the `UI_BAKERY_ENABLED_FEATURE_FLAGS=chat` and `UI_BAKERY_CHAT_API_URL=`[`https://chat2.uibakery.io`](https://chat2.uibakery.io/) variables in the .env file.
2. Restart your instance `docker compose up -d`.
