Give the token ledger its own card on the dashboard
The AI card answers whether the model is healthy now; what it has spent over a month was a different question crowding it out one line at a time.
This commit is contained in:
@@ -511,15 +511,16 @@ function vv_ai_stats_cached(bool $live = false): array {
|
||||
// cache write, and — worse — the dashboard and the AI tab could disagree about whether the model
|
||||
// is resident, because they would have asked at different moments.
|
||||
//
|
||||
// Tokens are not part of vv_ai_stats(): that function's shape is the AI tab's banner contract,
|
||||
// and the ledger read is 15ms, so it is fetched here rather than widening the payload everything
|
||||
// else carries.
|
||||
// Tokens are deliberately absent. This block once carried today's total for a single line on the
|
||||
// AI card; that line is now a card of its own, which fetches the whole ledger from
|
||||
// api/ai.php?action=tokens because it shows the week and all-time beside today. Leaving the field
|
||||
// here would have run vv_ai_token_stats() on every cache write — once a minute, forever — and
|
||||
// discarded all but one number of it that nothing reads.
|
||||
function vv_ai_monitor_block(array $stats): array {
|
||||
return [
|
||||
'model' => $stats['model'] ?? '',
|
||||
'runtime' => $stats['runtime'] ?? [],
|
||||
'index' => $stats['index'] ?? [],
|
||||
'tokens' => vv_ai_token_stats()['today'] ?? null,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user