Mode switch Modes written as verbs and priced in time and quota, kept visually apart from the model control. The model is a ceiling; the mode is how much effort gets spent under it, and one left on quietly spends a week of quota. npx shadcn@latest add toggle-group button Tokens this needs: --card, --card-foreground, --muted, --muted-foreground, --accent, --accent-foreground, --border, --chart-1 ──────────────────────────────────────────────────────────────────────── // ModeSwitch.tsx ──────────────────────────────────────────────────────────────────────── import { Button } from "@/components/ui/button"; import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"; /** * A closed set, each one a verb. A mode is an amount of effort, and a menu * that mixes these with model names leaves nobody able to predict a row. * Time and credits are on every entry because the viewer is choosing whether * to wait and what to spend, and a toggle with no price understates both. */ export const MODES = { answer: { verb: "answer now", seconds: 2, credits: 0 }, search: { verb: "search first", seconds: 15, credits: 1 }, think: { verb: "think longer", seconds: 90, credits: 4 }, research: { verb: "research", seconds: 540, credits: 40 }, } as const; export type Mode = keyof typeof MODES; const time = (s: number) => (s >= 120 ? `${Math.round(s / 60)} min` : `${s}s`); const credits = (n: number) => (n === 0 ? "" : n === 1 ? " · 1 credit" : ` · ${n} credits`); /** "9 min · 40 credits", computed rather than typed, so it cannot drift. */ export const price = (m: Mode) => `${time(MODES[m].seconds)}${credits(MODES[m].credits)}`; type Props = { value: Mode; onChange: (mode: Mode) => void; /** The model is a separate control on purpose. It is a capability ceiling, * and it sits on its own row so it cannot be mistaken for an effort level. */ model: string; onPickModel: () => void; /** Where routing escalated the current turn past the chosen mode. Most * people never touch the row above, so this is the part they see. */ escalatedTo?: Mode; onForceFast: () => void; }; export function ModeSwitch({ value, onChange, model, onPickModel, escalatedTo, onForceFast }: Props) { return (