Open History to see the last commit
1import {
2 type ProviderInstanceId,
3 type ProviderDriverKind,
4 type ResolvedKeybindingsConfig,
5} from "@t3tools/contracts";
6import { resolveSelectableModel } from "@t3tools/shared/model";
7import { memo, useMemo, useState, useCallback, useEffect, useLayoutEffect, useRef } from "react";
8import { SearchIcon } from "lucide-react";
9import { ModelListRow } from "./ModelListRow";
10import { ModelPickerSidebar } from "./ModelPickerSidebar";
11import { isModelPickerNewModel } from "./modelPickerModelHighlights";
12import { buildModelPickerSearchText, scoreModelPickerSearch } from "./modelPickerSearch";
13import { Combobox, ComboboxEmpty, ComboboxInput, ComboboxList } from "../ui/combobox";
14import { ModelEsque, PROVIDER_ICON_BY_PROVIDER } from "./providerIconUtils";
15import {
16 modelPickerJumpCommandForIndex,
17 modelPickerJumpIndexFromCommand,
18 resolveShortcutCommand,
19 shortcutLabelForCommand,
20} from "../../keybindings";
21import { useSettings, useUpdateSettings } from "~/hooks/useSettings";
22import { cn } from "~/lib/utils";
23import { TooltipProvider } from "../ui/tooltip";
24import type { ProviderInstanceEntry } from "../../providerInstances";
25import { providerModelKey, sortProviderModelItems } from "../../modelOrdering";
26
27type ModelPickerItem = {
28 slug: string;
29 name: string;
30 shortName?: string;
31 subProvider?: string;
32 instanceId: ProviderInstanceId;
33 driverKind: ProviderDriverKind;
34 instanceDisplayName: string;
35 instanceAccentColor?: string | undefined;
36 continuationGroupKey?: string | undefined;
37};
38
39const EMPTY_MODEL_JUMP_LABELS = new Map<string, string>();
40
41// Split a `${instanceId}:${slug}` combobox key back into its pieces. Slugs
42// can contain colons (e.g. some vendor model ids), so we only split on the
43// first colon — anything after that is the slug.
44function splitInstanceModelKey(key: string): { instanceId: ProviderInstanceId; slug: string } {
45 const colonIndex = key.indexOf(":");
46 if (colonIndex === -1) {
47 return { instanceId: key as ProviderInstanceId, slug: "" };
48 }
49 return {
50 instanceId: key.slice(0, colonIndex) as ProviderInstanceId,
51 slug: key.slice(colonIndex + 1),
52 };
53}
54
55export const ModelPickerContent = memo(function ModelPickerContent(props: {
56 /** The instance currently selected in the composer (combobox "value"). */
57 activeInstanceId: ProviderInstanceId;
58 model: string;
59 /**
60 * When set, the picker is locked to the given driver kind — typically
61 * because the user is editing a previously-sent message and can't change
62 * which driver served the turn. Multiple instances of the same kind
63 * remain selectable (e.g. locked to `codex` still lets the user switch
64 * between the default Codex and a custom Codex Personal).
65 */
66 lockedProvider: ProviderDriverKind | null;
67 lockedContinuationGroupKey?: string | null;
68 /**
69 * All configured provider instances in display order. Used to render
70 * the sidebar (one button per instance) and to resolve display names
71 * for the locked-mode header.
72 */
73 instanceEntries: ReadonlyArray<ProviderInstanceEntry>;
74 keybindings?: ResolvedKeybindingsConfig;
75 /**
76 * Model options per instance. Keyed by `ProviderInstanceId` so the
77 * default Codex instance and any custom Codex instances each have their
78 * own list (custom instances typically start with the same built-in
79 * model set but are free to diverge via customModels).
80 */
81 modelOptionsByInstance: ReadonlyMap<ProviderInstanceId, ReadonlyArray<ModelEsque>>;
82 terminalOpen: boolean;
83 onRequestClose?: () => void;
84 onInstanceModelChange: (instanceId: ProviderInstanceId, model: string) => void;
85}) {
86 const {
87 keybindings: providedKeybindings,
88 modelOptionsByInstance,
89 instanceEntries,
90 onInstanceModelChange,
91 } = props;
92 const [searchQuery, setSearchQuery] = useState("");
93 const searchInputRef = useRef<HTMLInputElement>(null);
94 const listRegionRef = useRef<HTMLDivElement>(null);
95 const highlightedModelKeyRef = useRef<string | null>(null);
96 const favorites = useSettings((s) => s.favorites ?? []);
97 const [selectedInstanceId, setSelectedInstanceId] = useState<ProviderInstanceId | "favorites">(
98 () => {
99 if (props.lockedProvider !== null) {
100 // When locked, prime the sidebar to the currently-active instance
101 // so jumping into the picker keeps the focused instance visible.
102 return props.activeInstanceId;
103 }
104 return favorites.length > 0 ? "favorites" : props.activeInstanceId;
105 },
106 );
107 const keybindings = useMemo<ResolvedKeybindingsConfig>(
108 () => providedKeybindings ?? [],
109 [providedKeybindings],
110 );
111 const { updateSettings } = useUpdateSettings();
112
113 const focusSearchInput = useCallback(() => {
114 searchInputRef.current?.focus({ preventScroll: true });
115 }, []);
116
117 const handleSelectInstance = useCallback(
118 (instanceId: ProviderInstanceId | "favorites") => {
119 setSelectedInstanceId(instanceId);
120 window.requestAnimationFrame(() => {
121 focusSearchInput();
122 });
123 },
124 [focusSearchInput],
125 );
126
127 useLayoutEffect(() => {
128 focusSearchInput();
129 const frame = window.requestAnimationFrame(() => {
130 focusSearchInput();
131 });
132 const timeout = window.setTimeout(() => {
133 focusSearchInput();
134 }, 0);
135 return () => {
136 window.cancelAnimationFrame(frame);
137 window.clearTimeout(timeout);
138 };
139 }, [focusSearchInput]);
140
141 // Create a Set for efficient lookup. Favorites are keyed by
142 // `${instanceId}:${slug}`; the storage schema widened from ProviderDriverKind
143 // to ProviderInstanceId so pre-migration favorites keyed by driver slugs
144 // (e.g. `"codex:gpt-5"`) still resolve — the default instance id equals
145 // the driver slug.
146 const favoritesSet = useMemo(() => {
147 return new Set(favorites.map((fav) => providerModelKey(fav.provider, fav.model)));
148 }, [favorites]);
149
150 /**
151 * Lookup table keyed by `instanceId`. Used for display name + driver
152 * kind enrichment and for `ready`/enabled filtering before flattening
153 * models into the search list.
154 */
155 const entryByInstanceId = useMemo(
156 () => new Map(instanceEntries.map((entry) => [entry.instanceId, entry])),
157 [instanceEntries],
158 );
159 const matchesLockedProvider = useCallback(
160 (entry: Pick<ProviderInstanceEntry, "driverKind" | "continuationGroupKey">): boolean => {
161 if (props.lockedProvider === null) return true;
162 if (entry.driverKind !== props.lockedProvider) return false;
163 if (!props.lockedContinuationGroupKey) return true;
164 return entry.continuationGroupKey === props.lockedContinuationGroupKey;
165 },
166 [props.lockedContinuationGroupKey, props.lockedProvider],
167 );
168
169 const readyInstanceSet = useMemo(() => {
170 const ready = new Set<ProviderInstanceId>();
171 for (const entry of instanceEntries) {
172 if (entry.status === "ready") {
173 ready.add(entry.instanceId);
174 }
175 }
176 return ready;
177 }, [instanceEntries]);
178
179 // Flatten models into a searchable array. One pass over the
180 // instance-keyed map; each model carries its instance id + driver kind
181 // so the list row can render the right icon and display name without
182 // another lookup.
183 const flatModels = useMemo(() => {
184 const out: ModelPickerItem[] = [];
185 for (const [instanceId, models] of modelOptionsByInstance) {
186 const entry = entryByInstanceId.get(instanceId);
187 if (!entry) {
188 // Instance disappeared between renders (configuration change). Skip
189 // its models — stale options shouldn't appear in the picker.
190 continue;
191 }
192 if (!readyInstanceSet.has(instanceId)) {
193 continue;
194 }
195 for (const model of models) {
196 out.push({
197 slug: model.slug,
198 name: model.name,
199 ...(model.shortName ? { shortName: model.shortName } : {}),
200 ...(model.subProvider ? { subProvider: model.subProvider } : {}),
201 instanceId,
202 driverKind: entry.driverKind,
203 instanceDisplayName: entry.displayName,
204 ...(entry.accentColor ? { instanceAccentColor: entry.accentColor } : {}),
205 ...(entry.continuationGroupKey
206 ? { continuationGroupKey: entry.continuationGroupKey }
207 : {}),
208 });
209 }
210 }
211 return out;
212 }, [modelOptionsByInstance, entryByInstanceId, readyInstanceSet]);
213
214 const isLocked = props.lockedProvider !== null;
215 const isSearching = searchQuery.trim().length > 0;
216 const lockedInstanceEntries = useMemo(
217 () =>
218 props.lockedProvider ? instanceEntries.filter((entry) => matchesLockedProvider(entry)) : [],
219 [instanceEntries, matchesLockedProvider, props.lockedProvider],
220 );
221 const showLockedInstanceSidebar = isLocked && lockedInstanceEntries.length > 1;
222 const showSidebar = !isSearching && (!isLocked || showLockedInstanceSidebar);
223 const sidebarInstanceEntries = showLockedInstanceSidebar
224 ? lockedInstanceEntries
225 : instanceEntries;
226 const instanceOrder = useMemo(
227 () => instanceEntries.map((entry) => entry.instanceId),
228 [instanceEntries],
229 );
230
231 // Filter models based on search query and selected instance
232 const filteredModels = useMemo(() => {
233 let result = flatModels;
234
235 // Apply tokenized fuzzy search across the combined provider/model search fields.
236 if (searchQuery.trim()) {
237 const rankedMatches = result
238 .map((model) => ({
239 model,
240 score: scoreModelPickerSearch(
241 {
242 name: model.name,
243 ...(model.shortName ? { shortName: model.shortName } : {}),
244 ...(model.subProvider ? { subProvider: model.subProvider } : {}),
245 driverKind: model.driverKind,
246 providerDisplayName: model.instanceDisplayName,
247 isFavorite: favoritesSet.has(providerModelKey(model.instanceId, model.slug)),
248 },
249 searchQuery,
250 ),
251 isFavorite: favoritesSet.has(providerModelKey(model.instanceId, model.slug)),
252 tieBreaker: buildModelPickerSearchText({
253 name: model.name,
254 ...(model.shortName ? { shortName: model.shortName } : {}),
255 ...(model.subProvider ? { subProvider: model.subProvider } : {}),
256 driverKind: model.driverKind,
257 providerDisplayName: model.instanceDisplayName,
258 }),
259 }))
260 .filter(
261 (
262 rankedModel,
263 ): rankedModel is {
264 model: ModelPickerItem;
265 score: number;
266 isFavorite: boolean;
267 tieBreaker: string;
268 } => rankedModel.score !== null,
269 );
270
271 // When searching, we only respect locked provider (by driver kind),
272 // ignoring sidebar selection so account-scoped searches can find a
273 // model before the user chooses a specific instance rail item.
274 if (props.lockedProvider !== null) {
275 const lockedProviderMatches: Array<(typeof rankedMatches)[number]> = [];
276 for (const rankedModel of rankedMatches) {
277 if (matchesLockedProvider(rankedModel.model)) {
278 lockedProviderMatches.push(rankedModel);
279 }
280 }
281 return lockedProviderMatches
282 .toSorted((a, b) => {
283 const scoreDelta = a.score - b.score;
284 if (scoreDelta !== 0) {
285 return scoreDelta;
286 }
287 if (a.isFavorite !== b.isFavorite) {
288 return a.isFavorite ? -1 : 1;
289 }
290 return a.tieBreaker.localeCompare(b.tieBreaker);
291 })
292 .map((rankedModel) => rankedModel.model);
293 }
294
295 return rankedMatches
296 .toSorted((a, b) => {
297 const scoreDelta = a.score - b.score;
298 if (scoreDelta !== 0) {
299 return scoreDelta;
300 }
301 if (a.isFavorite !== b.isFavorite) {
302 return a.isFavorite ? -1 : 1;
303 }
304 return a.tieBreaker.localeCompare(b.tieBreaker);
305 })
306 .map((rankedModel) => rankedModel.model);
307 }
308
309 if (props.lockedProvider !== null) {
310 result = result.filter((m) => matchesLockedProvider(m));
311 if (showLockedInstanceSidebar) {
312 result = result.filter((m) => m.instanceId === selectedInstanceId);
313 }
314 } else if (selectedInstanceId === "favorites") {
315 result = result.filter((m) => favoritesSet.has(providerModelKey(m.instanceId, m.slug)));
316 } else {
317 result = result.filter((m) => m.instanceId === selectedInstanceId);
318 }
319
320 return sortProviderModelItems(result, {
321 favoriteModelKeys: favoritesSet,
322 groupFavorites: selectedInstanceId !== "favorites",
323 instanceOrder: selectedInstanceId === "favorites" ? instanceOrder : [],
324 });
325 }, [
326 favoritesSet,
327 flatModels,
328 instanceOrder,
329 matchesLockedProvider,
330 props.lockedProvider,
331 searchQuery,
332 showLockedInstanceSidebar,
333 selectedInstanceId,
334 ]);
335
336 const handleModelSelect = useCallback(
337 (modelSlug: string, instanceId: ProviderInstanceId) => {
338 const options = modelOptionsByInstance.get(instanceId);
339 if (!options) {
340 return;
341 }
342 const entry = entryByInstanceId.get(instanceId);
343 if (!entry) {
344 return;
345 }
346 // `resolveSelectableModel` uses the driver kind for normalization
347 // (slug casing etc.). Custom instances share their driver's
348 // normalization rules, so pass the driver kind here.
349 const resolvedModel = resolveSelectableModel(entry.driverKind, modelSlug, options);
350 if (resolvedModel) {
351 onInstanceModelChange(instanceId, resolvedModel);
352 }
353 },
354 [entryByInstanceId, modelOptionsByInstance, onInstanceModelChange],
355 );
356
357 const toggleFavorite = useCallback(
358 (instanceId: ProviderInstanceId, model: string) => {
359 const newFavorites = [...favorites];
360 const index = newFavorites.findIndex((f) => f.provider === instanceId && f.model === model);
361 if (index >= 0) {
362 newFavorites.splice(index, 1);
363 } else {
364 newFavorites.push({ provider: instanceId, model });
365 }
366 updateSettings({ favorites: newFavorites });
367 },
368 [favorites, updateSettings],
369 );
370
371 const LockedProviderIcon =
372 isLocked && props.lockedProvider ? PROVIDER_ICON_BY_PROVIDER[props.lockedProvider] : null;
373 // Header label for locked mode. Use the active instance's displayName
374 // when the lock narrows to exactly one instance (so "Codex Personal"
375 // shows instead of the generic driver label); fall back to the first
376 // matching entry otherwise.
377 const lockedHeaderLabel = useMemo(() => {
378 if (!isLocked || !props.lockedProvider) return null;
379 const matches = instanceEntries.filter((entry) => matchesLockedProvider(entry));
380 if (matches.length === 0) return null;
381 const active = matches.find((entry) => entry.instanceId === props.activeInstanceId);
382 return (active ?? matches[0])?.displayName ?? null;
383 }, [
384 isLocked,
385 matchesLockedProvider,
386 props.lockedProvider,
387 props.activeInstanceId,
388 instanceEntries,
389 ]);
390 const modelJumpCommandByKey = useMemo(() => {
391 const mapping = new Map<
392 string,
393 NonNullable<ReturnType<typeof modelPickerJumpCommandForIndex>>
394 >();
395 for (const [visibleModelIndex, model] of filteredModels.entries()) {
396 const jumpCommand = modelPickerJumpCommandForIndex(visibleModelIndex);
397 if (!jumpCommand) {
398 return mapping;
399 }
400 mapping.set(`${model.instanceId}:${model.slug}`, jumpCommand);
401 }
402 return mapping;
403 }, [filteredModels]);
404 const modelJumpModelKeys = useMemo(
405 () => [...modelJumpCommandByKey.keys()],
406 [modelJumpCommandByKey],
407 );
408 const allModelKeys = useMemo(
409 (): string[] => flatModels.map((model) => `${model.instanceId}:${model.slug}`),
410 [flatModels],
411 );
412 const filteredModelKeys = useMemo(
413 (): string[] => filteredModels.map((model) => `${model.instanceId}:${model.slug}`),
414 [filteredModels],
415 );
416 const filteredModelByKey = useMemo(
417 (): ReadonlyMap<string, ModelPickerItem> =>
418 new Map(filteredModels.map((model) => [`${model.instanceId}:${model.slug}`, model] as const)),
419 [filteredModels],
420 );
421 const modelJumpShortcutContext = useMemo(
422 () =>
423 ({
424 terminalFocus: false,
425 terminalOpen: props.terminalOpen,
426 modelPickerOpen: true,
427 }) as const,
428 [props.terminalOpen],
429 );
430 const modelJumpLabelByKey = useMemo((): ReadonlyMap<string, string> => {
431 if (modelJumpCommandByKey.size === 0) {
432 return EMPTY_MODEL_JUMP_LABELS;
433 }
434 const shortcutLabelOptions = {
435 platform: navigator.platform,
436 context: modelJumpShortcutContext,
437 };
438 const mapping = new Map<string, string>();
439 for (const [modelKey, command] of modelJumpCommandByKey) {
440 const label = shortcutLabelForCommand(keybindings, command, shortcutLabelOptions);
441 if (label) {
442 mapping.set(modelKey, label);
443 }
444 }
445 return mapping.size > 0 ? mapping : EMPTY_MODEL_JUMP_LABELS;
446 }, [keybindings, modelJumpCommandByKey, modelJumpShortcutContext]);
447
448 useEffect(() => {
449 const onWindowKeyDown = (event: globalThis.KeyboardEvent) => {
450 if (event.defaultPrevented || event.repeat) {
451 return;
452 }
453
454 const command = resolveShortcutCommand(event, keybindings, {
455 platform: navigator.platform,
456 context: modelJumpShortcutContext,
457 });
458 const jumpIndex = modelPickerJumpIndexFromCommand(command ?? "");
459 if (jumpIndex === null) {
460 return;
461 }
462
463 const targetModelKey = modelJumpModelKeys[jumpIndex];
464 if (!targetModelKey) {
465 return;
466 }
467 const { instanceId, slug } = splitInstanceModelKey(targetModelKey);
468 event.preventDefault();
469 event.stopPropagation();
470 handleModelSelect(slug, instanceId);
471 };
472
473 window.addEventListener("keydown", onWindowKeyDown, true);
474
475 return () => {
476 window.removeEventListener("keydown", onWindowKeyDown, true);
477 };
478 }, [handleModelSelect, keybindings, modelJumpModelKeys, modelJumpShortcutContext]);
479
480 useLayoutEffect(() => {
481 const listRegion = listRegionRef.current;
482 if (!listRegion) {
483 return;
484 }
485
486 let cancelled = false;
487 let frame = 0;
488 let nestedFrame = 0;
489 let timeout = 0;
490
491 const measureScrollArea = () => {
492 if (cancelled) {
493 return;
494 }
495 const viewport = listRegion.querySelector<HTMLElement>('[data-slot="scroll-area-viewport"]');
496 if (!viewport || viewport.scrollHeight <= viewport.clientHeight) {
497 return;
498 }
499 const originalScrollTop = viewport.scrollTop;
500 const maxScrollTop = viewport.scrollHeight - viewport.clientHeight;
501 if (maxScrollTop <= 0) {
502 return;
503 }
504 viewport.scrollTop = Math.min(originalScrollTop + 1, maxScrollTop);
505 viewport.scrollTop = originalScrollTop;
506 };
507
508 queueMicrotask(measureScrollArea);
509 frame = window.requestAnimationFrame(() => {
510 measureScrollArea();
511 nestedFrame = window.requestAnimationFrame(measureScrollArea);
512 });
513 timeout = window.setTimeout(measureScrollArea, 0);
514
515 return () => {
516 cancelled = true;
517 window.cancelAnimationFrame(frame);
518 window.cancelAnimationFrame(nestedFrame);
519 window.clearTimeout(timeout);
520 };
521 }, [filteredModelKeys]);
522
523 return (
524 <TooltipProvider delay={0}>
525 <div
526 className={cn(
527 "relative flex h-screen max-h-96 w-screen max-w-100 overflow-hidden rounded-lg border bg-popover not-dark:bg-clip-padding text-popover-foreground shadow-lg/5 before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",
528 isLocked && !showLockedInstanceSidebar ? "flex-col" : "flex-row",
529 )}
530 >
531 {/* Locked provider header (only shown in locked mode) */}
532 {isLocked && !showLockedInstanceSidebar && LockedProviderIcon && lockedHeaderLabel && (
533 <div className="flex items-center gap-2 px-4 py-3 border-b">
534 <LockedProviderIcon className="size-5 shrink-0" />
535 <span className="font-medium text-sm">{lockedHeaderLabel}</span>
536 </div>
537 )}
538
539 {/* Sidebar (only in unlocked mode) */}
540 {showSidebar && (
541 <ModelPickerSidebar
542 selectedInstanceId={selectedInstanceId}
543 onSelectInstance={handleSelectInstance}
544 instanceEntries={sidebarInstanceEntries}
545 showFavorites={!isLocked}
546 showComingSoon={!isLocked}
547 />
548 )}
549
550 {/* Main content area */}
551 <Combobox
552 inline
553 items={allModelKeys}
554 filteredItems={filteredModelKeys}
555 filter={null}
556 autoHighlight
557 open
558 value={`${props.activeInstanceId}:${props.model}`}
559 onItemHighlighted={(modelKey) => {
560 highlightedModelKeyRef.current = typeof modelKey === "string" ? modelKey : null;
561 }}
562 onValueChange={(modelKey) => {
563 if (typeof modelKey !== "string") {
564 return;
565 }
566 const { instanceId, slug } = splitInstanceModelKey(modelKey);
567 handleModelSelect(slug, instanceId);
568 }}
569 >
570 <div
571 className={cn(
572 "flex min-h-0 flex-1 flex-col overflow-hidden",
573 isLocked && !showLockedInstanceSidebar ? "min-w-0" : showSidebar && "border-l",
574 )}
575 >
576 {/* Search bar */}
577 <div className="border-b px-3 py-2">
578 <ComboboxInput
579 ref={searchInputRef}
580 className="[&_input]:font-sans rounded-md"
581 inputClassName="border-0 shadow-none ring-0 focus-visible:ring-0"
582 placeholder="Search models..."
583 showTrigger={false}
584 startAddon={<SearchIcon className="size-4 shrink-0 text-muted-foreground/50" />}
585 value={searchQuery}
586 onChange={(e) => setSearchQuery(e.target.value)}
587 onKeyDown={(e) => {
588 if (e.key === "Escape") {
589 e.preventDefault();
590 e.stopPropagation();
591 props.onRequestClose?.();
592 return;
593 }
594 if (e.key === "Enter" && highlightedModelKeyRef.current) {
595 (
596 e as typeof e & { preventBaseUIHandler?: () => void }
597 ).preventBaseUIHandler?.();
598 e.preventDefault();
599 e.stopPropagation();
600 const { instanceId, slug } = splitInstanceModelKey(
601 highlightedModelKeyRef.current,
602 );
603 handleModelSelect(slug, instanceId);
604 return;
605 }
606 e.stopPropagation();
607 }}
608 onMouseDown={(e) => e.stopPropagation()}
609 onTouchStart={(e) => e.stopPropagation()}
610 size="sm"
611 />
612 </div>
613
614 {/* Model list */}
615 <div
616 ref={listRegionRef}
617 className="relative min-h-0 flex-1 before:pointer-events-none before:absolute before:inset-0 before:bg-muted/40"
618 >
619 <ComboboxList className="model-picker-list size-full divide-y px-2 py-1">
620 {filteredModelKeys.map((modelKey, index) => {
621 const model = filteredModelByKey.get(modelKey);
622 if (!model) {
623 return null;
624 }
625 return (
626 <ModelListRow
627 key={modelKey}
628 index={index}
629 model={model}
630 instanceId={model.instanceId}
631 driverKind={model.driverKind}
632 providerDisplayName={model.instanceDisplayName}
633 providerAccentColor={model.instanceAccentColor}
634 isFavorite={favoritesSet.has(modelKey)}
635 showProvider={!isLocked || showLockedInstanceSidebar}
636 preferShortName={!isLocked}
637 useTriggerLabel={isLocked && !showLockedInstanceSidebar}
638 showNewBadge={isModelPickerNewModel(model.driverKind, model.slug)}
639 jumpLabel={modelJumpLabelByKey.get(modelKey) ?? null}
640 onToggleFavorite={() => toggleFavorite(model.instanceId, model.slug)}
641 />
642 );
643 })}
644 </ComboboxList>
645 </div>
646 <ComboboxEmpty className="not-empty:py-6 empty:h-0 text-xs font-normal leading-snug">
647 No models found
648 </ComboboxEmpty>
649 </div>
650 </Combobox>
651 </div>
652 </TooltipProvider>
653 );
654});