From dce86a212d3044d252f33b9899a7c3b16cf20bcd Mon Sep 17 00:00:00 2001 From: Valerii Kovalskii Date: Wed, 8 Apr 2026 10:13:13 +0300 Subject: [PATCH] fix: count only user prompts, not assistant messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Leaderboard counts only type=user messages (your prompts) - Renamed "messages" → "prompts" in UI - Before: 155 (user+assistant), After: 76 (user only) Co-Authored-By: Claude Opus 4.6 (1M context) --- src/data.js | 4 ++-- src/frontend/app.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/data.js b/src/data.js index 9273746..d01ad22 100644 --- a/src/data.js +++ b/src/data.js @@ -2274,9 +2274,9 @@ function getDailyStats(sessions) { if (entry.timestamp) { ts = typeof entry.timestamp === 'number' ? entry.timestamp : new Date(entry.timestamp).getTime(); } - if (!ts || ts < 1000000000000) continue; // skip invalid + if (!ts || ts < 1000000000000) continue; const day = fmtLocalDay(ts); - msgsByDay[day] = (msgsByDay[day] || 0) + 1; + if (entry.type === 'user') msgsByDay[day] = (msgsByDay[day] || 0) + 1; if (!tsByDay[day]) tsByDay[day] = { first: ts, last: ts }; if (ts < tsByDay[day].first) tsByDay[day].first = ts; if (ts > tsByDay[day].last) tsByDay[day].last = ts; diff --git a/src/frontend/app.js b/src/frontend/app.js index aa624ae..dbe52d4 100644 --- a/src/frontend/app.js +++ b/src/frontend/app.js @@ -2657,7 +2657,7 @@ async function renderLeaderboard(container) { // Today stats html += '
Today
'; html += '
'; - html += '
' + data.today.messages + '
messages
'; + html += '
' + data.today.messages + '
prompts
'; html += '
' + data.today.hours.toFixed(1) + 'h
agent time
'; html += '
' + data.today.sessions + '
sessions
'; html += '
$' + data.today.cost.toFixed(2) + '
cost
'; @@ -2666,7 +2666,7 @@ async function renderLeaderboard(container) { // All time html += '
All Time
'; html += '
'; - html += '
' + data.totals.messages.toLocaleString() + '
messages
'; + html += '
' + data.totals.messages.toLocaleString() + '
prompts
'; html += '
' + data.totals.hours.toFixed(0) + 'h
agent time
'; html += '
' + data.totals.sessions + '
sessions
'; html += '
$' + data.totals.cost.toFixed(2) + '
cost
';