MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / ConvertBudgetToLevel

Function ConvertBudgetToLevel

internal/thinking/convert.go:77–97  ·  view source on GitHub ↗

ConvertBudgetToLevel converts a budget value to the nearest thinking level. This is a semantic conversion that maps numeric budgets to discrete levels. Uses threshold-based mapping for range conversion. Budget → Level thresholds: - -1 → auto - 0 → none - 1-512 → minimal - 513-10

(budget int)

Source from the content-addressed store, hash-verified

75// - level: The converted thinking level string
76// - ok: true if budget is valid, false for invalid negatives (< -1)
77func ConvertBudgetToLevel(budget int) (string, bool) {
78 switch {
79 case budget < -1:
80 // Invalid negative values
81 return "", false
82 case budget == -1:
83 return string(LevelAuto), true
84 case budget == 0:
85 return string(LevelNone), true
86 case budget <= ThresholdMinimal:
87 return string(LevelMinimal), true
88 case budget <= ThresholdLow:
89 return string(LevelLow), true
90 case budget <= ThresholdMedium:
91 return string(LevelMedium), true
92 case budget <= ThresholdHigh:
93 return string(LevelHigh), true
94 default:
95 return string(LevelXHigh), true
96 }
97}
98
99// HasLevel reports whether the given target level exists in the levels slice.
100// Matching is case-insensitive with leading/trailing whitespace trimmed.

Callers 11

applyCompatibleOpenAIFunction · 0.92
applyCompatibleCodexFunction · 0.92
ApplyMethod · 0.92
applyCompatibleKimiFunction · 0.92
ValidateConfigFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected