Files
mintlify__docs/zh/editor/agent.mdx
mintlify[bot] 7bf380b2b0 docs: translate missing pages into es, fr, zh (#6287)
Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
2026-06-25 21:18:57 +00:00

127 lines
5.3 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "向代理提问"
description: "使用编辑器内置的 AI 代理,通过聊天界面撰写内容、编辑页面、跨站点搜索、上传文件并配置设置。"
keywords: ["编辑器", "AI", "助手", "代理", "聊天", "code mode", "文件上传"]
---
编辑器内置了一个代理,可以编辑页面、重新组织导航、更新 `docs.json`、在整个仓库中搜索以及管理控制台设置。
编辑器代理会直接在你的当前 branch 中进行更改。
<div id="open-the-agent">
## 打开代理
</div>
点击编辑器工具栏中的 **Ask agent**,或按 <kbd>Cmd</kbd> + <kbd>I</kbd> (macOS) 或 <kbd>Ctrl</kbd> + <kbd>I</kbd> (Windows)。
要关闭面板,请点击面板标题栏中的 **X** 按钮,或再次按 <kbd>Cmd</kbd> + <kbd>I</kbd>。
<div id="send-a-message">
## 发送消息
</div>
在面板底部的聊天框中输入你的请求,按 <kbd>Enter</kbd> 或点击 <Icon icon="arrow-up" /> 发送按钮。
输入 <kbd>@</kbd> 可以提及特定页面。代理在处理你的请求时会聚焦于该页面。如果你不提及任何页面,代理会使用你当前打开的页面。
示例提示词:
- `simplify the introduction page`
- `fix all grammar errors across my content`
- `add a new page that explains authentication`
- `rename every mention of "Acme Pro" to "Acme Team" across all pages`
- `update docs.json to add a new group called "Guides"`
<div id="attach-files">
## 附加文件
</div>
点击聊天框中的回形针图标,或将文件拖放到面板上。代理会读取附加的文件作为请求的上下文。
支持的文件类型:
- **图像**:JPG、PNG、GIF、WebP、SVG
- **文档**:PDF
- **代码和文本**:`.js`、`.ts`、`.jsx`、`.tsx`、`.mdx`、`.md`、`.json`、`.yaml`、`.html`、`.css`、Python、Go、Rust、Ruby、Java、Swift、C、C++、SQL、shell 脚本等
最大大小:每个文件 5 MB。最多:每条消息 10 个文件。
<div id="add-a-selection-to-the-agent">
## 将选中内容添加到代理
</div>
在可视化模式下,在页面上选中文本。选区上方会出现一个浮动工具栏。点击 **Add to agent**,将所选文本作为上下文发送给代理。
<div id="review-what-the-agent-changed">
## 查看代理的更改
</div>
代理在编辑页面时,聊天中会出现 **Changed files** 面板。展开后可看到本次会话中修改的每个文件的列表。点击任意文件可在差异视图中打开它,将代理的更改与原文对比。
<div id="what-the-agent-can-do">
## 代理可以做什么
</div>
<div id="edit-pages">
### 编辑页面
</div>
代理可以在任意页面上撰写、改写、扩展和重新组织内容。它会阅读你现有的内容,以匹配你的风格和结构。
<div id="search-and-navigate-your-content">
### 搜索并浏览你的内容
</div>
代理可以在整个仓库中搜索,而不仅限于你当前打开的页面。可借助它查找信息、检查不一致之处,或在添加内容前确认内容是否已经存在。
<div id="update-navigation-and-docsjson">
### 更新导航和 docs.json
</div>
代理可以添加、重命名、重新排序和删除导航元素,这与你在导航面板中手动进行的更改相同。它还可以直接更新 `docs.json` 配置,包括添加新组、调整设置和配置重定向。
示例:`add a "Quickstart" group under the Getting Started tab and move the quickstart page into it`
<div id="run-bash-commands">
### 运行 bash 命令
</div>
代理可以对你的仓库运行 `grep`、`rg` 和其他 bash 命令。可用于跨多个文件的批量操作。
示例:`find every page that mentions the deprecated /v1/auth endpoint`
<div id="configure-your-site-code-mode">
### 配置你的站点 (code mode)
</div>
对于超出页面编辑范围的请求 (例如设置身份验证、管理工作流或更改部署设置),代理会切换到 code mode。它会代你编写并对 Mintlify 控制台运行脚本。
Code mode 会遵循你在控制台中的权限。如果你在控制台中无权访问某项设置,代理也无法更改它。
会使用 code mode 的示例提示词:
- `enable JWT authentication for my site`
- `create a workflow that updates my site when I merge a PR`
- `add a custom domain`
<div id="continue-an-automation-run">
### 继续自动化运行
</div>
当你通过点击 **View changes** 从已完成的自动化运行中打开编辑器时,代理面板会自动打开,并带有关于该自动化所执行操作的上下文。聊天顶部会显示一张 **Changed pages** 卡片,列出该自动化修改的每个页面——点击任意页面可打开差异视图。
代理拥有该自动化提示词、所做更改的摘要以及它修改的页面的上下文。你可以让它细化或扩展该自动化的工作,无需再次说明背景。
例如:`The new section on rate limits is too long. Trim it to three sentences.`
<div id="session-history">
## 会话历史
</div>
点击面板标题栏中的时钟图标,可查看你之前的聊天会话。点击任意会话可重新打开它,并查看代理的更改。
<div id="ai-instructions">
## AI 指令
</div>
要为代理提供持久性指引 (例如语气规则、术语或格式约定),请在[编辑器设置](/zh/editor/settings#ai-instructions)中配置 AI 指令。代理会在每次请求时遵循这些指令,无需你重复说明。