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

@@ -44,18 +44,11 @@ func init() {
// }
// }
func (a *Applier) Apply(body []byte, config thinking.ThinkingConfig, modelInfo *registry.ModelInfo) ([]byte, error) {
if modelInfo == nil {
if thinking.IsUserDefinedModel(modelInfo) {
return applyCompatibleCodex(body, config)
}
if modelInfo.Thinking == nil {
if modelInfo.Type == "" {
modelID := modelInfo.ID
if modelID == "" {
modelID = "unknown"
}
return nil, thinking.NewThinkingErrorWithModel(thinking.ErrThinkingNotSupported, "thinking not supported for this model", modelID)
}
return applyCompatibleCodex(body, config)
return body, nil
}
// Only handle ModeLevel and ModeNone; other modes pass through unchanged.