1. 31 Dec, 2025 24 commits
    • song's avatar
      test: 更新 model mapping 测试用例期望值 · edee46e4
      song authored
      edee46e4
    • song's avatar
      style: fix gofmt formatting · 85485f17
      song authored
      85485f17
    • song's avatar
      refactor(antigravity): 简化模型映射逻辑,支持前缀匹配 · 7f7bbdf6
      song authored
      - 删除精确映射表 antigravityModelMapping,统一使用前缀映射
      - 前缀映射支持模型版本号变化(如 -20251111, -thinking, -preview)
      - 简化 IsModelSupported 函数,所有 claude-/gemini- 前缀模型都支持
      - 添加跨协议测试用例:Claude 端点调用 Gemini 模型、Gemini 端点调用 Claude 模型
      7f7bbdf6
    • shaw's avatar
      style: fix gofmt formatting in claude_types.go · 8e55ee0e
      shaw authored
      8e55ee0e
    • NepetaLemon's avatar
      refactor: 移除 infrastructure 目录 (#108) · 2270a54f
      NepetaLemon authored
      * refactor: 迁移初始化 db 和 redis 到 repository
      
      * refactor: 迁移 errors 到 pkg
      2270a54f
    • shaw's avatar
      chore(token-refresh): 添加 Antigravity Token 刷新调试日志 · bb7ade26
      shaw authored
      - NeedsRefresh 判断为 true 时输出 expires_at、time_until_expiry、window
      - 修正注释中的刷新窗口描述(10分钟 → 15分钟)
      bb7ade26
    • shaw's avatar
      fix(billing): 修复限额为0时消费记录失败的问题 · c5b792ad
      shaw authored
      - 添加 normalizeLimit 函数,将 0 或负数限额规范化为 nil(无限制)
      - 简化 IncrementUsage,移除冗余的配额检查逻辑
        - 配额检查已在请求前由中间件和网关完成
        - 消费记录应无条件执行,确保数据完整性
      - 删除测试限额超出行为的无效集成测试
      c5b792ad
    • IanShaw027's avatar
      fix(upstream): 完善边界检查和 thinking block 处理 · c1e25b7e
      IanShaw027 authored
      基于 Gemini + Codex 审查结果的修复:
      
      1. thinking block dummy signature 填充
         - Gemini 模型现在会填充 dummyThoughtSignature
         - 与 tool_use 处理逻辑保持一致
      
      2. 边界检查增强
         - buildTools: 跳过空工具名称
         - buildTools: 为 nil schema 提供默认值
         - convertClaudeToolsToGeminiTools: 为 nil params 提供默认值
      
      3. 防止下游 API 验证错误
         - 确保所有工具都有有效的 parameters
         - 默认 schema: {type: 'object', properties: {}}
      
      审查报告:Gemini 评分 95%, Codex 评分 8.2/10
      c1e25b7e
    • IanShaw027's avatar
      fix(upstream): 跳过 Claude 模型无 signature 的 thinking block · 35b768b7
      IanShaw027 authored
      - buildParts 函数检测 thinking block 的 signature
      - Claude 模型 (allowDummyThought=false) 时跳过无 signature 的 block
      - 记录警告日志以便调试
      - Gemini 模型继续使用 dummy signature 兼容方案
      
      修复 Issue 0.1: Claude thinking block signature 缺失错误
      35b768b7
    • shaw's avatar
      0b637117
    • IanShaw027's avatar
      fix(upstream): 支持 Claude custom 类型工具 (MCP) 格式 · 15e676e9
      IanShaw027 authored
      - ClaudeTool 结构体增加 Type 和 Custom 字段
      - buildTools 函数支持从 custom 字段读取 input_schema
      - convertClaudeToolsToGeminiTools 函数支持 MCP 工具格式
      - 修复 Antigravity upstream error 400: JSON schema invalid
      
      修复 Issue 0.2: tools.X.custom.input_schema 验证错误
      15e676e9
    • shaw's avatar
      refactor(service): 统一时间戳解析,支持多种格式 · 81213f23
      shaw authored
      新增 Account.GetCredentialAsTime 方法,统一处理凭证中的时间戳字段,
      兼容 RFC3339 字符串、Unix 时间戳字符串和数字类型。
      
      - 重构 Claude/Gemini/Antigravity TokenRefresher.NeedsRefresh
      - 移除重复的 parseExpiresAt/parseAntigravityExpiresAt 函数
      - 简化 GetOpenAITokenExpiresAt 实现
      - 新增 RFC3339 格式单元测试用例
      81213f23
    • yangjianbo's avatar
      fix(网关): 添加 model 参数必填验证 · 1ef4f09d
      yangjianbo authored
      在以下端点添加 model 参数的必填验证,缺失时直接返回 400 错误:
      - /v1/messages
      - /v1/messages/count_tokens
      - /openai/v1/responses
      
      修复前:空 model 会进入账号选择流程,最终由上游 API 返回错误
      修复后:入口处直接拒绝,避免浪费资源和不明确的错误信息
      
      🤖 Generated with [Claude Code](https://claude.com/claude-code
      
      )
      Co-Authored-By: default avatarClaude Opus 4.5 <noreply@anthropic.com>
      1ef4f09d
    • shaw's avatar
      style: fix gofmt formatting in test file · aac7dd6b
      shaw authored
      Remove redundant alignment whitespace before comments.
      aac7dd6b
    • yangjianbo's avatar
      fix(设置): 修复站点设置保存失败的问题 · 6f6dc303
      yangjianbo authored
      问题:
      1. Setting.value 字段设置了 NotEmpty() 约束,导致保存空字符串值时验证失败
      2. 数据库 settings 表缺少 key 字段的唯一约束,导致 ON CONFLICT 语句执行失败
      
      修复:
      - 移除 ent/schema/setting.go 中 value 字段的 NotEmpty() 约束
      - 新增迁移 015_fix_settings_unique_constraint.sql 添加缺失的唯一约束
      - 添加3个回归测试确保空值保存功能正常
      
      🤖 Generated with [Claude Code](https://claude.com/claude-code
      
      )
      Co-Authored-By: default avatarClaude Opus 4.5 <noreply@anthropic.com>
      6f6dc303
    • yangjianbo's avatar
      fix(仓储): 修复并发缓存前缀与软删除更新 · d77d0544
      yangjianbo authored
      补齐 Redis ZSET 前缀处理,确保并发释放计数正确
      
      删除时改用 Client().Mutate 走更新逻辑,保留软删除记录
      
      测试: make test-integration
      d77d0544
    • yangjianbo's avatar
      fix(lint): 修复 golangci-lint 报告的代码问题 · 682f546c
      yangjianbo authored
      - errcheck: 修复类型断言未检查返回值的问题
        - pool.go: 添加 sync.Map 类型断言安全检查
        - req_client_pool.go: 添加 sync.Map 类型断言安全检查
        - concurrency_cache_benchmark_test.go: 显式忽略断言返回值
        - gateway_service.go: 显式忽略 WriteString 返回值
      
      - gofmt: 修复代码格式问题
        - redis.go: 注释对齐
        - api_key_repo.go: 结构体字段对齐
        - concurrency_cache.go: 字段对齐
        - http_upstream.go: 注释对齐
      
      - unused: 删除未使用的代码
        - user_repo.go: 删除未使用的 sql 字段
        - usage_service.go: 删除未使用的 calculateStats 函数
      
      🤖 Generated with [Claude Code](https://claude.com/claude-code
      
      )
      Co-Authored-By: default avatarClaude Opus 4.5 <noreply@anthropic.com>
      682f546c
    • yangjianbo's avatar
      fix(数据层): 修复数据完整性与仓储一致性问题 · 5906f9ab
      yangjianbo authored
      ## 数据完整性修复 (fix-critical-data-integrity)
      - 添加 error_translate.go 统一错误转换层
      - 修复 nil 输入和 NotFound 错误处理
      - 增强仓储层错误一致性
      
      ## 仓储一致性修复 (fix-high-repository-consistency)
      - Group schema 添加 default_validity_days 字段
      - Account schema 添加 proxy edge 关联
      - 新增 UsageLog ent schema 定义
      - 修复 UpdateBalance/UpdateConcurrency 受影响行数校验
      
      ## 数据卫生修复 (fix-medium-data-hygiene)
      - UserSubscription 添加软删除支持 (SoftDeleteMixin)
      - RedeemCode/Setting 添加硬删除策略文档
      - account_groups/user_allowed_groups 的 created_at 声明 timestamptz
      - 停止写入 legacy users.allowed_groups 列
      - 新增迁移: 011-014 (索引优化、软删除、孤立数据审计、列清理)
      
      ## 测试补充
      - 添加 UserSubscription 软删除测试
      - 添加迁移回归测试
      - 添加 NotFound 错误测试
      
      🤖 Generated with [Claude Code](https://claude.com/claude-code
      
      )
      Co-Authored-By: default avatarClaude Opus 4.5 <noreply@anthropic.com>
      5906f9ab
    • yangjianbo's avatar
      fix(网关): 防止连接池缓存失控 · 820bb16c
      yangjianbo authored
      超限且无可淘汰条目时拒绝新建
      
      规范化代理地址并更新失败时的访问时间
      
      补充连接池上限与代理规范化测试
      820bb16c
    • Wei Shaw's avatar
      a1540e27
    • yangjianbo's avatar
      perf(网关): 实现上游账号连接池隔离 · d1c98896
      yangjianbo authored
      新增隔离策略与连接池缓存回收
      
      连接池大小跟随账号并发并处理代理切换
      
      同步配置默认值与示例并补充测试
      d1c98896
    • shaw's avatar
      fix: 修复Antigravity token刷新间隔问题 · b7c6d040
      shaw authored
      b7c6d040
    • yangjianbo's avatar
      fix(服务): 修复system判定、统计时区与缓存日志 · 3d7f8e4b
      yangjianbo authored
      - system 字段存在即视为显式提供,避免 null 触发默认注入
      - 日统计分组显式使用应用时区,缺失时从 TZ 回退到 UTC
      - 缓存写入队列丢弃日志节流汇总,关键任务同步回退
      
      测试: go test ./internal/service -run TestBillingCacheServiceQueueHighLoad
      3d7f8e4b
    • yangjianbo's avatar
      perf(后端): 完成性能优化与连接池配置 · 7efa8b54
      yangjianbo authored
      新增 DB/Redis 连接池配置与校验,并补充单测
      
      网关请求体大小限制与 413 处理
      
      HTTP/req 客户端池化并调整上游连接池默认值
      
      并发槽位改为 ZSET+Lua 与指数退避
      
      用量统计改 SQL 聚合并新增索引迁移
      
      计费缓存写入改工作池并补测试/基准
      
      测试: 在 backend/ 下运行 go test ./...
      7efa8b54
  2. 30 Dec, 2025 13 commits
  3. 29 Dec, 2025 3 commits