mirror of
https://github.com/headroomlabs-ai/headroom.git
synced 2026-08-27 14:17:10 -04:00
fix(dashboard): restore cache setup hints after refresh
This commit is contained in:
parent
69cf5db9b8
commit
c87a0ec2ef
1 changed files with 27 additions and 5 deletions
|
|
@ -468,8 +468,8 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Prefix Cache Impact: current process only -->
|
||||
<template x-if="cacheSessionActive">
|
||||
<!-- Prefix Cache Impact: current process plus durable cache reads after restart -->
|
||||
<template x-if="cacheCardAvailable">
|
||||
<div class="bg-surface rounded-lg p-4 border border-border mb-6">
|
||||
<div class="flex justify-between items-center mb-3">
|
||||
<div class="text-sm font-medium text-gray-300">Prefix Cache Impact</div>
|
||||
|
|
@ -479,6 +479,15 @@
|
|||
<div class="text-xs text-gray-500 font-mono"
|
||||
x-show="!cacheSessionActive">no activity since restart</div>
|
||||
</div>
|
||||
<template x-if="!cacheSessionActive && lifetimeCacheReadTokens > 0">
|
||||
<div class="mb-4 rounded-lg border border-cyan-500/20 bg-cyan-500/5 p-3">
|
||||
<div class="text-xs text-gray-500 uppercase tracking-wide mb-1">Cache Reads (lifetime)</div>
|
||||
<div class="text-2xl font-light tabular-nums text-cyan-400"
|
||||
x-text="formatNumber(lifetimeCacheReadTokens)"></div>
|
||||
<div class="text-xs text-cyan-400/70"
|
||||
x-text="'$' + formatCurrency(lifetimeCacheSavingsUsd) + ' saved'"></div>
|
||||
</div>
|
||||
</template>
|
||||
<!-- Totals row -->
|
||||
<div class="grid grid-cols-2 md:grid-cols-4 gap-4 mb-4">
|
||||
<div>
|
||||
|
|
@ -783,7 +792,9 @@
|
|||
|
||||
<template x-if="agentRows.length === 0">
|
||||
<div class="rounded-lg border border-dashed border-border p-6 text-center text-sm text-gray-500">
|
||||
Agent usage appears after Cursor, Claude, Codex, or another client sends traffic through this proxy.
|
||||
<div>Agent usage appears after Cursor, Claude, Codex, or another client sends traffic through this proxy.</div>
|
||||
<div class="mt-2 font-mono text-xs text-accent"
|
||||
x-text="'ANTHROPIC_BASE_URL: ' + window.location.origin + '/p/<project-name>'"></div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
|
|
@ -1323,8 +1334,7 @@
|
|||
<div class="px-4 py-8 text-center">
|
||||
<div class="text-xs text-gray-500 mb-3">No per-project data yet.</div>
|
||||
<div class="text-xs text-gray-600 font-mono leading-relaxed">
|
||||
Route project traffic through
|
||||
<span class="text-accent" x-text="window.location.origin + '/p/<project-name>'"></span>
|
||||
<span class="text-accent" x-text="'ANTHROPIC_BASE_URL: ' + window.location.origin + '/p/<project-name>'"></span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -2478,6 +2488,18 @@
|
|||
return (this.stats.prefix_cache?.totals?.requests || 0) > 0;
|
||||
},
|
||||
|
||||
get lifetimeCacheReadTokens() {
|
||||
return this.stats.persistent_savings?.lifetime?.cache_read_tokens || 0;
|
||||
},
|
||||
|
||||
get lifetimeCacheSavingsUsd() {
|
||||
return this.stats.persistent_savings?.lifetime?.cache_savings_usd || 0;
|
||||
},
|
||||
|
||||
get cacheCardAvailable() {
|
||||
return this.cacheSessionActive || this.lifetimeCacheReadTokens > 0 || this.lifetimeCacheSavingsUsd > 0;
|
||||
},
|
||||
|
||||
get cacheSavingsPercent() {
|
||||
const t = this.stats.prefix_cache?.totals || {};
|
||||
const total = (t.cache_read_tokens || 0) + (t.cache_write_tokens || 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue