fix: retry model fallback on rate limits

This commit is contained in:
CI
2026-01-05 18:04:36 +01:00
committed by Peter Steinberger
parent 7900d33701
commit 5622dfe86b
3 changed files with 52 additions and 0 deletions

View File

@@ -109,3 +109,12 @@ export function formatAssistantErrorText(
// Keep it short for WhatsApp.
return raw.length > 600 ? `${raw.slice(0, 600)}` : raw;
}
export function isRateLimitAssistantError(
msg: AssistantMessage | undefined,
): boolean {
if (!msg || msg.stopReason !== "error") return false;
const raw = (msg.errorMessage ?? "").toLowerCase();
if (!raw) return false;
return /rate[_ ]limit|too many requests|429/.test(raw);
}