diff --git a/src/app/(dashboard)/dashboard/providers/[id]/page.tsx b/src/app/(dashboard)/dashboard/providers/[id]/page.tsx index 52198bfa42..81370b7d6f 100644 --- a/src/app/(dashboard)/dashboard/providers/[id]/page.tsx +++ b/src/app/(dashboard)/dashboard/providers/[id]/page.tsx @@ -529,7 +529,8 @@ function ModelCompatPopover({ const ref = useRef(null); const panelRef = useRef(null); const [portalPanelRect, setPortalPanelRect] = useState<{ - top: number; + top?: number; + bottom?: number; left: number; width: number; } | null>(null); @@ -621,7 +622,16 @@ function ModelCompatPopover({ const width = Math.min(window.innerWidth - 2 * margin, 24 * 16); let left = rect.right - width; left = Math.max(margin, Math.min(left, window.innerWidth - width - margin)); - setPortalPanelRect({ top: rect.bottom + 8, left, width }); + // Estimated panel height: capped at min(82vh, 42rem=672px) + const estimatedPanelHeight = Math.min(window.innerHeight * 0.82, 672); + const spaceBelow = window.innerHeight - rect.bottom - margin; + const spaceAbove = rect.top - margin; + if (spaceBelow < estimatedPanelHeight && spaceAbove > spaceBelow) { + // Not enough space below — open upward + setPortalPanelRect({ bottom: window.innerHeight - rect.top + 8, left, width }); + } else { + setPortalPanelRect({ top: rect.bottom + 8, left, width }); + } }, [open]); useLayoutEffect(() => { @@ -662,7 +672,9 @@ function ModelCompatPopover({ className={panelChromeClass} style={{ position: "fixed", - top: portalPanelRect.top, + ...(portalPanelRect.top !== undefined + ? { top: portalPanelRect.top } + : { bottom: portalPanelRect.bottom }), left: portalPanelRect.left, width: portalPanelRect.width, zIndex: 10040, diff --git a/src/app/(dashboard)/dashboard/settings/components/AutoDisableCard.tsx b/src/app/(dashboard)/dashboard/settings/components/AutoDisableCard.tsx index 3d3d0c3387..98bd920293 100644 --- a/src/app/(dashboard)/dashboard/settings/components/AutoDisableCard.tsx +++ b/src/app/(dashboard)/dashboard/settings/components/AutoDisableCard.tsx @@ -116,11 +116,10 @@ export default function AutoDisableCard() { onChange={(e) => setDraft((prev) => ({ ...prev, threshold: parseInt(e.target.value) || 1 })) } - disabled={!draft.enabled} /> ) : ( - {data.threshold} {t("failures", { count: data.threshold })} + {t("failures", { count: data.threshold })} )}

{t("autoDisableThresholdDesc")}

diff --git a/src/app/(dashboard)/dashboard/settings/components/ResilienceTab.tsx b/src/app/(dashboard)/dashboard/settings/components/ResilienceTab.tsx index 6e127dac38..e286af443b 100644 --- a/src/app/(dashboard)/dashboard/settings/components/ResilienceTab.tsx +++ b/src/app/(dashboard)/dashboard/settings/components/ResilienceTab.tsx @@ -79,7 +79,9 @@ function ProviderProfilesCard({ profiles, onSave, saving }) { ]; const handleSave = () => { - onSave(draft); + // Only send 'oauth' and 'apikey' — the API schema rejects any other keys (e.g. 'local') + const { oauth, apikey } = draft ?? {}; + onSave({ ...(oauth ? { oauth } : {}), ...(apikey ? { apikey } : {}) }); setEditMode(false); };