-
Notifications
You must be signed in to change notification settings - Fork 2.5k
feat(stats): 增强stats能力,支持跨session的全局用量统计,参考Claude Code #4597
Copy link
Copy link
Closed
Labels
category/telemetryTelemetry and analyticsTelemetry and analyticsroadmap/export-dataRoadmap: Export and data featuresRoadmap: Export and data featuresroadmap/terminal-uxRoadmap: Terminal UX and UIRoadmap: Terminal UX and UIscope/analyticsUsage analyticsUsage analyticsscope/session-managementSession state and persistenceSession state and persistencestatus/needs-triageIssue needs to be triaged and labeledIssue needs to be triaged and labeledtype/feature-requestNew feature or enhancement requestNew feature or enhancement request
Metadata
Metadata
Assignees
Labels
category/telemetryTelemetry and analyticsTelemetry and analyticsroadmap/export-dataRoadmap: Export and data featuresRoadmap: Export and data featuresroadmap/terminal-uxRoadmap: Terminal UX and UIRoadmap: Terminal UX and UIscope/analyticsUsage analyticsUsage analyticsscope/session-managementSession state and persistenceSession state and persistencestatus/needs-triageIssue needs to be triaged and labeledIssue needs to be triaged and labeledtype/feature-requestNew feature or enhancement requestNew feature or enhancement request
Type
Fields
Give feedbackNo fields configured for issues without a type.
What would you like to be added?
增强
/stats命令,支持跨会话的持久化用量追踪和交互式全屏仪表盘,对标 Claude Code 的 stats 体验。当前行为
/stats仅展示当前会话的指标(token、工具调用、时长)uiTelemetryService)期望行为
1. 用量持久化
会话退出时自动将用量摘要追加写入
~/.qwen/usage-history.jsonl,包含:2. 交互式
/stats仪表盘交互模式下将
/stats升级为全屏 Dialog,包含:·░▒▓█)、会话数、活跃天数、连续活跃天数、最长会话、常用模型r在 All time / Last 7 days / Last 30 days 之间循环Tab/Shift+Tab切换 Overview 和 Models3. Report 子命令
/stats report [today|week|month|all]输出内联文本报告,/stats report export [json|csv]导出文件。4. 非交互模式兼容
headless 模式(
-p)下/stats仍返回纯文本的当前会话统计,行为不变。Why is this needed?
对于日常使用 CLI 编程助手的用户,了解 token 消耗模式至关重要:
Claude Code 已经提供了包含热力图、图表和日期过滤的交互式 stats 页面,Qwen Code 应该提供同等或更好的用量可视化能力。
Additional context
参考:Claude Code 的 stats 界面
Claude Code 的
/stats渲染一个交互式全屏面板,包含:实现思路
jsonl-utils.ts中的writeLineSync),保证崩溃安全DialogManager全屏接管)/stats model、/stats tools)保持不变,仍为内联面板/insight流水线中的 streak 计算逻辑