1. 31 Dec, 2025 14 commits
    • IanShaw027's avatar
      fix(lint): 修复 golangci-lint 报错 · 9c889804
      IanShaw027 authored
      - 修复 gofmt 格式问题
      - 修复 staticcheck SA4031 nil check 问题(只在成功时设置 release 函数)
      - 删除未使用的 sortAccountsByPriority 函数
      9c889804
    • IanShaw027's avatar
      test(gateway): 补充账号调度优化的单元测试 · fe31495a
      IanShaw027 authored
      - 添加 GetAccountsLoadBatch 批量负载查询测试
      - 添加 CleanupExpiredAccountSlots 过期槽位清理测试
      - 添加 SelectAccountWithLoadAwareness 负载感知选择测试
      - 测试覆盖降级行为、账号排除、错误处理等场景
      fe31495a
    • IanShaw027's avatar
      feat(gateway): 实现负载感知的账号调度优化 · 592d2d09
      IanShaw027 authored
      - 新增调度配置:粘性会话排队、兜底排队、负载计算、槽位清理
      - 实现账号级等待队列和批量负载查询(Redis Lua 脚本)
      - 三层选择策略:粘性会话优先 → 负载感知选择 → 兜底排队
      - 后台定期清理过期槽位,防止资源泄漏
      - 集成到所有网关处理器(Claude/Gemini/OpenAI)
      592d2d09
    • 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
    • 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(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
    • 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 9 commits
  3. 29 Dec, 2025 15 commits
    • Junming Chen's avatar
      19d0ee13
    • song's avatar
      fix(antigravity): 修复 429 限流处理逻辑 · caa8c47b
      song authored
      - 只有 5 次重试全部失败后才标记账户限流
      - 使用 Gemini 格式解析 429 响应中的重试时间
      - Claude 模型无重试时间时默认 1 分钟,Gemini 默认 5 分钟
      - 添加生图模型映射 gemini-3-pro-image-preview
      caa8c47b
    • song's avatar
      fix: gofmt · 42e2c506
      song authored
      42e2c506
    • song's avatar
    • song's avatar
      fix: 删除未使用的代码并修复格式 · 026740b5
      song authored
      - 删除 client.go 中未使用的 proxyURL 字段
      - 删除 AntigravityGatewayService 中未使用的字段和方法
      - 修复 gofmt 格式问题
      026740b5
    • song's avatar
      fix: 修复 golangci-lint 检查错误 · 21a04332
      song authored
      - SA1029: 创建 ctxkey 包定义类型安全的 context key
      - ST1005: 错误字符串首字母改小写
      - errcheck: 显式忽略 bytes.Buffer.Write 返回值
      - 修复单元测试中 GatewayService 缺少 cfg 字段的问题
      21a04332
    • yangjianbo's avatar
      fix(用户): 修复删除用户软删除钩子 · 4dab18a9
      yangjianbo authored
      避免软删除钩子类型断言失败导致 500\n删除无记录时返回未找到错误并记录日志
      4dab18a9
    • song's avatar
      234e98f1
    • song's avatar
      feat(antigravity): 添加专用路由,支持仅使用 antigravity 账户 · b31bfd53
      song authored
      添加 /antigravity/v1/* 和 /antigravity/v1beta/* 路由:
      - 通过 ForcePlatform 中间件强制使用 antigravity 平台
      - 跳过混合调度逻辑,仅调度 antigravity 账户
      - 支持按分组优先查找,找不到时回退查询全部 antigravity 账户
      
      修复 context key 类型不匹配问题:
      - middleware 和 service 统一使用字符串常量 "ctx_force_platform"
      - 解决 Go context.Value() 类型+值匹配导致的读取失败
      
      其他改动:
      - 嵌入式前端中间件白名单添加 /antigravity/ 路径
      - e2e 测试 Gemini 端点 URL 添加 endpointPrefix 支持
      b31bfd53
    • yangjianbo's avatar
      test(用户): 补齐创建用户与注册单测 · 305eaabb
      yangjianbo authored
      覆盖管理员创建用户与注册流程的关键失败分支\n完善创建成功路径的断言
      305eaabb
    • yangjianbo's avatar
      test(删除): 添加删除单测并修复中间件测试 · f6de36cb
      yangjianbo authored
      新增 AdminService 删除路径单元测试与规范场景更新\n同步调整 Google API Key 中间件测试桩与签名
      f6de36cb
    • yangjianbo's avatar
      test(服务层): 添加删除方法的单元测试 · 100d9d20
      yangjianbo authored
      - 新增 AccountService.Delete 方法的 4 个测试用例
      - 新增 ApiKeyService.Delete 方法的 4 个测试用例
      - 使用 stub 模式隔离数据库依赖,验证权限检查和缓存清理逻辑
      - 添加详细的中文注释说明测试设计和预期行为
      
      🤖 Generated with [Claude Code](https://claude.com/claude-code
      
      )
      Co-Authored-By: default avatarClaude Opus 4.5 <noreply@anthropic.com>
      100d9d20
    • yangjianbo's avatar
      perf(后端): 优化删除操作的数据库查询性能 · e9c755f4
      yangjianbo authored
      - 新增 ExistsByID 方法用于账号存在性检查,避免加载完整对象
      - 新增 GetOwnerID 方法用于 API Key 所有权验证,仅查询 user_id 字段
      - 优化 AccountService.Delete 使用轻量级存在性检查
      - 优化 ApiKeyService.Delete 使用轻量级权限验证
      - 改进前端删除错误提示,显示后端返回的具体错误消息
      - 添加详细的中文注释说明优化原因
      
      🤖 Generated with [Claude Code](https://claude.com/claude-code
      
      )
      Co-Authored-By: default avatarClaude Opus 4.5 <noreply@anthropic.com>
      e9c755f4
    • song's avatar
      feat(antigravity): 添加混合调度可选功能 · 1ad29032
      song authored
      - 后端:账户模型添加 IsMixedSchedulingEnabled() 方法,读取 extra.mixed_scheduling
      - 后端:gateway_service 和 gemini_messages_compat_service 支持混合调度逻辑
      - 后端:分组创建支持指定 platform 参数
      - 前端:账户创建/编辑弹窗添加混合调度开关(仅 antigravity 账户显示)
      - 前端:混合调度开关添加问号图标和 tooltip 说明
      - 前端:GroupSelector 支持根据 mixedScheduling 属性过滤分组
      - 前端:分组创建支持选择 platform
      - 测试:e2e 测试添加 ENDPOINT_PREFIX 环境变量支持混合/隔离模式测试
      - 测试:删除过时的 Claude signature 测试用例
      1ad29032
    • shaw's avatar
      refactor: 移除旧版数据库配置的简易模式实现 · 31fef105
      shaw authored
      移除与 PR #66 冲突的旧版简易模式实现(commit 7d4b7dee)。
      新版简易模式通过 run_mode 配置文件/环境变量控制,无需数据库设置。
      
      后端变更:
      - 移除 SettingKeySimpleMode 常量
      - 移除 SystemSettings/PublicSettings 中的 SimpleMode 字段
      - 移除 setting_handler 中的简易模式切换逻辑
      - 移除 userService 依赖(不再需要自动设置管理员并发数)
      
      前端变更:
      - 移除 appStore.simpleMode 状态
      - 移除设置页面的"使用模式"设置区块
      - 移除 GroupsView 中的简易模式相关逻辑
      - 移除相关国际化文案
      31fef105
  4. 28 Dec, 2025 2 commits
    • IanShaw027's avatar
      feat(全栈): 实现简易模式核心功能 · ecfad788
      IanShaw027 authored
      **功能概述**:
      实现简易模式(Simple Mode),为个人用户和小团队提供简化的使用体验,隐藏复杂的分组、订阅、配额等概念。
      
      **后端改动**:
      1. 配置系统
         - 新增 run_mode 配置项(standard/simple)
         - 支持环境变量 RUN_MODE
         - 默认值为 standard
      
      2. 数据库初始化
         - 自动创建3个默认分组:anthropic-default、openai-default、gemini-default
         - 默认分组配置:无并发限制、active状态、非独占
         - 幂等性保证:重复启动不会重复创建
      
      3. 账号管理
         - 创建账号时自动绑定对应平台的默认分组
         - 如果未指定分组,自动查找并绑定默认分组
      
      **前端改动**:
      1. 状态管理
         - authStore 新增 isSimpleMode 计算属性
         - 从后端API获取并同步运行模式
      
      2. UI隐藏
         - 侧边栏:隐藏分组管理、订阅管理、兑换码菜单
         - 账号管理页面:隐藏分组列
         - 创建/编辑账号对话框:隐藏分组选择器
      
      3. 路由守卫
         - 限制访问分组、订阅、兑换码相关页面
         - 访问受限页面时自动重定向到仪表板
      
      **配置示例**:
      ```yaml
      run_mode: simple
      
      run_mode: standard
      ```
      
      **影响范围**:
      - 后端:配置、数据库迁移、账号服务
      - 前端:认证状态、路由、UI组件
      - 部署:配置文件示例
      
      **兼容性**:
      - 简易模式和标准模式可无缝切换
      - 不需要数据迁移
      - 现有数据不受影响
      ecfad788
    • song's avatar
      cf1d0f23