1. 14 Jan, 2026 30 commits
  2. 13 Jan, 2026 5 commits
    • yangjianbo's avatar
      为类型断言补充 ok 校验并添加中文说明,避免 errcheck 报错(backend/internal/service/ · 7bbf49fd
      yangjianbo authored
          openai_codex_transform_test.go:36、backend/internal/service/
          openai_codex_transform_test.go:89、backend/internal/service/
          openai_codex_transform_test.go:104)。
      7bbf49fd
    • yangjianbo's avatar
      fix(网关): 修复工具续链校验与存储策略 · 70eaa450
      yangjianbo authored
      完善 function_call_output 续链校验与引用匹配
      续链场景强制 store=true,过滤 input 时避免副作用
      补充续链判断与过滤相关单元测试
      
      测试: go test ./...
      70eaa450
    • ianshaw's avatar
    • ianshaw's avatar
      fix(openai): 增强 OpenCode 兼容性和模型规范化 · 3d6e01a5
      ianshaw authored
      ## 主要改动
      
      1. **模型规范化扩展到所有账号**
         - 将 Codex 模型规范化(如 gpt-5-nano → gpt-5.1)应用到所有 OpenAI 账号类型
         - 不再仅限于 OAuth 非 CLI 请求
         - 解决 Codex CLI 使用 ChatGPT 账号时的模型兼容性问题
      
      2. **reasoning.effort 参数规范化**
         - 自动将 `minimal` 转换为 `none`
         - 解决 gpt-5.1 模型不支持 `minimal` 值的问题
      
      3. **Session/Conversation ID fallback 机制**
         - 从请求体多个字段提取 session_id/conversation_id
         - 优先级:prompt_cache_key → session_id → conversation_id → previous_response_id
         - 支持 Codex CLI 的会话保持
      
      4. **Tool Call ID fallback**
         - 当 call_id 为空时使用 id 字段作为 fallback
         - 确保 tool call 输出能正确匹配
         - 保留 item_reference 类型的 items
      
      5. **Header 优化**
         - 添加 conversation_id 到允许的 headers
         - 移除删除 session headers 的逻辑
      
      ## 相关 Issue
      - 参考 OpenCode issue #3118 关于 item_reference 的讨论
      3d6e01a5
    • IanShaw027's avatar
      fix(codex): 添加codex CLI instructions fallback机制 · f9713e87
      IanShaw027 authored
      ## 问题
      - 使用OpenAI API key时,opencode客户端可能因instructions不兼容而报错
      - 依赖外部GitHub获取instructions,网络故障时会失败
      
      ## 解决方案
      1. 将codex CLI标准instructions嵌入到项目中
      2. 实现自动fallback机制:
         - 优先使用opencode GitHub的instructions
         - 失败时自动fallback到本地codex CLI instructions
      3. 添加辅助函数用于错误检测和手动替换
      
      ## 改动
      - 新增: internal/service/prompts/codex_cli_instructions.md
        - 从codex项目复制的标准instructions
        - 使用go:embed嵌入到二进制文件
      
      - 修改: internal/service/openai_codex_transform.go
        - 添加embed支持
        - 增强getOpenCodeCodexHeader()的fallback逻辑
        - 新增GetCodexCLIInstructions()公开函数
        - 新增ReplaceWithCodexInstructions()用于手动替换
        - 新增IsInstructionError()用于错误检测
      
      ## 优势
      - 零停机:GitHub不可用时仍能正常工作
      - 离线可用:不依赖外部网络
      - 兼容性:使用标准codex CLI instructions
      - 部署简单:instructions嵌入到二进制文件
      f9713e87
  3. 12 Jan, 2026 5 commits
    • ianshaw's avatar
      d85288a6
    • ianshaw's avatar
      feat(gateway): 对所有请求(包括 Codex CLI)应用模型映射 · 3402acb6
      ianshaw authored
      - 移除 Codex CLI 的模型映射跳过逻辑
      - 添加详细的模型映射日志,包含账号名称和请求类型
      - 确保所有 OpenAI 请求都能正确应用账号配置的模型映射
      3402acb6
    • ianshaw's avatar
      fix(gateway): 修复 base_url 包含 /chat/completions 时路径拼接错误 · 7fdc25df
      ianshaw authored
      问题:
      - 当账号的 base_url 配置为 https://example.com/v1/chat/completions 时
      - 代码直接追加 /responses,导致路径变成 /v1/chat/completions/responses
      - 上游返回 404 错误
      
      修复:
      - 在追加 /responses 前,先移除 base_url 中的 /chat/completions 后缀
      - 确保最终路径为 https://example.com/v1/responses
      
      影响范围:
      - OpenAI API Key 账号的测试接口
      - OpenAI API Key 账号的实际网关请求
      
      Related-to: #231
      7fdc25df
    • ianshaw's avatar
      fix(gateway): 完善 max_output_tokens 参数处理逻辑 · fe6a3f42
      ianshaw authored
      根据不同平台和账号类型处理 max_output_tokens 参数:
      - OpenAI OAuth (Responses API): 保留 max_output_tokens(支持)
      - OpenAI API Key: 删除 max_output_tokens(不支持)
      - Anthropic (Claude): 转换 max_output_tokens 为 max_tokens
      - Gemini: 删除 max_output_tokens(由 Gemini 专用转换处理)
      - 其他平台: 删除(安全起见)
      
      同时处理 max_completion_tokens 参数,仅在 OpenAI OAuth 时保留。
      
      修复客户端(如 OpenCode)发送不支持参数导致上游返回 400 错误的问题。
      
      Related-to: #231
      fe6a3f42
    • xiluo's avatar
      feat(gateway): 优化 Antigravity/Gemini 思考块处理 · 524d80ae
      xiluo authored
      此提交解决了思考块 (thinking blocks) 在转发过程中的兼容性问题。
      
      主要变更:
      
      1. **思考块优化 (Thinking Blocks)**:
         - 在 AntigravityGatewayService 中增加了 sanitizeThinkingBlocks 处理,强制移除思考块中不支持的 cache_control 字段(避免 Anthropic/Vertex AI 报错)
         - 实现历史思考块展平 (Flattening):将非最后一条消息中的思考块转换为普通文本块,以绕过上游对历史思考块签名的严格校验
         - 增加 cleanCacheControlFromGeminiJSON 作为最后一道防线,确保转换后的 Gemini 请求中不残留非法的 cache_control
      
      2. **GatewayService 缓存控制优化**:
         - 更新缓存控制逻辑,跳过 thinking 块(thinking 块不支持 cache_control 字段)
         - 增加 removeCacheControlFromThinkingBlocks 函数强制清理
      
      关联 Issue: #225
      524d80ae