Fix cloud

This commit is contained in:
decolua
2026-01-29 18:07:28 +07:00
parent 239377143e
commit c7219d0ac9
13 changed files with 40 additions and 33 deletions

View File

@@ -52,11 +52,20 @@ export async function handleComboChat({ body, models, handleSingleModel, log })
let errorText = result.statusText || "";
try {
const errorBody = await result.clone().json();
errorText = errorBody.error || errorBody.message || errorText;
errorText = errorBody?.error ?? errorBody?.message ?? errorText;
} catch {
// Ignore JSON parse errors
}
// Normalize error text to string (Worker-safe)
if (typeof errorText !== "string") {
try {
errorText = JSON.stringify(errorText);
} catch {
errorText = String(errorText);
}
}
// Check if should fallback to next model
const { shouldFallback } = checkFallbackError(result.status, errorText);