Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
c0110cb5
Unverified
Commit
c0110cb5
authored
Mar 12, 2026
by
Wesley Liddick
Committed by
GitHub
Mar 12, 2026
Browse files
Merge pull request #941 from CoolCoolTomato/main
fix: 修复gpt-5.2以上模型映射到gpt-5.2以下时verbosity参数引发的报错
parents
1f8e1142
eb0b77bf
Changes
2
Hide whitespace changes
Inline
Side-by-side
backend/internal/service/openai_codex_transform.go
View file @
c0110cb5
package
service
package
service
import
(
import
(
"fmt"
"strings"
"strings"
)
)
...
@@ -226,6 +227,29 @@ func normalizeCodexModel(model string) string {
...
@@ -226,6 +227,29 @@ func normalizeCodexModel(model string) string {
return
"gpt-5.1"
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
{
func
getNormalizedCodexModel
(
modelID
string
)
string
{
if
modelID
==
""
{
if
modelID
==
""
{
return
""
return
""
...
...
backend/internal/service/openai_gateway_service.go
View file @
c0110cb5
...
@@ -1767,6 +1767,14 @@ func (s *OpenAIGatewayService) Forward(ctx context.Context, c *gin.Context, acco
...
@@ -1767,6 +1767,14 @@ func (s *OpenAIGatewayService) Forward(ctx context.Context, c *gin.Context, acco
bodyModified
=
true
bodyModified
=
true
markPatchSet
(
"model"
,
normalizedModel
)
markPatchSet
(
"model"
,
normalizedModel
)
}
}
// 移除 gpt-5.2-codex 以下的版本 verbosity 参数
// 确保高版本模型向低版本模型映射不报错
if
!
SupportsVerbosity
(
normalizedModel
)
{
if
text
,
ok
:=
reqBody
[
"text"
]
.
(
map
[
string
]
any
);
ok
{
delete
(
text
,
"verbosity"
)
}
}
}
}
// 规范化 reasoning.effort 参数(minimal -> none),与上游允许值对齐。
// 规范化 reasoning.effort 参数(minimal -> none),与上游允许值对齐。
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment