fix: strip antigravity prefix and improve model list for flash-preview
This commit is contained in:
parent
d3fe8c5e17
commit
1765f6d0e7
1 changed files with 39 additions and 6 deletions
|
|
@ -54,10 +54,15 @@ func (p *AntigravityProvider) Chat(ctx context.Context, messages []Message, tool
|
||||||
if model == "" || model == "antigravity" || model == "google-antigravity" {
|
if model == "" || model == "antigravity" || model == "google-antigravity" {
|
||||||
model = antigravityDefaultModel
|
model = antigravityDefaultModel
|
||||||
}
|
}
|
||||||
// Strip provider prefix if present
|
// Strip provider prefixes if present
|
||||||
if strings.HasPrefix(model, "google-antigravity/") {
|
model = strings.TrimPrefix(model, "google-antigravity/")
|
||||||
model = strings.TrimPrefix(model, "google-antigravity/")
|
model = strings.TrimPrefix(model, "antigravity/")
|
||||||
}
|
|
||||||
|
logger.DebugCF("provider.antigravity", "Starting chat", map[string]interface{}{
|
||||||
|
"model": model,
|
||||||
|
"project": projectID,
|
||||||
|
"requestId": fmt.Sprintf("agent-%d-%s", time.Now().UnixMilli(), randomString(9)),
|
||||||
|
})
|
||||||
|
|
||||||
// Build the inner Gemini-format request
|
// Build the inner Gemini-format request
|
||||||
innerRequest := p.buildRequest(messages, tools, model, options)
|
innerRequest := p.buildRequest(messages, tools, model, options)
|
||||||
|
|
@ -272,8 +277,12 @@ func (p *AntigravityProvider) buildRequest(messages []Message, tools []ToolDefin
|
||||||
|
|
||||||
// Generation config
|
// Generation config
|
||||||
config := &antigravityGenConfig{}
|
config := &antigravityGenConfig{}
|
||||||
if maxTokens, ok := options["max_tokens"].(int); ok && maxTokens > 0 {
|
if val, ok := options["max_tokens"]; ok {
|
||||||
config.MaxOutputTokens = maxTokens
|
if maxTokens, ok := val.(int); ok && maxTokens > 0 {
|
||||||
|
config.MaxOutputTokens = maxTokens
|
||||||
|
} else if maxTokens, ok := val.(float64); ok && maxTokens > 0 {
|
||||||
|
config.MaxOutputTokens = int(maxTokens)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if temp, ok := options["temperature"].(float64); ok {
|
if temp, ok := options["temperature"].(float64); ok {
|
||||||
config.Temperature = temp
|
config.Temperature = temp
|
||||||
|
|
@ -639,6 +648,30 @@ func FetchAntigravityModels(accessToken, projectID string) ([]AntigravityModelIn
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure gemini-3-flash-preview and gemini-3-flash are in the list if they aren't already
|
||||||
|
hasFlashPreview := false
|
||||||
|
hasFlash := false
|
||||||
|
for _, m := range models {
|
||||||
|
if m.ID == "gemini-3-flash-preview" {
|
||||||
|
hasFlashPreview = true
|
||||||
|
}
|
||||||
|
if m.ID == "gemini-3-flash" {
|
||||||
|
hasFlash = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !hasFlashPreview {
|
||||||
|
models = append(models, AntigravityModelInfo{
|
||||||
|
ID: "gemini-3-flash-preview",
|
||||||
|
DisplayName: "Gemini 3 Flash (Preview)",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if !hasFlash {
|
||||||
|
models = append(models, AntigravityModelInfo{
|
||||||
|
ID: "gemini-3-flash",
|
||||||
|
DisplayName: "Gemini 3 Flash",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return models, nil
|
return models, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue