Merge pull request #7169 from HuntercodeT/fix/gemini-mixed-model-listing

fix(gateway): list mixed Antigravity models for Gemini groups
This commit is contained in:
Wesley Liddick authored and GitHub committed 2026-09-22 21:56:04 +08:00
commit fa9f104a93
2 files changed
+189 -6

No files matched your search

+25 -6
View File
@@ -1377,6 +1377,19 @@ func (s *GatewayService) DoGrokNativeResponsesJSON(ctx context.Context, account
return respBytes, nil
}
// mixedListingAccountAllowed mirrors the mixed-scheduling rule in
// GeminiMessagesCompatService.listSchedulableAccountsOnce: a gemini group may be
// served by antigravity accounts, so model listing must consider them too.
func mixedListingAccountAllowed(groupPlatform string, account *Account) bool {
return groupPlatform == PlatformGemini && account.IsMixedSchedulingEnabled()
}
// mixedListingModelAllowed limits what a mixed-scheduling account may advertise
// on the group's platform: only gemini-* wire IDs are meaningful on a gemini group.
func mixedListingModelAllowed(groupPlatform, model string) bool {
return groupPlatform == PlatformGemini && isAntigravityGeminiModel(model)
}
func (s *GatewayService) GetAvailableModels(ctx context.Context, groupID *int64, platform string) []string {
cacheKey := modelsListCacheKey(groupID, platform)
if s.modelsListCache != nil {
@@ -1402,11 +1415,13 @@ func (s *GatewayService) GetAvailableModels(ctx context.Context, groupID *int64,
return nil
}
// Filter by platform if specified
// Filter by platform if specified. Mixed scheduling (a gemini group routing
// to antigravity accounts) is honoured here as well, so the advertised list
// stays in sync with what the request path can actually serve.
if platform != "" {
filtered := make([]Account, 0)
for _, acc := range accounts {
if acc.Platform == platform {
if acc.Platform == platform || mixedListingAccountAllowed(platform, &acc) {
filtered = append(filtered, acc)
}
}
@@ -1430,11 +1445,15 @@ func (s *GatewayService) GetAvailableModels(ctx context.Context, groupID *int64,
}
mapping := acc.GetModelMapping()
if len(mapping) > 0 {
hasAnyMapping = true
for model := range mapping {
modelSet[model] = struct{}{}
for model := range mapping {
// Accounts pulled in through mixed scheduling only contribute the
// models that belong to the listing platform (e.g. an antigravity
// account's claude-* mappings must not surface on a gemini group).
if platform != "" && acc.Platform != platform && !mixedListingModelAllowed(platform, model) {
continue
}
modelSet[model] = struct{}{}
hasAnyMapping = true
}
}