Add per-call detail panel to the usage dashboard - #3
Open
ogj130 wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
durationMs(step/start -> assistant/message) andeffort(request/header reasoningeffort) per call, keyed per session so concurrent sessions never bleed timing into each other.
GET /usage-stats/v1/callswith date, scope, workspace, model, provider, token-threshold, andpagination filters. History without a paired step or header reports
nullwithout backfill.summarizeSession) and live (acceptLive) paths.CallsPanelReact component (7-column table + filters + page-size selector), bilingual copy(zh/en), and styles.
ActivityRecordwith optionaldurationMs/effort; addCallsQuery/CallRecord/CallsPagetypes.Files changed
src/core.ts— collector state +aggregateCallssrc/index.ts—/callsroute +parsePaginationsrc/client/index.tsx—CallsPanelcomponentsrc/client/i18n.ts/src/client/styles.ts— bilingual copy + stylessrc/types.ts— new types +ActivityRecordextensiontests/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)复用同一套采集逻辑。CallsPanelReact 组件(7 列表格 + 筛选 + 每页条数切换),含中英文文案与样式。ActivityRecord(可选durationMs/effort);新增CallsQuery/CallRecord/CallsPage类型。
涉及文件
src/core.ts— 采集状态 +aggregateCallssrc/index.ts—/calls路由 + 参数解析src/client/index.tsx—CallsPanel组件src/client/i18n.ts/src/client/styles.ts— 中英文文案与样式src/types.ts— 新增类型 +ActivityRecord扩展tests/core.test.ts— 5 个新测试(会话隔离、配对、过滤)验证
npm run check— typecheck、22 项测试、构建全部通过实际效果为: