tune grsai gpt image health handling
This commit is contained in:
parent
1aaf904fd3
commit
36654a6fa3
@ -533,6 +533,8 @@ function formatImageResponse(
|
|||||||
const GRSAI_NANO_BANANA_SUBMIT_TIMEOUT_MS = 30000;
|
const GRSAI_NANO_BANANA_SUBMIT_TIMEOUT_MS = 30000;
|
||||||
const GRSAI_NANO_BANANA_POLL_TIMEOUT_MS = 30000;
|
const GRSAI_NANO_BANANA_POLL_TIMEOUT_MS = 30000;
|
||||||
const GRSAI_NANO_BANANA_POLL_INTERVAL_MS = 5000;
|
const GRSAI_NANO_BANANA_POLL_INTERVAL_MS = 5000;
|
||||||
|
const GRSAI_GPT_IMAGE_TIMEOUT_MS = 300000;
|
||||||
|
const GRSAI_GPT_IMAGE_4K_TIMEOUT_MS = 420000;
|
||||||
|
|
||||||
function isRecord(value: unknown): value is Record<string, any> {
|
function isRecord(value: unknown): value is Record<string, any> {
|
||||||
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
||||||
@ -1003,7 +1005,10 @@ async function sendGeminiRequest(
|
|||||||
`${apiLogPrefix} Resolved size: aspectRatio=${resolvedAspectRatio}, imageSize=${imageParams?.imageSize || "2K"} => ${resolvedSize}`
|
`${apiLogPrefix} Resolved size: aspectRatio=${resolvedAspectRatio}, imageSize=${imageParams?.imageSize || "2K"} => ${resolvedSize}`
|
||||||
);
|
);
|
||||||
|
|
||||||
const timeout = imageParams?.imageSize === "4K" ? 300000 : 120000;
|
const timeout =
|
||||||
|
imageParams?.imageSize === "4K"
|
||||||
|
? GRSAI_GPT_IMAGE_4K_TIMEOUT_MS
|
||||||
|
: GRSAI_GPT_IMAGE_TIMEOUT_MS;
|
||||||
logger.debug(`${apiLogPrefix} Timeout set to ${timeout / 1000} seconds for ${imageParams?.imageSize || "default"}`);
|
logger.debug(`${apiLogPrefix} Timeout set to ${timeout / 1000} seconds for ${imageParams?.imageSize || "default"}`);
|
||||||
return sendGrsaiGptImageRequest({
|
return sendGrsaiGptImageRequest({
|
||||||
baseURL,
|
baseURL,
|
||||||
|
|||||||
@ -70,6 +70,7 @@ export function classifyAiModelHealthFailure(error: unknown): {
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
normalized.includes("生成结果未通过替换质检") ||
|
normalized.includes("生成结果未通过替换质检") ||
|
||||||
|
normalized.includes("output_moderation") ||
|
||||||
normalized.includes("quality check") ||
|
normalized.includes("quality check") ||
|
||||||
normalized.includes("review result") ||
|
normalized.includes("review result") ||
|
||||||
normalized.includes("content policy") ||
|
normalized.includes("content policy") ||
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user