From 0e71903cc1419d20fbd593fd7330defdc4628af2 Mon Sep 17 00:00:00 2001 From: Adam Malczewski Date: Fri, 12 Jun 2026 01:10:56 +0900 Subject: feat(chat): old-Dispatch composer layout — textarea + send + status bar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Restore the ergonomic composer from old Dispatch: an auto-resizing textarea (1→7 lines) with a fixed-width Send button beside it, and a status bar BELOW holding a status icon · context-window fill bar (escalating success/warning/ error color) · compact token count (current / limit · pct%). The bar reuses the latest turn's contextSize as current usage and HARDCODES a 1,000,000-token window limit as a placeholder (real per-model limit is the next backend ask). Absorbs the standalone ContextSizeBadge (removed). Pure helpers computeContextUsage + formatCompactTokens added to core/metrics (tested). 540 tests green. --- src/app/App.svelte | 8 +- src/core/metrics/format.test.ts | 44 ++++++++ src/core/metrics/format.ts | 39 +++++++ src/core/metrics/index.ts | 3 + src/features/chat/index.ts | 1 - src/features/chat/ui/Composer.svelte | 152 ++++++++++++++++++++++++--- src/features/chat/ui/ContextSizeBadge.svelte | 20 ---- 7 files changed, 230 insertions(+), 37 deletions(-) delete mode 100644 src/features/chat/ui/ContextSizeBadge.svelte (limited to 'src') diff --git a/src/app/App.svelte b/src/app/App.svelte index 32db54f..dbb346a 100644 --- a/src/app/App.svelte +++ b/src/app/App.svelte @@ -10,7 +10,6 @@ ChatView, Composer, manifest as chatManifest, - ContextSizeBadge, ModelSelector, } from "../features/chat"; import { manifest as conversationCacheManifest } from "../features/conversation-cache"; @@ -217,8 +216,11 @@ smartScroll.resume()} /> - - + +
+ + +
+ + +
+ + {#if status === "running"} + + {:else if status === "error"} + + + + + + {:else} + + + + {/if} + + + {#if usage.percent !== null} + + {:else} + + {/if} + + + {#if hasUsage} + {formatCompactTokens(usage.current)}{#if usage.max !== null} + / {formatCompactTokens(usage.max)}{/if} + {#if usage.percent !== null} + · {usage.percent.toFixed(1)}% + {/if} + {:else} + — tokens + {/if} + +
diff --git a/src/features/chat/ui/ContextSizeBadge.svelte b/src/features/chat/ui/ContextSizeBadge.svelte deleted file mode 100644 index 475d54f..0000000 --- a/src/features/chat/ui/ContextSizeBadge.svelte +++ /dev/null @@ -1,20 +0,0 @@ - - -
- - {label} - -
-- cgit v1.2.3