fix(openai): 统一 OAuth instructions 处理逻辑,修复 Codex CLI 400 错误
- 修改 applyCodexOAuthTransform 函数签名,增加 isCodexCLI 参数 - 移除 && !isCodexCLI 条件,对所有 OAuth 请求统一处理 - 新增 applyInstructions/applyCodexCLIInstructions/applyOpenCodeInstructions 辅助函数 - 新增 isInstructionsEmpty 函数检查 instructions 字段是否为空 - 添加 Codex CLI 和非 Codex CLI 场景的测试用例 逻辑说明: - Codex CLI + 有 instructions: 保持不变 - Codex CLI + 无 instructions: 补充 opencode 指令 - 非 Codex CLI: 使用 opencode 指令覆盖
This commit is contained in:
@@ -796,8 +796,8 @@ func (s *OpenAIGatewayService) Forward(ctx context.Context, c *gin.Context, acco
|
||||
}
|
||||
}
|
||||
|
||||
if account.Type == AccountTypeOAuth && !isCodexCLI {
|
||||
codexResult := applyCodexOAuthTransform(reqBody)
|
||||
if account.Type == AccountTypeOAuth {
|
||||
codexResult := applyCodexOAuthTransform(reqBody, isCodexCLI)
|
||||
if codexResult.Modified {
|
||||
bodyModified = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user