取得元資料欄位清單
取得元資料欄位清單
查詢 Agent 下的元資料欄位定義,分組傳回全域欄位及各知識庫的專屬欄位。系統預設欄位(如 document_name)不會回傳。
請求方式
GET
呼叫位址
https://api-${endpoint}.gptbots.ai/v1/bot/doc/metadata/field/list
呼叫驗證
鑒權方式請參閱 API 總覽。
請求
請求範例
curl -X GET 'https://api-${endpoint}.gptbots.ai/v1/bot/doc/metadata/field/list' \
-H 'Authorization: Bearer ${API Key}'
curl -X GET 'https://api-${endpoint}.gptbots.ai/v1/bot/doc/metadata/field/list' \
-H 'Authorization: Bearer ${API Key}'
此代碼塊在浮窗中顯示
請求標頭
| 欄位 | 類型 | 描述 |
|---|---|---|
| Authorization | Bearer ${API Key} | 使用 Authorization: Bearer ${API Key} 進行驗證。請前往 API 金鑰頁面取得 API Key。 |
請求參數
無請求參數。系統會透過 API Key 識別 Agent。
回應
回應範例
{
"global_fields": [
{
"id": "665f1c8a9b2e4d001a3f0001",
"name": "category",
"display_name": "分類",
"type": "LIST",
"options": ["技術", "產品"],
"description": "文件分類",
"ai_search_filter": true,
"is_predefined": false
}
],
"knowledge_bases": [
{
"knowledge_base_id": "kb_001",
"knowledge_base_name": "產品文件庫",
"fields": [
{
"id": "665f1c8a9b2e4d001a3f0009",
"name": "product_line",
"display_name": "產品線",
"type": "STRING",
"options": null,
"description": "",
"ai_search_filter": false,
"is_predefined": false
}
]
},
{
"knowledge_base_id": "kb_002",
"knowledge_base_name": "售後 FAQ 庫",
"fields": []
}
]
}
{
"global_fields": [
{
"id": "665f1c8a9b2e4d001a3f0001",
"name": "category",
"display_name": "分類",
"type": "LIST",
"options": ["技術", "產品"],
"description": "文件分類",
"ai_search_filter": true,
"is_predefined": false
}
],
"knowledge_bases": [
{
"knowledge_base_id": "kb_001",
"knowledge_base_name": "產品文件庫",
"fields": [
{
"id": "665f1c8a9b2e4d001a3f0009",
"name": "product_line",
"display_name": "產品線",
"type": "STRING",
"options": null,
"description": "",
"ai_search_filter": false,
"is_predefined": false
}
]
},
{
"knowledge_base_id": "kb_002",
"knowledge_base_name": "售後 FAQ 庫",
"fields": []
}
]
}
此代碼塊在浮窗中顯示
成功回應
| 欄位 | 類型 | 說明 |
|---|---|---|
| global_fields | Array<Object> | 對 Agent 下所有文件生效的全域欄位。 |
| id | String | 欄位 ID,編輯/刪除時使用。 |
| name | String | 欄位內部識別碼,使用小寫且必須唯一。 |
| display_name | String | 欄位展示名,唯一。 |
| type | String | 欄位類型:STRING / NUMBER / DATETIME / LIST。 |
| options | Array<String> | LIST 型別的枚舉選項,其它類型為 null。 |
| description | String | 欄位說明。 |
| ai_search_filter | Boolean | 是否為 AI Search 篩選欄位。 |
| is_predefined | Boolean | 是否為系統預設欄位。 |
| knowledge_bases | Array<Object> | 各知識庫及其專屬欄位。 |
| knowledge_base_id | String | 知識庫 ID。 |
| knowledge_base_name | String | 知識庫名稱。 |
| fields | Array<Object> | 此知識庫的專屬欄位,結構同全域欄位。 |
失敗回應
| 欄位 | 類型 | 描述 |
|---|---|---|
| code | Integer | 錯誤碼。 |
| message | String | 錯誤詳情。 |
