summaryrefslogtreecommitdiffhomepage
path: root/src/features/chat/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/features/chat/ui')
-rw-r--r--src/features/chat/ui/ContextSizeBadge.svelte20
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>