Skip to content

feat(requestlog): page payload details and cap field previews - #542

Merged
qxcnm merged 3 commits into
qxcnm:mainfrom
xcosmosbox:feat/requestlog-detail-pagination
Nov 28, 2026
Merged

qxcnm merged 3 commits into
qxcnm:mainfrom
xcosmosbox:feat/requestlog-detail-pagination

Conversation

@xcosmosbox

Copy link
Copy Markdown
Contributor

问题

请求日志详情弹窗一次性拉取整份存储的请求体。真实会话的 payload 常态在 700KB–12MB(对话条目 + 顶层字段里的 base64 图片),前端 RPC 默认 10 秒传输预算会在下载途中超时,detail 变成空,弹窗就落到兜底文案「未找到该请求的内容记录;日志可能产生于旧版本,或已被清理」——但记录其实一直在。

实测(自托管 SQLite 存储):

指标 数值
服务端 requestlog/detail 耗时 0.02s(802KB)/ 0.11s(12.7MB)
payload 体积分布 p50 144KB、p90 1.4MB、最大 12.7MB
12.6MB 那条的构成 items 仅 3 条共 11KB,其余全在顶层字段(base64 图片)
前端默认超时 10s

也就是说:单纯按条目分页解决不了"单个字段 12MB"的情况,必须同时限制字段预览体积。

改动

服务端

  • RequestLogDetailParams 新增 itemOffset / itemLimit / fieldLimit(0 保持原有"全量返回"行为,完全向后兼容)
  • RequestLogDetailResult 新增 itemTotal / itemOffset / itemLimit / hasMore
  • RequestLogDetailField 新增 bytes / truncated,超过 fieldLimit 的值按 UTF-8 边界截断并标记
  • full_detail 改为按窗口切 items、按上限截断字段;preview 模式不变

前端

  • requestlog/detail 单独给 120s 传输预算(rpcRequestOptions 按方法覆盖超时),不再共用 10s 默认值
  • 弹窗默认取前 200 条 items + 每个字段最多 64KB 预览:
    • 还有剩余条目时显示「已加载 x/y 条」+「加载更多条目」
    • 字段被截断时显示提示 +「展开全部字段」(按需重新拉取全量)
  • service-client / 类型定义同步新参数;中/英/韩/俄四份文案

兼容性

  • 不传新参数的旧客户端行为完全不变(itemLimit=0、fieldLimit=0)
  • 新增单测 item_window_and_field_limit_are_applied 覆盖窗口切片与字段截断

备注

本地未做编译验证(环境不具备 Rust 构建能力),以 CI 为准。

@xcosmosbox
xcosmosbox force-pushed the feat/requestlog-detail-pagination branch from c4b9f33 to 0941a17 Compare November 27, 2026 06:18
The request detail modal fetched the entire captured body in a single
response. Real turns routinely store 700 KB to 12 MB payloads (conversation
items plus base64 images inside top-level fields), so the browser's default
10 second RPC deadline expired mid-transfer and the modal fell back to
"no payload record found" even though the record existed.

- requestlog/detail accepts itemOffset, itemLimit and fieldLimit. Items are
  returned as a window with itemTotal/hasMore, and oversized first-level
  fields are truncated with bytes/truncated flags instead of shipping
  megabytes on every open. Zero limits keep the previous behaviour.
- The detail RPC gets its own 120 second transfer budget instead of the
  shared 10 second default.
- The modal loads the first 200 items, offers "load more", and can expand
  truncated fields on demand.
@xcosmosbox
xcosmosbox force-pushed the feat/requestlog-detail-pagination branch from 0941a17 to de44e8e Compare November 27, 2026 06:20
@qxcnm
qxcnm merged commit 84c68bd into qxcnm:main Nov 28, 2026
4 checks passed
@qxcnm

qxcnm commented Nov 29, 2026

Copy link
Copy Markdown
Owner

感谢贡献!日志详情分页和大字段预览已合入 main,合并提交为 84c68bdb。

合并前补了两处修复:

  • 桌面端原先只转发 traceId 和 stage,打开大日志时仍会拉取全部内容。现在会完整转发 itemOffset、itemLimit 和 fieldLimit,原生读取超时也从 10 秒调到 120 秒。
  • 点击“复制完整请求”时,如果当前只加载了部分条目,或字段预览已截断,会先读取当前阶段的完整内容再复制。

已通过桌面 IPC 和 SQLite 实测:一条含 3 个条目的日志,请求第 2 条时只返回该条;旧客户端不传分页参数时仍返回全部 3 条。4 项 CI 全部通过。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants