Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
14c6c932
Commit
14c6c932
authored
Feb 07, 2026
by
erio
Browse files
refactor: remove unused IsAntigravityModelSupported function and its tests
parent
386126b1
Changes
2
Hide whitespace changes
Inline
Side-by-side
backend/internal/service/antigravity_model_mapping_test.go
View file @
14c6c932
...
...
@@ -8,49 +8,6 @@ import (
"github.com/stretchr/testify/require"
)
func
TestIsAntigravityModelSupported
(
t
*
testing
.
T
)
{
tests
:=
[]
struct
{
name
string
model
string
expected
bool
}{
// 在默认映射中的模型(支持)
{
"默认映射 - claude-sonnet-4-5"
,
"claude-sonnet-4-5"
,
true
},
{
"默认映射 - claude-opus-4-6-thinking"
,
"claude-opus-4-6-thinking"
,
true
},
{
"默认映射 - claude-opus-4-6"
,
"claude-opus-4-6"
,
true
},
{
"默认映射 - claude-opus-4-5-thinking"
,
"claude-opus-4-5-thinking"
,
true
},
{
"默认映射 - claude-sonnet-4-5-thinking"
,
"claude-sonnet-4-5-thinking"
,
true
},
{
"默认映射 - gemini-2.5-flash"
,
"gemini-2.5-flash"
,
true
},
{
"默认映射 - gemini-2.5-flash-lite"
,
"gemini-2.5-flash-lite"
,
true
},
{
"默认映射 - gemini-3-pro-high"
,
"gemini-3-pro-high"
,
true
},
{
"默认映射 - claude-haiku-4-5"
,
"claude-haiku-4-5"
,
true
},
// 不在默认映射中的模型(不支持)
{
"未配置 - claude-3-5-sonnet-20241022"
,
"claude-3-5-sonnet-20241022"
,
false
},
{
"未配置 - claude-3-5-sonnet-20240620"
,
"claude-3-5-sonnet-20240620"
,
false
},
{
"未配置 - claude-3-haiku-20240307"
,
"claude-3-haiku-20240307"
,
false
},
{
"未配置 - gemini-unknown-model"
,
"gemini-unknown-model"
,
false
},
{
"未配置 - gemini-future-version"
,
"gemini-future-version"
,
false
},
{
"未配置 - claude-unknown-model"
,
"claude-unknown-model"
,
false
},
{
"未配置 - claude-3-opus-20240229"
,
"claude-3-opus-20240229"
,
false
},
{
"未配置 - claude-future-version"
,
"claude-future-version"
,
false
},
// 非 Claude/Gemini 模型(不支持)
{
"不支持 - gpt-4"
,
"gpt-4"
,
false
},
{
"不支持 - gpt-4o"
,
"gpt-4o"
,
false
},
{
"不支持 - llama-3"
,
"llama-3"
,
false
},
{
"不支持 - mistral-7b"
,
"mistral-7b"
,
false
},
{
"不支持 - 空字符串"
,
""
,
false
},
}
for
_
,
tt
:=
range
tests
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
got
:=
IsAntigravityModelSupported
(
tt
.
model
)
require
.
Equal
(
t
,
tt
.
expected
,
got
,
"model: %s"
,
tt
.
model
)
})
}
}
func
TestAntigravityGatewayService_GetMappedModel
(
t
*
testing
.
T
)
{
svc
:=
&
AntigravityGatewayService
{}
...
...
backend/internal/service/gateway_service.go
View file @
14c6c932
...
...
@@ -22,7 +22,6 @@ import (
"time"
"github.com/Wei-Shaw/sub2api/internal/config"
"github.com/Wei-Shaw/sub2api/internal/domain"
"github.com/Wei-Shaw/sub2api/internal/pkg/claude"
"github.com/Wei-Shaw/sub2api/internal/pkg/ctxkey"
"github.com/Wei-Shaw/sub2api/internal/util/responseheaders"
...
...
@@ -2617,13 +2616,6 @@ func (s *GatewayService) isModelSupportedByAccount(account *Account, requestedMo
return
account
.
IsModelSupported
(
requestedModel
)
}
// IsAntigravityModelSupported 检查 Antigravity 平台是否支持指定模型
// 只有在默认映射(DefaultAntigravityModelMapping)中配置的模型才被支持
func
IsAntigravityModelSupported
(
requestedModel
string
)
bool
{
// 检查是否在默认映射的 key 中
_
,
exists
:=
domain
.
DefaultAntigravityModelMapping
[
requestedModel
]
return
exists
}
// GetAccessToken 获取账号凭证
func
(
s
*
GatewayService
)
GetAccessToken
(
ctx
context
.
Context
,
account
*
Account
)
(
string
,
string
,
error
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment