mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-03 13:00:52 +08:00
fix(thinking): improve model lookup and validation
This commit is contained in:
@@ -1458,7 +1458,7 @@ func generateProjectID() string {
|
||||
// - For Claude models: removing thinkingConfig if budget < minimum allowed
|
||||
func normalizeAntigravityThinking(model string, payload []byte, isClaude bool) []byte {
|
||||
payload = util.StripThinkingConfigIfUnsupported(model, payload)
|
||||
modelInfo := registry.GetGlobalRegistry().GetModelInfo(model)
|
||||
modelInfo := registry.LookupModelInfo(model)
|
||||
if modelInfo == nil || modelInfo.Thinking == nil {
|
||||
return payload
|
||||
}
|
||||
@@ -1501,7 +1501,7 @@ func antigravityEffectiveMaxTokens(model string, payload []byte) (max int, fromM
|
||||
if maxTok := gjson.GetBytes(payload, "request.generationConfig.maxOutputTokens"); maxTok.Exists() && maxTok.Int() > 0 {
|
||||
return int(maxTok.Int()), false
|
||||
}
|
||||
if modelInfo := registry.GetGlobalRegistry().GetModelInfo(model); modelInfo != nil && modelInfo.MaxCompletionTokens > 0 {
|
||||
if modelInfo := registry.LookupModelInfo(model); modelInfo != nil && modelInfo.MaxCompletionTokens > 0 {
|
||||
return modelInfo.MaxCompletionTokens, true
|
||||
}
|
||||
return 0, false
|
||||
@@ -1510,7 +1510,7 @@ func antigravityEffectiveMaxTokens(model string, payload []byte) (max int, fromM
|
||||
// antigravityMinThinkingBudget returns the minimum thinking budget for a model.
|
||||
// Falls back to -1 if no model info is found.
|
||||
func antigravityMinThinkingBudget(model string) int {
|
||||
if modelInfo := registry.GetGlobalRegistry().GetModelInfo(model); modelInfo != nil && modelInfo.Thinking != nil {
|
||||
if modelInfo := registry.LookupModelInfo(model); modelInfo != nil && modelInfo.Thinking != nil {
|
||||
return modelInfo.Thinking.Min
|
||||
}
|
||||
return -1
|
||||
|
||||
Reference in New Issue
Block a user