What's Changed
Bug Fixes
- fix(analytics): Add dedup subqueries to all
ai_promptsmonitoring queriesai_promptstable usesMergeTree()(notReplacingMergeTree), and the PATCH endpoint inserts duplicate rows for updates- All
count()/countIf()queries were double-counting prompts - Fixed by wrapping with
GROUP BY prompt_id+argMax(field, timestamp)subqueries - Affected files:
prompt-analytics.ts(8 queries),leaderboard/route.ts(2 queries)
New
- skill_suggestions ClickHouse table DDL added (
clickhouse/tables/skill_suggestions.sql) - Documentation added to
ai_prompts.sqlabout MergeTree dedup requirements
Migration Notes
After deploying, run the skill_suggestions.sql DDL on your ClickHouse instance:
-- See: zeude/dashboard/clickhouse/tables/skill_suggestions.sql