fix(thinking): improve model lookup and validation

This commit is contained in:
hkfires
2026-01-14 16:30:28 +08:00
parent 40ee065eff
commit 7f1b2b3f6e
13 changed files with 78 additions and 137 deletions

View File

@@ -54,15 +54,11 @@ func init() {
// "reasoning_split": true
// }
func (a *Applier) Apply(body []byte, config thinking.ThinkingConfig, modelInfo *registry.ModelInfo) ([]byte, error) {
if modelInfo == nil {
if thinking.IsUserDefinedModel(modelInfo) {
return body, nil
}
if modelInfo.Thinking == nil {
modelID := modelInfo.ID
if modelID == "" {
modelID = "unknown"
}
return nil, thinking.NewThinkingErrorWithModel(thinking.ErrThinkingNotSupported, "thinking not supported for this model", modelID)
return body, nil
}
if isGLMModel(modelInfo.ID) {