refactor: 重构 handleChatCompletions 函数模块化

- 使用策略模式处理不同后端(Claude/OpenAI/Gemini)
- 添加 OpenAI chat/completions 兼容支持
- 修复代码缩进符合 ESLint 规范
This commit is contained in:
jft0m
2025-10-04 13:48:07 +08:00
committed by root
parent 1705412bb0
commit 61e5cb4584
2 changed files with 5 additions and 2 deletions

View File

@@ -53,7 +53,8 @@ class CodexCliValidator {
// 2. 对于特定路径,进行额外的严格验证
// 对于 /openai 和 /azure 路径需要完整验证
const strictValidationPaths = ['/openai', '/azure']
const needsStrictValidation = req.path && strictValidationPaths.some(path => req.path.startsWith(path))
const needsStrictValidation =
req.path && strictValidationPaths.some((path) => req.path.startsWith(path))
if (!needsStrictValidation) {
// 其他路径,只要 User-Agent 匹配就认为是 Codex CLI