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
ba69736f
Commit
ba69736f
authored
Feb 25, 2026
by
cagedbird043
Browse files
refactor(admin): 测试连接模型列表改为复用 antigravity.DefaultModels,消除硬编码重复
parent
c75c6b68
Changes
1
Hide whitespace changes
Inline
Side-by-side
backend/internal/handler/admin/account_handler.go
View file @
ba69736f
...
...
@@ -16,6 +16,7 @@ import (
"github.com/Wei-Shaw/sub2api/internal/domain"
"github.com/Wei-Shaw/sub2api/internal/handler/dto"
"github.com/Wei-Shaw/sub2api/internal/pkg/antigravity"
"github.com/Wei-Shaw/sub2api/internal/pkg/claude"
"github.com/Wei-Shaw/sub2api/internal/pkg/geminicli"
"github.com/Wei-Shaw/sub2api/internal/pkg/openai"
...
...
@@ -1459,36 +1460,8 @@ func (h *AccountHandler) GetAvailableModels(c *gin.Context) {
// Handle Antigravity accounts: return Claude + Gemini models
if
account
.
Platform
==
service
.
PlatformAntigravity
{
// Antigravity 支持 Claude 和部分 Gemini 模型
type
UnifiedModel
struct
{
ID
string
`json:"id"`
Type
string
`json:"type"`
DisplayName
string
`json:"display_name"`
}
var
models
[]
UnifiedModel
// 添加 Claude 模型
for
_
,
m
:=
range
claude
.
DefaultModels
{
models
=
append
(
models
,
UnifiedModel
{
ID
:
m
.
ID
,
Type
:
m
.
Type
,
DisplayName
:
m
.
DisplayName
,
})
}
// 添加 Gemini 3 系列模型用于测试
geminiTestModels
:=
[]
UnifiedModel
{
{
ID
:
"gemini-3-flash"
,
Type
:
"model"
,
DisplayName
:
"Gemini 3 Flash"
},
{
ID
:
"gemini-3-pro-low"
,
Type
:
"model"
,
DisplayName
:
"Gemini 3 Pro Low"
},
{
ID
:
"gemini-3-pro-high"
,
Type
:
"model"
,
DisplayName
:
"Gemini 3 Pro High"
},
{
ID
:
"gemini-3.1-pro-low"
,
Type
:
"model"
,
DisplayName
:
"Gemini 3.1 Pro Low"
},
{
ID
:
"gemini-3.1-pro-high"
,
Type
:
"model"
,
DisplayName
:
"Gemini 3.1 Pro High"
},
{
ID
:
"gemini-3-pro-preview"
,
Type
:
"model"
,
DisplayName
:
"Gemini 3 Pro Preview"
},
}
models
=
append
(
models
,
geminiTestModels
...
)
response
.
Success
(
c
,
models
)
// 直接复用 antigravity.DefaultModels(),与 /v1/models 端点保持同步
response
.
Success
(
c
,
antigravity
.
DefaultModels
())
return
}
...
...
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