獲取對話列表
獲取對話列表
根據指定的篩選條件,檢索代理的所有對話資訊,包括 conversation_id、user_id、最近聊天時間、對話主題、對話類型、總訊息數量,以及點數消耗。
請求方法
GET
請求 URL
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 金鑰頁取得。 |
請求參數
| 欄位 | 類型 | 必填 | 描述 |
|---|---|---|---|
| conversation_type | string | 是 | 對話類型的來源。可設為:ALL、API、EMBED 及其他來源類型。 |
| user_id | string | 否 | 使用者 ID。若未填寫,則無限制。 |
| start_time | long | 是 | 最近對話的開始時間,需使用時間戳格式。 |
| end_time | long | 是 | 最近對話的結束時間,需使用時間戳格式。 |
| page | int | 是 | 頁碼,表示請求的頁數,從第 1 頁開始。 |
| page_size | int | 是 | 每頁的資料筆數,範圍 1-100。 |
注意:關於
conversation_type的可能值,請參考 使用者概述 表格中的 Conversation 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 陣列 | 對話列表。 |
| 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 | 代理 ID。 |
| total | int | 返回的對話數量。 |
錯誤回應
| 欄位 | 類型 | 描述 |
|---|---|---|
| code | int | 錯誤代碼。 |
| message | string | 錯誤詳情。 |
錯誤代碼
| 代碼 | 訊息 |
|---|---|
| 40000 | 無效的參數 |
| 20059 | 代理已刪除 |
