// frontend/components/ContextMeter.jsx // // Small bottom-right control that shows the active LLM's context-window // utilisation. Collapsed: a single ⓘ icon (no number — keeps the UI // quiet during normal use). Expanded: a compact popover with the // breakdown, topology line, and a manual refresh button. // // Refresh model: lazy — fetched only when the popover opens, plus the // explicit ↻ button. Zero idle traffic. // // Token-count estimate flag: when the backend reports is_estimate=true // (Ollama / OllaBridge — no real tokenizer available) every number is // prefixed with ≈ so the imprecision is visible. // // Colours: GitPilot orange #D95C3D for ≥60% (warning), red #B91C1C for // ≥85% (saturated). No new dependencies; inline styles + a scoped // {open && (

Context window

{loading && !data && (
Loading…
)} {error && error !== "disabled" && (
Couldn't load: {error}
)} {data && ( <>
Provider {data.provider} Model {data.model || "—"} Topology {data.topology}
{prefix} {fmt(data.used)} / {fmt(data.context_window)}{" "} ({percent.toFixed(1)}%)
{percent >= 85 && (
= 95 ? "1" : "0"}> Context near saturation. Consider:
  • Resetting the conversation
  • Switching to a larger-context model
  • Reducing repository scope
)}
{estimate ? "Token counts are estimated" : "Token counts via tiktoken"}
)}
)} ); }