获取回答引用文档
获取回答引用文档
根据入参的message_id,获取该条消息 Agent 回复时所引用的文档数据,包括引用的文档ID、名称和来源 URL等信息。
请求方式
POST
调用地址
https://api-${endpoint}.gptbots.ai/v1/bot/data/references
调用验证
详情参见 API 概述的鉴权方式说明。
请求
请求示例
curl -X POST 'https://api-${endpoint}.gptbots.ai/v1/bot/data/references' \
-H 'Authorization: Bearer ${API Key}' \
-H 'Content-Type: application/json' \
-d '{
"message_id": "xxxxx"
}'
curl -X POST 'https://api-${endpoint}.gptbots.ai/v1/bot/data/references' \
-H 'Authorization: Bearer ${API Key}' \
-H 'Content-Type: application/json' \
-d '{
"message_id": "xxxxx"
}'
此代码块在浮窗中显示
请求头
| 字段 | 类型 | 描述 |
|---|---|---|
| Authorization | Bearer ${token} | 使用Authorization: Bearer ${token}进行调用验证,请在 API 密钥页面获取密钥作为token。 |
| Content-Type | application/json | 数据类型,取值为application/json。 |
请求体
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
| message_id | string | true | Agent 回复的消息 ID。 |
响应
响应示例
{
"code": 0,
"msg": "success",
"data": {
"conversationId": "65dc320df07244300b25b993",
"questionId": "65dc323ef07244300b25b9c5",
"answerId": "65dc323ef07244300b25b9c6",
"refDoc": [
{
"dataId": "65dc3234f07244300b25b9b9",
"dataName": "中国的历史",
"sourceUrl": "https://www.example.com/chinese-history"
}
]
}
}
{
"code": 0,
"msg": "success",
"data": {
"conversationId": "65dc320df07244300b25b993",
"questionId": "65dc323ef07244300b25b9c5",
"answerId": "65dc323ef07244300b25b9c6",
"refDoc": [
{
"dataId": "65dc3234f07244300b25b9b9",
"dataName": "中国的历史",
"sourceUrl": "https://www.example.com/chinese-history"
}
]
}
}
此代码块在浮窗中显示
成功响应
| 字段 | 类型 | 描述 |
|---|---|---|
| conversationId | string | 会话 ID |
| questionId | string | 问题 ID |
| answerId | string | Agent 回答 ID |
| refDoc | JSON Array | 引用的文档数据 |
| dataId | string | 文档 ID |
| dataName | string | 文档名称 |
| sourceUrl | string | 文档来源 URL |
失败响应
| 字段 | 类型 | 描述 |
|---|---|---|
| code | int | 错误码。 |
| msg | string | 错误详情。 |
错误码
| Code | Message |
|---|---|
| 40000 | 参数错误 |
| 40379 | 积分不足 |
| 40378 | Agent 已删除 |
| 20055 | 禁止使用 API 功能 |
| 40127 | 开发者鉴权失败 |
