Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

ModelPickerContent.tsx

649 lines24.1 KB

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 };
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 return rankedMatches
276 .filter((rankedModel) => matchesLockedProvider(rankedModel.model))
277 .toSorted((a, b) => {
278 const scoreDelta = a.score - b.score;
279 if (scoreDelta !== 0) {
280 return scoreDelta;
281 }
282 if (a.isFavorite !== b.isFavorite) {
283 return a.isFavorite ? -1 : 1;
284 }
285 return a.tieBreaker.localeCompare(b.tieBreaker);
286 })
287 .map((rankedModel) => rankedModel.model);
288 }
289​
290 return rankedMatches
291 .toSorted((a, b) => {
292 const scoreDelta = a.score - b.score;
293 if (scoreDelta !== 0) {
294 return scoreDelta;
295 }
296 if (a.isFavorite !== b.isFavorite) {
297 return a.isFavorite ? -1 : 1;
298 }
299 return a.tieBreaker.localeCompare(b.tieBreaker);
300 })
301 .map((rankedModel) => rankedModel.model);
302 }
303​
304 if (props.lockedProvider !== null) {
305 result = result.filter((m) => matchesLockedProvider(m));
306 if (showLockedInstanceSidebar) {
307 result = result.filter((m) => m.instanceId === selectedInstanceId);
308 }
309 } else if (selectedInstanceId === "favorites") {
310 result = result.filter((m) => favoritesSet.has(providerModelKey(m.instanceId, m.slug)));
311 } else {
312 result = result.filter((m) => m.instanceId === selectedInstanceId);
313 }
314​
315 return sortProviderModelItems(result, {
316 favoriteModelKeys: favoritesSet,
317 groupFavorites: selectedInstanceId !== "favorites",
318 instanceOrder: selectedInstanceId === "favorites" ? instanceOrder : [],
319 });
320 }, [
321 favoritesSet,
322 flatModels,
323 instanceOrder,
324 matchesLockedProvider,
325 props.lockedProvider,
326 searchQuery,
327 showLockedInstanceSidebar,
328 selectedInstanceId,
329 ]);
330​
331 const handleModelSelect = useCallback(
332 (modelSlug: string, instanceId: ProviderInstanceId) => {
333 const options = modelOptionsByInstance.get(instanceId);
334 if (!options) {
335 return;
336 }
337 const entry = entryByInstanceId.get(instanceId);
338 if (!entry) {
339 return;
340 }
341 // `resolveSelectableModel` uses the driver kind for normalization
342 // (slug casing etc.). Custom instances share their driver's
343 // normalization rules, so pass the driver kind here.
344 const resolvedModel = resolveSelectableModel(entry.driverKind, modelSlug, options);
345 if (resolvedModel) {
346 onInstanceModelChange(instanceId, resolvedModel);
347 }
348 },
349 [entryByInstanceId, modelOptionsByInstance, onInstanceModelChange],
350 );
351​
352 const toggleFavorite = useCallback(
353 (instanceId: ProviderInstanceId, model: string) => {
354 const newFavorites = [...favorites];
355 const index = newFavorites.findIndex((f) => f.provider === instanceId && f.model === model);
356 if (index >= 0) {
357 newFavorites.splice(index, 1);
358 } else {
359 newFavorites.push({ provider: instanceId, model });
360 }
361 updateSettings({ favorites: newFavorites });
362 },
363 [favorites, updateSettings],
364 );
365​
366 const LockedProviderIcon =
367 isLocked && props.lockedProvider ? PROVIDER_ICON_BY_PROVIDER[props.lockedProvider] : null;
368 // Header label for locked mode. Use the active instance's displayName
369 // when the lock narrows to exactly one instance (so "Codex Personal"
370 // shows instead of the generic driver label); fall back to the first
371 // matching entry otherwise.
372 const lockedHeaderLabel = useMemo(() => {
373 if (!isLocked || !props.lockedProvider) return null;
374 const matches = instanceEntries.filter((entry) => matchesLockedProvider(entry));
375 if (matches.length === 0) return null;
376 const active = matches.find((entry) => entry.instanceId === props.activeInstanceId);
377 return (active ?? matches[0])?.displayName ?? null;
378 }, [
379 isLocked,
380 matchesLockedProvider,
381 props.lockedProvider,
382 props.activeInstanceId,
383 instanceEntries,
384 ]);
385 const modelJumpCommandByKey = useMemo(() => {
386 const mapping = new Map<
387 string,
388 NonNullable<ReturnType<typeof modelPickerJumpCommandForIndex>>
389 >();
390 for (const [visibleModelIndex, model] of filteredModels.entries()) {
391 const jumpCommand = modelPickerJumpCommandForIndex(visibleModelIndex);
392 if (!jumpCommand) {
393 return mapping;
394 }
395 mapping.set(`${model.instanceId}:${model.slug}`, jumpCommand);
396 }
397 return mapping;
398 }, [filteredModels]);
399 const modelJumpModelKeys = useMemo(
400 () => [...modelJumpCommandByKey.keys()],
401 [modelJumpCommandByKey],
402 );
403 const allModelKeys = useMemo(
404 (): string[] => flatModels.map((model) => `${model.instanceId}:${model.slug}`),
405 [flatModels],
406 );
407 const filteredModelKeys = useMemo(
408 (): string[] => filteredModels.map((model) => `${model.instanceId}:${model.slug}`),
409 [filteredModels],
410 );
411 const filteredModelByKey = useMemo(
412 (): ReadonlyMap<string, ModelPickerItem> =>
413 new Map(filteredModels.map((model) => [`${model.instanceId}:${model.slug}`, model] as const)),
414 [filteredModels],
415 );
416 const modelJumpShortcutContext = useMemo(
417 () =>
418 ({
419 terminalFocus: false,
420 terminalOpen: props.terminalOpen,
421 modelPickerOpen: true,
422 }) as const,
423 [props.terminalOpen],
424 );
425 const modelJumpLabelByKey = useMemo((): ReadonlyMap<string, string> => {
426 if (modelJumpCommandByKey.size === 0) {
427 return EMPTY_MODEL_JUMP_LABELS;
428 }
429 const shortcutLabelOptions = {
430 platform: navigator.platform,
431 context: modelJumpShortcutContext,
432 };
433 const mapping = new Map<string, string>();
434 for (const [modelKey, command] of modelJumpCommandByKey) {
435 const label = shortcutLabelForCommand(keybindings, command, shortcutLabelOptions);
436 if (label) {
437 mapping.set(modelKey, label);
438 }
439 }
440 return mapping.size > 0 ? mapping : EMPTY_MODEL_JUMP_LABELS;
441 }, [keybindings, modelJumpCommandByKey, modelJumpShortcutContext]);
442​
443 useEffect(() => {
444 const onWindowKeyDown = (event: globalThis.KeyboardEvent) => {
445 if (event.defaultPrevented || event.repeat) {
446 return;
447 }
448​
449 const command = resolveShortcutCommand(event, keybindings, {
450 platform: navigator.platform,
451 context: modelJumpShortcutContext,
452 });
453 const jumpIndex = modelPickerJumpIndexFromCommand(command ?? "");
454 if (jumpIndex === null) {
455 return;
456 }
457​
458 const targetModelKey = modelJumpModelKeys[jumpIndex];
459 if (!targetModelKey) {
460 return;
461 }
462 const { instanceId, slug } = splitInstanceModelKey(targetModelKey);
463 event.preventDefault();
464 event.stopPropagation();
465 handleModelSelect(slug, instanceId);
466 };
467​
468 window.addEventListener("keydown", onWindowKeyDown, true);
469​
470 return () => {
471 window.removeEventListener("keydown", onWindowKeyDown, true);
472 };
473 }, [handleModelSelect, keybindings, modelJumpModelKeys, modelJumpShortcutContext]);
474​
475 useLayoutEffect(() => {
476 const listRegion = listRegionRef.current;
477 if (!listRegion) {
478 return;
479 }
480​
481 let cancelled = false;
482 let frame = 0;
483 let nestedFrame = 0;
484 let timeout = 0;
485​
486 const measureScrollArea = () => {
487 if (cancelled) {
488 return;
489 }
490 const viewport = listRegion.querySelector<HTMLElement>('[data-slot="scroll-area-viewport"]');
491 if (!viewport || viewport.scrollHeight <= viewport.clientHeight) {
492 return;
493 }
494 const originalScrollTop = viewport.scrollTop;
495 const maxScrollTop = viewport.scrollHeight - viewport.clientHeight;
496 if (maxScrollTop <= 0) {
497 return;
498 }
499 viewport.scrollTop = Math.min(originalScrollTop + 1, maxScrollTop);
500 viewport.scrollTop = originalScrollTop;
501 };
502​
503 queueMicrotask(measureScrollArea);
504 frame = window.requestAnimationFrame(() => {
505 measureScrollArea();
506 nestedFrame = window.requestAnimationFrame(measureScrollArea);
507 });
508 timeout = window.setTimeout(measureScrollArea, 0);
509​
510 return () => {
511 cancelled = true;
512 window.cancelAnimationFrame(frame);
513 window.cancelAnimationFrame(nestedFrame);
514 window.clearTimeout(timeout);
515 };
516 }, [filteredModelKeys]);
517​
518 return (
519 <TooltipProvider delay={0}>
520 <div
521 className={cn(
522 "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%)]",
523 isLocked && !showLockedInstanceSidebar ? "flex-col" : "flex-row",
524 )}
525 >
526 {/* Locked provider header (only shown in locked mode) */}
527 {isLocked && !showLockedInstanceSidebar && LockedProviderIcon && lockedHeaderLabel && (
528 <div className="flex items-center gap-2 px-4 py-3 border-b">
529 <LockedProviderIcon className="size-5 shrink-0" />
530 <span className="font-medium text-sm">{lockedHeaderLabel}</span>
531 </div>
532 )}
533​
534 {/* Sidebar (only in unlocked mode) */}
535 {showSidebar && (
536 <ModelPickerSidebar
537 selectedInstanceId={selectedInstanceId}
538 onSelectInstance={handleSelectInstance}
539 instanceEntries={sidebarInstanceEntries}
540 showFavorites={!isLocked}
541 showComingSoon={!isLocked}
542 />
543 )}
544​
545 {/* Main content area */}
546 <Combobox
547 inline
548 items={allModelKeys}
549 filteredItems={filteredModelKeys}
550 filter={null}
551 autoHighlight
552 open
553 value={`${props.activeInstanceId}:${props.model}`}
554 onItemHighlighted={(modelKey) => {
555 highlightedModelKeyRef.current = typeof modelKey === "string" ? modelKey : null;
556 }}
557 onValueChange={(modelKey) => {
558 if (typeof modelKey !== "string") {
559 return;
560 }
561 const { instanceId, slug } = splitInstanceModelKey(modelKey);
562 handleModelSelect(slug, instanceId);
563 }}
564 >
565 <div
566 className={cn(
567 "flex min-h-0 flex-1 flex-col overflow-hidden",
568 isLocked && !showLockedInstanceSidebar ? "min-w-0" : showSidebar && "border-l",
569 )}
570 >
571 {/* Search bar */}
572 <div className="border-b px-3 py-2">
573 <ComboboxInput
574 ref={searchInputRef}
575 className="[&_input]:font-sans rounded-md"
576 inputClassName="border-0 shadow-none ring-0 focus-visible:ring-0"
577 placeholder="Search models..."
578 showTrigger={false}
579 startAddon={<SearchIcon className="size-4 shrink-0 text-muted-foreground/50" />}
580 value={searchQuery}
581 onChange={(e) => setSearchQuery(e.target.value)}
582 onKeyDown={(e) => {
583 if (e.key === "Escape") {
584 e.preventDefault();
585 e.stopPropagation();
586 props.onRequestClose?.();
587 return;
588 }
589 if (e.key === "Enter" && highlightedModelKeyRef.current) {
590 (
591 e as typeof e & { preventBaseUIHandler?: () => void }
592 ).preventBaseUIHandler?.();
593 e.preventDefault();
594 e.stopPropagation();
595 const { instanceId, slug } = splitInstanceModelKey(
596 highlightedModelKeyRef.current,
597 );
598 handleModelSelect(slug, instanceId);
599 return;
600 }
601 e.stopPropagation();
602 }}
603 onMouseDown={(e) => e.stopPropagation()}
604 onTouchStart={(e) => e.stopPropagation()}
605 size="sm"
606 />
607 </div>
608​
609 {/* Model list */}
610 <div
611 ref={listRegionRef}
612 className="relative min-h-0 flex-1 before:pointer-events-none before:absolute before:inset-0 before:bg-muted/40"
613 >
614 <ComboboxList className="model-picker-list size-full divide-y px-2 py-1">
615 {filteredModelKeys.map((modelKey, index) => {
616 const model = filteredModelByKey.get(modelKey);
617 if (!model) {
618 return null;
619 }
620 return (
621 <ModelListRow
622 key={modelKey}
623 index={index}
624 model={model}
625 instanceId={model.instanceId}
626 driverKind={model.driverKind}
627 providerDisplayName={model.instanceDisplayName}
628 providerAccentColor={model.instanceAccentColor}
629 isFavorite={favoritesSet.has(modelKey)}
630 showProvider={!isLocked || showLockedInstanceSidebar}
631 preferShortName={!isLocked}
632 useTriggerLabel={isLocked && !showLockedInstanceSidebar}
633 showNewBadge={isModelPickerNewModel(model.driverKind, model.slug)}
634 jumpLabel={modelJumpLabelByKey.get(modelKey) ?? null}
635 onToggleFavorite={() => toggleFavorite(model.instanceId, model.slug)}
636 />
637 );
638 })}
639 </ComboboxList>
640 </div>
641 <ComboboxEmpty className="not-empty:py-6 empty:h-0 text-xs font-normal leading-snug">
642 No models found
643 </ComboboxEmpty>
644 </div>
645 </Combobox>
646 </div>
647 </TooltipProvider>
648 );
649});