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

Function parseSuffixToConfig

internal/thinking/apply.go:287–318  ·  view source on GitHub ↗

parseSuffixToConfig converts a raw suffix string to ThinkingConfig. Parsing priority: 1. Special values: "none" → ModeNone, "auto"/"-1" → ModeAuto 2. Level names: "minimal", "low", "medium", "high", "xhigh" → ModeLevel 3. Numeric values: positive integers → ModeBudget, 0 → ModeNone If none of the

(rawSuffix, provider, model string)

Source from the content-addressed store, hash-verified

285//
286// If none of the above match, returns empty ThinkingConfig (treated as no config).
287func parseSuffixToConfig(rawSuffix, provider, model string) ThinkingConfig {
288 // 1. Try special values first (none, auto, -1)
289 if mode, ok := ParseSpecialSuffix(rawSuffix); ok {
290 switch mode {
291 case ModeNone:
292 return ThinkingConfig{Mode: ModeNone, Budget: 0}
293 case ModeAuto:
294 return ThinkingConfig{Mode: ModeAuto, Budget: -1}
295 }
296 }
297
298 // 2. Try level parsing (minimal, low, medium, high, xhigh)
299 if level, ok := ParseLevelSuffix(rawSuffix); ok {
300 return ThinkingConfig{Mode: ModeLevel, Level: level}
301 }
302
303 // 3. Try numeric parsing
304 if budget, ok := ParseNumericSuffix(rawSuffix); ok {
305 if budget == 0 {
306 return ThinkingConfig{Mode: ModeNone, Budget: 0}
307 }
308 return ThinkingConfig{Mode: ModeBudget, Budget: budget}
309 }
310
311 // Unknown suffix format - return empty config
312 log.WithFields(log.Fields{
313 "provider": provider,
314 "model": model,
315 "raw_suffix": rawSuffix,
316 }).Debug("thinking: unknown suffix format, treating as no config |")
317 return ThinkingConfig{}
318}
319
320// applyUserDefinedModel applies thinking configuration for user-defined models
321// without ThinkingSupport validation.

Callers 3

ApplyThinkingFunction · 0.85
applyUserDefinedModelFunction · 0.85

Calls 3

ParseSpecialSuffixFunction · 0.85
ParseLevelSuffixFunction · 0.85
ParseNumericSuffixFunction · 0.85

Tested by

no test coverage detected