chore: gofmt antigravity gateway service
This commit is contained in:
@@ -33,18 +33,18 @@ const antigravityScopeRateLimitEnv = "GATEWAY_ANTIGRAVITY_429_SCOPE_LIMIT"
|
|||||||
|
|
||||||
// antigravityRetryLoopParams 重试循环的参数
|
// antigravityRetryLoopParams 重试循环的参数
|
||||||
type antigravityRetryLoopParams struct {
|
type antigravityRetryLoopParams struct {
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
prefix string
|
prefix string
|
||||||
account *Account
|
account *Account
|
||||||
proxyURL string
|
proxyURL string
|
||||||
accessToken string
|
accessToken string
|
||||||
action string
|
action string
|
||||||
body []byte
|
body []byte
|
||||||
quotaScope AntigravityQuotaScope
|
quotaScope AntigravityQuotaScope
|
||||||
c *gin.Context
|
c *gin.Context
|
||||||
httpUpstream HTTPUpstream
|
httpUpstream HTTPUpstream
|
||||||
settingService *SettingService
|
settingService *SettingService
|
||||||
handleError func(ctx context.Context, prefix string, account *Account, statusCode int, headers http.Header, body []byte, quotaScope AntigravityQuotaScope)
|
handleError func(ctx context.Context, prefix string, account *Account, statusCode int, headers http.Header, body []byte, quotaScope AntigravityQuotaScope)
|
||||||
}
|
}
|
||||||
|
|
||||||
// antigravityRetryLoopResult 重试循环的结果
|
// antigravityRetryLoopResult 重试循环的结果
|
||||||
@@ -769,18 +769,18 @@ func (s *AntigravityGatewayService) Forward(ctx context.Context, c *gin.Context,
|
|||||||
|
|
||||||
// 执行带重试的请求
|
// 执行带重试的请求
|
||||||
result, err := antigravityRetryLoop(antigravityRetryLoopParams{
|
result, err := antigravityRetryLoop(antigravityRetryLoopParams{
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
prefix: prefix,
|
prefix: prefix,
|
||||||
account: account,
|
account: account,
|
||||||
proxyURL: proxyURL,
|
proxyURL: proxyURL,
|
||||||
accessToken: accessToken,
|
accessToken: accessToken,
|
||||||
action: action,
|
action: action,
|
||||||
body: geminiBody,
|
body: geminiBody,
|
||||||
quotaScope: quotaScope,
|
quotaScope: quotaScope,
|
||||||
c: c,
|
c: c,
|
||||||
httpUpstream: s.httpUpstream,
|
httpUpstream: s.httpUpstream,
|
||||||
settingService: s.settingService,
|
settingService: s.settingService,
|
||||||
handleError: s.handleUpstreamError,
|
handleError: s.handleUpstreamError,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, s.writeClaudeError(c, http.StatusBadGateway, "upstream_error", "Upstream request failed after retries")
|
return nil, s.writeClaudeError(c, http.StatusBadGateway, "upstream_error", "Upstream request failed after retries")
|
||||||
@@ -1459,18 +1459,18 @@ func (s *AntigravityGatewayService) ForwardGemini(ctx context.Context, c *gin.Co
|
|||||||
|
|
||||||
// 执行带重试的请求
|
// 执行带重试的请求
|
||||||
result, err := antigravityRetryLoop(antigravityRetryLoopParams{
|
result, err := antigravityRetryLoop(antigravityRetryLoopParams{
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
prefix: prefix,
|
prefix: prefix,
|
||||||
account: account,
|
account: account,
|
||||||
proxyURL: proxyURL,
|
proxyURL: proxyURL,
|
||||||
accessToken: accessToken,
|
accessToken: accessToken,
|
||||||
action: upstreamAction,
|
action: upstreamAction,
|
||||||
body: wrappedBody,
|
body: wrappedBody,
|
||||||
quotaScope: quotaScope,
|
quotaScope: quotaScope,
|
||||||
c: c,
|
c: c,
|
||||||
httpUpstream: s.httpUpstream,
|
httpUpstream: s.httpUpstream,
|
||||||
settingService: s.settingService,
|
settingService: s.settingService,
|
||||||
handleError: s.handleUpstreamError,
|
handleError: s.handleUpstreamError,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, s.writeGoogleError(c, http.StatusBadGateway, "Upstream request failed after retries")
|
return nil, s.writeGoogleError(c, http.StatusBadGateway, "Upstream request failed after retries")
|
||||||
|
|||||||
Reference in New Issue
Block a user