Commit Graph

463 Commits

Author SHA1 Message Date
erio
fc095bf054 refactor: replace scope-level rate limiting with model-level rate limiting
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
2026-02-09 08:19:01 +08:00
erio
2f1182e8a9 feat: unified error policy for Antigravity + enable custom error codes for Gemini accounts 2026-02-09 06:54:42 +08:00
Wesley Liddick
5fa93ebdc7 Merge pull request #519 from bayma888/feature/group-sort-order
feat(admin): 新增-分组管理自由拖拽排序功能
2026-02-08 18:00:22 +08:00
bayma888
2eb32a0ed7 chore: update pnpm-lock.yaml for vue-draggable-plus
CI 的 pnpm install --frozen-lockfile 需要 lock 文件同步更新
2026-02-08 17:10:25 +08:00
bayma888
bac9e2bfd5 feat(admin): add drag-and-drop group sort order
- Add `sort_order` field to groups table with migration
- Add `PUT /api/v1/admin/groups/sort-order` API for batch update
- Implement drag-and-drop UI using vue-draggable-plus
- All queries now order groups by sort_order
- Add i18n support (en/zh) for sort-related UI text
- Update test stubs to satisfy new interface methods
2026-02-08 16:53:45 +08:00
shaw
e4d74ae11d feat(ui): 用户列表页显示当前并发数
优化 /admin/users 页面的并发数列,显示「当前/最大」格式,
参考 AccountCapacityCell 的设计风格。

- 后端 UserHandler 注入 ConcurrencyService,批量查询用户当前并发数
- 新增 UserConcurrencyCell 组件,支持颜色状态(空闲灰/使用中黄/满载红)
- 前端 AdminUser 类型添加 current_concurrency 字段
2026-02-08 16:44:51 +08:00
shaw
8a0a8558cf feat(ui): OpenAI OAuth 账号支持批量 RT 输入创建
新增通过手动输入 Refresh Token 创建 OpenAI OAuth 账号功能,
参考 Anthropic sessionKey 批量创建方式:

- useOpenAIOAuth 添加 validateRefreshToken 方法
- accounts.ts 添加 refreshOpenAIToken API
- AuthInputMethod 类型新增 refresh_token 选项
- 支持多行输入 RT(每行一个)批量创建账号
- 账号名称自动累加后缀 #1, #2 等
- UI 显示 RT 数量徽章和批量创建提示
- 添加中英文 i18n 翻译
2026-02-08 16:10:15 +08:00
Wesley Liddick
2185a3b674 Merge pull request #517 from touwaeriol/fix/upstream-baseurl
refactor(upstream): replace upstream account type with apikey + auto-append base_url
2026-02-08 14:03:12 +08:00
shaw
b1c30df8e3 fix(ui): unify admin table toolbar layout with search and buttons in single row
Standardize filter bar layout across admin pages to place search/filters
on left and action buttons on right within the same row, improving
visual consistency and space utilization.
2026-02-08 14:00:02 +08:00
erio
fb58560d15 refactor(upstream): replace upstream account type with apikey, auto-append /antigravity
Upstream accounts now use the standard APIKey type instead of a dedicated
upstream type. GetBaseURL() and new GetGeminiBaseURL() automatically append
/antigravity for Antigravity platform APIKey accounts, eliminating the need
for separate upstream forwarding methods.

- Remove ForwardUpstream, ForwardUpstreamGemini, testUpstreamConnection
- Remove upstream branch guards in Forward/ForwardGemini/TestConnection
- Add migration 052 to convert existing upstream accounts to apikey
- Update frontend CreateAccountModal to create apikey type
- Add unit tests for GetBaseURL and GetGeminiBaseURL
2026-02-08 13:06:25 +08:00
erio
df3346387f fix(frontend): upstream account edit fields and mixed_scheduling on create
- EditAccountModal: add Base URL / API Key fields for upstream type
- EditAccountModal: initialize editBaseUrl from credentials on upstream account open
- EditAccountModal: save upstream credentials (base_url, api_key) on submit
- CreateAccountModal: pass mixed_scheduling extra when creating upstream account
2026-02-08 02:08:51 +08:00
shaw
f3605ddc71 chore: /admin/usage页面增加一个刷新按钮 2026-02-07 19:13:43 +08:00
shaw
da9546ba24 fix(ui): widen CreateAccountModal to fix platform selector overflow 2026-02-07 17:25:52 +08:00
shaw
1439eb39a9 fix(gateway): harden digest logging and align antigravity ops
- avoid panic by using safe UUID prefix truncation in Gemini digest fallback logs\n- remove unconditional Antigravity 429 full-body debug logs and honor log truncation config\n- align Antigravity quick preset mappings to opus 4.6-thinking targets only\n- restore scope rate-limit aggregation/output in ops availability stats
2026-02-07 17:12:15 +08:00
Wesley Liddick
c4615a1224 Merge pull request #509 from touwaeriol/pr/antigravity-full
feat(antigravity): comprehensive enhancements - model mapping, rate limiting, scheduling & ops
2026-02-07 16:44:28 +08:00
erio
2656320d04 fix(antigravity): fetch default mapping from API and sync Redis on rate limit
1. Frontend: replace hardcoded antigravityDefaultMappings with async
   fetch from GET /admin/accounts/antigravity/default-model-mapping,
   eliminating the duplicate data source that caused frontend/backend
   mapping inconsistency.

