mirror of
https://github.com/lobehub/lobe-chat.git
synced 2026-06-13 19:20:04 +00:00
2eb9e34fda
* ✨ feat(stats): add daily token-usage mode to activity heatmap Add a Messages/Tokens toggle to the stats activity heatmap. The token mode sums assistant messages' `metadata.usage.totalTokens` (the source of truth for usage) bucketed by the day each message was created, so tokens land on the day they were actually consumed rather than on a topic's creation date. Aggregation runs in SQL (SUM over the jsonb path, GROUP BY date) and levels are scaled relative to the busiest day. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * 💄 feat(stats): format heatmap token counts and add token stat row - Format tooltip token counts compactly (e.g. 44.2K, 12.5M) via the chart's customTooltip; message counts get thousand separators. - Add a token-dimension summary row (cumulative / peak daily / current streak / longest streak) shown in token mode, derived client-side from the heatmap data over the past year. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * ✨ feat(stats): add longest-task duration to token heatmap stats Add the "longest task" figure to the token-mode stats row, computed from the longest wall-clock agent operation (completedAt - startedAt) over the past year — MAX in SQL on the agent_operations table, scoped by user and using the (user_id, created_at) index. Rendered as a compact 1h 15m / 45s duration. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * 💄 feat(stats): default heatmap to token mode and move toggle beside title - Token is now the first/default segmented option (Messages second); the share card keeps Messages as its default. - Move the Messages/Tokens toggle next to the section title (left) via a new StatsFormGroup `afterTitle` slot; day tags stay on the right. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>