---
title: "查询任务历史轮次"
method: GET
path: "/api/v1/users/tasks/rounds"
tags: ["【用户】任务管理"]
---

# 查询任务历史轮次

`GET /api/v1/users/tasks/rounds`

根据 cursor 翻页查询任务的历史轮次。limit 为轮次数（非条目数），
limit=2 表示返回 2 轮的完整消息。direction=backward（默认）从 cursor 往更早翻，轮间倒序（最新轮在前）；
direction=forward 往更新翻，轮间正序（最旧轮在前）；轮内消息始终按时间正序。
即响应中最后一轮总是与 next_cursor 相邻的那一轮。前端应以每条 chunk 的 seq 做分组排序，不依赖数组顺序。
日志存储为 ClickHouse 时 cursor 即轮次号 seq，可配合 inclusive=true 实现"跳转到第 seq 轮"；
Loki 仅支持 backward 且不支持 inclusive，违反时返回 err-task-rounds-direction-unsupported。
返回的 user-input.data 统一为 JSON payload 字符串，例如 `{"content":"57un57ut5aSE55CG","attachments":[]}`；content 为用户输入文本的 base64 编码，旧历史裸文本也会按该结构包装返回。

## Query parameters

- `id` string, required
- `cursor` string
- `limit` integer
- `direction` string
- `inclusive` boolean

## Response `200`

成功

- object
  - `code` integer
  - `data` DomainTaskRoundsResp
    - `chunks` DomainTaskChunkEntry[]
      - `data` integer[]
      - `event` string
      - `kind` string
      - `labels` object
      - `seq` integer — 消息序号，来自 ClickHouse msg_seq_start
      - `timestamp` integer
      - `turn_seq` integer — 轮次号，可作为 cursor 翻页；仅日志存储为 ClickHouse 时有值
    - `has_more` boolean
    - `next_cursor` string — 下一页游标
  - `message` string

## Other responses

- `500` — 服务器内部错误

---

[API](https://skmtc.net/chaitin/apis/untitled-api.md) · [All operations](https://skmtc.net/chaitin/apis/untitled-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/chaitin/untitled-api/versions/5a5929cb17f2/schema)
