History

Remove fast-tier icons from model selection UI

- delete `shouldShowFastTierIcon` and its test - remove Zap icon badges from slash model commands and provider model picker - simplify related ChatView props and memo dependencies

Julius Marminge committed 8 months ago

Commit 081a6da1 parent 9fdb45b3 files · +2 −41Browse files

Unified · Split

3 files
  1. apps/web/src/appSettings.test.ts +0 −9
  2. apps/web/src/appSettings.ts +0 −13
  3. apps/web/src/components/ChatView.tsx +2 −19
apps/web/src/appSettings.test.ts+0−9
@@ -4,7 +4,6 @@ import { · 3 unmodified lines
44 getAppModelOptions,
55 getSlashModelOptions,
66 normalizeCustomModelSlugs,
7− shouldShowFastTierIcon,
87 resolveAppModelSelection,
98 } from "./appSettings";
109
@@ -83,11 +82,3 @@ describe("getSlashModelOptions", () => { · 72 unmodified lines
8382 expect(options.map((option) => option.slug)).toEqual(["openai/gpt-oss-120b"]);
8483 });
8584 });
86−
87−describe("shouldShowFastTierIcon", () => {
88− it("shows the fast-tier icon only for gpt-5.4 when fast mode is enabled", () => {
89− expect(shouldShowFastTierIcon("gpt-5.4", true)).toBe(true);
90− expect(shouldShowFastTierIcon("gpt-5.4", false)).toBe(false);
91− expect(shouldShowFastTierIcon("gpt-5.3-codex", true)).toBe(false);
92− });
93−});
apps/web/src/appSettings.ts+0−13
@@ -6,7 +6,6 @@ import { getDefaultModel, getModelOptions, normalizeModelSlug } from "@t3tools/s · 5 unmodified lines
66 const APP_SETTINGS_STORAGE_KEY = "t3code:app-settings:v1";
77 const MAX_CUSTOM_MODEL_COUNT = 32;
88 export const MAX_CUSTOM_MODEL_LENGTH = 256;
9−const MODELS_WITH_FAST_SUPPORT = new Set(["gpt-5.4"]);
109 const BUILT_IN_MODEL_SLUGS_BY_PROVIDER: Record<ProviderKind, ReadonlySet<string>> = {
1110 codex: new Set(getModelOptions("codex").map((option) => option.slug)),
1211 };
@@ -33,18 +32,6 @@ export interface AppModelOption { · 20 unmodified lines
3332 isCustom: boolean;
3433 }
3534
36−export function shouldShowFastTierIcon(
37− model: string | null | undefined,
38− fastModeEnabled: boolean,
39−): boolean {
40− const normalizedModel = normalizeModelSlug(model);
41− return (
42− fastModeEnabled &&
43− normalizedModel !== null &&
44− MODELS_WITH_FAST_SUPPORT.has(normalizedModel)
45− );
46−}
47−
4835 const DEFAULT_APP_SETTINGS = AppSettingsSchema.makeUnsafe({});
4936
5037 let listeners: Array<() => void> = [];
apps/web/src/components/ChatView.tsx+2−19
@@ -145,7 +145,6 @@ import { · 144 unmodified lines
145145 XIcon,
146146 CopyIcon,
147147 CheckIcon,
148− ZapIcon,
149148 } from "lucide-react";
150149 import { Button } from "./ui/button";
151150 import { Input } from "./ui/input";
@@ -205,7 +204,6 @@ import { readNativeApi } from "~/nativeApi"; · 53 unmodified lines
205204 import {
206205 getAppModelOptions,
207206 resolveAppModelSelection,
208− shouldShowFastTierIcon,
209207 useAppSettings,
210208 } from "../appSettings";
211209 import {
@@ -408,7 +406,6 @@ type ComposerCommandItem = · 196 unmodified lines
408406 model: ModelSlug;
409407 label: string;
410408 description: string;
411− showFastBadge: boolean;
412409 };
413410
414411 type SendPhase = "idle" | "preparing-worktree" | "sending-turn";
@@ -519,9 +516,6 @@ const ComposerCommandMenuItem = memo(function ComposerCommandMenuItem(props: { · 104 unmodified lines
519516 </Badge>
520517 ) : null}
521518 <span className="flex min-w-0 items-center gap-1.5 truncate">
522− {props.item.type === "model" && props.item.showFastBadge ? (
523− <ZapIcon className="size-3.5 shrink-0 text-amber-500" />
524− ) : null}
525519 <span className="truncate">{props.item.label}</span>
526520 </span>
527521 <span className="truncate text-muted-foreground/70 text-xs">{props.item.description}</span>
@@ -1250,10 +1244,8 @@ export default function ChatView({ threadId }: ChatViewProps) { · 722 unmodified lines
12501244 model: slug,
12511245 label: name,
12521246 description: `${providerLabel} · ${slug}`,
1253− showFastBadge:
1254− provider === "codex" && shouldShowFastTierIcon(slug, selectedCodexFastModeEnabled),
12551247 }));
1256− }, [composerTrigger, searchableModelOptions, selectedCodexFastModeEnabled, workspaceEntries]);
1248+ }, [composerTrigger, searchableModelOptions, workspaceEntries]);
12571249 const composerMenuOpen = Boolean(composerTrigger);
12581250 const activeComposerMenuItem = useMemo(
12591251 () =>
@@ -3695,7 +3687,6 @@ export default function ChatView({ threadId }: ChatViewProps) { · 2435 unmodified lines
36953687 model={selectedModelForPickerWithCustomFallback}
36963688 lockedProvider={lockedProvider}
36973689 modelOptionsByProvider={modelOptionsByProvider}
3698− fastModeEnabled={selectedCodexFastModeEnabled}
36993690 onProviderModelChange={onProviderModelSelect}
37003691 />
37013692
@@ -5543,7 +5534,6 @@ const ProviderModelPicker = memo(function ProviderModelPicker(props: { · 1841 unmodified lines
55435534 model: ModelSlug;
55445535 lockedProvider: ProviderKind | null;
55455536 modelOptionsByProvider: Record<ProviderKind, ReadonlyArray<{ slug: string; name: string }>>;
5546− fastModeEnabled: boolean;
55475537 disabled?: boolean;
55485538 onProviderModelChange: (provider: ProviderKind, model: ModelSlug) => void;
55495539 }) {
@@ -5573,12 +5563,9 @@ const ProviderModelPicker = memo(function ProviderModelPicker(props: { · 23 unmodified lines
55735563 disabled={props.disabled}
55745564 />
55755565 }
5576− >
5566+ >
55775567 <span className="flex min-w-0 items-center gap-2">
55785568 <ProviderIcon aria-hidden="true" className="size-4 shrink-0 text-muted-foreground/70" />
5579− {props.provider === "codex" && shouldShowFastTierIcon(props.model, props.fastModeEnabled) ? (
5580− <ZapIcon className="size-3.5 shrink-0 text-amber-500" />
5581− ) : null}
55825569 <span className="truncate">{selectedModelLabel}</span>
55835570 <ChevronDownIcon aria-hidden="true" className="size-3 opacity-60" />
55845571 </span>
@@ -5621,10 +5608,6 @@ const ProviderModelPicker = memo(function ProviderModelPicker(props: { · 36 unmodified lines
56215608 value={modelOption.slug}
56225609 onClick={() => setIsMenuOpen(false)}
56235610 >
5624− {option.value === "codex" &&
5625− shouldShowFastTierIcon(modelOption.slug, props.fastModeEnabled) ? (
5626− <ZapIcon className="size-3.5 shrink-0 text-amber-500" />
5627− ) : null}
56285611 {modelOption.name}
56295612 </MenuRadioItem>
56305613 ))}