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 -2
View File
@@ -82,7 +82,8 @@ func (c OpenAIClient) Run(ctx context.Context, request Request) (Response, error
upstreamEndpoint := joinURL(openAIBaseURL(endpointKind, request.Candidate), endpoint)
responseStartedAt := time.Now()
correctionScope := newParameterCorrectionScope(request, endpointKind)
correctionEnabled := endpointKind == "chat.completions" || endpointKind == "responses"
correctionEnabled := endpointKind == "chat.completions" || endpointKind == "responses" ||
endpointKind == "images.generations" || endpointKind == "images.edits"
protectedCorrections := callerProtectedCorrectionParameters(request, endpointKind)
if correctionEnabled {
c.Corrections.apply(correctionScope, body, protectedCorrections)
@@ -108,7 +109,7 @@ func (c OpenAIClient) Run(ctx context.Context, request Request) (Response, error
}
resp, requestErr = requestClient.Do(req)
if requestErr != nil {
return Response{}, &ClientError{Code: "network", Message: requestErr.Error(), Retryable: true}
return Response{}, transportClientError(requestErr)
}
if err := notifyResponseReceived(request); err != nil {
_ = resp.Body.Close()