Allows resetting the LLM stats aggregation window without deleting historical data. Stores a reset timestamp in metadata and filters the aggregation query to only include calls after that point. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1.2 KiB
1.2 KiB
LLM Stats Reset Button
Goal
Add a "Reset Stats" button to the Admin panel's LLM tracking column that gives a clean aggregation window without deleting historical data.
Behavior
- "Reset Stats" button appears at the bottom of the right column, below the TOTAL row.
- Clicking it emits
admin-reset-llm-statssocket event. - Server stores the current timestamp in the
metadatatable asllm_stats_reset_after. - Server's
getAggregatedStats()addsWHERE timestamp > ?using that value. - Server responds with updated (now-empty) stats via existing
admin-llm-stats-result. - Client renders the refreshed stats as usual.
Changes
server/src/llm/llmStatsService.ts—getAggregatedStats()reads reset timestamp from metadata, filters query. NewresetStats()method to store the timestamp.server/src/network/SocketServer.ts— Handleadmin-reset-llm-statsevent: callresetStats(), respond with fresh stats.client/src/ui/AdminPanel.ts— Add "Reset Stats" button inupdateLlmStats(), wire click to new callback.client/src/scenes/GameScene.ts— Wire the new callback through to SocketClient.client/src/network/SocketClient.ts— AddresetLlmStats()method emitting the event.