fix: route antigravity apikey account test to native protocol
Antigravity APIKey accounts were incorrectly routed to testAntigravityAccountConnection which calls AntigravityTokenProvider, but the token provider only handles OAuth and Upstream types, causing "not an antigravity oauth account" error. Extract routeAntigravityTest to route APIKey accounts to native Claude/Gemini test paths based on model prefix, matching the gateway_handler routing logic for normal requests.
This commit is contained in:
@@ -180,7 +180,7 @@ func (s *AccountTestService) TestAccountConnection(c *gin.Context, accountID int
|
|||||||
}
|
}
|
||||||
|
|
||||||
if account.Platform == PlatformAntigravity {
|
if account.Platform == PlatformAntigravity {
|
||||||
return s.testAntigravityAccountConnection(c, account, modelID)
|
return s.routeAntigravityTest(c, account, modelID)
|
||||||
}
|
}
|
||||||
|
|
||||||
if account.Platform == PlatformSora {
|
if account.Platform == PlatformSora {
|
||||||
@@ -1177,6 +1177,18 @@ func truncateSoraErrorBody(body []byte, max int) string {
|
|||||||
return soraerror.TruncateBody(body, max)
|
return soraerror.TruncateBody(body, max)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// routeAntigravityTest 路由 Antigravity 账号的测试请求。
|
||||||
|
// APIKey 类型走原生协议(与 gateway_handler 路由一致),OAuth/Upstream 走 CRS 中转。
|
||||||
|
func (s *AccountTestService) routeAntigravityTest(c *gin.Context, account *Account, modelID string) error {
|
||||||
|
if account.Type == AccountTypeAPIKey {
|
||||||
|
if strings.HasPrefix(modelID, "gemini-") {
|
||||||
|
return s.testGeminiAccountConnection(c, account, modelID)
|
||||||
|
}
|
||||||
|
return s.testClaudeAccountConnection(c, account, modelID)
|
||||||
|
}
|
||||||
|
return s.testAntigravityAccountConnection(c, account, modelID)
|
||||||
|
}
|
||||||
|
|
||||||
// testAntigravityAccountConnection tests an Antigravity account's connection
|
// testAntigravityAccountConnection tests an Antigravity account's connection
|
||||||
// 支持 Claude 和 Gemini 两种协议,使用非流式请求
|
// 支持 Claude 和 Gemini 两种协议,使用非流式请求
|
||||||
func (s *AccountTestService) testAntigravityAccountConnection(c *gin.Context, account *Account, modelID string) error {
|
func (s *AccountTestService) testAntigravityAccountConnection(c *gin.Context, account *Account, modelID string) error {
|
||||||
|
|||||||
Reference in New Issue
Block a user