diff --git a/components/agents/AgentGenerationWorkspaceDarkV2.tsx b/components/agents/AgentGenerationWorkspaceDarkV2.tsx index c765b920e..30381c7ec 100644 --- a/components/agents/AgentGenerationWorkspaceDarkV2.tsx +++ b/components/agents/AgentGenerationWorkspaceDarkV2.tsx @@ -770,7 +770,7 @@ type DirectDetailReviewResult = { }; const AGENT_IMAGE_TASK_POLL_INTERVAL_MS = 1600; -const AGENT_IMAGE_TASK_TIMEOUT_MS = 8 * 60 * 1000; +const AGENT_IMAGE_TASK_TIMEOUT_MS = 20 * 60 * 1000; const AGENT_DETAIL_IMAGE_PARALLEL_WORKER_COUNT = 4; function sleep(ms: number) { diff --git a/components/canvas/CanvasChatPanel.tsx b/components/canvas/CanvasChatPanel.tsx index e9ffba684..c4d56f2e5 100644 --- a/components/canvas/CanvasChatPanel.tsx +++ b/components/canvas/CanvasChatPanel.tsx @@ -435,7 +435,7 @@ const CANVAS_AGENT_SECTION_TITLES = new Set([ "输出设置", ]); const CANVAS_IMAGE_TASK_POLL_INTERVAL_MS = 1600; -const CANVAS_IMAGE_TASK_TIMEOUT_MS = 4 * 60 * 1000; +const CANVAS_IMAGE_TASK_TIMEOUT_MS = 20 * 60 * 1000; const CANVAS_GENERATION_NODE_GAP = 56; const CANVAS_GENERATION_STACK_GAP = 28; const CANVAS_GENERATION_COLLISION_GAP = 32; diff --git a/components/canvas/nodes/image-node/image-node-local-edit.ts b/components/canvas/nodes/image-node/image-node-local-edit.ts index d6bcb23d8..7fab1b769 100644 --- a/components/canvas/nodes/image-node/image-node-local-edit.ts +++ b/components/canvas/nodes/image-node/image-node-local-edit.ts @@ -37,7 +37,7 @@ export const LOCAL_EDIT_MAX_REGIONS = 8; export const LOCAL_EDIT_MAX_REFERENCE_IMAGES_PER_REGION = 3; export const LOCAL_EDIT_MIN_EDGE_PX = 24; export const LOCAL_EDIT_POLL_INTERVAL_MS = 2500; -export const LOCAL_EDIT_MAX_POLL_ATTEMPTS = 192; +export const LOCAL_EDIT_MAX_POLL_ATTEMPTS = 480; export const LOCAL_EDIT_COLORS = [ "#ef4444", "#2563eb", diff --git a/lib/ai/providers/gemini-image.ts b/lib/ai/providers/gemini-image.ts index 30c32f393..588b9ab72 100644 --- a/lib/ai/providers/gemini-image.ts +++ b/lib/ai/providers/gemini-image.ts @@ -640,8 +640,8 @@ function formatImageResponse( const GRSAI_NANO_BANANA_SUBMIT_TIMEOUT_MS = 30000; const GRSAI_NANO_BANANA_POLL_TIMEOUT_MS = 30000; const GRSAI_NANO_BANANA_POLL_INTERVAL_MS = 5000; -const GRSAI_GPT_IMAGE_TIMEOUT_MS = 540000; -const GRSAI_GPT_IMAGE_4K_TIMEOUT_MS = 570000; +const GRSAI_GPT_IMAGE_TIMEOUT_MS = 12 * 60 * 1000; +const GRSAI_GPT_IMAGE_4K_TIMEOUT_MS = 14 * 60 * 1000; function isRecord(value: unknown): value is Record { return Boolean(value && typeof value === "object" && !Array.isArray(value)); diff --git a/lib/ai/runtime/direct-agent-image-edit-executor.ts b/lib/ai/runtime/direct-agent-image-edit-executor.ts index b83688a8a..e82964f1d 100644 --- a/lib/ai/runtime/direct-agent-image-edit-executor.ts +++ b/lib/ai/runtime/direct-agent-image-edit-executor.ts @@ -122,7 +122,7 @@ async function executeDirectAgentEnhanceJob(params: { messageId: params.messageId, sourceImageUrl: params.imageUrl, }, - timeoutMs: 8 * 60 * 1000, + timeoutMs: 20 * 60 * 1000, headers: cookieHeader ? { cookie: cookieHeader, diff --git a/lib/canvas/generate-image.ts b/lib/canvas/generate-image.ts index b0b2d90e6..446eba90c 100644 --- a/lib/canvas/generate-image.ts +++ b/lib/canvas/generate-image.ts @@ -1539,29 +1539,41 @@ export async function generateCanvasImage( await slot.release(); } - await recordAiModelHealthFailure({ - model: selectedModel.model, - provider, - error: caughtError, - context: debugLabel, - elapsedMs: Date.now() - startedAt, - metadata: { - aspectRatio, - imageSize, - imageCount, - requestedReferenceImageCount: normalizedReferenceImages.length, - reachableReferenceImageCount: reachableReferenceImages.length, - effectiveReferenceImageCount: effectiveReferenceImages.length, - droppedReferenceImageCount: unreachableReferenceImages.length, - ...debugMeta, - }, - }).catch((healthError) => { - console.warn("[Canvas Generate Image] Record model health failure failed:", { + const scaleAdjustRejected = + caughtError instanceof ScaleAdjustOutputRejectedError; + + if (scaleAdjustRejected) { + console.info("[Canvas Generate Image] Skip model health failure for scale adjust rejection:", { + debugLabel, selectedModelRef: selectedModel.model.id, selectedModelId: selectedModel.model.modelId, - error: healthError instanceof Error ? healthError.message : String(healthError), + error: caughtError instanceof Error ? caughtError.message : String(caughtError), }); - }); + } else { + await recordAiModelHealthFailure({ + model: selectedModel.model, + provider, + error: caughtError, + context: debugLabel, + elapsedMs: Date.now() - startedAt, + metadata: { + aspectRatio, + imageSize, + imageCount, + requestedReferenceImageCount: normalizedReferenceImages.length, + reachableReferenceImageCount: reachableReferenceImages.length, + effectiveReferenceImageCount: effectiveReferenceImages.length, + droppedReferenceImageCount: unreachableReferenceImages.length, + ...debugMeta, + }, + }).catch((healthError) => { + console.warn("[Canvas Generate Image] Record model health failure failed:", { + selectedModelRef: selectedModel.model.id, + selectedModelId: selectedModel.model.modelId, + error: healthError instanceof Error ? healthError.message : String(healthError), + }); + }); + } const failedModelRefs = Array.from( new Set([ @@ -1573,8 +1585,6 @@ export async function generateCanvasImage( ].filter(Boolean)) ); const allowFailover = request.allowFailover !== false; - const scaleAdjustRejected = - caughtError instanceof ScaleAdjustOutputRejectedError; const shouldFailover = shouldFailoverAiModelError(caughtError) || scaleAdjustRejected || diff --git a/lib/client/long-task.ts b/lib/client/long-task.ts index cd7358837..04e6e9d96 100644 --- a/lib/client/long-task.ts +++ b/lib/client/long-task.ts @@ -119,7 +119,7 @@ export async function requestLongTaskResult(params: { pollingParams.set(key, String(value)); } - const timeoutMs = Math.max(10_000, params.timeoutMs ?? 8 * 60 * 1000); + const timeoutMs = Math.max(10_000, params.timeoutMs ?? 20 * 60 * 1000); const maxPollFailures = Math.max(1, params.maxPollFailures ?? 4); const startedAt = Date.now(); let pollAfterMs = Math.max(800, Number(result?.pollAfterMs || 1500));