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
ea8104c6
Commit
ea8104c6
authored
Feb 24, 2026
by
cagedbird043
Browse files
fix: antigravity 默认补全 gemini-3-flash 透传
parent
7be5e173
Changes
2
Hide whitespace changes
Inline
Side-by-side
backend/internal/service/account.go
View file @
ea8104c6
...
@@ -372,6 +372,9 @@ func (a *Account) GetModelMapping() map[string]string {
...
@@ -372,6 +372,9 @@ func (a *Account) GetModelMapping() map[string]string {
}
}
}
}
if
len
(
result
)
>
0
{
if
len
(
result
)
>
0
{
if
a
.
Platform
==
domain
.
PlatformAntigravity
{
ensureAntigravityDefaultPassthrough
(
result
,
"gemini-3-flash"
)
}
return
result
return
result
}
}
}
}
...
@@ -382,6 +385,21 @@ func (a *Account) GetModelMapping() map[string]string {
...
@@ -382,6 +385,21 @@ func (a *Account) GetModelMapping() map[string]string {
return
nil
return
nil
}
}
func
ensureAntigravityDefaultPassthrough
(
mapping
map
[
string
]
string
,
model
string
)
{
if
mapping
==
nil
||
model
==
""
{
return
}
if
_
,
exists
:=
mapping
[
model
];
exists
{
return
}
for
pattern
:=
range
mapping
{
if
matchWildcard
(
pattern
,
model
)
{
return
}
}
mapping
[
model
]
=
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 @
ea8104c6
...
@@ -267,3 +267,38 @@ func TestAccountGetMappedModel(t *testing.T) {
...
@@ -267,3 +267,38 @@ func TestAccountGetMappedModel(t *testing.T) {
})
})
}
}
}
}
func
TestAccountGetModelMapping_AntigravityEnsuresGemini3FlashPassthrough
(
t
*
testing
.
T
)
{
account
:=
&
Account
{
Platform
:
PlatformAntigravity
,
Credentials
:
map
[
string
]
any
{
"model_mapping"
:
map
[
string
]
any
{
"gemini-3-pro-high"
:
"gemini-3.1-pro-high"
,
},
},
}
mapping
:=
account
.
GetModelMapping
()
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"
])
}
}
func
TestAccountGetModelMapping_AntigravityRespectsWildcardOverride
(
t
*
testing
.
T
)
{
account
:=
&
Account
{
Platform
:
PlatformAntigravity
,
Credentials
:
map
[
string
]
any
{
"model_mapping"
:
map
[
string
]
any
{
"gemini-3*"
:
"gemini-3.1-pro-high"
,
},
},
}
mapping
:=
account
.
GetModelMapping
()
if
_
,
exists
:=
mapping
[
"gemini-3-flash"
];
exists
{
t
.
Fatalf
(
"did not expect explicit gemini-3-flash passthrough when wildcard already exists"
)
}
if
mapped
:=
account
.
GetMappedModel
(
"gemini-3-flash"
);
mapped
!=
"gemini-3.1-pro-high"
{
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