查询Web应用会话消息

读取指定访客会话中与该发布智能体匹配的消息。

GET https://api.moi.matrixorigin.cn/v5/workspaces/{workspace_id}/agents/{agent_id}/webapp/conversations/{conversation_id}/messages

调用前准备

BASE_URL 使用产品 API 前缀 https://api.moi.matrixorigin.cn/v5;专有部署填写对应的产品 API 地址。

准备发布管理身份和对象。

请求

curl --request GET \
  "$BASE_URL/workspaces/$WORKSPACE_ID/agents/$AGENT_ID/webapp/conversations/$CONVERSATION_ID/messages?role=user&limit=50&offset=0" \
  --header "X-API-Key: $MOI_KEY" \
  --header "X-Workspace-ID: $WORKSPACE_ID"

下一页示例:

curl --request GET \
  "$BASE_URL/workspaces/$WORKSPACE_ID/agents/$AGENT_ID/webapp/conversations/$CONVERSATION_ID/messages?role=user&limit=50&offset=50" \
  --header "X-API-Key: $MOI_KEY" \
  --header "X-Workspace-ID: $WORKSPACE_ID"

参数

位置

类型

必填

说明

workspace_id

路径

string

是

同环境发布工作区ID。

agent_id

路径

string

是

目标智能体ID。

conversation_id

路径

string

是

来自该Web应用会话列表。

role

查询

string

否

user/agent/system/tool/assistant;省略不按角色筛选。

limit

查询

integer

否

默认50,上限200;无效/非正按50。

offset

查询

integer

否

默认0,负数按0。

会话必须属于当前工作区和目标Agent定义、purpose=webapp且可见;不能把普通登录会话ID或其他应用会话ID直接代入。普通翻页至offset + items.length达到total或当前items为空时停止;并发变化可能改变分页集合。

成功响应

{
  "code": 0,
  "data": {
    "items": [
      {
        "id": "message-example",
        "workspace_id": "workspace-example",
        "conversation_id": "conversation-example",
        "role": "user",
        "parts": [
          {
            "kind": "text",
            "text": "你好"
          }
        ],
        "seq": 1,
        "created_at": "2026-11-12T01:00:00Z"
      }
    ],
    "total": 1,
    "limit": 50,
    "offset": 0
  }
}

字段

类型

说明

code

integer

成功代码。

data

object

对应对象。

错误响应

错误与回读按该入口区分参数、权限和写入结果。

最后更新于