Commit Graph

1096 Commits

Author SHA1 Message Date
liuxiongfeng
0913cfc082 chore: bump version to 0.1.83.1 2026-02-14 22:03:26 +08:00
liuxiongfeng
59e8465325 Merge release/custom-0.1.81 into release/custom-0.1.83
- Resolved conflict in .github/workflows/security-scan.yml: use upstream .gosec.json config
- Resolved conflict in deploy/docker-compose.yml: keep Redis, remove PostgreSQL (use external DB)
2026-02-14 22:03:09 +08:00
liuxiongfeng
be6e8ff77b fix(ui): extend mixed channel check to both Antigravity and Anthropic accounts
Problem:
- When creating Anthropic Console accounts to groups with Antigravity accounts,
  the mixed channel warning was not triggered
- Only Antigravity accounts triggered the confirmation dialog

Solution:
- Renamed isAntigravityAccount to needsMixedChannelCheck
- Extended check to include both 'antigravity' and 'anthropic' platforms
- Updated all 8 call sites in CreateAccountModal and EditAccountModal

Changes:
- frontend/src/components/account/CreateAccountModal.vue: 4 updates
- frontend/src/components/account/EditAccountModal.vue: 4 updates

Testing:
- Frontend compilation: passed
- Backend unit tests: passed
- OAuth flow: confirmation parameter correctly passed in Step 2
- Backend compatibility: verified with checkMixedChannelRisk logic

Impact:
- Both Antigravity and Anthropic accounts now show mixed channel warning
- OAuth accounts correctly pass confirm_mixed_channel_risk parameter
- No breaking changes to existing functionality
2026-02-14 21:29:36 +08:00
shaw
a817cafe3d feat: 区分 Anthropic 5m/1h 缓存创建 token 的差异化计费
Anthropic API 的 cache_creation 对象区分了 ephemeral_5m 和 ephemeral_1h
两种缓存创建 token,1h 单价远高于 5m(如 claude-3-5-haiku: 5m=$1/MTok,
1h=$6/MTok)。此前系统统一按 5m 单价计费,导致计费偏低。

后端:
- pricing_service: 加载 LiteLLM 的 cache_creation_input_token_cost_above_1hr
- billing_service: GetModelPricing 启用分类计费(安全守卫 1h>5m),
  CalculateCost 按 5m/1h 分别计费,无明细时回退到 5m 单价
- gateway_service: parseSSEUsage/handleNonStreamingResponse 用 gjson
  提取嵌套 cache_creation 对象的 ephemeral_5m/1h_input_tokens
- antigravity_gateway_service: extractSSEUsage/extractClaudeUsage 同步提取
- usage_log: 修复 GORM column tag 确保写入正确的数据库列
- 新增迁移 054: 删除 GORM 自动生成的重复列

前端:
- 使用记录 tooltip 展示 5m/1h 缓存创建明细(带彩色 badge 区分)
- 表格单元格缓存写入数值旁显示 1h 标识
2026-02-14 18:15:35 +08:00
shaw
e681431454 fix: Anthropic 429 限流使用精确的窗口重置时间而非聚合最大值
当账号仅触发 5h 窗口限流时,旧逻辑从聚合头
anthropic-ratelimit-unified-reset 读取重置时间,该值为所有窗口的
最大值(即 7d 重置时间),导致账号被标记为不可调度约 6 天。

