# 知識庫總覽

## 知識庫是什麼？ <a href="#what-is-knowledge-base" id="what-is-knowledge-base"></a>

AI 助理建立完成後，接下來要設定的就是**知識庫**，也就是 AI 助理回答問題時的資料來源。

知識庫的運作方式：

<figure><img src="/files/N3vy48KzRBMOtY7ozYa4" alt=""><figcaption><p>知識庫運作示意圖</p></figcaption></figure>

可以把知識庫想像成開書考試（Open Book），AI 助理會從知識庫中找出與問題最相關的內容，作為回答時的依據。

雖然知識庫可放置大量資料，但仍建議上傳與助理任務高度相關的內容。若不相關，根據目前的檢索技術，仍然可能會造成找到不相關的資訊當作回答上下文，導致回答不準確的情形。

## 知識庫可以做什麼？ <a href="#what-can-knowledge-base-do" id="what-can-knowledge-base-do"></a>

藉由知識庫的以下功能，您可以：

### 📋 **標籤管理文件** <a href="#tag-document-management" id="tag-document-management"></a>

您可以為每個文件加入多個標籤，建立系統化的分類架構

* **範例**：為「帳篷手冊」加上 `#帳篷 #新手 #搭建教學` 標籤

### 🔐 **選擇性開放文件權限** <a href="#selective-document-permissions" id="selective-document-permissions"></a>

您可以根據用戶身份設定不同的文件存取權限，實現差異化服務

* **範例**：產品價格表僅在 VIP 會員對話中開放，成本資料僅在內部對話中開放

### ❓ **建立 FAQ** <a href="#create-faq" id="create-faq"></a>

您可以將常見問題整理成標準問答集，確保回覆一致性、完整性

* **範例**：「帳篷保固幾年？」→ 標準答案：「我們提供3年保固服務」

### 📊 **傳入文件的 Metadata** <a href="#document-metadata-input" id="document-metadata-input"></a>

您可以為文件加入版本、更新日期、適用範圍等詳細資訊，方便未來維護文件

* **範例**：文件版本 v2.1、更新日期 2024/11/28、適用產品「山岳系列帳篷」

### 🔍 **搜尋測試** <a href="#search-testing" id="search-testing"></a>

您可以測試不同問題的檢索結果，驗證 AI 是否找到正確的資料片段

* **範例**：輸入「帳篷搭建步驟」→ 檢查 AI 是否找到正確的搭建教學片段

## 如何上傳知識庫？ <a href="#how-to-upload-knowledge-base" id="how-to-upload-knowledge-base"></a>

1. 進入左側功能欄 「<mark style="color:blue;">AI 功能</mark>」 中的 「<mark style="color:blue;">AI 助理</mark>」 ，選擇要為哪個 AI 助理建立知識庫，點選右方的 「<mark style="color:blue;">操作</mark>」 圖示。

<figure><img src="/files/mwnvzZEufs5zw87eP8ei" alt=""><figcaption></figcaption></figure>

2. 進入左側功能欄 「<mark style="color:blue;">AI 功能 > AI 助理 > 知識庫」</mark>，點選右上方的 「<mark style="color:blue;">上傳檔案</mark>」 藍色按鈕，上傳您想讓 AI 助理知道的資料

{% hint style="info" %}

* 根據不同的方案會提供不同大小的知識庫容量
* 如果您的檔案較大或資料量較多，上傳後系統可能需要一些時間處理。
  {% endhint %}

<figure><img src="/files/XcyDPjv6AoM6suTXMb0N" alt=""><figcaption></figcaption></figure>

您可於 「<mark style="color:blue;">處理狀況</mark>」 欄位中檢視處理進度。

<figure><img src="/files/3QWTzcnZ1AbFKWy3Fbos" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
目前知識庫支援的檔案類型：

* 試算表文件：`.xls, .xlsx, .csv, .ods`
* 文書處理文件：`.doc, .docx, .odt, .pdf, .md, .txt`
* 簡報文件：`.ppt, .pptx, .odp`
* 網頁文件：`.html, .htm`
* 資料格式：`.json, .jsonl`
* 音訊文件：`.wav, .mp3`
  {% endhint %}

### 查看資料 <a href="#view-data" id="view-data"></a>

#### 資料片段說明 <a href="#chunk-description" id="chunk-description"></a>

當資料上傳至知識庫時，資料會被分為片段，這麼做有以下好處：

* **提升檢索精確度**：小片段更精確匹配查詢，避免無關內容干擾
* **優化回應速度**：處理更快，減少計算資源消耗
* **增強內容相關性**：每個片段聚焦單一主題，提高針對性
* **便於維護管理**：易於更新、追蹤和品質控制
* **符合 AI 模型限制**：避免超出輸入長度，確保資訊完整性

#### 編輯、查看片段內容 <a href="#edit-view-chunk-content" id="edit-view-chunk-content"></a>

您可以查看您的文件分段內容：

1. 進入知識庫的文件頁面，點按「<mark style="color:blue;">編輯</mark>」
2. 查看分段內容，點擊要查看的片段

畫面會以 Markdown 格式顯示此片段的完整內容。

<div><figure><img src="/files/YqpBav9CAaEYrwAm8ZaP" alt=""><figcaption></figcaption></figure> <figure><img src="/files/S8qemJu09BE4xuJPCeAB" alt=""><figcaption></figcaption></figure></div>

#### 編輯原始文件 <a href="#edit-source-document" id="edit-source-document"></a>

1. 在編輯頁面點擊「<mark style="color:blue;">檢視文件</mark>」

<figure><img src="/files/aDbOdjOrP0TSZsXw0LF0" alt=""><figcaption></figcaption></figure>

2. 進入編輯頁面，文字框中會顯示該文件的 Markdown 格式

可在文字框中編輯您的原始文件，所有檔案格式都可以依此方法編輯。完成後按下「<mark style="color:blue;">儲存</mark>」即可保存您的編輯結果。

<div><figure><img src="/files/na6fVfjiLc2UXVN7UQ5f" alt=""><figcaption></figcaption></figure> <figure><img src="/files/na6fVfjiLc2UXVN7UQ5f" alt=""><figcaption></figcaption></figure></div>

{% hint style="info" %}
**資料管理提醒**

* 建議在編輯前先備份重要內容
* 編輯原始文件後，系統會重新進行片段分割
  {% endhint %}


---

# Agent Instructions: 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:

```
GET https://docs.maiagent.ai/km/km.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
