fix(runtime): validate reasoning effort levels

This commit is contained in:
hkfires
2025-12-11 12:36:54 +08:00
parent 169f4295d0
commit 519da2e042
4 changed files with 49 additions and 10 deletions

View File

@@ -91,8 +91,7 @@ func ModelUsesThinkingLevels(model string) bool {
}
// NormalizeReasoningEffortLevel validates and normalizes a reasoning effort
// level for the given model. If the level is not supported, it returns the
// first (lowest) level from the model's supported levels.
// level for the given model. Returns false when the level is not supported.
func NormalizeReasoningEffortLevel(model, effort string) (string, bool) {
levels := GetModelThinkingLevels(model)
if len(levels) == 0 {
@@ -104,12 +103,5 @@ func NormalizeReasoningEffortLevel(model, effort string) (string, bool) {
return lvl, true
}
}
return defaultReasoningLevel(levels), true
}
func defaultReasoningLevel(levels []string) string {
if len(levels) > 0 {
return levels[0]
}
return ""
return "", false
}