Skip to content

Add per-call detail panel to the usage dashboard - #3

Open
ogj130 wants to merge 1 commit into
lanlandeli:mainfrom
ogj130:feat/calls-detail
Open

Add per-call detail panel to the usage dashboard#3
ogj130 wants to merge 1 commit into
lanlandeli:mainfrom
ogj130:feat/calls-detail

Conversation

@ogj130

@ogj130 ogj130 commented Aug 16, 2026

Copy link
Copy Markdown

Summary

Add a "Call Details" panel to the dashboard: a paginated list of every assistant call showing
wall-clock duration, input/output tokens, cache hit rate, model, and reasoning effort. Filter by
model, provider, input/output token thresholds, and switch page size (5/10/20/50).

Changes

  • Collect durationMs (step/start -> assistant/message) and effort (request/header reasoning
    effort) per call, keyed per session so concurrent sessions never bleed timing into each other.
  • Add GET /usage-stats/v1/calls with date, scope, workspace, model, provider, token-threshold, and
    pagination filters. History without a paired step or header reports null without backfill.
  • Reuse the shared collector in both replay (summarizeSession) and live (acceptLive) paths.
  • Add a CallsPanel React component (7-column table + filters + page-size selector), bilingual copy
    (zh/en), and styles.
  • Extend ActivityRecord with optional durationMs / effort; add CallsQuery / CallRecord /
    CallsPage types.

Files changed

  • src/core.ts — collector state + aggregateCalls
  • src/index.ts/calls route + parsePagination
  • src/client/index.tsxCallsPanel component
  • src/client/i18n.ts / src/client/styles.ts — bilingual copy + styles
  • src/types.ts — new types + ActivityRecord extension
  • tests/core.test.ts — 5 new tests (session isolation, pairing, filters)

Test plan

  • npm run check — typecheck, 22 tests, build all pass

摘要

在仪表盘新增「调用明细」面板:以分页列表展示每次模型调用的真实耗时、输入/输出
Token、缓存率、模型与思考程度;支持按模型、提供商、输入/输出 Token
阈值筛选,并可切换每页条数(5/10/20/50)。

改动

  • 按会话隔离采集 durationMs(step/start → assistant/message)与 effort(request/header 的
    reasoning effort),并发会话互不串扰。
  • 新增 GET /usage-stats/v1/calls 接口,支持日期、任务范围、工作区、模型、提供商、Token
    阈值与分页过滤;缺少配对 step/header 的历史数据返回 null,不做回填。
  • 实时路径(acceptLive)与历史回放路径(summarizeSession)复用同一套采集逻辑。
  • 新增 CallsPanel React 组件(7 列表格 + 筛选 + 每页条数切换),含中英文文案与样式。
  • 扩展 ActivityRecord(可选 durationMs/effort);新增 CallsQuery/CallRecord/CallsPage
    类型。

涉及文件

  • src/core.ts — 采集状态 + aggregateCalls
  • src/index.ts/calls 路由 + 参数解析
  • src/client/index.tsxCallsPanel 组件
  • src/client/i18n.ts / src/client/styles.ts — 中英文文案与样式
  • src/types.ts — 新增类型 + ActivityRecord 扩展
  • tests/core.test.ts — 5 个新测试(会话隔离、配对、过滤)

验证

  • npm run check — typecheck、22 项测试、构建全部通过

实际效果为:

image

Add a "Call Details" panel to the dashboard: a paginated list of every
assistant call showing wall-clock duration, input/output tokens, cache hit
rate, model, and reasoning effort. Filter by model, provider, input/output
token thresholds, and switch page size (5/10/20/50).

- Collect durationMs (step/start -> assistant/message) and effort
  (request/header reasoning effort) per call, keyed per session so
  concurrent sessions never bleed timing into each other.
- Add GET /usage-stats/v1/calls with date, scope, workspace, model,
  provider, token-threshold, and pagination filters. History without a
  paired step or header reports null without backfill.
- Reuse the shared collector in both replay (summarizeSession) and live
  (acceptLive) paths.
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.

1 participant