Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

fix(dashboard): resolve popover overflow, resilience API schema reject (#1039)

diegosouzapw6ea545df0558
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<HTMLDivElement>(null);
const panelRef = useRef<HTMLDivElement | null>(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}
/>
) : (
<span className={`text-sm font-mono ${!data.enabled && "opacity-50"}`}>
- {data.threshold} {t("failures", { count: data.threshold })}
+ {t("failures", { count: data.threshold })}
</span>
)}
<p className="text-xs text-text-muted mt-2">{t("autoDisableThresholdDesc")}</p>
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);
};