> ## Documentation Index
> Fetch the complete documentation index at: https://ayakaleaf-pro.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# AI 助手

> 在编辑器中询问有关项目的问题，审阅助手建议的修改，并应用或拒绝它们。

助手基于你当前打开的项目工作。它会阅读你的文档并建议修改，由你逐一应用或拒绝。截图中的回答仅为示例：你得到的回答取决于你的站点所使用的模型。

> [!NOTE]
>
> 如果左侧栏中没有 **AI assistant**，请让管理员参阅 [AI 集成](https://ayakaleaf-pro.mintlify.site/zh-CN/on-premises/configuration/overleaf-toolkit/integrations/ai-integration.md)。

## 开始对话

**1. 打开助手**

在编辑器左侧栏中点击 **AI assistant**。面板会在编辑器旁打开。

**2. 接受条款**

第一次使用时，面板会显示 AI 功能的条款。点击 **Accept and continue**。此操作只需一次，并且同样适用于[错误助手](https://ayakaleaf-pro.mintlify.site/zh-CN/on-premises/user-guide/users/error-assistant.md)。

![显示条款和 Accept and continue 按钮的 AI assistant 面板](https://mintcdn.com/ayakaleaf-pro/IsGnx0wnzqtV4hI8/images/on-premises/ai-assistant-consent.png?fit=max\&auto=format\&n=IsGnx0wnzqtV4hI8\&q=85\&s=79becdeef84e44c498bf0419d8db25a7)

条款只显示一次

**3. 提问**

在 **What would you like to do?** 中输入内容并按回车，或点击箭头。你也可以点击 **Start a chat** 下的建议。每次对话的建议都会变化；如果上次编译有错误，还会出现 **Fix the compile errors**。

![显示 Start a chat 下的建议和消息框的面板](https://mintcdn.com/ayakaleaf-pro/IsGnx0wnzqtV4hI8/images/on-premises/ai-assistant-start.png?fit=max\&auto=format\&n=IsGnx0wnzqtV4hI8\&q=85\&s=a11293cc7f7276ad452d7e8e85a804f0)

空白对话

**4. 阅读回答**

助手执行的操作会以行的形式显示在一个框中，例如 **Read line 15-16 of main.tex**，步骤完成后会带有勾号。随后是回答。如果模型分享了推理过程，点击 **Reasoned for 1 s** 即可查看。

![一个问题、包含 Reasoned for 1 s 和 Read line 15-16 of main.tex 的框，以及回答](https://mintcdn.com/ayakaleaf-pro/IsGnx0wnzqtV4hI8/images/on-premises/ai-assistant-answer.png?fit=max\&auto=format\&n=IsGnx0wnzqtV4hI8\&q=85\&s=4f2054c3c112d83598c9577372f800d9)

一个问题及其回答

## 针对选中的行提问

在编辑器中选中若干行。消息框上方会出现类似 `main.tex: 16` 的标签，选中的文本会随消息一起发送。在空白对话中，建议会针对所选内容，例如 **Make it shorter**。

![编辑器中选中的一行、消息框中的 main.tex: 16 标签以及针对所选内容的建议](https://mintcdn.com/ayakaleaf-pro/IsGnx0wnzqtV4hI8/images/on-premises/ai-assistant-selection.png?fit=max\&auto=format\&n=IsGnx0wnzqtV4hI8\&q=85\&s=67844d0ede72e0016cde010310b8c426)

选中的一行

## 审阅建议的修改

在你应用之前，修改不会进入文档。

**1. 阅读建议**

名为 **Edit line 16** 的框会显示原因、行号和修改内容：旧文本带删除线，新文本高亮显示。此时文档尚未改变。**Show result** 只显示新文本，**Show diff** 则切换回来。

![带有 Show result、Reject 和 Apply 的 Edit line 16 框，以及编辑器中未改变的行](https://mintcdn.com/ayakaleaf-pro/IsGnx0wnzqtV4hI8/images/on-premises/ai-assistant-edit.png?fit=max\&auto=format\&n=IsGnx0wnzqtV4hI8\&q=85\&s=95bec4ca29c8fde20e7e0826984e2bf5)

等待你决定的修改

**2. 应用**

点击 **Apply**。修改会出现在编辑器中，框上出现勾号，助手继续工作。如果修改位于另一个文档，该文档会被打开。

![带勾号和 Undo 按钮的 Edit line 16 框，以及编辑器中已修改的行](https://mintcdn.com/ayakaleaf-pro/IsGnx0wnzqtV4hI8/images/on-premises/ai-assistant-applied.png?fit=max\&auto=format\&n=IsGnx0wnzqtV4hI8\&q=85\&s=bd52b0f9d5902d602af42fdb5c0e4522)

修改已应用

**3. 改变主意时撤回**

**Undo** 会将修改从文档中撤回，**Apply** 会重新应用。助手不会得知这两种操作。

### 拒绝修改

点击 **Reject**。文档保持不变，框中显示 **The user declined this edit.**，助手会在知道你已拒绝的情况下继续工作。按钮会消失，因此如需找回该修改，请重新提问。

如果你没有做出决定而是发送了新消息，该修改不会被应用，框中会注明这一点。

![两个标有叉号的 Edit line 13 框，一个被拒绝，一个未决定](https://mintcdn.com/ayakaleaf-pro/IsGnx0wnzqtV4hI8/images/on-premises/ai-assistant-rejected.png?fit=max\&auto=format\&n=IsGnx0wnzqtV4hI8\&q=85\&s=094a0cb06812a6a927276f5369900d3d)

一个被拒绝的修改和一个未决定的修改

## 助手在项目中能做什么

只有修改需要等待你的决定。其他步骤在助手执行时会立即运行。

| 对话中的行 | 作用 |
| - | - |
| **Read line 15-16 of main.tex** | 读取文档中的若干行 |
| **Find “schedule” in main.tex** | 在文档中查找文本 |
| **List the project files** | 列出项目文件 |
| **Create appendix.tex** | 创建一个空文档并打开 |
| **Edit line 16** | 建议一处修改，见上文 |
| **Compile** | 编译项目 |
| **Check the compile log** | 读取上次编译的错误和警告 |
| **Look at PDF page 1** | 在对话中显示 PDF 的某一页 |
| **Read the PDF structure** | 读取 PDF 的结构 |
| **Switch to xelatex** | 更改项目的编译器，与 **Settings** 中相同 |
| **Search the web for “...”** | 搜索网络 |
| **Search the help pages for “...”** | 搜索帮助页面 |

![Create appendix.tex 行、在编辑器中打开的新文件，以及一个等待决定的修改](https://mintcdn.com/ayakaleaf-pro/IsGnx0wnzqtV4hI8/images/on-premises/ai-assistant-new-file.png?fit=max\&auto=format\&n=IsGnx0wnzqtV4hI8\&q=85\&s=a0f13a37ad174e18c47cf0ca22e11f62)

一个新文件，然后是另一个文档中的修改

![Compile 和 Look at PDF page 1 行，以及在对话中显示的页面](https://mintcdn.com/ayakaleaf-pro/IsGnx0wnzqtV4hI8/images/on-premises/ai-assistant-compile.png?fit=max\&auto=format\&n=IsGnx0wnzqtV4hI8\&q=85\&s=469c0083109baabb19934d17cca382a6)

一次编译和 PDF 的一页

搜索行会显示找到的结果数。点击它即可列出结果。搜索是否可用取决于你的站点，参见[可选搜索服务](https://ayakaleaf-pro.mintlify.site/zh-CN/on-premises/configuration/overleaf-toolkit/integrations/ai-integration.md#optional-search-services)。

![展开后显示两个结果的 Search the web 行](https://mintcdn.com/ayakaleaf-pro/IsGnx0wnzqtV4hI8/images/on-premises/ai-assistant-search.png?fit=max\&auto=format\&n=IsGnx0wnzqtV4hI8\&q=85\&s=009ac0a2b38ca77426211898c5cfcbe0)

搜索结果

**Fix the compile errors** 建议会让助手检查日志并修复发现的问题。它的修复会以修改的形式交给你审阅。

## 附加图片或 PDF

在消息框中点击图片图标 **Attach image or PDF**，然后选择文件。文件名会显示在你的文本上方。写好消息后发送。

![附加了 sketch.png 并写有消息的消息框](https://mintcdn.com/ayakaleaf-pro/IsGnx0wnzqtV4hI8/images/on-premises/ai-assistant-attach.png?fit=max\&auto=format\&n=IsGnx0wnzqtV4hI8\&q=85\&s=33dd1f32532bde887b07dc5d5115f69c)

附加到消息的文件

面板会以 **Only images and PDF files can be attached.** 拒绝其他文件，并以 **Files must be smaller than 2 MB.** 拒绝过大的文件。

## 停止助手

助手工作时，消息框中的箭头会变成 **Stop** 按钮。点击它。正在运行的步骤会以 **Stopped by the user.** 结束，在你再次发送消息之前不会发生其他操作。

![带有 Stop 按钮的消息框](https://mintcdn.com/ayakaleaf-pro/IsGnx0wnzqtV4hI8/images/on-premises/ai-assistant-stop.png?fit=max\&auto=format\&n=IsGnx0wnzqtV4hI8\&q=85\&s=4837c5fda55d9ffa9b5af3a30987bf76)

Stop 按钮

## 如果助手自行停止

助手针对一条消息能执行的步骤数是有限的。达到上限时，面板会显示 **The assistant used all the steps it may take for one message. Reply to let it carry on.** 回复一下，例如 `Go on`，它就会继续。

![提示助手已用完所有步骤的通知](https://mintcdn.com/ayakaleaf-pro/IsGnx0wnzqtV4hI8/images/on-premises/ai-assistant-step-limit.png?fit=max\&auto=format\&n=IsGnx0wnzqtV4hI8\&q=85\&s=7509f3e5d5ffac6f2f51f54527e90738)

步骤上限

如果面板显示 **Something’s gone wrong**，说明请求失败。请重新发送消息，或点击 **Start new chat**。

## 移动面板与重新开始

面板顶部有以下按钮：

* **Start new chat** 会清空面板。没有历史对话列表。重新加载页面也会清空对话。
* **Move to the right** 会把面板移到 PDF 右侧，在你使用文件树时它会保持打开。**Move to the left** 会将其移回。对话会保留。
* **Close** 会隐藏面板。点击左侧栏中的 **AI assistant** 即可重新打开，对话仍在。

![AI assistant 面板位于 PDF 右侧的编辑器](https://mintcdn.com/ayakaleaf-pro/IsGnx0wnzqtV4hI8/images/on-premises/ai-assistant-right.png?fit=max\&auto=format\&n=IsGnx0wnzqtV4hI8\&q=85\&s=fdc556fe305a6c625b8bfad2adc537d7)

位于右侧的面板

## Token 用量

助手不会显示你已使用多少 token。如果你的站点设置了限额并且你已达到，下一条消息将不会得到回答。面板会显示 **Usage limit reached** 以及距离可以再次对话还需多久，消息框会变灰。

![变灰的消息框上方的 Usage limit reached 通知](https://mintcdn.com/ayakaleaf-pro/IsGnx0wnzqtV4hI8/images/on-premises/ai-assistant-usage-limit.png?fit=max\&auto=format\&n=IsGnx0wnzqtV4hI8\&q=85\&s=fcf261fc5ad7073bc725e24600c90de5)

已达到限额

新对话会显示同样的通知。重新加载后消息框看起来恢复正常，但下一条消息同样会收到该通知。[错误助手](https://ayakaleaf-pro.mintlify.site/zh-CN/on-premises/user-guide/users/error-assistant.md)与其共用同一限额，并会在日志条目中显示 **Usage limit reached**。

限额由管理员设置，参见[用量与重置](https://ayakaleaf-pro.mintlify.site/zh-CN/on-premises/configuration/overleaf-toolkit/integrations/ai-integration.md#usage-and-reset)。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.