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 | 4bc02b0102e45dc8cce97b7fc8499e0ab23d862f (patch) | |
| tree | 8d8c40ca4f2951a68ec812fb3d0f31c044a76599 /src/features/chat/ui | |
| parent | 4866ebe724d247ab9c1a7615104712cf0ff2e508 (diff) | |
| download | dispatch-web-4bc02b0102e45dc8cce97b7fc8499e0ab23d862f.tar.gz dispatch-web-4bc02b0102e45dc8cce97b7fc8499e0ab23d862f.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> |