新增 calculateAnthropic429ResetTime 函数,解析 Anthropic 的
per-window 头(5h-utilization/reset、7d-utilization/reset、
surpassed-threshold),判断实际触发的窗口并使用对应的重置时间:
- 仅 5h 超标 → 使用 5h-reset(约 5 小时)
- 仅 7d 超标 → 使用 7d-reset
- 两者均超标 → 使用 7d-reset(较长冷却)
- per-window 头不存在 → 回退到聚合头(向后兼容)
2026-02-14 00:21:56 +08:00
Wesley Liddick
b4c22ce6ce Merge pull request #561 from james-6-23/main
feat(admin): Add group filtering for account listings
2026-02-13 20:23:56 +08:00
shaw
5248097f90 fix: 修复 gosec 配置文件格式错误导致 CI 失败
gosec -conf 只支持 JSON 格式,将 .gosec.yaml 转换为 .gosec.json
2026-02-13 20:12:50 +08:00
wucm667
5f4eb9f9d0 chore: 配置 gosec 排除规则
- 新增 backend/.gosec.yaml 配置文件,排除 G704 (SSRF) 检查
- 更新 security-scan.yml workflow,使用 gosec 配置文件
- 原因:作为 API 网关平台,需要代理请求到配置的上游服务,所有上游 URL 来自管理员配置而非用户输入
2026-02-13 10:48:33 +08:00
liuxiongfeng
ebb85cf843 chore: bump version to 0.1.81.9 2026-02-13 04:15:12 +08:00
liuxiongfeng
ef959bc3c6 chore: bump version to 0.1.81.8 2026-02-13 03:12:31 +08:00
liuxiongfeng
8cb7356bbc feat: add mixed-channel precheck flow for antigravity accounts 2026-02-13 03:12:09 +08:00
liuxiongfeng
496545188a chore: bump version to 0.1.81.7 2026-02-13 00:26:37 +08:00
liuxiongfeng
5715587baf chore: bump version to 0.1.81.6 2026-02-12 23:49:49 +08:00
liuxiongfeng
428ee065d3 chore: bump version to 0.1.81.5 2026-02-12 20:09:57 +08:00
liuxiongfeng
320ca28f90 fix: antigravity 429 fallback uses final model key 2026-02-12 19:30:44 +08:00
liuxiongfeng
5e518f5fbd feat: allow antigravity warmup intercept toggle
- Show warmup-intercept toggle for antigravity accounts in admin UI\n- Add unit tests verifying antigravity accounts are intercepted on /v1/messages
2026-02-12 18:56:55 +08:00
liuxiongfeng
24dcba1d72 chore: gofmt antigravity gateway tests 2026-02-12 18:56:31 +08:00
kyx236
fe1d46a8ea feat(admin): Add group filtering for account listings
- Add groupID parameter to ListAccounts and ListWithFilters methods
- Implement account filtering by group ID in repository query
- Add group query parameter parsing in account handler
- Update all ListAccounts/ListWithFilters call sites with groupID parameter
- Add group filter UI component to AccountTableFilters
- Add i18n translations for group filter label in English and Chinese
- Update API contract and test stubs to reflect new signature
- Enable filtering accounts by their assigned groups in admin panel
2026-02-12 03:47:06 +08:00
liuxiongfeng
1abc688cad chore: bump version to 0.1.81.4 2026-02-12 02:33:33 +08:00
liuxiongfeng
34936189d8 fix(antigravity): 固定按映射模型计费并补充回归测试
当账号配置了 model_mapping 时,确保计费使用映射后的实际模型,
而非用户请求的原始模型名,避免计费不准确。
2026-02-12 02:33:20 +08:00
liuxiongfeng
3a9f1c5796 chore: bump version to 0.1.81.3 2026-02-11 23:37:37 +08:00
liuxiongfeng
bb1e205516 Merge branch 'develop' into release/custom-0.1.81 2026-02-11 23:37:21 +08:00
liuxiongfeng
9af4a55176 fix: gofmt 格式修复 gateway_cache_integration_test.go 2026-02-11 23:35:26 +08:00
liuxiongfeng
51e903c34e Revert "fix: 并发/排队面板支持 platform/group 过滤"
This reverts commit 86e600aa52.
2026-02-11 23:26:20 +08:00
liuxiongfeng
7f03319646 Revert "fix: 并发/排队面板支持 platform/group 过滤"
This reverts commit 86e600aa52.
2026-02-11 23:06:59 +08:00
liuxiongfeng
0c33d18a4d chore: bump version to 0.1.81.2 2026-02-11 22:31:27 +08:00
liuxiongfeng
a747c63b8e feat: add gemini model mapping whitelist for apikey and bulk edit 2026-02-11 22:31:27 +08:00
liuxiongfeng
a03c361b04 feat: add gemini model mapping whitelist for apikey and bulk edit 2026-02-11 22:31:07 +08:00
liuxiongfeng
850e267763 chore: bump version to 0.1.81.1 2026-02-11 20:49:31 +08:00
liuxiongfeng
c75ae56f10 Merge branch 'develop' into release/custom-0.1.81 2026-02-11 20:49:18 +08:00
Wesley Liddick
bc1abb6a23 Merge pull request #557 from james-6-23/main
feat(admin): 为账户和兑换码新增邮箱搜索及限流过滤功能
2026-02-11 20:00:43 +08:00
Wesley Liddick
d307d48def Merge pull request #551 from SilentFlower/opus4.6-think
[UPDATE] 增强 Claude Thinking 模式支持与 Opus 4.6 动态预算适配
2026-02-11 20:00:22 +08:00
Wesley Liddick
1bb40084fc Merge pull request #550 from Tian-orz/feat/antigravity-refresh-token-import
feat(antigravity): 支持 Refresh Token 批量导入创建 OAuth 账号
2026-02-11 19:59:52 +08:00
Wesley Liddick
8f0efa16ca Merge pull request #555 from sususu98/fix/gemini-thoughts-token-billing
fix: include Gemini thoughtsTokenCount in output token billing
2026-02-11 19:53:43 +08:00
kyx236
04a1a7c2b5 feat(admin): Add email search and rate limit filtering for accounts and redeem codes
- Add used_by_email column to redeem code export CSV for better user identification
- Implement rate_limited status filter in account listing with RateLimitResetAt check
- Extend redeem code search to include user email in addition to code matching
- Add API key search capability to user listing filters
- Display user email in redeem code table used_by column for improved visibility
- Update search placeholders in UI to reflect expanded search capabilities (email, username, notes, API key)
- Improve Chinese and English localization strings for search hints
2026-02-11 16:39:42 +08:00
liuxiongfeng
d11b295729 chore: bump version to 0.1.80.1 2026-02-11 16:21:22 +08:00
liuxiongfeng
91d0059f8d Merge branch 'develop' into release/custom-0.1.80
# Conflicts:
#	backend/internal/pkg/antigravity/client.go
#	backend/internal/service/antigravity_oauth_service.go
#	backend/internal/service/antigravity_oauth_service_test.go
#	backend/internal/service/antigravity_token_provider.go
2026-02-11 16:20:56 +08:00
sususu98
d21d70a5cf fix: include Gemini thoughtsTokenCount in output token billing
Gemini 2.5 Pro/Flash thinking models return thoughtsTokenCount separately
from candidatesTokenCount in usageMetadata, but this field was not parsed
or included in billing calculations, causing thinking tokens to be
unbilled.

