diff options
| author | Adam Malczewski <[email protected]> | 2026-06-12 01:01:32 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-12 01:01:32 +0900 |
| commit | 6bd7b39f6f53dd8f3743347a1cb72c2f74424dd8 (patch) | |
| tree | b41911099883e8386ea8edbd88d42911de401d27 /src/features/chat/ui | |
| parent | fd565a6555e8bc9f37f21cf9d900523ef3be531b (diff) | |
| download | dispatch-web-6bd7b39f6f53dd8f3743347a1cb72c2f74424dd8.tar.gz dispatch-web-6bd7b39f6f53dd8f3743347a1cb72c2f74424dd8.zip | |
feat(metrics): consume contextSize — current context-usage readout
Backend context-size handoff: re-pin [email protected] / [email protected]
(+ re-mirror .dispatch reference snapshots). Thread the optional contextSize
through core/metrics (done fold + durable + selectCurrentContextSize: latest
turn's defined value, undefined=>unknown never 0, durable-wins-over-live).
Chat store exposes currentContextSize; ContextSizeBadge renders
"N tokens in context" / "context size unknown" above the composer.
GLOSSARY: add context size / context window. 533 tests green.
Diffstat (limited to 'src/features/chat/ui')
| -rw-r--r-- | src/features/chat/ui/ContextSizeBadge.svelte | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/features/chat/ui/ContextSizeBadge.svelte b/src/features/chat/ui/ContextSizeBadge.svelte new file mode 100644 index 0000000..475d54f --- /dev/null +++ b/src/features/chat/ui/ContextSizeBadge.svelte @@ -0,0 +1,20 @@ +<script lang="ts"> + import { formatContextSize } from "../../../core/metrics"; + + let { + contextSize, + }: { + // The conversation's current context size (tokens occupied), or `undefined` + // ("unknown") when no finalized turn has reported one yet. Never `0` for the + // unknown case — `formatContextSize` renders a placeholder instead. + contextSize: number | undefined; + } = $props(); + + const label = $derived(formatContextSize(contextSize)); +</script> + +<div class="px-4 pb-1 text-xs opacity-60" aria-live="polite"> + <span title="The model's max context window is not reported yet — current usage only."> + {label} + </span> +</div> |
