查询 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 密钥页面获取密钥作为 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 | 错误详情。 |
