- 12 Mar, 2026 1 commit
-
-
ius authored
-
- 07 Mar, 2026 1 commit
-
-
admin authored
-
- 06 Mar, 2026 4 commits
-
-
神乐 authored
-
神乐 authored
-
神乐 authored
-
yangjianbo authored
抽取共享的用户分组专属倍率解析器,统一缓存、singleflight 与回退逻辑。\n\n让 OpenAI 独立计费链路复用专属倍率解析,修复 usage 记录与实际扣费未命中用户专属倍率的问题。\n\n补齐 OpenAI 计费与解析器单元测试,并修复全量回归中暴露的 lint 阻塞项。\n\nCo-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
-
- 03 Mar, 2026 1 commit
-
-
QTom authored
当 API Key 无分组时,调度仅从未分组账号池中选取。 修复 isAccountInGroup 在 groupID==nil 时的逻辑, 同时补全 scheduler_snapshot_service 和 gemini_compat_service 中的 SimpleMode 保护,确保分组隔离在所有调度路径生效。 新增 ListSchedulableUngroupedByPlatform/s 方法, 使用 Ent 的 Not(HasAccountGroups()) 谓词实现未分组账号隔离。 新增 17 个单元和端到端隔离测试,覆盖所有分支和边界条件。
-
- 28 Feb, 2026 1 commit
-
-
yangjianbo authored
-
- 12 Feb, 2026 1 commit
-
-
yangjianbo authored
- 优化 /v1/responses 热路径,减少重复解析与不必要拷贝\n- 优化并发与 token 竞争路径并补齐运行指标\n- 补充 OpenAI/Ops 相关单元测试与回归用例\n- 新增灰度阈值守护与压测脚本,支撑发布验收
-
- 10 Feb, 2026 1 commit
-
-
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:Claude Opus 4.6 <noreply@anthropic.com>
-
- 09 Feb, 2026 1 commit
-
-
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
-
- 08 Feb, 2026 2 commits
-
-
erio authored
-
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:Claude Opus 4.6 <noreply@anthropic.com>
-
- 07 Feb, 2026 3 commits
-
-
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.
-
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:Claude Opus 4.6 <noreply@anthropic.com>
-
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
-
- 06 Feb, 2026 1 commit
-
-
yangjianbo authored
将流式响应中 bufio.Scanner 的 64KB buffer 从每次 make 分配改为 sync.Pool 复用,统一切片表达式为 [:0]、变量命名为 scanBuf, 并补充对应的单元测试。 Co-Authored-By:Claude Opus 4.6 <noreply@anthropic.com>
-
- 02 Feb, 2026 1 commit
-
-
song authored
-
- 20 Jan, 2026 2 commits
-
-
yangjianbo authored
- Update/BulkUpdate 按不可调度字段触发缓存刷新 - GatewayCache 支持多前缀会话键清理 - 模型路由与混合调度优化粘性会话处理 - 补充调度与缓存相关测试覆盖
-
yangjianbo authored
- Update/BulkUpdate 按不可调度字段触发缓存刷新 - GatewayCache 支持多前缀会话键清理 - 模型路由与混合调度优化粘性会话处理 - 补充调度与缓存相关测试覆盖
-
- 19 Jan, 2026 1 commit
-
-
cyhhao authored
-
- 16 Jan, 2026 1 commit
-
-
IanShaw027 authored
opencode 请求不带 session_id/conversation_id,导致粘性会话失效。现在按 header 优先、prompt_cache_key 兜底生成 session hash,并补充单测验证优先级。
-
- 15 Jan, 2026 2 commits
- 14 Jan, 2026 1 commit
-
-
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时的聚合问题 ## 测试结果 所有单元测试通过
✅
-
- 10 Jan, 2026 1 commit
-
-
cyhhao authored
-
- 09 Jan, 2026 1 commit
-
-
cyhhao authored
-
- 05 Jan, 2026 2 commits
-
-
yangjianbo authored
实现 allow_insecure_http 并在关闭校验时执行最小格式验证 - 关闭 allowlist 时要求 URL 可解析且 scheme 合规 - 响应头过滤关闭时使用默认白名单策略 - 更新相关文档、示例与测试覆盖
-
yangjianbo authored
实现安全开关默认关闭与响应头透传逻辑 - URL 校验与响应头过滤支持开关并覆盖流式路径 - 非流式 Content-Type 透传/默认值按配置生效 - 接入 go test、golangci-lint 与前端 lint/typecheck - 补充相关测试与配置/文档说明
-
- 04 Jan, 2026 2 commits
-
-
yangjianbo authored
修正测试中的 APIKey 名称引用 移除不可达返回与未使用函数 统一 gofmt 格式并处理 Close 错误
-
yangjianbo authored
- 扩展SSE行长与间隔超时处理,补充keepalive - 写入失败与超长行时发送错误事件,修复并发释放 - 同步默认配置与示例配置,更新Caddy超时/压缩规则 - 新增OpenAI流式超时与超长行测试 测试: go test ./...
-