获取元数据字段列表
获取元数据字段列表
查询 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。 |
请求参数
无请求参数。Agent 由 API Key 解析。
响应
响应示例
{
"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 | 错误详情。 |
