diff --git a/ui/src/components/settings/view/tabs/PilotDeckConfigTab.tsx b/ui/src/components/settings/view/tabs/PilotDeckConfigTab.tsx index d13f8937..503fd4a8 100644 --- a/ui/src/components/settings/view/tabs/PilotDeckConfigTab.tsx +++ b/ui/src/components/settings/view/tabs/PilotDeckConfigTab.tsx @@ -692,7 +692,7 @@ function ProviderCard({ const protocol = provider.protocol ?? catalogEntry?.protocol ?? 'openai'; const effectiveUrl = provider.url || catalogEntry?.defaultUrl || ''; const enabledModels = Object.keys(provider.models ?? {}); - const [newModelId, setNewModelId] = useState(''); + const newModelInputRef = useRef(null); const [providerIdDraft, setProviderIdDraft] = useState(providerId); const [providerIdError, setProviderIdError] = useState(''); const displayName = providerDisplayName( @@ -727,7 +727,7 @@ function ProviderCard({ if (!id) return; if (provider.models && id in provider.models) return; update({ models: { ...(provider.models ?? {}), [id]: {} } }); - setNewModelId(''); + if (newModelInputRef.current) newModelInputRef.current.value = ''; }; const removeModel = (mid: string) => { const next = { ...(provider.models ?? {}) }; @@ -902,13 +902,12 @@ function ProviderCard({ {/* Add custom model */}
setNewModelId(e.target.value)} + ref={newModelInputRef} placeholder={t('pilotDeckConfig.panels.models.customModelPlaceholder')} className="min-w-0 flex-1 rounded-md border border-border bg-background px-2 py-1 font-mono text-[11px] text-foreground outline-none focus:ring-1 focus:ring-ring" - onKeyDown={(e) => { if (e.key === 'Enter' && !isImeEnterEvent(e)) addModel(newModelId); }} + onKeyDown={(e) => { if (e.key === 'Enter' && !isImeEnterEvent(e)) addModel(e.currentTarget.value); }} /> -