mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-03 04:50:52 +08:00
fix(thinking): refine ModeNone handling based on provider capabilities
This commit is contained in:
@@ -159,15 +159,27 @@ func ValidateConfig(config ThinkingConfig, modelInfo *registry.ModelInfo, provid
|
|||||||
normalized = convertAutoToMidRange(normalized, support, provider, model)
|
normalized = convertAutoToMidRange(normalized, support, provider, model)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch normalized.Mode {
|
// ModeNone handling varies by provider/model capability:
|
||||||
case ModeBudget, ModeAuto, ModeNone:
|
// - Claude can always disable thinking via thinking.type="disabled".
|
||||||
normalized.Budget = ClampBudget(normalized.Budget, modelInfo, provider)
|
// - Some models/providers cannot be fully disabled; for those we force minimal thinking
|
||||||
|
// while hiding thoughts (ModeNone + Budget>0 and/or Level set).
|
||||||
|
if normalized.Mode == ModeNone {
|
||||||
|
if provider == "claude" {
|
||||||
|
normalized.Budget = 0
|
||||||
|
normalized.Level = ""
|
||||||
|
} else if !support.ZeroAllowed {
|
||||||
|
if support.Min > 0 {
|
||||||
|
normalized.Budget = support.Min
|
||||||
|
}
|
||||||
|
if normalized.Level == "" && normalized.Budget > 0 && len(support.Levels) > 0 {
|
||||||
|
normalized.Level = ThinkingLevel(support.Levels[0])
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ModeNone with clamped Budget > 0: set Level to lowest for Level-only/Hybrid models
|
switch normalized.Mode {
|
||||||
// This ensures Apply layer doesn't need to access support.Levels
|
case ModeBudget, ModeAuto:
|
||||||
if normalized.Mode == ModeNone && normalized.Budget > 0 && len(support.Levels) > 0 {
|
normalized.Budget = ClampBudget(normalized.Budget, modelInfo, provider)
|
||||||
normalized.Level = ThinkingLevel(support.Levels[0])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return &normalized, nil
|
return &normalized, nil
|
||||||
|
|||||||
Reference in New Issue
Block a user