获取对话列表
获取对话列表
获取指定筛选条件范围内,Agent 所有对话的 conversation_id
、user_id
、最近对话时间、对话主题、对话类型、对话内的消息总数、消耗积分数等信息。
请求方式
GET
调用地址
https://api-${endpoint}.gptbots.ai/v1/bot/conversation/page
调用验证
详情参见 API 概述的鉴权方式说明。
请求
请求示例
curl -X GET 'https://api-${endpoint}.gptbots.ai/v1/bot/conversation/page?page=1&conversation_type=API&start_time=1691942400000&end_time=1699868066999&page_size=50&user_id=1234567890' \
-H 'Authorization: Bearer ${API Key}'
curl -X GET 'https://api-${endpoint}.gptbots.ai/v1/bot/conversation/page?page=1&conversation_type=API&start_time=1691942400000&end_time=1699868066999&page_size=50&user_id=1234567890' \
-H 'Authorization: Bearer ${API Key}'
此代码块在浮窗中显示
请求头
字段 | 类型 | 描述 |
---|---|---|
Authorization | Bearer ${API Key} | 使用Authorization: Bearer ${API Key} 进行调用验证,请在 API 密钥页面获取密钥作为API Key 。 |
请求参数
字段 | 类型 | 必填 | 描述 |
---|---|---|---|
conversation_type | string | 是 | 对话ID来源类型,可设置为:ALL 、API 、EMBED 等多个来源类型。 |
user_id | string | 否 | User ID。若不填写,则视为不限制。 |
start_time | long | 是 | 最近对话时间(开始),时间戳。 |
end_time | long | 是 | 最近对话时间(结束),时间戳。 |
page | int | 是 | 页码数,即需要请求第几页,从 1 开始。 |
page_size | int | 是 | 每页的数据量,范围 1-100。 |
注意:conversation_type 的取值详见用户概述的表格中的对话ID(conversation_id)来源字段值列表。
响应
响应示例
{
"list": [
{
"conversation_id": "AaACmo05Yrqb6bOSTbsg",
"user_id": "3",
"recent_chat_time": 1694572952383,
"subject": "2+3=?",
"conversation_type": "API",
"message_count": 2,
"cost_credit": 0.01,
"bot_id": "64b902a84f1ff25d1c60c10b"
},
{
"conversation_id": "64ec1508c9c1ed5605e6ff28",
"user_id": "33",
"recent_chat_time": 1693194862160,
"subject": "Hello!",
"conversation_type": "API",
"message_count": 20,
"cost_credit": 0.59,
"bot_id": "64b902a84f1ff25d1c60c10b"
}
],
"total": 2
}
{
"list": [
{
"conversation_id": "AaACmo05Yrqb6bOSTbsg",
"user_id": "3",
"recent_chat_time": 1694572952383,
"subject": "2+3=?",
"conversation_type": "API",
"message_count": 2,
"cost_credit": 0.01,
"bot_id": "64b902a84f1ff25d1c60c10b"
},
{
"conversation_id": "64ec1508c9c1ed5605e6ff28",
"user_id": "33",
"recent_chat_time": 1693194862160,
"subject": "Hello!",
"conversation_type": "API",
"message_count": 20,
"cost_credit": 0.59,
"bot_id": "64b902a84f1ff25d1c60c10b"
}
],
"total": 2
}
此代码块在浮窗中显示
成功响应
字段 | 类型 | 描述 |
---|---|---|
list | JSON Array | 对话列表。 |
conversation_id | string | 对话 ID。 |
user_id | string | 用户 ID。 |
recent_chat_time | long | 最近对话时间。 |
subject | string | 对话主题。 |
conversation_type | string | 对话类型。 |
message_count | int | 对话内的消息总数。 |
cost_credit | float | 对话的消耗积分数。 |
bot_id | string | Agent ID。 |
total | int | 返回的对话数。 |
失败响应
字段 | 类型 | 描述 |
---|---|---|
code | int | 错误码 |
message | string | 错误详情 |
错误码
Code | Message |
---|---|
40000 | 参数错误 |
20059 | Agent 已删除 |