feat(codex): 支持compact端点非流式请求,更新请求头与字段清理

- Codex适配器支持compact端点:非流式请求使用application/json Accept头,
  stream_policy根据compact上下文返回FORCE_NON_STREAM
- 更新Codex请求头格式:添加Version/Connection头,header key首字母大写
- 简化include列表处理:normalizer和request_patching统一强制为固定列表
- 清理Codex不支持的字段:truncation、context_management、user
- 默认instructions改为空字符串
- 前端用量页面:用户页面使用前端筛选后总数,避免不必要的后端分页请求
This commit is contained in:
fawney19
2026-03-01 18:20:42 +08:00
parent d4840df447
commit a137601728
9 changed files with 190 additions and 67 deletions

View File

@@ -315,18 +315,16 @@ class OpenAICliNormalizer(FormatNormalizer):
# Codex 特定设置(覆盖/删除不支持的字段)
if is_codex:
result["parallel_tool_calls"] = True
# 添加 reasoning.encrypted_content 到 include
include = result.get("include", [])
if not isinstance(include, list):
include = []
if self._CODEX_REQUIRED_INCLUDE not in include:
include.append(self._CODEX_REQUIRED_INCLUDE)
result["include"] = include
# 和 codex passthrough patch 保持一致:固定 include 列表
result["include"] = [self._CODEX_REQUIRED_INCLUDE]
# 删除 Codex 不支持的字段
for key in (
"previous_response_id",
"service_tier",
"max_completion_tokens",
"truncation",
"context_management",
"user",
):
result.pop(key, None)