Merge remote-tracking branch 'upstream/master'
# Conflicts: # open-sse/handlers/chatCore.js # open-sse/providers/registry/index.js # open-sse/services/usage.js
This commit is contained in:
commit
eaf204b83c
114 files changed
+5587
-2184
No files matched your search
@@ -7,6 +7,7 @@ import {
|
||||
extractApiKey,
|
||||
isValidApiKey,
|
||||
} from "../services/auth.js";
|
||||
import { handleAntigravityQuotaError } from "../services/antigravityQuota.js";
|
||||
import { getSettings } from "@/lib/localDb";
|
||||
import { getModelInfo, getComboModels } from "../services/model.js";
|
||||
import { handleChatCore } from "open-sse/handlers/chatCore.js";
|
||||
@@ -274,6 +275,7 @@ async function handleSingleModelChat(body, modelStr, clientRawRequest = null, re
|
||||
headroomEnabled: !!chatSettings.headroomEnabled,
|
||||
headroomUrl: chatSettings.headroomUrl || DEFAULT_HEADROOM_URL,
|
||||
headroomCompressUserMessages: !!chatSettings.headroomCompressUserMessages,
|
||||
headroomTimeoutMs: chatSettings.headroomTimeoutMs,
|
||||
cavemanEnabled: !!chatSettings.cavemanEnabled,
|
||||
cavemanLevel: chatSettings.cavemanLevel || "full",
|
||||
ponytailEnabled: !!chatSettings.ponytailEnabled,
|
||||
@@ -318,8 +320,22 @@ async function handleSingleModelChat(body, modelStr, clientRawRequest = null, re
|
||||
|
||||
if (result.success) return result.response;
|
||||
|
||||
// Mark account unavailable (auto-calculates cooldown with exponential backoff, or precise resetsAtMs)
|
||||
const { shouldFallback } = await markAccountUnavailable(credentials.connectionId, result.status, result.error, provider, model, result.resetsAtMs);
|
||||
// Antigravity 409/429: refresh live quota to get exact resetAt before locking
|
||||
let quotaResetMs = null;
|
||||
let resetsAtMs = result.resetsAtMs;
|
||||
if (provider === "antigravity" && (result.status === 409 || result.status === 429)) {
|
||||
quotaResetMs = await handleAntigravityQuotaError(
|
||||
credentials.connectionId, result.status, model,
|
||||
refreshedCredentials.accessToken, credentials.providerSpecificData
|
||||
);
|
||||
if (quotaResetMs) resetsAtMs = quotaResetMs;
|
||||
}
|
||||
|
||||
// Exhausted Antigravity model is blocked only in RAM cache until upstream resetAt.
|
||||
// Do not persist a modelLock_* for this path.
|
||||
const shouldFallback = provider === "antigravity" && quotaResetMs
|
||||
? true
|
||||
: (await markAccountUnavailable(credentials.connectionId, result.status, result.error, provider, model, resetsAtMs)).shouldFallback;
|
||||
|
||||
if (shouldFallback) {
|
||||
log.warn("FALLBACK", `⇄ ACC:${credentials.connectionName} UNAVAILABLE (${result.status}) → NEXT ACCOUNT`);
|
||||
|
||||
Reference in new issue
Block a user