- Cap maximum cooldown for rate limit handling in account unavailability and single-model chat flows

- Dynamic custom model fetching for model selection
This commit is contained in:
decolua 2026-04-24 16:14:18 +07:00
parent c42c0146ab
commit cca615eaff
19 changed files with 108 additions and 60 deletions

View file

@ -1,7 +1,7 @@
import { NextResponse } from "next/server";
import { getSettings, updateSettings } from "@/lib/localDb";
import { applyOutboundProxyEnv } from "@/lib/network/outboundProxy";
import { setRtkEnabled } from "open-sse/rtk/flag.js";
import { resetComboRotation } from "open-sse/services/combo.js";
import bcrypt from "bcryptjs";
export async function GET() {
@ -67,10 +67,14 @@ export async function PATCH(request) {
applyOutboundProxyEnv(settings);
}
// Sync RTK toggle immediately (sync cache for request hot path)
if (Object.prototype.hasOwnProperty.call(body, "rtkEnabled")) {
setRtkEnabled(settings.rtkEnabled);
// Invalidate combo rotation state when strategy settings change
if (
Object.prototype.hasOwnProperty.call(body, "comboStrategy") ||
Object.prototype.hasOwnProperty.call(body, "comboStrategies")
) {
resetComboRotation();
}
const { password, ...safeSettings } = settings;
return NextResponse.json(safeSettings);
} catch (error) {