2. Backend: convert handleSmartRetry and antigravityRetryLoop from
   standalone functions to AntigravityGatewayService methods, enabling
   Redis cache sync (updateAccountModelRateLimitInCache) after both
   rate-limit write paths — long-delay branch and retry-exhausted branch.
2026-02-07 15:59:27 +08:00
shaw
5d4327eb14 fix: 前端codex教程里模型ID升级为gpt-5.3-codex 2026-02-07 14:53:53 +08:00
erio
5e98445b22 feat(antigravity): comprehensive enhancements - model mapping, rate limiting, scheduling & ops
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
2026-02-07 12:31:10 +08:00
erio
8826705e71 feat(frontend): show seconds in rate limit time display
Change formatTime() to include seconds (HH:MM:SS) instead of only
hours and minutes (HH:MM). This gives users more precise information
about when rate limits will reset.
2026-02-07 11:59:27 +08:00
shaw
35a55e10aa fix: 前端快捷添加模型id新增gpt5.3系列 2026-02-07 11:13:51 +08:00
shaw
9e80ed0fa8 fix(frontend): 优化代理管理页面工具栏布局
- 将筛选器和操作按钮合并到同一行显示
- 筛选器在左侧,操作按钮在右侧
- 添加响应式支持,窄屏时自动换行并简化按钮文字
2026-02-07 11:09:34 +08:00
shaw
76d242e024 refactor(frontend): 复用 TokenUsageTrend 组件优化用户 Dashboard 图表
用户 Dashboard 的 Token 使用趋势图表现在显示 Input/Output/Cache 三种类型,
并在 Tooltip 中显示 Actual 和 Standard 价格,与管理员页面保持一致。
2026-02-06 20:18:38 +08:00
shaw
260c152166 fix(frontend): 修复重启后健康检查接口路径错误
将 /api/health 改为 /health,与后端实际注册的路由一致
2026-02-06 19:53:39 +08:00
shaw
bd7fdb5e6c refactor(frontend): 调整账号页面错误透传规则按钮位置
将错误透传规则按钮从自动刷新按钮前面移动到后面
2026-02-06 16:38:06 +08:00
LLLLLLiulei
7319122e92 merge upstream/main 2026-02-06 11:33:45 +08:00
shaw
01b08e1e43 chore: 前端增加opus4.6模型映射 2026-02-06 08:50:45 +08:00
shaw
39e05a2dad feat: 新增全局错误透传规则功能
支持管理员配置上游错误如何返回给客户端:
- 新增 ErrorPassthroughRule 数据模型和 Ent Schema
- 实现规则的 CRUD API(/admin/error-passthrough-rules)
- 支持按错误码、关键词匹配,支持 any/all 匹配模式
- 支持按平台过滤(anthropic/openai/gemini/antigravity)
- 支持透传或自定义响应状态码和错误消息
- 实现两级缓存(Redis + 本地内存)和多实例同步
- 集成到 gateway_handler 的错误处理流程
- 新增前端管理界面组件
- 新增单元测试覆盖核心匹配逻辑

