fix: change HTTP status code from 400 to 502 when no provider available

Fixes #1082

When all Antigravity accounts are unavailable, the error response now returns
HTTP 502 (Bad Gateway) instead of HTTP 400 (Bad Request). This ensures that
NewAPI and other clients will retry the request on a different channel,
improving overall reliability.
This commit is contained in:
lieyan666
2026-01-23 23:45:14 +08:00
parent 19b4ef33e0
commit 6da7ed53f2

View File

@@ -615,7 +615,7 @@ func (h *BaseAPIHandler) getRequestDetails(modelName string) (providers []string
} }
if len(providers) == 0 { if len(providers) == 0 {
return nil, "", &interfaces.ErrorMessage{StatusCode: http.StatusBadRequest, Error: fmt.Errorf("unknown provider for model %s", modelName)} return nil, "", &interfaces.ErrorMessage{StatusCode: http.StatusBadGateway, Error: fmt.Errorf("unknown provider for model %s", modelName)}
} }
// The thinking suffix is preserved in the model name itself, so no // The thinking suffix is preserved in the model name itself, so no