{choice.configuration.model}
{!providerReady(choice.configuration.provider) && (
{MODEL_PROVIDERS[choice.configuration.provider].name}{" "}
· Set up in Settings
)}
{selected === choice.value && (
)}
))}
No models found.
);
}
function ModelSearchInput({ onClose }: { onClose: () => void }) {
const input = useRef(null);
useEffect(() => {
const field = input.current;
const dialog = field?.closest(".chat-model-dropdown");
if (!field || !dialog) return;
// The pinned ARIA adapter loses the active descendant when filtering replaces rows.
const syncFocus = () => {
const list = dialog.querySelector('[role="listbox"]');
const option = dialog.querySelector(
'[role="option"][data-focused="true"]',
);
if (list?.id) field.setAttribute("aria-controls", list.id);
if (option?.id) field.setAttribute("aria-activedescendant", option.id);
else field.removeAttribute("aria-activedescendant");
};
const observer = new MutationObserver(syncFocus);
observer.observe(dialog, {
subtree: true,
childList: true,
attributes: true,
attributeFilter: ["data-focused"],
});
syncFocus();
return () => observer.disconnect();
}, []);
return (
{
if (event.key === "Escape") {
event.preventDefault();
onClose();
return;
}
if (event.key !== "Enter" || event.isComposing) return;
const input = event.target as HTMLInputElement;
const option = input
.closest(".chat-model-dropdown")
?.querySelector(
'[role="option"][data-focused="true"]',
);
if (!option || option.getAttribute("aria-disabled") === "true")
return;
event.preventDefault();
option.click();
}}
/>
);
}