fix(网关): OAuth 请求强制 store=false
避免上游 Store 必须为 false 的错误 仅在缺失或 true 时写回 store 测试: go test ./internal/service -run TestApplyCodexOAuthTransform 测试: make test-backend(golangci-lint 已单独执行)
This commit is contained in:
@@ -90,17 +90,14 @@ func applyCodexOAuthTransform(reqBody map[string]any) codexTransformResult {
|
||||
result.NormalizedModel = normalizedModel
|
||||
}
|
||||
|
||||
// 续链场景强制启用 store;非续链仍按原策略强制关闭存储。
|
||||
if needsToolContinuation {
|
||||
if v, ok := reqBody["store"].(bool); !ok || !v {
|
||||
reqBody["store"] = true
|
||||
result.Modified = true
|
||||
}
|
||||
} else {
|
||||
if v, ok := reqBody["store"].(bool); !ok || v {
|
||||
reqBody["store"] = false
|
||||
result.Modified = true
|
||||
}
|
||||
// OAuth 走 ChatGPT internal API 时,store 必须为 false;显式 true 也会强制覆盖。
|
||||
// 避免上游返回 "Store must be set to false"。
|
||||
if v, ok := reqBody["store"].(bool); !ok {
|
||||
reqBody["store"] = false
|
||||
result.Modified = true
|
||||
} else if v {
|
||||
reqBody["store"] = false
|
||||
result.Modified = true
|
||||
}
|
||||
if v, ok := reqBody["stream"].(bool); !ok || !v {
|
||||
reqBody["stream"] = true
|
||||
|
||||
Reference in New Issue
Block a user