fix: 修复gpt-5.2以上模型映射到gpt-5.2以下时verbosity参数引发的报错

This commit is contained in:
CoolCoolTomato
2026-03-11 21:12:07 +08:00
parent 8dd38f4775
commit fd8ccaf01a
2 changed files with 34 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
package service
import (
"fmt"
"strings"
)
@@ -226,6 +227,29 @@ func normalizeCodexModel(model string) string {
return "gpt-5.1"
}
func SupportsVerbosity(model string) bool {
if !strings.HasPrefix(model, "gpt-") {
return true
}
var major, minor int
n, _ := fmt.Sscanf(model, "gpt-%d.%d", &major, &minor)
if major > 5 {
return true
}
if major < 5 {
return false
}
// gpt-5
if n == 1 {
return true
}
return minor >= 3
}
func getNormalizedCodexModel(modelID string) string {
if modelID == "" {
return ""