> 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/fa-bu/embedding/configuration/customizing-docs-embed.md).

# 自定义嵌入

通过设置欢迎消息、操作等，自定义将 Docs Embed 嵌入到你的产品或应用中的体验

之后 [将 Docs Embed 添加到您的网站或应用后](/docs/documentation/zh/fa-bu/embedding/implementation.md)，您可以通过向侧边栏添加可执行按钮、通过上下文问题、标签页等方式向用户提供建议，进一步自定义体验。

### 自定义按钮（[独立](/docs/documentation/zh/fa-bu/embedding/implementation/script.md) 仅）

当使用 [独立 script 标签实现](/docs/documentation/zh/fa-bu/embedding/implementation/script.md)时，您可以自定义启动嵌入组件的按钮标签和图标。

{% hint style="info" %}
此按钮自定义选项仅在使用 [独立 script 标签实现](/docs/documentation/zh/fa-bu/embedding/implementation/script.md)。对于 [React](/docs/documentation/zh/fa-bu/embedding/implementation/react.md) 或 [Node.js/NPM 包](/docs/documentation/zh/fa-bu/embedding/implementation/nodejs.md) 实现，您需要创建自己的按钮来启动嵌入。
{% endhint %}

```javascript
window.GitBook("configure", {
  button: {
    标签："询问"，
    图标："assistant"，// 'assistant' | 'sparkle' | 'help' | 'book'
  },
});
```

**可用图标选项：**

* `助手` - <i class="fa-gitbook-assistant">:gitbook-assistant:</i> 助手图标（默认）
* `闪光` - <i class="fa-sparkle">:sparkle:</i> 闪光图标
* `帮助` - <i class="fa-circle-question">:circle-question:</i> 帮助/问号图标
* `书本` - <i class="fa-book-open">:book-open:</i> 书本图标

### 设置颜色方案

默认情况下，嵌入内容会遵循 iframe 的 CSS `color-scheme`。这可以让它自动匹配您的应用主题或浏览器偏好。

如果您想强制使用某种模式，请传入 `colorScheme` 在初始化嵌入、构建 frame URL 或渲染 React 组件时。这不属于 `configure`.

{% tabs %}
{% tab title="独立 script" %}

```javascript
window.GitBook(
  "init"，
  { siteURL: "https://docs.company.com" }，
  { colorScheme: "dark" }
);
```

{% endtab %}

{% tab title="Node.js/NPM" %}

```javascript
const iframeURL = gitbook.getFrameURL({
  colorScheme: "dark"，
});
```

{% endtab %}

{% tab title="React" %}

```jsx
<GitBookFrame colorScheme="dark" />
```

{% endtab %}
{% endtabs %}

### 添加操作

向嵌入中添加操作，可让您在界面中为用户提供额外操作。每个操作包括一个标签、一个图标（来自 [Font Awesome](https://fontawesome.com/search?ip=brands%2Cclassic%2Cduotone)），以及一个 `onClick` 当用户点击该操作时执行的动作。您添加的任何操作都会与标签页一起显示在侧边栏中。操作可以控制 Docs Embed 本身，也可以执行您想要的任何代码。

```javascript
window.GitBook("configure", {
  actions: [
    {
      标签："联系支持"，
      图标："circle-question"，
      onClick: () => {
        window.open("https://support.example.com", "_blank");
      },
    },
    {
      标签："文档"，
      图标："book"，
      onClick: () => {
        window.open("https://docs.example.com", "_blank");
      },
    },
  ],
});
```

### 添加建议

您可以向 Assistant 标签页添加建议，这些建议会在 Assistant 加载时显示为可点击的提示，供用户使用。

```javascript
window.GitBook("configure", {
  suggestions: [
    "帮我开始使用我的新账户"，
    "如何重置我的密码？"，
    "你们有哪些定价方案？"，
  ],
});
```

### 添加问候语

自定义显示在 Assistant 标签页中的欢迎消息：

```javascript
window.GitBook("configure", {
  greeting: {
    标题："欢迎！"，
    副标题："今天我能如何帮助您？"，
  },
});
```

### 覆盖助手名称

使用 `assistantName` 以覆盖界面中显示的助手名称。

该值最多可包含 32 个字符。

```javascript
window.GitBook("configure", {
  assistantName: "Support Copilot"，
});
```

### 显示关闭按钮

使用 `closeButton` 以在 Assistant 内显示关闭按钮。

```javascript
window.GitBook("configure", {
  closeButton: true,
});
```

### 显示或隐藏商标

使用 `商标` 以在嵌入界面中显示或隐藏 GitBook 商标——包括 Docs Embed 页脚和 Assistant 品牌标识。

```javascript
window.GitBook("configure", {
  trademark: false,
});
```

### 配置标签页

覆盖要显示的标签页。默认情况下，只要您的站点支持，所有标签页都会启用。例如，如果您的站点未启用 Assistant，它将不会显示。如果您设置 `tabs`，嵌入内容将只显示你列出的标签页。

```javascript
window.GitBook("configure", {
  tabs: ["assistant", "search", "docs"], // 显示所有标签页
  // tabs: ["search", "docs"], // 仅显示搜索和文档
  // tabs: ['docs'], // 仅显示文档标签页
});
```


---

# 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/fa-bu/embedding/configuration/customizing-docs-embed.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.
