Merge pull request #625 from cagedbird043/pr/antigravity-default-gemini31-passthrough
fix: 默认补全 Antigravity 的 Gemini 3.1 Pro 透传映射
This commit is contained in:
@@ -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
|
|||||||
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 {
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ func TestAccountGetMappedModel(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAccountGetModelMapping_AntigravityEnsuresGemini3FlashPassthrough(t *testing.T) {
|
func TestAccountGetModelMapping_AntigravityEnsuresGeminiDefaultPassthroughs(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
|
|||||||
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
|
|||||||
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)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user