fix(thinking): map reasoning_effort to thinkingConfig

This commit is contained in:
hkfires
2026-01-14 22:45:07 +08:00
parent 2262479365
commit 6e4a602c60
13 changed files with 107 additions and 909 deletions

View File

@@ -5,7 +5,6 @@
package thinking
import (
"fmt"
"strconv"
"strings"
)
@@ -44,29 +43,6 @@ func ParseSuffix(model string) SuffixResult {
}
}
// ParseSuffixWithError extracts thinking suffix and returns an error on invalid format.
//
// Invalid format cases:
// - Contains "(" but does not end with ")"
// - Contains ")" without any "("
//
// The error message includes the original input for debugging context.
func ParseSuffixWithError(model string) (SuffixResult, error) {
lastOpen := strings.LastIndex(model, "(")
if lastOpen == -1 {
if strings.Contains(model, ")") {
return SuffixResult{ModelName: model, HasSuffix: false}, NewThinkingError(ErrInvalidSuffix, fmt.Sprintf("invalid suffix format: %s", model))
}
return SuffixResult{ModelName: model, HasSuffix: false}, nil
}
if !strings.HasSuffix(model, ")") {
return SuffixResult{ModelName: model, HasSuffix: false}, NewThinkingError(ErrInvalidSuffix, fmt.Sprintf("invalid suffix format: %s", model))
}
return ParseSuffix(model), nil
}
// ParseNumericSuffix attempts to parse a raw suffix as a numeric budget value.
//
// This function parses the raw suffix content (from ParseSuffix.RawSuffix) as an integer.