- Add ThoughtsTokenCount field to GeminiUsageMetadata struct
- Include thoughtsTokenCount in OutputTokens across all 3 Gemini usage
  parsing paths (non-streaming, streaming, compat layer)
- Add tests covering thinking token scenarios

Closes #554
2026-02-11 15:41:54 +08:00
liuxiongfeng
44693d0dfb chore: bump version to 0.1.79.7 2026-02-11 14:39:29 +08:00
liuxiongfeng
c722212e12 fix: distinguish client disconnection from upstream retry failure
When client disconnects during upstream request, the error was
incorrectly reported as "Upstream request failed after retries".
Now checks context cancellation first and returns
"Client disconnected before upstream response" instead.
2026-02-11 14:39:14 +08:00
SilentFlower
e73b778d2b Merge branch 'main' into opus4.6-think 2026-02-11 13:56:30 +08:00
Edric Li
a4a46a8618 feat(antigravity): 添加 onboardUser 支持并修复 project_id 补齐逻辑
- 新增 OnboardUser API 客户端方法,支持账号 onboarding 获取 project_id
- loadProjectIDWithRetry 增加 onboard 回退:LoadCodeAssist 未返回 project_id 时自动触发 onboarding
- GetAccessToken 中 project_id 补齐改用轻量 FillProjectID 替代全量 RefreshAccountToken
- 补齐逻辑增加 5 分钟冷却机制,防止频繁重试
- OnboardUser 轮询等待改为 context 感知,支持提前取消
- 提取 mergeCredentials 辅助方法消除重复代码
- 新增 extractProjectIDFromOnboardResponse 和 resolveDefaultTierID 单元测试
2026-02-11 13:41:55 +08:00
liuxiongfeng
92745f7534 chore: bump version to 0.1.79.6 2026-02-11 13:08:49 +08:00
liuxiongfeng
f2917aeaf8 fix: use safe type assertion for errcheck lint compliance 2026-02-11 13:06:41 +08:00
liuxiongfeng
a1e2ffd586 refactor: optimize project_id fill to lightweight approach
- Replace heavy RefreshAccountToken with lightweight tryFillProjectID
  (loadCodeAssist → onboardUser → fallback), consistent with
  Antigravity-Manager's behavior
- Add sync.Map cooldown/dedup (60s) to prevent repeated fill attempts
- Add fallback project_id "bamboo-precept-lgxtn" matching AM
- Extract mergeCredentials helper to eliminate duplication
- Use slog structured logging instead of log.Printf
- Fix time.Sleep in OnboardUser to context-aware select
- Fix strings.NewReader(string(bodyBytes)) → bytes.NewReader(bodyBytes)
- Remove redundant tc := tc in test (Go 1.22+)
- Add nil guard in persistProjectID for test safety
2026-02-11 13:00:31 +08:00
liuxiongfeng
78a9705fad fix: resolve ineffassign lint error in onboard project_id logic 2026-02-11 12:45:52 +08:00
liuxiongfeng
4661c2f90f chore: bump version to 0.1.79.5 2026-02-11 12:35:26 +08:00
liuxiongfeng
130112a84a fix: 补齐 Antigravity OAuth 账号 project_id 获取逻辑
部分账号 loadCodeAssist 不会立即返回 cloudaicompanionProject,
导致转发时 project 字段为空,上游返回 400 "Invalid project resource name projects/"。

- 新增 OnboardUser API:当 loadCodeAssist 未返回 project_id 时,
  通过 onboardUser 完成账号初始化并获取 project_id
- token 刷新时增加 onboard 兜底逻辑
- GetAccessToken 按需补齐:转发时发现 project_id 为空立即触发刷新
- 新增 resolveDefaultTierID 单元测试
2026-02-11 12:25:04 +08:00
SilentFlower
6ae82e04d5 [UPDATE] 优化思考预算逻辑与代码结构
🧠 refactor(antigravity): 完善 thinking 预算分配策略并重构工具构建逻辑
2026-02-11 10:39:54 +08:00
SilentFlower
19cca11e00 [UPDATE] 增强 Claude Thinking 模式支持与 Opus 4.6 动态预算适配
 feat(antigravity): 支持 thinking adaptive 类型并适配 Opus 4.6 动态预算
🧪 test(gateway): 增加 thinking 模式解析与签名块过滤的边界用例测试
2026-02-11 10:31:16 +08:00