fix(provider): 延长媒体超时并终止超时轮转

将图像和视频的默认 HTTP/轮询超时分别提高到 20 分钟和 30 分钟。媒体任务超时后直接失败,不再重试、切换客户端或标记为 upstream_submission_unknown。OpenAI 图像端点遇到上游明确拒绝 response_format 时自动移除并缓存兼容结论。

验证:go test ./... -count=1;go vet ./...;gofmt;相关 Shell bash -n、ShellCheck 与发布脚本回归测试。
This commit is contained in:
2026-08-05 13:58:02 +08:00
parent 9ce9053d7b
commit dd10a807df
23 changed files with 336 additions and 55 deletions
+3 -3
View File
@@ -190,7 +190,7 @@ func providerPostJSON(ctx context.Context, client *http.Client, url string, body
applyProviderAuth(req, credentials, auth)
resp, err := client.Do(req)
if err != nil {
return nil, "", &ClientError{Code: "network", Message: err.Error(), Retryable: true}
return nil, "", transportClientError(err)
}
requestID := requestIDFromHTTPResponse(resp)
result, err := decodeHTTPResponse(resp)
@@ -205,7 +205,7 @@ func providerGetJSON(ctx context.Context, client *http.Client, url string, crede
applyProviderAuth(req, credentials, auth)
resp, err := client.Do(req)
if err != nil {
return nil, "", &ClientError{Code: "network", Message: err.Error(), Retryable: true}
return nil, "", transportClientError(err)
}
requestID := requestIDFromHTTPResponse(resp)
result, err := decodeHTTPResponse(resp)
@@ -460,7 +460,7 @@ func providerPollInterval(request Request) time.Duration {
}
func providerPollTimeout(request Request) time.Duration {
return durationFromConfig(request.Candidate.PlatformConfig, 10*time.Minute, "pollTimeoutMs", "poll_timeout_ms", "timeoutMs")
return durationFromConfig(request.Candidate.PlatformConfig, ProviderRequestTimeout(request.Kind), "pollTimeoutMs", "poll_timeout_ms", "timeoutMs")
}
func durationFromConfig(config map[string]any, fallback time.Duration, keys ...string) time.Duration {