fix(image): add response-header timeout and idempotent retry

Give the image client a configurable ResponseHeaderTimeout (default 4m,
capped at the overall timeout) so a stalled upstream fails fast, and
retry such timeouts when an idempotency key is set so a slow-but-safe
request can recover instead of terminating. Raise the Next.js API proxy
maxDuration to 1200s to accommodate long generations.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-08 10:56:42 +08:00
parent 836de5b597
commit 1a1c0a6544
5 changed files with 79 additions and 18 deletions
+6 -5
View File
@@ -123,11 +123,12 @@ type AgentConfig struct {
}
type ImageGenerationConfig struct {
BaseURL string `json:",optional"`
APIKey string `json:",optional"`
APIKeyEnv string `json:",default=GPT_IMAGE_API_KEY"`
InputImageTransport string `json:",default=file"`
TimeoutSeconds int `json:",default=600"`
BaseURL string `json:",optional"`
APIKey string `json:",optional"`
APIKeyEnv string `json:",default=GPT_IMAGE_API_KEY"`
InputImageTransport string `json:",default=file"`
TimeoutSeconds int `json:",default=600"`
ResponseHeaderTimeoutSeconds int `json:",default=240"`
}
type TextExtractionConfig struct {