查询会话条目列表

查询本地会话中的条目摘要。

GET https://token.moi.matrixorigin.cn/v1/conversations/{conversation_id}/items

调用前准备

  1. 准备具有 Genesis 权限的个人访问令牌

  2. 使用创建会话时的凭据,选择尚未删除、尚未关联上游模型的本地会话。

请求示例

将示例中的 $GENESIS_ACCESS_TOKEN$CONVERSATION_ID 分别替换为个人访问令牌和所选会话的 ID。

curl -X GET "https://token.moi.matrixorigin.cn/v1/conversations/$CONVERSATION_ID/items?limit=100&order=asc" \
  -H "Authorization: Bearer $GENESIS_ACCESS_TOKEN"

路径参数

参数

类型

是否必填

说明

conversation_id

string

创建会话响应中的 id

查询参数

参数

类型

是否必填

说明

limit

integer

返回条目数。默认 100;超过 200 时按 200 处理;非正整数或无法解析时使用默认值。

order

string

默认按创建时间升序取数;传入 desc 时,将已截取的返回集合倒序展示。

本地会话条目最多返回 200 条,暂不支持通过 after 游标翻页。需要完整历史记录时,由应用保存条目与消息正文。

成功响应

成功时返回会话的条目摘要列表。

本地条目保存类型、角色和状态等摘要;消息正文需由应用自行保存。

{
  "object": "list",
  "data": [
    {
      "id": "$ITEM_ID",
      "object": "conversation.item",
      "conversation_id": "$CONVERSATION_ID",
      "type": "message",
      "role": "user",
      "status": "active",
      "created_at": 1780000000
    }
  ],
  "first_id": "$ITEM_ID",
  "last_id": "$ITEM_ID",
  "has_more": false
}

字段

类型

说明

object

string

固定为 list

data

array of object

当前返回的条目摘要。

data[].id

string

条目标识。

data[].object

string

固定为 conversation.item

data[].conversation_id

string

条目所属的会话标识。

data[].type

string

条目类型,例如 message

data[].role

string

条目角色,例如 user

data[].status

string

条目状态,省略时为 active

data[].created_at

integer

创建时间,Unix 秒级时间戳。

first_id

string

第一条结果的标识;空列表时为空字符串。

last_id

string

最后一条结果的标识;空列表时为空字符串。

has_more

boolean

本地响应固定为 false;该值无法用于判断条目是否被 limit 截断。

错误响应

资源不存在、已删除或当前凭据不可访问时,请求返回 404

{
  "error": {
    "message": "conversation not found",
    "type": "conversation_not_found",
    "code": "conversation_not_found"
  }
}

字段

类型

说明

error

object

错误信息。

error.message

string

错误原因。

error.type

string

错误类别。

error.code

string

错误代码。

后续操作

使用 data 中目标条目的 id 查询会话条目

最后更新于