> For the complete documentation index, see [llms.txt](https://gitbook.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.com/docs/documentation/zh/ai-yu-sou-suo/gitbook-ai-assistant.md).

# GitBook Assistant

{% hint style="info" %}
此功能可在 [终极站点方案](https://www.gitbook.com/pricing).
{% endhint %}

<figure><img src="/files/f2eaadca01442634ca10c2075094311ffd26de3c" alt="GitBook Assistant"><figcaption><p>GitBook 助手</p></figcaption></figure>

GitBook 助手使用自然语言为你的用户提供关于你文档的快速、准确答案。它会根据你的用户进行个性化定制，可嵌入到你的网站或产品中，并可在你已发布文档的侧边栏中使用。

可以把它看作一位面向所有用户的产品专家，随时出现在他们最需要的地方和时间。

助手使用代理式检索，根据用户当前页面、之前阅读的页面以及之前的对话来理解查询的上下文。

试着在下面的框中向助手提问：

<p align="center"><button type="button" class="button primary" data-action="ask" data-icon="gitbook-assistant">提一个问题…</button></p>

## 启用 GitBook 助手 <a href="#how-do-i-use-gitbook-ai" id="how-do-i-use-gitbook-ai"></a>

要启用 GitBook 助手，请打开 **自定义**，在……下 **工具** 在网站侧边栏中，然后点击 **AI 助手**。你可以在这里从可用选项中启用 GitBook 助手。

### 添加建议问题

建议问题是在助手打开且没有活动对话时显示的预设提示。它们可帮助用户理解可以提问什么，也可以帮助你引导用户找到有用的答案或工作流程。

你可以在你网站的 **设置**下的 **AI 与 MCP** 部分中添加建议问题。

#### **建议问题的最佳实践：**

* 从真实的用户目标开始（设置、排障、集成）。
* 使用你的用户会用的词汇（避免内部代号）。
* 保持具体。“我该如何……？”比“告诉我关于……”更好。
* 覆盖不同意图：快速开始、操作指南、故障排查和参考。

{% hint style="info" %}
如果你要把助手嵌入到产品中，也可以在嵌入配置中动态设置建议。参见 [自定义嵌入](/docs/documentation/zh/docs-site/embedding/configuration/customizing-docs-embed.md#adding-suggestions).
{% endhint %}

## 在已发布文档中使用 GitBook 助手 <a href="#how-do-i-use-gitbook-ai" id="how-do-i-use-gitbook-ai"></a>

用户可以通过三种方式访问 GitBook 助手：

* 按 <kbd>⌘</kbd> + <kbd>I</kbd> （Mac 上）或 <kbd>Ctrl</kbd> + <kbd>I</kbd> （PC 上）
* 点击 **GitBook 助手** <picture><source srcset="/files/KOSE771IpEtAlfLNdKX1" media="(prefers-color-scheme: dark)"><img src="/files/464645f54a431f4fb9d7878d3281e325f2e2f741" alt=""></picture> 按钮，位于 **提问或搜索…** 栏旁边
* 在 **提问或搜索…** 栏中输入问题，并在菜单顶部选择“提问…”选项

## 将 GitBook 助手嵌入到你的产品中

你可以将 GitBook 助手直接嵌入到你的产品或网站中，让用户无需离开应用即可立即获得 AI 驱动的帮助。助手可以作为 [文档嵌入](/docs/documentation/zh/docs-site/embedding.md)的一部分进行嵌入，其中包含用于 AI 聊天的助手标签页、用于范围化发现的搜索标签页，以及用于浏览文档的文档标签页。

请选择适合你技术栈的嵌入方式：

* [**独立脚本标签**](/docs/documentation/zh/docs-site/embedding/implementation/script.md) – 使用 `<script>` 标签快速设置
* [**Node.js/NPM**](/docs/documentation/zh/docs-site/embedding/implementation/nodejs.md) – 服务端或构建时集成
* [**React 组件**](/docs/documentation/zh/docs-site/embedding/implementation/react.md) – 预构建的 React 组件

### 其他助手嵌入指南：

* [在经过身份验证的文档中使用嵌入式助手](/docs/documentation/zh/docs-site/embedding/using-with-authenticated-docs.md) – 如果你的文档需要登录，这是必需的
* [自定义助手嵌入](/docs/documentation/zh/docs-site/embedding/configuration/customizing-docs-embed.md) – 欢迎消息、操作和建议
* [创建自定义嵌入工具](/docs/documentation/zh/docs-site/embedding/configuration/creating-custom-tools.md) – 将助手连接到你的 API
* [API 参考](/docs/documentation/zh/docs-site/embedding/configuration/reference.md) – 所有可用的方法和事件

## 扩展 GitBook 助手的知识

GitBook 助手可以通过以下方式使用外部知识： [连接](/docs/documentation/zh/ai-yu-sou-suo/connections.md) 和 [MCP 服务器](/docs/documentation/zh/ai-yu-sou-suo/mcp-servers-for-published-docs.md).

当你希望 GitBook 将记录同步到你的网站中时，可以使用连接；当你希望将 GitBook 助手连接到自定义工具时，可以使用 MCP 服务器。

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th>最适合</th></tr></thead><tbody><tr><td><strong>连接</strong></td><td><p>连接最适合内容量较大的来源：</p><ul><li>GitHub 问题和讨论</li><li>Slack 或 Discord 对话</li><li>支持内容</li><li>外部文档、帮助中心和网站</li></ul></td></tr><tr><td><strong>MCP 服务器</strong></td><td><p>MCP 服务器最适合实时工具和数据：</p><ul><li>当前账户或产品状态</li><li>经常变更的内部系统</li><li>创建工单或提交错误报告等操作</li><li>你不想同步到 GitBook 的来源</li></ul></td></tr></tbody></table>

{% tabs %}
{% tab title="添加连接" %}
{% stepper %}
{% step %}
**打开你网站的设置**

打开你的网站控制面板。然后选择 **设置** → **连接**.
{% endstep %}

{% step %}
**连接来源**

选择一个来源类型。然后对其进行授权，或输入要导入的 URL。
{% endstep %}

{% step %}
**向 GitBook 助手公开记录**

开启 **在搜索/助手中公开** 为该连接。

然后 GitBook 就可以在搜索和 GitBook 助手中使用这些记录。
{% endstep %}
{% endstepper %}
{% endtab %}

{% tab title="添加 MCP 服务器" %}
{% stepper %}
{% step %}
**打开你网站的设置**

打开你的网站控制面板。然后选择 **设置** → **AI 与 MCP**.
{% endstep %}

{% step %}
**添加新服务器**

在 MCP 服务器表格中，点击 **添加 MCP 服务器**.
{% endstep %}

{% step %}
**输入服务器详细信息**

为服务器命名。添加其 URL。

然后配置 GitBook 必须随每个请求发送的任何 HTTP 标头。
{% endstep %}
{% endstepper %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://gitbook.com/docs/documentation/zh/ai-yu-sou-suo/gitbook-ai-assistant.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
