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
TypeScript a2aai-agentsai-gatewayanthropicclaudeclaude-codeclinecodexcopilotcursordeepseekfree-aigeminikimillm-gatewaymcpopenaiopenai-proxyqwentoken-saver
fix: resolve Gemini Code Assist review comments on models.dev integration
oyi777c59f0568105
diff --git a/src/app/(dashboard)/dashboard/settings/components/ModelsDevSyncTab.tsx b/src/app/(dashboard)/dashboard/settings/components/ModelsDevSyncTab.tsxindex c2ae96660d..cc30493021 100644--- a/src/app/(dashboard)/dashboard/settings/components/ModelsDevSyncTab.tsx+++ b/src/app/(dashboard)/dashboard/settings/components/ModelsDevSyncTab.tsx@@ -58,7 +58,10 @@ export default function ModelsDevSyncTab() {setIntervalHours(Math.round(intervalMs / 3600000));}})- .catch(() => {});+ .catch((err) => {+ console.error("Failed to fetch models.dev settings:", err);+ setFeedback({ type: "error", message: "Failed to load settings" });+ });}, [fetchStatus]);const triggerSync = async () => {@@ -113,15 +116,19 @@ export default function ModelsDevSyncTab() {};const updateInterval = async (hours: number) => {+ const oldInterval = intervalHours;setIntervalHours(hours);try {- await fetch("/api/settings", {+ const res = await fetch("/api/settings", {method: "PATCH",headers: { "Content-Type": "application/json" },body: JSON.stringify({ modelsDevSyncInterval: hours * 3600000 }),});+ if (!res.ok) {+ setIntervalHours(oldInterval);+ }} catch {- // Revert on failure+ setIntervalHours(oldInterval);}};diff --git a/src/app/api/settings/route.ts b/src/app/api/settings/route.tsindex 2de4af1636..e84e3f35a9 100644--- a/src/app/api/settings/route.ts+++ b/src/app/api/settings/route.ts@@ -44,6 +44,12 @@ export async function PATCH(request) {try {const rawBody = await request.json();+ // Capture old settings BEFORE update for comparison (needed for models.dev sync toggle)+ const oldSettings =+ "modelsDevSyncEnabled" in rawBody || "modelsDevSyncInterval" in rawBody+ ? await getSettings()+ : null;+// Zod validationconst validation = validateBody(updateSettingsSchema, rawBody);if (isValidationFailure(validation)) {@@ -149,16 +155,23 @@ export async function PATCH(request) {invalidateCacheControlSettingsCache();}- // Sync models.dev sync settings- if ("modelsDevSyncEnabled" in body) {+ // Sync models.dev sync settings (compare old vs new state)+ if (oldSettings && ("modelsDevSyncEnabled" in body || "modelsDevSyncInterval" in body)) {const { stopPeriodicSync, startPeriodicSync } = await import("@/lib/modelsDevSync");- const settings = await getSettings();- const wasEnabled = (settings as Record<string, unknown>).modelsDevSyncEnabled === true;- const isEnabled = body.modelsDevSyncEnabled === true;+ const wasEnabled = (oldSettings as Record<string, unknown>).modelsDevSyncEnabled === true;+ const isEnabled = settings.modelsDevSyncEnabled === true;+ const oldInterval = (oldSettings as Record<string, unknown>).modelsDevSyncInterval as+ | number+ | undefined;+ const newInterval = settings.modelsDevSyncInterval as number | undefined;+if (wasEnabled && !isEnabled) {stopPeriodicSync();} else if (!wasEnabled && isEnabled) {- startPeriodicSync();+ startPeriodicSync(newInterval);+ } else if (isEnabled && oldInterval !== newInterval) {+ stopPeriodicSync();+ startPeriodicSync(newInterval);}}