1. 07 Apr, 2026 1 commit
  2. 12 Mar, 2026 1 commit
  3. 07 Mar, 2026 1 commit
  4. 06 Mar, 2026 4 commits
  5. 03 Mar, 2026 1 commit
    • QTom's avatar
      fix(gateway): 分组隔离 — 禁止未分组账号被跨组调度 · 530a1629
      QTom authored
      当 API Key 无分组时,调度仅从未分组账号池中选取。
      修复 isAccountInGroup 在 groupID==nil 时的逻辑,
      同时补全 scheduler_snapshot_service 和 gemini_compat_service
      中的 SimpleMode 保护,确保分组隔离在所有调度路径生效。
      
      新增 ListSchedulableUngroupedByPlatform/s 方法,
      使用 Ent 的 Not(HasAccountGroups()) 谓词实现未分组账号隔离。
      新增 17 个单元和端到端隔离测试,覆盖所有分支和边界条件。
      530a1629
  6. 28 Feb, 2026 1 commit
  7. 12 Feb, 2026 1 commit
    • yangjianbo's avatar
      feat(openai): 极致优化 OAuth 链路并补齐性能守护 · 61a2bf46
      yangjianbo authored
      - 优化 /v1/responses 热路径,减少重复解析与不必要拷贝\n- 优化并发与 token 竞争路径并补齐运行指标\n- 补充 OpenAI/Ops 相关单元测试与回归用例\n- 新增灰度阈值守护与压测脚本,支撑发布验收
      61a2bf46
  8. 10 Feb, 2026 1 commit
    • yangjianbo's avatar
      perf(backend): 使用 gjson/sjson 优化热路径 JSON 处理 · 58912d4a
      yangjianbo authored
      
      
      将 API 网关热路径中的 json.Unmarshal+json.Marshal 替换为 gjson 零拷贝查询和 sjson 精准写入:
      - unwrapV1InternalResponse 性能提升 22x(4009ns→182ns),内存分配减少 28.5x
      - unwrapGeminiResponse、extractGeminiUsage、estimateGeminiCountTokens、ParseGeminiRateLimitResetTime 改为接收 []byte 使用 gjson 提取
      - ParseGatewayRequest 的 model/stream/metadata/thinking/max_tokens 改用 gjson 类型安全提取
      - Handler 层(sora/openai)改用 gjson 提取字段、sjson 注入/修改字段,移除 map[string]any 中间变量
      - Sora Client 响应解析改用 gjson ForEach 遍历,减少内存分配
      - 新增约 100 个单元测试用例,所有改动函数覆盖率 >85%
      Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
      58912d4a
  9. 09 Feb, 2026 1 commit
    • erio's avatar
      refactor: replace scope-level rate limiting with model-level rate limiting · fc095bf0
      erio authored
      Merge functional changes from develop branch:
      - Remove AntigravityQuotaScope system (claude/gemini_text/gemini_image)
      - Replace with per-model rate limiting using resolveAntigravityModelKey
      - Remove model load statistics (IncrModelCallCount/GetModelLoadBatch)
      - Simplify account selection to unified priority→load→LRU algorithm
      - Remove SetAntigravityQuotaScopeLimit from AccountRepository
      - Clean up scope-related UI indicators and API fields
      fc095bf0
  10. 08 Feb, 2026 2 commits
    • erio's avatar
      b889d501
    • yangjianbo's avatar
      test: 完善自动化测试体系(7个模块,73个任务) · bb5a5dd6
      yangjianbo authored
      
      
      系统性地修复、补充和强化项目的自动化测试能力:
      
      1. 测试基础设施修复
         - 修复 stubConcurrencyCache 缺失方法和构造函数参数不匹配
         - 创建 testutil 共享包(stubs.go, fixtures.go, httptest.go)
         - 为所有 Stub 添加编译期接口断言
      
      2. 中间件测试补充
         - 新增 JWT 认证中间件测试(有效/过期/篡改/缺失 Token)
         - 补充 rate_limiter 和 recovery 中间件测试场景
      
      3. 网关核心路径测试
         - 新增账户选择、等待队列、流式响应、并发控制、计费、Claude Code 检测测试
         - 覆盖负载均衡、粘性会话、SSE 转发、槽位管理等关键逻辑
      
      4. 前端测试体系(11个新测试文件,163个测试用例)
         - Pinia stores: auth, app, subscriptions
         - API client: 请求拦截器、响应拦截器、401 刷新
         - Router guards: 认证重定向、管理员权限、简易模式限制
         - Composables: useForm, useTableLoader, useClipboard
         - Components: LoginForm, ApiKeyCreate, Dashboard
      
      5. CI/CD 流水线重构
         - 重构 backend-ci.yml 为统一的 ci.yml
         - 前后端 4 个并行 Job + Postgres/Redis services
         - Race 检测、覆盖率收集与门禁、Docker 构建验证
      
      6. E2E 自动化测试
         - e2e-test.sh 自动化脚本(Docker 启动→健康检查→测试→清理)
         - 用户注册→登录→API Key→网关调用完整链路测试
         - Mock 模式和 API Key 脱敏支持
      
      7. 修复预存问题
         - tlsfingerprint dialer_test.go 缺失 build tag 导致集成测试编译冲突
      Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
      bb5a5dd6
  11. 07 Feb, 2026 3 commits
    • erio's avatar
      feat: add Anthropic sticky session digest chain matching via Trie · 50a783ff
      erio authored
      The previous fallback (step 3) in GenerateSessionHash hashed system +
      all messages together, producing a different hash each round as the
      conversation grew ([a] -> [a,b] -> [a,b,c]). This made fallback sticky
      sessions ineffective for multi-turn conversations.
      
      Implement per-message Trie digest chain matching (reusing Gemini's Trie
      infrastructure) so that the previous round's chain is always a prefix
      of the current round's chain, enabling reliable session affinity.
      50a783ff
    • yangjianbo's avatar
      perf(service): 优化 model 替换函数,用 gjson/sjson 替代全量 JSON 序列化 · 8226a4ce
      yangjianbo authored
      
      
      SSE 热路径中 replaceModelInSSELine 和 replaceModelInResponseBody 原来
      使用 json.Unmarshal/Marshal 对每个事件做全量反序列化再序列化,现改为
      gjson.Get/sjson.Set 精确字段操作,消除 O(n) 中间 map 分配,保持 JSON
      字段顺序不变。涉及 OpenAIGatewayService 和 GatewayService 两个服务。
      
      新增 23 个单元测试覆盖:顶层/嵌套 model 替换、不匹配跳过、空行/[DONE]/
      非法 JSON 等边界情况。
      
      Fixes: P1-08
      Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
      8226a4ce
    • erio's avatar
      feat(antigravity): comprehensive enhancements - model mapping, rate limiting, scheduling & ops · 5e98445b
      erio authored
      Key changes:
      - Upgrade model mapping: Opus 4.5 → Opus 4.6-thinking with precise matching
      - Unified rate limiting: scope-level → model-level with Redis snapshot sync
      - Load-balanced scheduling by call count with smart retry mechanism
      - Force cache billing support
      - Model identity injection in prompts with leak prevention
      - Thinking mode auto-handling (max_tokens/budget_tokens fix)
      - Frontend: whitelist mode toggle, model mapping validation, status indicators
      - Gemini session fallback with Redis Trie O(L) matching
      - Ops: enhanced concurrency monitoring, account availability, retry logic
      - Migration scripts: 049-051 for model mapping unification
      5e98445b
  12. 06 Feb, 2026 1 commit
  13. 02 Feb, 2026 1 commit
  14. 20 Jan, 2026 2 commits
  15. 19 Jan, 2026 1 commit
  16. 16 Jan, 2026 1 commit
  17. 15 Jan, 2026 2 commits
  18. 14 Jan, 2026 1 commit
    • ianshaw's avatar
      fix(网关): 修复账号选择中的调度器快照延迟问题 · 25b00abc
      ianshaw authored
      ## 问题描述
      调度器快照更新存在0.5-1秒的延迟(Outbox轮询间隔),导致在账号被限流或过载后的短时间窗口内,
      可能仍会被选中,造成请求失败。
      
      ## 根本原因
      账号选择逻辑依赖调度器快照(listSchedulableAccounts),但快照更新有延迟:
      - Outbox轮询: 每1秒检查一次变更事件
      - 全量重建: 每300秒重建一次
      - 时间窗口: 账号状态变更后0.5-1秒内,快照可能未更新
      
      ## 解决方案
      在账号选择循环中添加IsSchedulable()实时检查,作为第二道防线:
      1. 第一道防线: 调度器快照过滤(可能有延迟)
      2. 第二道防线: IsSchedulable()实时检查(本次修复)
      
      IsSchedulable()会检查:
      - RateLimitResetAt: 限流重置时间
      - OverloadUntil: 过载持续时间
      - TempUnschedulableUntil: 临时不可调度时间
      - Status: 账号状态
      - Schedulable: 可调度标志
      
      ## 修改范围
      ### OpenAI Gateway Service
      - SelectAccountForModelWithExclusions: 添加IsSchedulable()检查
      - SelectAccountWithLoadAwareness: 添加IsSchedulable()检查
      
      ### Gateway Service (Claude/Gemini/Antigravity)
      - 负载感知选择候选账号筛选: 添加IsSchedulable()检查
      - selectAccountForModelWithPlatform: 添加IsSchedulable()检查
      - selectAccountWithMixedScheduling: 添加IsSchedulable()检查
      
      ### 测试用例
      - OpenAI: 添加2个测试用例验证限流账号过滤
      - Gateway: 添加2个测试用例验证限流和过载账号过滤
      
      ### 其他修复
      - ops_repo_preagg.go: 修复platform为NULL时的聚合问题
      
      ## 测试结果
      所有单元测试通过 
      25b00abc
  19. 10 Jan, 2026 1 commit
  20. 09 Jan, 2026 1 commit
  21. 05 Jan, 2026 2 commits
    • yangjianbo's avatar
      fix(安全): 关闭白名单时保留最小校验与默认白名单 · 048ed061
      yangjianbo authored
      实现 allow_insecure_http 并在关闭校验时执行最小格式验证
      - 关闭 allowlist 时要求 URL 可解析且 scheme 合规
      - 响应头过滤关闭时使用默认白名单策略
      - 更新相关文档、示例与测试覆盖
      048ed061
    • yangjianbo's avatar
      feat(安全): 添加安全开关并完善测试流程 · 794a9f96
      yangjianbo authored
      实现安全开关默认关闭与响应头透传逻辑
      - URL 校验与响应头过滤支持开关并覆盖流式路径
      - 非流式 Content-Type 透传/默认值按配置生效
      - 接入 go test、golangci-lint 与前端 lint/typecheck
      - 补充相关测试与配置/文档说明
      794a9f96
  22. 04 Jan, 2026 2 commits