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

@@ -1758,6 +1758,16 @@ func (s *OpenAIGatewayService) Forward(ctx context.Context, c *gin.Context, acco
bodyModified = true
markPatchSet("model", normalizedModel)
}
// 移除 gpt-5.2-codex 以下的版本 verbosity 参数
// 确保高版本模型向低版本模型映射不报错
if !SupportsVerbosity(reqBody["model"].(string)) {
if text, ok := reqBody["text"].(map[string]any); ok {
if _, ok := text["verbosity"].(string); ok {
delete(text, "verbosity")
}
}
}
}
// 规范化 reasoning.effort 参数minimal -> none与上游允许值对齐。