feat(desktop): 优化用量历史时间筛选与热力图 - #3802
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
| Filename | Overview |
|---|---|
| apps/desktop/src/main/usage/usageHistory.ts | 增加独立的 days/modelDays 窗口、全量查询支持及 modelDaily token 分项,未发现可发布的正确性问题。 |
| apps/desktop/src/renderer/hooks/useUsageHistory.ts | 按用户与查询窗口隔离缓存、请求和刷新订阅,并保留账户切换时的迟到结果防护。 |
| apps/desktop/src/renderer/components/settings/usage/usageHistoryStats.ts | 新增范围判断、单日选择和客户端重聚合,并兼容旧快照缺少 token 分项的情况。 |
| apps/desktop/src/renderer/components/settings/usage/UsageHistorySection.tsx | 接入范围选择器、日期下钻以及按范围派生的概览和明细数据。 |
| apps/desktop/src/renderer/components/new-chat/UsageHeatmap.tsx | 热力图改为自适应周数、可滚动布局和可访问的日期按钮,并保持未来占位不可交互。 |
| apps/desktop/src/renderer/components/settings/usage/UsageTaskTable.tsx | 任务列表改为按照选定本地日历范围筛选,同时继续按会话累计 token 排序。 |
Sequence Diagram
sequenceDiagram
participant U as 用户
participant UI as 用量历史界面
participant H as useUsageHistory
participant P as Preload / IPC
participant M as Main 用量聚合
U->>UI: 打开用量历史
UI->>H: "请求 days=all, modelDays=all"
H->>P: getHistory(options)
P->>M: maker:usage:history
M-->>P: 全量 days 与 modelDaily
P-->>H: UsageHistoryPayload
H-->>UI: 缓存并发布历史数据
U->>UI: 选择范围或点击日期
UI->>UI: 过滤并重新聚合统计与明细
UI-->>U: 展示所选范围结果
Reviews (1): Last reviewed commit: "chore(design): refresh usage history sur..." | Re-trigger Greptile
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d2eeb0d098
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@dashhuang 👋 这个 PR 还有 3 条 review conversation 没 resolve(apps/desktop/src/renderer/components/new-chat/UsageHeatmap.tsx / apps/desktop/src/renderer/components/settings/usage/UsageTaskTable.tsx),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 980221e259
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
命中 UI 路径(apps/desktop/src/renderer/components/new-chat/UsageHeatmap.tsx / apps/desktop/src/renderer/components/settings/usage/UsageBreakdownTables.tsx / apps/desktop/src/renderer/components/settings/usage/UsageHistorySection.tsx 等)但 description 未附界面效果证据——建议补充改动后效果:截图/录屏,或改动后界面的 HTML 页面(```html 代码块、.html 附件或在线预览链接),便于确认界面符合 DESIGN.md 设计规范 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bb707b07b3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
bb707b0 to
217ee8e
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 217ee8e832
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9397e9a44b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e870511e79
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
…alds Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com> # Conflicts: # docs/design-rules/design-inventory.md
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0ce4ded2f9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@dashhuang 👋 这个 PR 还有 1 条 review conversation 没 resolve(apps/desktop/src/renderer/components/settings/usage/UsageTaskTable.tsx),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cabf4245d2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| <th className={TH_CLASS}> | ||
| {todayLabel ?? t('usageHistory.byAgent.col.today')} | ||
| </th> |
There was a problem hiding this comment.
| const sessions = useMemo(() => { | ||
| if (!usageSessions) return recentSessions; | ||
| const byId = new Map(usageSessions.map((session) => [session.id, session])); | ||
| // 当前列表快照包含最近的实时 token/status patch,优先覆盖全量查询的旧行。 | ||
| for (const session of recentSessions) byId.set(session.id, session); |
There was a problem hiding this comment.
|
@dashhuang 👋 这个 PR 还有 2 条 review conversation 没 resolve(apps/desktop/src/renderer/components/settings/usage/UsageBreakdownTables.tsx / apps/desktop/src/renderer/components/settings/usage/UsageTaskTable.tsx),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
这次改了什么
摘要
为 Desktop 用量历史增加可切换的时间范围,并支持从活跃热力图与每日 Token 图直接选中某一天查看明细;同时扩展热力图的历史展示宽度与数据范围。
变更类型
feat新功能fix缺陷修复refactor/perf重构或性能优化docs/test/chore文档、测试或工程维护范围
UI 变化
docs/design-rules/DESIGN.md的双模式交付门槛、语义 Token、布局与交互规范;新增控件和图表交互均复用现有语义 Token,并同时适配 Light/Dark。怎么验证的
自动验证
手工验证
在 macOS Desktop 开发版的设置 → 用量历史中验证时间范围筛选、热力图日期点击、每日 Token 日期点击、单日筛选标签及明细联动。
未执行的验证
无。
风险
风险分类
影响与回滚
提交前检查
git commit -s,见 DCO)