diff --git a/app/components/settings/llm-configurations-panel.tsx b/app/components/settings/llm-configurations-panel.tsx index 93e559c..8220cbc 100644 --- a/app/components/settings/llm-configurations-panel.tsx +++ b/app/components/settings/llm-configurations-panel.tsx @@ -224,17 +224,11 @@ export function LlmConfigurationsPanel() { - setDraft({ ...draft, model: e.target.value })} - list="llm-config-models" - placeholder="gpt-4o-mini" + models={modelsForProvider} + onChange={(model) => setDraft({ ...draft, model })} /> - - {modelsForProvider.map((m) => ( - void +}) { + const known = useMemo(() => new Set(models.map((m) => m.model)), [models]) + const isCustom = value !== "" && !known.has(value) + const [customMode, setCustomMode] = useState(isCustom) + + // Reset to dropdown if the available models change (e.g. provider switched) + // and we're not actively in custom mode. + useEffect(() => { + if (!isCustom) setCustomMode(false) + }, [models, isCustom]) + + if (customMode) { + return ( +
+ onChange(e.target.value)} + placeholder="custom-model-id" + autoFocus + /> + +
+ ) + } + + return ( + + ) +} + function Field({ label, children }: { label: string; children: React.ReactNode }) { return (