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
a3aed3c4
Commit
a3aed3c4
authored
Feb 24, 2026
by
cagedbird043
Browse files
fix: 默认补全 antigravity 的 Gemini 3.1 Pro 透传映射
parent
516f8f28
Changes
2
Hide whitespace changes
Inline
Side-by-side
backend/internal/service/account.go
View file @
a3aed3c4
...
@@ -373,7 +373,11 @@ func (a *Account) GetModelMapping() map[string]string {
...
@@ -373,7 +373,11 @@ func (a *Account) GetModelMapping() map[string]string {
}
}
if
len
(
result
)
>
0
{
if
len
(
result
)
>
0
{
if
a
.
Platform
==
domain
.
PlatformAntigravity
{
if
a
.
Platform
==
domain
.
PlatformAntigravity
{
ensureAntigravityDefaultPassthrough
(
result
,
"gemini-3-flash"
)
ensureAntigravityDefaultPassthroughs
(
result
,
[]
string
{
"gemini-3-flash"
,
"gemini-3.1-pro-high"
,
"gemini-3.1-pro-low"
,
})
}
}
return
result
return
result
}
}
...
@@ -400,6 +404,12 @@ func ensureAntigravityDefaultPassthrough(mapping map[string]string, model string
...
@@ -400,6 +404,12 @@ func ensureAntigravityDefaultPassthrough(mapping map[string]string, model string
mapping
[
model
]
=
model
mapping
[
model
]
=
model
}
}
func
ensureAntigravityDefaultPassthroughs
(
mapping
map
[
string
]
string
,
models
[]
string
)
{
for
_
,
model
:=
range
models
{
ensureAntigravityDefaultPassthrough
(
mapping
,
model
)
}
}
// IsModelSupported 检查模型是否在 model_mapping 中(支持通配符)
// IsModelSupported 检查模型是否在 model_mapping 中(支持通配符)
// 如果未配置 mapping,返回 true(允许所有模型)
// 如果未配置 mapping,返回 true(允许所有模型)
func
(
a
*
Account
)
IsModelSupported
(
requestedModel
string
)
bool
{
func
(
a
*
Account
)
IsModelSupported
(
requestedModel
string
)
bool
{
...
...
backend/internal/service/account_wildcard_test.go
View file @
a3aed3c4
...
@@ -268,7 +268,7 @@ func TestAccountGetMappedModel(t *testing.T) {
...
@@ -268,7 +268,7 @@ func TestAccountGetMappedModel(t *testing.T) {
}
}
}
}
func
TestAccountGetModelMapping_AntigravityEnsuresGemini
3Flash
Passthrough
(
t
*
testing
.
T
)
{
func
TestAccountGetModelMapping_AntigravityEnsuresGemini
Default
Passthrough
s
(
t
*
testing
.
T
)
{
account
:=
&
Account
{
account
:=
&
Account
{
Platform
:
PlatformAntigravity
,
Platform
:
PlatformAntigravity
,
Credentials
:
map
[
string
]
any
{
Credentials
:
map
[
string
]
any
{
...
@@ -282,6 +282,12 @@ func TestAccountGetModelMapping_AntigravityEnsuresGemini3FlashPassthrough(t *tes
...
@@ -282,6 +282,12 @@ func TestAccountGetModelMapping_AntigravityEnsuresGemini3FlashPassthrough(t *tes
if
mapping
[
"gemini-3-flash"
]
!=
"gemini-3-flash"
{
if
mapping
[
"gemini-3-flash"
]
!=
"gemini-3-flash"
{
t
.
Fatalf
(
"expected gemini-3-flash passthrough to be auto-filled, got: %q"
,
mapping
[
"gemini-3-flash"
])
t
.
Fatalf
(
"expected gemini-3-flash passthrough to be auto-filled, got: %q"
,
mapping
[
"gemini-3-flash"
])
}
}
if
mapping
[
"gemini-3.1-pro-high"
]
!=
"gemini-3.1-pro-high"
{
t
.
Fatalf
(
"expected gemini-3.1-pro-high passthrough to be auto-filled, got: %q"
,
mapping
[
"gemini-3.1-pro-high"
])
}
if
mapping
[
"gemini-3.1-pro-low"
]
!=
"gemini-3.1-pro-low"
{
t
.
Fatalf
(
"expected gemini-3.1-pro-low passthrough to be auto-filled, got: %q"
,
mapping
[
"gemini-3.1-pro-low"
])
}
}
}
func
TestAccountGetModelMapping_AntigravityRespectsWildcardOverride
(
t
*
testing
.
T
)
{
func
TestAccountGetModelMapping_AntigravityRespectsWildcardOverride
(
t
*
testing
.
T
)
{
...
@@ -298,6 +304,12 @@ func TestAccountGetModelMapping_AntigravityRespectsWildcardOverride(t *testing.T
...
@@ -298,6 +304,12 @@ func TestAccountGetModelMapping_AntigravityRespectsWildcardOverride(t *testing.T
if
_
,
exists
:=
mapping
[
"gemini-3-flash"
];
exists
{
if
_
,
exists
:=
mapping
[
"gemini-3-flash"
];
exists
{
t
.
Fatalf
(
"did not expect explicit gemini-3-flash passthrough when wildcard already exists"
)
t
.
Fatalf
(
"did not expect explicit gemini-3-flash passthrough when wildcard already exists"
)
}
}
if
_
,
exists
:=
mapping
[
"gemini-3.1-pro-high"
];
exists
{
t
.
Fatalf
(
"did not expect explicit gemini-3.1-pro-high passthrough when wildcard already exists"
)
}
if
_
,
exists
:=
mapping
[
"gemini-3.1-pro-low"
];
exists
{
t
.
Fatalf
(
"did not expect explicit gemini-3.1-pro-low passthrough when wildcard already exists"
)
}
if
mapped
:=
account
.
GetMappedModel
(
"gemini-3-flash"
);
mapped
!=
"gemini-3.1-pro-high"
{
if
mapped
:=
account
.
GetMappedModel
(
"gemini-3-flash"
);
mapped
!=
"gemini-3.1-pro-high"
{
t
.
Fatalf
(
"expected wildcard mapping to stay effective, got: %q"
,
mapped
)
t
.
Fatalf
(
"expected wildcard mapping to stay effective, got: %q"
,
mapped
)
}
}
...
...
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