From 9c09128e00d2f384bd248c54bec8d62be25c0134 Mon Sep 17 00:00:00 2001 From: hkfires <10558748+hkfires@users.noreply.github.com> Date: Sun, 7 Dec 2025 19:12:55 +0800 Subject: [PATCH] feat(registry): add explicit thinking support config for antigravity models --- internal/registry/model_definitions.go | 13 ++++++++- .../runtime/executor/antigravity_executor.go | 28 ++++++++----------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/internal/registry/model_definitions.go b/internal/registry/model_definitions.go index 36aa83bb..64e78199 100644 --- a/internal/registry/model_definitions.go +++ b/internal/registry/model_definitions.go @@ -943,8 +943,19 @@ func GetQwenModels() []*ModelInfo { } } -// GetIFlowModels returns supported models for iFlow OAuth accounts. +// GetAntigravityThinkingConfig returns the Thinking configuration for antigravity models. +// Keys use the ALIASED model names (after modelName2Alias conversion) for direct lookup. +func GetAntigravityThinkingConfig() map[string]*ThinkingSupport { + return map[string]*ThinkingSupport{ + "gemini-2.5-flash": {Min: 0, Max: 24576, ZeroAllowed: true, DynamicAllowed: true}, + "gemini-2.5-flash-lite": {Min: 0, Max: 24576, ZeroAllowed: true, DynamicAllowed: true}, + "gemini-3-pro-preview": {Min: 128, Max: 32768, ZeroAllowed: false, DynamicAllowed: true}, + "gemini-claude-sonnet-4-5-thinking": {Min: 1024, Max: 200000, ZeroAllowed: false, DynamicAllowed: true}, + "gemini-claude-opus-4-5-thinking": {Min: 1024, Max: 200000, ZeroAllowed: false, DynamicAllowed: true}, + } +} +// GetIFlowModels returns supported models for iFlow OAuth accounts. func GetIFlowModels() []*ModelInfo { entries := []struct { ID string diff --git a/internal/runtime/executor/antigravity_executor.go b/internal/runtime/executor/antigravity_executor.go index 9fc4e722..ed9207f0 100644 --- a/internal/runtime/executor/antigravity_executor.go +++ b/internal/runtime/executor/antigravity_executor.go @@ -366,29 +366,25 @@ func FetchAntigravityModels(ctx context.Context, auth *cliproxyauth.Auth, cfg *c } now := time.Now().Unix() + thinkingConfig := registry.GetAntigravityThinkingConfig() models := make([]*registry.ModelInfo, 0, len(result.Map())) - for id := range result.Map() { - id = modelName2Alias(id) - if id != "" { + for originalName := range result.Map() { + aliasName := modelName2Alias(originalName) + if aliasName != "" { modelInfo := ®istry.ModelInfo{ - ID: id, - Name: id, - Description: id, - DisplayName: id, - Version: id, + ID: aliasName, + Name: aliasName, + Description: aliasName, + DisplayName: aliasName, + Version: aliasName, Object: "model", Created: now, OwnedBy: antigravityAuthType, Type: antigravityAuthType, } - // Add Thinking support for thinking models - if strings.HasSuffix(id, "-thinking") || strings.Contains(id, "-thinking-") { - modelInfo.Thinking = ®istry.ThinkingSupport{ - Min: 1024, - Max: 100000, - ZeroAllowed: false, - DynamicAllowed: true, - } + // Look up Thinking support from static config using alias name + if thinking, ok := thinkingConfig[aliasName]; ok { + modelInfo.Thinking = thinking } models = append(models, modelInfo) }