优化:
- 移除 refreshLocalCache 中的冗余排序(数据库已排序)
- 后端 Validate() 增加匹配条件非空校验
2026-02-05 21:52:54 +08:00
LLLLLLiulei
37047919ab fix: harden import/export flow 2026-02-05 18:59:30 +08:00
LLLLLLiulei
0c660f8335 feat: refine proxy export and toolbar layout 2026-02-05 18:35:00 +08:00
LLLLLLiulei
ce9a247a9d feat: add proxy import flow 2026-02-05 18:23:49 +08:00
LLLLLLiulei
b4bd46d067 feat: add data import/export bundle 2026-02-05 17:46:08 +08:00
shaw
2b192f7dca feat: 支持用户专属分组倍率配置 2026-02-05 16:05:42 +08:00
shaw
49a3c43741 feat(auth): 实现 Refresh Token 机制
- 新增 Access Token + Refresh Token 双令牌认证
- 支持 Token 自动刷新和轮转
- 添加登出和撤销所有会话接口
- 前端实现无感刷新和主动刷新定时器
2026-02-05 12:42:54 +08:00
Wesley Liddick
4cce21b125 Merge branch 'main' into main 2026-02-03 21:43:41 +08:00
Wesley Liddick
c0c9c984d1 Merge pull request #471 from bayma888/feature/api-key-quota-expiration
feat(api-key): 添加API密钥独立配额和过期时间功能
2026-02-03 21:11:17 +08:00
Wesley Liddick
c89bbf5130 Merge pull request #458 from bayma888/feature/admin-user-balance-history
feat(admin): 管理员可查看每个用户充值和并发变动记录、点击余额可直接查看、优化弹框UI
2026-02-03 20:37:30 +08:00
bayma888
6146be1474 feat(api-key): add independent quota and expiration support
This feature allows API Keys to have their own quota limits and expiration
times, independent of the user's balance.

Backend:
- Add quota, quota_used, expires_at fields to api_key schema
- Implement IsExpired() and IsQuotaExhausted() checks in middleware
- Add ResetQuota and ClearExpiration API endpoints
- Integrate quota billing in gateway handlers (OpenAI, Anthropic, Gemini)
- Include quota/expiration fields in auth cache for performance
- Expiration check returns 403, quota exhausted returns 429

Frontend:
- Add quota and expiration inputs to key create/edit dialog
- Add quick-select buttons for expiration (+7, +30, +90 days)
- Add reset quota confirmation dialog
- Add expires_at column to keys list
- Add i18n translations for new features (en/zh)

Migration:
- Add 045_add_api_key_quota.sql for new columns
2026-02-03 19:49:31 +08:00
song
976d6fb03f chore: update antigravity example url 2026-02-03 17:00:46 +08:00
song
3bede6e65f merge upstream main 2026-02-03 16:21:58 +08:00
song
2220fd18ca merge upstream main 2026-02-03 15:36:17 +08:00
Wesley Liddick
bb3df5785a Merge pull request #322 from xlx0852/main
fix: 混合渠道警告确认框和过滤 prompt_cache_retention 参数
2026-02-03 15:13:10 +08:00
Wesley Liddick
6e54eda41f Merge pull request #464 from touwaeriol/pr/antigravity-scope-ratelimit
feat(antigravity): 支持按配额域(scope)级别限流
2026-02-03 15:02:15 +08:00
Wesley Liddick
df4c0adf0b Merge pull request #463 from DuckyProject/feat/usage-records-codex-reasoning-effort
feat(usage): add reasoning effort column
2026-02-03 14:57:45 +08:00
ducky
53ee6383db feat(usage): add reasoning effort column 2026-02-03 14:36:29 +08:00
liuxiongfeng
d3c1d77a35 fix(frontend): import missing formatTime function in AccountStatusIndicator 2026-02-03 14:25:30 +08:00
liuxiongfeng
8824400c3e feat(accounts): 账号列表显示 Antigravity scope 级别限流状态
- 后端 DTO 新增 scope_rate_limits 字段,从 extra 提取限流信息
- 前端状态列显示 scope 级限流徽章(Claude/Gemini/Image)
- 清除速率限制时同时清除账号级和 scope 级限流(已有实现)

Cherry-picked from slovx2/sub2api: 66f49b67
2026-02-03 14:25:30 +08:00
liuxiongfeng
6e8eff9bb9 feat(ops): 运维界面展示 Antigravity 账号 scope 级别限流统计
在运维监控的并发/排队卡片中,为 Antigravity 平台账号显示各 scope
(claude/gemini_text/gemini_image) 的限流数量统计,便于管理员了解
哪些 scope 正在被限流。

Cherry-picked from slovx2/sub2api: 08d6dc52
2026-02-03 14:25:30 +08:00
song
11ff73b578 fix: align migration checksum and import formatTime 2026-02-03 14:04:11 +08:00
shuike
6c86501d11 feat: 增加邀请码注册功能 2026-02-03 13:38:44 +08:00
shaw
0ab68aa9fb fix(setup): 修复 Redis TLS 配置选项位置错误
- 将 TLS Toggle 从第一步(PostgreSQL)移动到第二步(Redis)
- 添加缺失的 Toggle 组件导入

问题描述:
TLS 配置选项错误地出现在数据库配置步骤中,而不是 Redis 配置步骤
2026-02-03 11:24:04 +08:00