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:
@@ -305,10 +305,11 @@ func newImageGenerator(c config.Config) piagent.ImageGenerator {
|
||||
opts := c.Agent.Image
|
||||
apiKey := resolveImageAPIKey(opts)
|
||||
client := piagent.NewImageClient(piagent.ImageClientOptions{
|
||||
BaseURL: opts.BaseURL,
|
||||
APIKey: apiKey,
|
||||
InputImageTransport: opts.InputImageTransport,
|
||||
TimeoutSeconds: opts.TimeoutSeconds,
|
||||
BaseURL: opts.BaseURL,
|
||||
APIKey: apiKey,
|
||||
InputImageTransport: opts.InputImageTransport,
|
||||
TimeoutSeconds: opts.TimeoutSeconds,
|
||||
ResponseHeaderTimeoutSeconds: opts.ResponseHeaderTimeoutSeconds,
|
||||
})
|
||||
if client == nil {
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user