- 03 Feb, 2026 11 commits
-
-
JIA-ss authored
问题描述: 使用扩展思考功能时,偶现以下错误: "thinking or redacted_thinking blocks in the latest assistant message cannot be modified" 根因分析: 当代理服务修改请求体中的某些字段时(如 metadata.user_id、model), 使用 map[string]any 解析整个 JSON 后重新序列化,导致: 1. 字段顺序改变(Go map 序列化按字母排序) 2. 数字格式变化(如 1.0 → 1) 3. Unicode 转义变化 Claude API 对 thinking 块进行字节级验证,任何变化都会触发错误。 修复内容: 1. identity_service.go - RewriteUserID/RewriteUserIDWithMasking 使用 json.RawMessage 保留其他字段的原始字节 2. gateway_service.go - replaceModelInBody 使用 json.RawMessage 保留其他字段的原始字节 3. gateway_service.go - normalizeClaudeOAuthRequestBody 保留 messages 的原始字节,跳过包含 thinking 块的消息修改 4. gateway_service.go - isThinkingBlockSignatureError 添加 "cannot be modified" 错误检测,触发自动重试 5. antigravity_gateway_service.go - isSignatureRelatedError 添加 "cannot be modified" 错误检测 Co-Authored-By:Claude Opus 4.5 <noreply@anthropic.com>
-
ducky authored
-
liuxiongfeng authored
- 后端 DTO 新增 scope_rate_limits 字段,从 extra 提取限流信息 - 前端状态列显示 scope 级限流徽章(Claude/Gemini/Image) - 清除速率限制时同时清除账号级和 scope 级限流(已有实现) Cherry-picked from slovx2/sub2api: 66f49b67
-
liuxiongfeng authored
在运维监控的并发/排队卡片中,为 Antigravity 平台账号显示各 scope (claude/gemini_text/gemini_image) 的限流数量统计,便于管理员了解 哪些 scope 正在被限流。 Cherry-picked from slovx2/sub2api: 08d6dc52
-
liuxiongfeng authored
PostgreSQL jsonb_set 在 create_if_missing=true 时无法一次性创建多层嵌套路径。 例如设置 {antigravity_quota_scopes,gemini_image} 时,如果 antigravity_quota_scopes 不存在, jsonb_set 不会自动创建外层 key,导致更新静默失败(affected=1 但数据未变)。 修复方案:嵌套两次 jsonb_set,先确保外层 key 存在,再设置内层值。 同时在设置限流时更新 last_used_at,使刚触发 429 的账号调度优先级降低。 Cherry-picked from slovx2/sub2api: 4b57e80e -
liuxiongfeng authored
将 GATEWAY_ANTIGRAVITY_429_SCOPE_LIMIT 的默认值从关闭改为开启。 当 Gemini 模型触发 429 限流时,只会限制对应的配额域(gemini_text), 而 Claude 和 gemini_image 仍可继续使用,提高账号利用率。
-
liuxiongfeng authored
Antigravity 上游不再支持 gemini-2.5 系列,统一映射到 gemini-3: - gemini-2.5-flash → gemini-3-flash - gemini-2.5-flash-lite → gemini-3-flash - gemini-2.5-flash-thinking → gemini-3-flash - gemini-2.5-flash-image → gemini-3-pro-image - gemini-2.5-pro → gemini-3-pro-high - gemini-2.5-pro-preview → gemini-3-pro-high - gemini-2.5-pro-exp → gemini-3-pro-high
-
liuxiongfeng authored
Update test expectation to reflect new mapping: gemini-2.5-pro -> gemini-3-pro-high
-
liuxiongfeng authored
Add prefix mapping rules for gemini-2.5-pro variants: - gemini-2.5-pro -> gemini-3-pro-high - gemini-2.5-pro-preview -> gemini-3-pro-high - gemini-2.5-pro-exp -> gemini-3-pro-high
-
shuike authored
-
shuike authored
-
- 02 Feb, 2026 13 commits
-
-
ianshaw authored
-
liuxiongfeng authored
新增 BindAccountsToGroup 和 GetAccountIDsByGroupIDs 方法的 stub 实现, 确保测试文件中的 mock 类型满足 GroupRepository 接口要求。
-
liuxiongfeng authored
- 创建分组时可选择从已有分组复制账号 - 编辑分组时支持同步账号(全量替换操作) - 仅允许选择相同平台的源分组 - 添加完整的数据校验:去重、自引用检查、平台一致性检查 - 前端支持多选源分组,带提示说明操作行为
-
liuxiongfeng authored
将 token 直接拆分为范围内和范围外两部分,分别调用 CalculateCost: - 范围内:正常计费 (rateMultiplier) - 范围外:双倍计费 (rateMultiplier × extraMultiplier) 代码更直观,便于理解和维护
-
liuxiongfeng authored
- 新增 CalculateCostWithLongContext 方法支持阈值双倍计费 - 新增 RecordUsageWithLongContext 方法专用于 Gemini 计费 - Gemini 超过 200K token 的部分按 2 倍费率计算 - 其他平台(Claude/OpenAI)完全不受影响
-
Zero Clover authored
新增 IgnoreInvalidApiKeyErrors 开关,启用后 INVALID_API_KEY 和 API_KEY_REQUIRED 错误将被完全跳过,不写入 Ops 错误日志。 这些错误由用户错误配置导致,与服务质量无关。
-
shaw authored
Token 刷新成功后,调度器缓存中的 Account 对象仍包含旧的 credentials, 导致在 Outbox 异步更新之前(最多 1 秒窗口)请求使用过期 token, 返回 403 错误(OAuth token has been revoked)。 修复方案:在 token 刷新成功后同步更新调度器缓存,确保调度获取的 Account 对象立即包含最新的 access_token 和 _token_version。 此修复覆盖所有 OAuth 平台:OpenAI、Claude、Gemini、Antigravity。
-
Zero Clover authored
将账户停用 (USER_INACTIVE) 导致的请求失败视为业务限制类错误,不计入 SLA 和错误率统计。 账户停用是预期内的业务结果,不应被视为系统错误或服务质量问题。此改动使错误分类更加准确,避免将预期的业务限制误报为系统故障。 修改内容: - 在 classifyOpsIsBusinessLimited 函数中添加 USER_INACTIVE 错误码 - 该类错误不再触发错误率告警 Fixes Wei-Shaw/sub2api#453
-
JIA-ss authored
为 CC Switch 集成增强 /v1/usage 网关端点,在保持原有 4 字段 (isValid, planName, remaining, unit) 向后兼容的基础上,新增: - usage 对象:今日/累计的请求数、token 用量、费用,以及 RPM/TPM - subscription 对象(订阅模式):日/周/月用量和限额、过期时间 - balance 字段(余额模式):当前钱包余额 用量数据获取采用 best-effort 策略,失败不影响基础响应。 Co-Authored-By:Claude Opus 4.5 <noreply@anthropic.com>
-
小北 authored
- 为RedeemCode DTO添加notes字段(仅用于admin_balance/admin_concurrency类型) - 更新mapper使其有条件地包含备注信息 - 在用户兑换历史UI中显示备注 - 备注以斜体显示,悬停时显示完整内容 用户现在可以看到管理员调整其余额的原因说明。 Changes: - backend/internal/handler/dto/types.go: RedeemCode添加notes字段 - backend/internal/handler/dto/mappers.go: 条件性填充notes - frontend/src/api/redeem.ts: TypeScript接口添加notes - frontend/src/views/user/RedeemView.vue: UI显示备注信息
-
小北 authored
- 在用户仓库的搜索过滤器中添加备注字段 - 管理员现在可以通过备注/标记搜索用户 - 使用不区分大小写的搜索(ContainsFold) Changes: - backend/internal/repository/user_repo.go: 添加 NotesContainsFold 到搜索条件
-
liuxiongfeng authored
extractGeminiUsage 函数未提取 cachedContentTokenCount, 导致计费时缓存读取 token 始终为 0。 修复: - 提取 usageMetadata.cachedContentTokenCount - 设置 CacheReadInputTokens 字段 - InputTokens 减去缓存 token(与 response_transformer 逻辑一致)
-
liuxiongfeng authored
Gemini API Key 账户通常代理上游服务,模型支持由上游判断, 本地不需要预先配置模型映射。
-
- 31 Jan, 2026 1 commit
-
-
iBenzene authored
-
- 30 Jan, 2026 7 commits
-
-
iBenzene authored
-
cyhhao authored
-
cyhhao authored
-
cyhhao authored
-
ducky authored
-
ducky authored
Implements announcements end-to-end (admin CRUD + read status, user list + mark read) with OR-of-AND targeting. Also breaks the ent<->service import cycle by moving schema-facing constants/targeting into a new domain package.
-
liuxiongfeng authored
-
- 29 Jan, 2026 3 commits
- 28 Jan, 2026 5 commits