- 10 Feb, 2026 1 commit
-
-
shaw authored
-
- 09 Feb, 2026 1 commit
-
-
Rose Ding authored
当分组内只有一个可用账号且上游返回 503 (MODEL_CAPACITY_EXHAUSTED) 时, 不再设置模型限流+切换账号(因为切换回来还是同一个账号),而是在 Service 层 原地等待+重试,避免双重等待问题。 主要变更: - Handler 层:检测单账号 503 场景,清除排除列表并设置 SingleAccountRetry 标记 - Service 层:新增 handleSingleAccountRetryInPlace 原地重试逻辑 - Service 层:预检查跳过单账号模式下的限流检查 - 新增 ctxkey.SingleAccountRetry 上下文标记
-
- 07 Feb, 2026 5 commits
-
-
yangjianbo authored
基于 backend-code-audit 审计报告,修复剩余 P0/P1/P2 共 34 项问题: P0 生产 Bug: - 修复 time.Since(time.Now()) 计时逻辑错误 (P0-03) - generateRandomID 改用 crypto/rand 替代固定索引 (P0-04) - IncrementQuotaUsed 重写为 Ent 原子操作消除 TOCTOU 竞态 (P0-05) 安全加固: - gateway/openai handler 错误响应替换为泛化消息,防止内部信息泄露 (P1-14) - usage_log_repo dateFormat 参数改用白名单映射,防止 SQL 注入 (P1-16) - 默认配置安全加固:sslmode=prefer、response_headers=true、mode=release (P1-18/19, P2-15) 性能优化: - gateway handler 循环内 defer 替换为显式 releaseWait 闭包 (P1-02) - group_repo/promo_code_repo Count 前 Clone 查询避免状态污染 (P1-03) - usage_log_repo 四个查询添加 LIMIT 10000 防止 OOM (P1-07) - GetBatchUsageStats 添加时间范围参数,默认最近 30 天 (P1-10) - ip.go CIDR 预编译为包级变量 (P1-11) - BatchUpdateCredentials 重构为先验证后更新 (P1-13) 缓存一致性: - billing_cache 添加 jitteredTTL 防止缓存雪崩 (P2-10) - DeductUserBalance/UpdateSubscriptionUsage 错误传播修复 (P2-12) - UserService.UpdateBalance 成功后异步失效 billingCache (P2-13) 代码质量: - search 截断改为按 rune 处理,支持多字节字符 (P2-01) - TLS Handshake 改为 HandshakeContext 支持 context 取消 (P2-07) - CORS 预检添加 Access-Control-Max-Age: 86400 (P2-16) 测试覆盖: - 新增 user_service_test.go(UpdateBalance 缓存失效 6 个用例) - 新增 batch_update_credentials_test.go(fail-fast + 类型验证 7 个用例) - 新增 response_transformer_test.go、ip_test.go、usage_log_repo_unit_test.go、search_truncate_test.go - 集成测试:IncrementQuotaUsed 并发测试、billing_cache 错误传播测试 - config_test.go 补充 server.mode/sslmode 默认值断言 Co-Authored-By:Claude Opus 4.6 <noreply@anthropic.com>
-
shaw authored
-
yangjianbo authored
oauth 和 openai 包的 SessionStore.Stop() 直接调用 close(stopCh), 重复调用会导致 panic。使用 sync.Once 包裹确保幂等安全。 新增单元测试覆盖连续调用和 50 goroutine 并发调用场景。 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
-
erio authored
When extended thinking is enabled, Claude API requires max_tokens > thinking.budget_tokens. If misconfigured, this auto-adjusts max_tokens to budget_tokens + 1000 instead of returning a 400 error. - Add ensureMaxTokensGreaterThanBudget helper function - Extract Gemini25FlashThinkingBudgetLimit constant (24576) - Log adjustment for debugging
-
- 06 Feb, 2026 1 commit
-
-
shaw authored
-
- 05 Feb, 2026 2 commits
-
-
yangjianbo authored
-
ianshaw authored
当 Gemini for Google Cloud API 未启用时(SERVICE_DISABLED 错误), 系统现在会: - 自动检测 403 PERMISSION_DENIED 错误 - 从错误响应中提取 API 激活 URL - 向用户显示清晰的错误消息和可点击的激活链接 - 提供操作指引(启用后等待几分钟) 新增文件: - internal/pkg/googleapi/error.go: Google API 错误解析器 - internal/pkg/googleapi/error_test.go: 完整的测试覆盖 - GEMINI_API_ERROR_HANDLING.md: 实现文档 修改文件: - internal/repository/geminicli_codeassist_client.go: 在 LoadCodeAssist 和 OnboardUser 中增强错误处理 这大大改善了用户体验,用户不再需要手动从错误日志中查找激活 URL。
-
- 03 Feb, 2026 2 commits
-
-
liuxiongfeng authored
- 将 dummyThoughtSignature 改为导出的 DummyThoughtSignature 常量,供跨包使用 - 修改 gemini_native_signature_cleaner.go 将删除签名改为替换为 dummy 签名 这样可以跳过 Gemini 3 的签名验证,解决粘性会话切换账号时的验证失败问题 - 更新相关测试文件 Fixes: 粘性会话切换账号时 thoughtSignature 验证失败导致 400 错误
-
song authored
-
- 02 Feb, 2026 1 commit
-
-
song authored
-
- 30 Jan, 2026 1 commit
-
-
liuxiongfeng authored
-
- 28 Jan, 2026 3 commits
- 27 Jan, 2026 4 commits
-
-
song authored
-
Gemini Wen authored
Prevents panic when ErrorFrom is called in test contexts where gin.CreateTestContext doesn't set up an HTTP request. Co-Authored-By:Claude Opus 4.5 <noreply@anthropic.com>
-
Gemini Wen authored
- 使用 ApplicationError 返回详细错误信息到前端 - 添加 User-Agent: codex-cli/0.91.0 - 移除 ForceHTTP2 以兼容 HTTP 代理 - 修复代理获取失败时静默忽略的问题 - 500 错误时记录完整错误日志 Co-Authored-By:Claude Opus 4.5 <noreply@anthropic.com>
-
song authored
- Group 新增 mcp_xml_inject 字段,控制 Antigravity 平台的 MCP XML 协议注入 - 默认启用,可在分组设置中关闭 - 修复 GetByKeyForAuth 遗漏查询 mcp_xml_inject 字段导致认证缓存值始终为 false 的问题
-
- 26 Jan, 2026 1 commit
-
-
shaw authored
新增功能: - 支持 Google Authenticator 等应用进行 TOTP 二次验证 - 用户可在个人设置中启用/禁用 2FA - 登录时支持 TOTP 验证流程 - 管理后台可全局开关 TOTP 功能 安全增强: - TOTP 密钥使用 AES-256-GCM 加密存储 - 添加 TOTP_ENCRYPTION_KEY 配置项,必须手动配置才能启用功能 - 防止服务重启导致加密密钥变更使用户无法登录 - 验证失败次数限制,防止暴力破解 配置说明: - Docker 部署:在 .env 中设置 TOTP_ENCRYPTION_KEY - 非 Docker 部署:在 config.yaml 中设置 totp.encryption_key - 生成密钥命令:openssl rand -hex 32
-
- 25 Jan, 2026 1 commit
-
-
ianshaw authored
## 问题描述 在使用 Gemini 模型(gemini-3-flash-preview)时,出现 400 错误: "Unable to submit request because Thought signature is not valid" ## 根本原因 在 `request_transformer.go` 的 `buildParts()` 函数中: - 对于 `tool_use` 和 `thinking` 块,当 `allowDummyThought=true`(Gemini 模型)时 - 代码会无条件将客户端传入的真实 `thoughtSignature` 覆盖成 dummy 值 - 导致 Gemini API 验证签名失败(签名与上下文不匹配) ## 修复方案 修改 signature 处理逻辑: 1. **优先透传真实 signature**:如果客户端提供了有效的 signature,保留它 2. **缺失时才使用 dummy**:只有在 signature 缺失且是 Gemini 模型时,才使用 dummy signature 3. **Claude 模型特殊处理**:将 dummy signature 视为缺失,避免透传到需要真实签名的链路 ## 修改内容 ### request_transformer.go - `thinking` 块(第 367-386 行):优先透传真实 signature - `tool_use` 块(第 411-418 行):优先透传真实 signature ### request_transformer_test.go - 修改测试用例名称,反映新的行为 - 新增测试用例验证"缺失时才使用 dummy"的逻辑 ## 影响范围 - 修复 Gemini 模型在多轮对话中使用 tool_use 时的签名验证错误 - 不影响 Claude 模型的现有行为 - 提高跨账号切换时的稳定性 相关问题:#[issue_number]
-
- 23 Jan, 2026 3 commits
- 22 Jan, 2026 1 commit
-
-
0xff26b9a8 authored
- 修复 TransformGeminiToClaude 的 JSON 解析逻辑,当 V1InternalResponse 解析成功但 candidates 为空时,尝试直接解析为 GeminiResponse 格式 - 修复 handleClaudeStreamToNonStreaming 收集流式响应的逻辑,累积所有 chunks 的内容而不是只保留最后一个(最后一个 chunk 通常 text 为空) - 新增 mergeCollectedPartsToResponse 函数,合并所有类型的 parts (text、thinking、functionCall、inlineData),保持原始顺序 - 连续的普通 text parts 合并为一个,thinking/functionCall/inlineData 保持原样
-
- 21 Jan, 2026 3 commits
-
-
0xff26b9a8 authored
-
0xff26b9a8 authored
主要变更: 1. 重构代码结构: - 将 CleanJSONSchema 及其相关辅助函数从 request_transformer.go 提取到独立的 schema_cleaner.go 文件中,实现逻辑解耦。 2. 逻辑优化与修正: - 参考 Antigravity-Manager (json_schema.rs) 的实现逻辑,修正了 Schema 清洗策略。
-
0xff26b9a8 authored
-
- 20 Jan, 2026 2 commits
-
-
0xff26b9a8 authored
主要变更: 1. 重构代码结构: - 将 CleanJSONSchema 及其相关辅助函数从 request_transformer.go 提取到独立的 schema_cleaner.go 文件中,实现逻辑解耦。 2. 逻辑优化与修正: - 参考 Antigravity-Manager (json_schema.rs) 的实现逻辑,修正了 Schema 清洗策略。
-
shaw authored
Add TestAllProfiles to verify TLS fingerprint configurations from config.yaml against tls.peet.ws. Tests check JA4 cipher hash (stable part) to validate fingerprint spoofing works correctly.
-
- 19 Jan, 2026 2 commits
-
-
shaw authored
- 更新TokenURL和RedirectURI为platform.claude.com - 更新scope定义,区分浏览器URL和内部API调用 - 修正state/code_verifier生成算法使用base64url编码 - 修正授权URL参数顺序并添加code=true - 更新token交换请求头匹配官方实现 - 清理未使用的类型和函数
-
shaw authored
- 新增 session_id_masking_enabled 配置,启用后将在15分钟内固定 metadata.user_id 中的 session ID - TLS fingerprint 模块日志从自定义 debugLog 迁移到 slog - main.go 添加 slog 初始化,根据 gin mode 设置日志级别 - 前端创建/编辑账号模态框添加会话ID伪装开关 - 多语言支持(中英文)
-
- 18 Jan, 2026 2 commits
- 17 Jan, 2026 4 commits