Side Chat
During the coding process, you can interact with the AI assistant in the side chat box at any time. This includes answering coding questions, explaining the code repository, generating code snippets, fixing errors, and more.
Enable the Chat Agent
After entering Trae IDE, the AI panel is usually opened on the right side by default. If not, you can use the shortcut (macOS: Command + U; Windows: Ctrl + U) to open it. Then, select the Chat agent from the agent list.
More Features
Trae IDE offers a range of functionalities that you can use during chat, enabling you to code more efficiently.
Models
Trae provides a series of outstanding models in the industry. You can easily switch between different models for use. In addition, Trae supports adding custom models through your own API keys so as to better meet your personalized needs. For more information, refer to "Models".
Agent
An agent is your programming assistant for various development scenarios. In addition to built-in agents, you can create custom agents by flexibly configuring prompts and toolsets, allowing them to assist you more efficiently with complex tasks. For more information, refer to "Agent".
Context
The AI assistant can understand the context of the current project, including code, files, and folders, allowing it to assist you more accurately in fulfilling your development needs. For more information, refer to "Context".
Input Multimodal Content
You can add images in the chat, such as error screenshots, design drafts, reference styles, and more, to express your needs more accurately and efficiently. For more information, refer to "Multimodal input".
Generate and Handle Code Changes
Based on your needs, the AI assistant will automatically create new files or edit existing ones and save the generated code. You can accept or reject code changes, including:
Note: If you choose to accept code changes, the AI assistant will create new files or apply the changes to existing files. The applied code will be displayed in a diff format.
- Handle all code changes in multiple files: Click the Accept All or Reject All buttons in the file list above the input box to bulk accept or reject all code changes in the current project.
- Handle all code changes in a file: In the editor, open the file and click the Accept button (shortcut: Command + Enter for macOS; Ctrl +Enter for Windows) or Reject button (shortcut: Command + Backspace for macOS; Ctrl + Backspace for Windows) in the top prompt bar to bulk accept or reject all code changes within the current file.
- Handle a single code change: Click the ^Y button (shortcut: Control + Y for macOS; Alt + Y for Windows) or ^N button (shortcut: Control + N for macOS; Alt + N for Windows) in the upper right corner of a specific code change in the editor to accept or reject that particular change.
Additionally, for the code snippets generated in chats, you can handle them as follows:
| No. | Description |
|---|---|
| 1 | Click the Copy button to copy all the code in the code snippet. |
| 2 | In the file currently open in the editor, click any area, then click the Insert at Cursor button to add the code in the code snippet to the place of the cursor in the file. |
| 3 | Click the Add to New File button to create a new file and add the code in the code snippet to the file. |
| 4 | For a code change, click the Apply button to apply it to the corresponding file. |
Note: Code irrelevant to the current project cannot be applied.
Generate and Run Commands
During chat, based on your needs, the AI assistant will provide executable Shell commands that you can run with a single click.
You can perform the following operations as needed:
| No. | Description |
|---|---|
| 1 | Click the Copy button to copy the command. |
| 2 | Click the Add to Terminal button to add the command to an available terminal. |
| 3 | Click the Run button to run the command in an available terminal. |
Revert to Previous Versions
You can revert the project to a version before a certain round of chat.
Note:
- Reversions cannot be undone.
- Only supports reverting a project to a version within the latest 10 rounds of chat.
- Find the target chat bubble.
- At the left, click the Revert button.
- A dialog box showing the file(s) that this reversion impacts appears.
- Click the name of a file in the list.
- The file is opened in the editor and the changes going to happen show.
- Confirm the impact this reversion brings.
- If the impact is as expected, click the Confirm button.
- The AI assistant starts to revert this project.
Manage Historical Chats
Click the Show History button at the top right of the side chat box to view and manage historical chats.
- To view a specific historical chat, click on the corresponding entry to jump to that part.
- If you need to delete a historical chat, hover over the desired entry and click the Delete button on the right side. Deleted chats cannot be restored.
Optimize Prompts
After entering a prompt in the input box, you can optimize it for better results.