查詢 LogTree
查詢 LogTree
可透過此介面,根據訊息 ID 查詢對應的 LogTree 鏈路資料。
請求方法
GET
端點
https://api-${endpoint}.gptbots.ai/v1/bot/logtree/query
認證
請參考 API 概述 了解認證指引。
請求
範例請求
curl -X GET 'https://api-${endpoint}.gptbots.ai/v1/bot/logtree/query?msgid=6a475fa11d276b3d062a1be8' \
-H 'Authorization: Bearer ${API Key}'
curl -X GET 'https://api-${endpoint}.gptbots.ai/v1/bot/logtree/query?msgid=6a475fa11d276b3d062a1be8' \
-H 'Authorization: Bearer ${API Key}'
此代碼塊在浮窗中顯示
請求標頭
| 欄位 | 類型 | 說明 |
|---|---|---|
| Authorization | Bearer ${API Key} | 使用 Authorization: Bearer ${API Key} 進行驗證。API Key 可在 API Key 頁面取得。 |
請求參數
| 欄位 | 類型 | 必填 | 說明 |
|---|---|---|---|
| msgid | String | 是 | 訊息 ID,通常為對話介面回傳的 message_id。 |
回應
範例回應
{
"treeData": [
{
"children": null,
"actionId": "START_001",
"traceId": "lyyqYMnfFSW5vWF5qdj5lR0t0DpjQR3icJi1lxm2CvUWpW8oI1-1783062433496",
"msgId": "6a475fa11d276b3d062a1be8",
"botId": "664ed07a277ef442b132feba",
"logComponentId": "1lwSWOnjxuQK",
"logComponentName": "Start",
"logComponentTitle": null,
"logComponentType": "Start",
"isComponent": true,
"actionType": "Start",
"actionName": "Start",
"startTimestampMillis": 1783062433496,
"endTimestampMillis": 1783062433654,
"runningStatus": "SUCCESS",
"latencyMillis": 0,
"input": {
"content": [
{
"type": "Text",
"text": "1+1=?"
}
]
},
"output": {
"content": [
{
"type": "Text",
"text": "1+1=?"
}
]
},
"inputTokens": 0,
"outputTokens": 0,
"totalTokens": "0",
"extension": "{}",
"createTime": 1783062433679,
"uuid": "e53dcbb9-07d1-4019-9b66-e9d32b28bcbf",
"workflowExecutionId": "",
"parentId": "1lwSWOnjxuQK"
}
],
"summary": {
"runningStatus": "SUCCESS",
"botId": "664ed07a277ef442b132feba",
"startTimestampMillis": 1783062433498,
"endTimestampMillis": 1783062434933,
"totalLatencyMillis": 1437,
"totalTokens": 34,
"stepCount": 3,
"credit": -0.0031
},
"msgId": "6a475fa11d276b3d062a1be8",
"conversationId": "6a475fa11d276b3d062a1be5",
"traceId": "lyyqYMnfFSW5vWF5qdj5lR0t0DpjQR3icJi1lxm2CvUWpW8oI1-1783062433496"
}
{
"treeData": [
{
"children": null,
"actionId": "START_001",
"traceId": "lyyqYMnfFSW5vWF5qdj5lR0t0DpjQR3icJi1lxm2CvUWpW8oI1-1783062433496",
"msgId": "6a475fa11d276b3d062a1be8",
"botId": "664ed07a277ef442b132feba",
"logComponentId": "1lwSWOnjxuQK",
"logComponentName": "Start",
"logComponentTitle": null,
"logComponentType": "Start",
"isComponent": true,
"actionType": "Start",
"actionName": "Start",
"startTimestampMillis": 1783062433496,
"endTimestampMillis": 1783062433654,
"runningStatus": "SUCCESS",
"latencyMillis": 0,
"input": {
"content": [
{
"type": "Text",
"text": "1+1=?"
}
]
},
"output": {
"content": [
{
"type": "Text",
"text": "1+1=?"
}
]
},
"inputTokens": 0,
"outputTokens": 0,
"totalTokens": "0",
"extension": "{}",
"createTime": 1783062433679,
"uuid": "e53dcbb9-07d1-4019-9b66-e9d32b28bcbf",
"workflowExecutionId": "",
"parentId": "1lwSWOnjxuQK"
}
],
"summary": {
"runningStatus": "SUCCESS",
"botId": "664ed07a277ef442b132feba",
"startTimestampMillis": 1783062433498,
"endTimestampMillis": 1783062434933,
"totalLatencyMillis": 1437,
"totalTokens": 34,
"stepCount": 3,
"credit": -0.0031
},
"msgId": "6a475fa11d276b3d062a1be8",
"conversationId": "6a475fa11d276b3d062a1be5",
"traceId": "lyyqYMnfFSW5vWF5qdj5lR0t0DpjQR3icJi1lxm2CvUWpW8oI1-1783062433496"
}
此代碼塊在浮窗中顯示
成功回應
| 欄位 | 類型 | 說明 |
|---|---|---|
| treeData | Array<Object> | LogTree 節點列表,節點參數詳見下表。無鏈路資料時可能為 null。 |
| summary | Object | 訊息層級彙總資訊。無鏈路資料時可能為 null。 |
| runningStatus | String | 整體執行狀態,例如 SUCCESS、FAILED、RUNNING。 |
| botId | String | Agent ID。 |
| startTimestampMillis | Long | 開始時間戳,單位毫秒。 |
| endTimestampMillis | Long | 結束時間戳,單位毫秒。 |
| totalLatencyMillis | Long | 總耗時,單位毫秒。 |
| totalTokens | Long | 總 Token 數。 |
| stepCount | Integer | 步數,由回傳的 LogTree 節點數量推導。 |
| credit | Number | 消耗點數。目前無點數資料時可能為 null。 |
| msgId | String | 訊息 ID。 |
| conversationId | String | 對話 ID。 |
| traceId | String | 鏈路 ID。 |
treeData 節點參數
| 欄位 | 類型 | 說明 |
|---|---|---|
| children | Array<Object> | 子節點,結構與本表一致。葉節點可能回傳 null。 |
| actionId | String | Action ID。 |
| traceId | String | 鏈路 ID。 |
| msgId | String | 訊息 ID。 |
| botId | String | Agent ID。 |
| logComponentId | String | 元件 ID。 |
| logComponentName | String | 元件名稱。 |
| logComponentTitle | String | 元件標題。 |
| logComponentType | String | 元件類型。 |
| isComponent | Boolean | 是否為元件節點。 |
| actionType | String | Action 類型。 |
| actionName | String | Action 名稱。 |
| runningStatus | String | 節點執行狀態。 |
| startTimestampMillis | Long | 節點開始時間戳,單位毫秒。 |
| endTimestampMillis | Long | 節點結束時間戳,單位毫秒。 |
| latencyMillis | Long | 節點耗時,單位毫秒。 |
| input | Object/String/Array | 節點輸入。 |
| output | Object/String/Array | 節點輸出。 |
| inputTokens | Integer | 輸入 Token 數。 |
| outputTokens | Integer | 輸出 Token 數。 |
| totalTokens | Integer/String | 總 Token 數,沿用現有 LogTree 回傳類型。 |
| extension | String/Object | 擴充資訊。 |
| createTime | Long | 建立時間戳,單位毫秒。 |
| uuid | String | 節點唯一識別碼。 |
| workflowExecutionId | String | Workflow 執行 ID。 |
| parentId | String | 父節點 ID。 |
錯誤回應
| 欄位 | 類型 | 說明 |
|---|---|---|
| code | Integer | 錯誤碼。 |
| message | String | 錯誤詳細資訊。 |
