erio
f89465fb39
Merge branch 'main' into release/custom-0.1.91
...
# Conflicts:
# frontend/src/components/admin/account/AccountActionMenu.vue
# frontend/src/views/admin/AccountsView.vue
2026-03-06 04:08:14 +08:00
erio
440c3f46a7
feat: add independent load_factor field for scheduling load calculation
...
- Separate load factor from concurrency: concurrency controls actual
slot acquisition, load_factor controls load rate calculation
- Add EffectiveLoadFactor() method: LoadFactor > Concurrency > 1
- Add load_factor field to Create/Edit/BulkEdit account forms
- Fix RPM default value: auto-fill 15 when RPM enabled but not set
- Fix stale test compilation errors in server and handler packages
2026-03-06 03:42:24 +08:00
erio
c746964936
chore: bump version to 0.1.90.8
2026-03-06 01:16:40 +08:00
erio
ce4095904e
chore: bump version to 0.1.90.7
2026-03-05 22:56:20 +08:00
erio
02dca78dbe
refactor: extract QuotaLimitCard component for reuse in create and edit modals
...
- Extract quota limit card/toggle UI into QuotaLimitCard.vue component
- Use v-model pattern for clean parent-child data flow
- Integrate into both EditAccountModal and CreateAccountModal
- All apikey accounts (all platforms) now support quota limit on creation
- Bump version to 0.1.90.6
2026-03-05 22:13:56 +08:00
erio
8df299b767
feat: restyle API Key quota limit UI to card/toggle format
...
- Redesign quota limit section with card layout and toggle switch
- Add watch to clear quota value when toggle is disabled
- Add i18n keys for toggle labels and hints (zh/en)
- Bump version to 0.1.90.5
2026-03-05 22:01:40 +08:00
erio
99331a5285
fix: throttle Anthropic usage queries and pass through upstream HTTP errors
...
- Frontend: queue Anthropic OAuth/setup-token usage requests by proxy
with random 1-1.5s interval to prevent upstream 429
- Backend: return ApplicationError with actual upstream status code
instead of wrapping all errors as 500
- Handle component unmount to skip stale updates on page navigation
2026-03-05 19:12:49 +08:00
guoyongchang
817a491087
simplify: 移除 leader lock,单实例无需分布式锁
...
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-03-05 16:31:27 +08:00
guoyongchang
9a8dacc514
fix: 修复 golangci-lint depguard 和 gofmt 错误
...
将 redis leader lock 逻辑从 service 层抽取为 LeaderLocker 接口,
实现移至 repository 层,消除 service 层对 redis 的直接依赖。
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-03-05 16:28:48 +08:00
guoyongchang
8adf80d98b
fix: wire_gen_test 补充 scheduledTestRunner 参数
...
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-03-05 16:23:41 +08:00
guoyongchang
3a089242f8
feat: 支持基于 crontab 的定时账号测试
...
每个测试计划绑定一个账号和一个模型,按 cron 表达式定期执行测试,
保存历史结果并在前端账号管理页面中提供完整的增删改查和结果查看功能。
主要变更:
- 新增 scheduled_test_plans / scheduled_test_results 两张表及迁移
- 后端 service 层:CRUD 服务 + 后台 cron runner(每分钟扫描到期计划并发执行)
- RunTestBackground 方法通过 httptest 在内存中执行账号测试并解析 SSE 输出
- Redis leader lock + pg_try_advisory_lock 双重保障多实例部署只执行一次
- REST API:5 个管理端点(计划 CRUD + 结果查询)
- 前端 ScheduledTestsPanel 组件:计划管理、启用开关、内联编辑、结果展开查看
- 中英文 i18n 支持
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-03-05 16:06:05 +08:00
erio
9245e197a8
chore: bump version to 0.1.90.3
2026-03-04 21:50:33 +08:00
erio
0bb683a6f1
chore: bump version to 0.1.90.2
2026-03-04 21:33:39 +08:00
erio
a6026e7ac4
Merge tag 'v0.1.90' into merge/upstream-v0.1.90
...
注册邮箱域名白名单策略上线,后台大数据场景性能大幅优化。
- 注册邮箱域名白名单:支持管理员配置允许注册的邮箱域名策略
- Keys 页面表单筛选:用户 /keys 页面支持按条件筛选 API Key
- Settings 页面分 Tab 拆分:管理后台设置页面按功能模块分 Tab 展示
- 后台大数据场景加载性能优化:仪表盘/用户/账号/Ops 页面大数据集加载显著提速
- Usage 大表分页优化:默认避免全量 COUNT(*),大幅降低分页查询耗时
- 消除重复的 normalizeAccountIDList,补充新增组件的单元测试
- 清理无用文件和过时文档,精简项目结构
- EmailVerifyView 硬编码英文字符串替换为 i18n 调用
- 修复 Anthropic 平台无限流重置时间的 429 误标记账号限流问题
- 修复自定义菜单页面管理员视角菜单不生效问题
- 修复 Ops 错误详情弹窗未展示真实上游 payload 的问题
- 修复充值/订阅菜单 icon 显示问题
# Conflicts:
# .gitignore
# backend/cmd/server/VERSION
# backend/ent/group.go
# backend/ent/runtime/runtime.go
# backend/ent/schema/group.go
# backend/go.sum
# backend/internal/handler/admin/account_handler.go
# backend/internal/handler/admin/dashboard_handler.go
# backend/internal/pkg/usagestats/usage_log_types.go
# backend/internal/repository/group_repo.go
# backend/internal/repository/usage_log_repo.go
# backend/internal/server/middleware/security_headers.go
# backend/internal/server/router.go
# backend/internal/service/account_usage_service.go
# backend/internal/service/admin_service_bulk_update_test.go
# backend/internal/service/dashboard_service.go
# backend/internal/service/gateway_service.go
# frontend/src/api/admin/dashboard.ts
# frontend/src/components/account/BulkEditAccountModal.vue
# frontend/src/components/charts/GroupDistributionChart.vue
# frontend/src/components/layout/AppSidebar.vue
# frontend/src/i18n/locales/en.ts
# frontend/src/i18n/locales/zh.ts
# frontend/src/views/admin/GroupsView.vue
# frontend/src/views/admin/SettingsView.vue
# frontend/src/views/admin/UsageView.vue
# frontend/src/views/user/PurchaseSubscriptionView.vue
2026-03-04 19:58:38 +08:00
shaw
ccf6a921c7
fix: 修复 PR #723 引入的 CI lint 和 test 编译错误
...
- wire_gen_test.go: 补充 NewTokenRefreshService 缺失的 tempUnschedCache 参数
- config.go, token_refresh_service.go: 修复 gofmt 格式问题
2026-03-03 16:45:29 +08:00
Wesley Liddick
197c570baa
Merge pull request #723 from zqq-nuli/fix/oauth-401-temp-unschedulable
...
fix: OAuth 401 不再永久锁死账号,改用临时不可调度实现自动恢复
2026-03-03 16:33:07 +08:00
shaw
a80ec5d8bb
feat: apikey支持5h/1d/7d速率控制
2026-03-03 15:01:10 +08:00
Wesley Liddick
b7df7ce5d5
Merge pull request #726 from DaydreamCoding/feat/dual-mode-umq
...
feat(gateway): 双模式用户消息队列 — 串行队列 + 软性限速
2026-03-03 08:41:34 +08:00
erio
50a8116ae9
fix: update SecurityHeaders call sites to match new signature
2026-03-03 06:37:50 +08:00
QTom
a9285b8a94
feat(gateway): 双模式用户消息队列 — 串行队列 + 软性限速
...
新增 UMQ (User Message Queue) 双模式支持:
- serialize: 账号级分布式串行锁 + RPM 自适应延迟(严格限流)
- throttle: 仅 RPM 自适应前置延迟,不阻塞并发(软性限速)
后端:
- config: 新增 Mode 字段,保留 Enabled 向后兼容
- service: 新增 UserMessageQueueService(Lua 锁/延迟算法/清理 worker)
- repository: 新增 UserMsgQueueCache(Redis Lua acquire/release/force-release)
- handler: 新增 UserMsgQueueHelper(SSE ping + 等待循环 + throttle)
- gateway: 按 mode 分支集成 serialize/throttle 逻辑
- lint: 修复 gofmt rewrite rules、errcheck 类型断言、staticcheck QF1012
前端:
- 三态选择器 UI(关闭/软性限速/串行队列)替代 toggle 开关
- BulkEdit 支持 null 语义(不修改)
- i18n 中英文文案
通过 6 轮专家评审(42 次 review)、golangci-lint、单元测试、集成测试。
2026-03-03 01:05:11 +08:00
zqq61
ec6bcfeb83
fix: OAuth 401 不再永久锁死账号,改用临时不可调度实现自动恢复
...
OAuth 账号收到 401 时,原逻辑同时设置 expires_at=now() 和 SetError(),
但刷新服务只查询 status=active 的账号,导致 error 状态的账号永远无法
被刷新服务拾取,expires_at=now() 实际上是死代码。
修复:
- OAuth 401 使用 SetTempUnschedulable 替代 SetError,保持 status=active
- 新增 oauth_401_cooldown_minutes 配置项(默认 10 分钟)
- 刷新成功后同步清除 DB 和 Redis 中的临时不可调度状态
- 不可重试错误检查(invalid_grant 等)从 Antigravity 推广到所有平台
- 可重试错误耗尽后不再标记 error,下个刷新周期继续重试
恢复流程:
OAuth 401 → temp_unschedulable + expires_at=now → 刷新服务拾取
→ 成功: 清除 temp_unschedulable → 自动恢复
→ invalid_grant: SetError → 永久禁用
→ 网络错误: 仅记日志 → 下周期重试
2026-03-02 22:54:38 +08:00
PMExtra
7e02082209
feat(settings): add default subscriptions for new users
...
- add default subscriptions to admin settings
- auto-assign subscriptions on register and admin user creation
- add validation/tests and align settings UI with subscription selector patterns
2026-03-02 03:59:31 +08:00
erio
1e03b2974a
chore: bump version to 0.1.87.18
2026-03-02 01:23:12 +08:00
erio
8a82a2a648
feat(csp): auto-inject purchase_subscription_url origin into frame-src
2026-03-02 00:19:25 +08:00
erio
c3ac68af2a
chore: bump version to 0.1.87.16
2026-03-01 20:14:48 +08:00
erio
62486cee37
chore: bump version to 0.1.87.15
2026-03-01 19:49:12 +08:00
Wesley Liddick
8c4d22b3f9
Merge pull request #685 from touwaeriol/pr/admin-create-and-redeem-docs
...
feat(admin): add create-and-redeem endpoint for payment integrations
2026-03-01 18:24:15 +08:00
erio
47f7b0213b
chore: bump version to 0.1.87.14
2026-03-01 18:16:41 +08:00
erio
81903e87e3
chore: bump version to 0.1.87.13
2026-03-01 16:37:12 +08:00
erio
34ccfe45ea
chore: bump version to 0.1.87.12
2026-03-01 15:59:29 +08:00
QTom
4280aca82c
feat(gateway): 添加 Claude Code 客户端最低版本检查功能
...
- 通过 User-Agent 识别 Claude Code 客户端并提取版本号
- 在网关层验证客户端版本是否满足管理员配置的最低要求
- 在管理后台提供版本要求配置选项(英文/中文双语)
- 实现原子缓存 + singleflight 防止并发问题和 thundering herd
- 使用 context.WithoutCancel 隔离 DB 查询,避免客户端断连影响缓存
- 双 TTL 策略:60s 正常、5s 错误恢复,保证性能与可用性
- 仅检查 Claude Code 客户端,其他客户端不受影响
- 添加完整单元测试覆盖版本提取、比对、上下文操作
2026-03-01 15:45:44 +08:00
erio
336a844712
chore: bump version to 0.1.87.11
2026-03-01 13:02:24 +08:00
erio
4d88248091
chore: bump version to 0.1.87.10
2026-03-01 12:46:42 +08:00
erio
05c2a65ef0
chore: bump version to 0.1.87.9
2026-03-01 12:37:07 +08:00
erio
87bd765a57
chore: bump version to 0.1.87.8
2026-03-01 01:02:53 +08:00
erio
39ca192c41
feat(admin): add create-and-redeem API and payment integration docs
2026-03-01 00:42:21 +08:00
erio
238d86f502
feat(admin): add create-and-redeem API and payment integration docs
2026-03-01 00:41:38 +08:00
Wesley Liddick
9fd95df5cf
Merge pull request #679 from DaydreamCoding/feat/account-rpm-limit
...
feat: 添加账号级别 RPM(每分钟请求数)限流功能
2026-02-28 22:37:10 +08:00
Wesley Liddick
4587c3e53e
Merge pull request #670 from DaydreamCoding/feat/admin-apikey-group-update
...
feat(admin): 添加管理员直接修改用户 API Key 分组的功能
2026-02-28 22:20:29 +08:00
shaw
be18bc6fc3
chore: 恢复数据库迁移文件060和修正版本号
2026-02-28 22:02:01 +08:00
QTom
c1c31ed9b2
feat: wire RPMCache into GatewayService and AccountHandler
2026-02-28 20:35:38 +08:00
QTom
9a91815b94
feat(admin): 完整实现管理员修改用户 API Key 分组的功能
...
## 核心功能
- 添加 AdminUpdateAPIKeyGroupID 服务方法,支持绑定/解绑/保持不变三态语义
- 实现 UserRepository.AddGroupToAllowedGroups 接口,自动同步专属分组权限
- 添加 HTTP PUT /api-keys/:id handler 端点,支持管理员直接修改 API Key 分组
## 事务一致性
- 使用 ent Tx 保证专属分组绑定时「添加权限」和「更新 Key」的原子性
- Repository 方法支持 clientFromContext,兼容事务内调用
- 事务失败时自动回滚,避免权限孤立
## 业务逻辑
- 订阅类型分组阻断,需通过订阅管理流程
- 非活跃分组拒绝绑定
- 负 ID 和非法 ID 验证
- 自动授权响应,告知管理员成功授权的分组
## 代码质量
- 16 个单元测试覆盖所有业务路径和边界用例
- 7 个 handler 集成测试覆盖 HTTP 层
- GroupRepo stub 返回克隆副本,防止测试间数据泄漏
- API 类型安全修复(PaginatedResponse<ApiKey>)
- 前端 ref 回调类型对齐 Vue 规范
## 国际化支持
- 中英文提示信息完整
- 自动授权成功/失败提示
2026-02-28 20:18:14 +08:00
QTom
000e621eb6
feat(admin): 添加管理员直接修改用户 API Key 分组的功能
...
- 新增 PUT /api/v1/admin/api-keys/:id 端点,允许管理员修改任意用户 API Key 的分组绑定
- 跳过用户级权限校验但保留分组有效性验证,修改后触发认证缓存失效
- Service 层支持三态语义:nil=不修改,0=解绑,>0=绑定,<0=拒绝
- 指针值拷贝保证安全隔离,负数 groupID 返回 400 INVALID_GROUP_ID
- 前端 UserApiKeysModal 新增可点击的分组选择下拉框,支持多 Key 并发更新
- 下拉支持视口翻转和滚动关闭,按钮有 disabled 和加载状态
- 覆盖:后端 20 个单元测试 (Service 11 + Handler 9) + 前端 16 个 E2E 测试
- golangci-lint 0 issues, make test-unit 全部通过
2026-02-28 20:18:14 +08:00
erio
7bf5c1cbcb
chore: bump version to 0.1.87.7
2026-02-28 19:32:24 +08:00
erio
c7392fc80b
fix: make purchase iframe fully fill container
2026-02-28 18:58:19 +08:00
erio
c37c68a341
feat: append auth token to purchase iframe url
2026-02-28 16:02:55 +08:00
erio
9230d3cbc9
fix: streamline purchase embed layout with floating open button
2026-02-28 15:26:16 +08:00
yangjianbo
bb664d9bbf
feat(sync): full code sync from release
2026-02-28 15:01:20 +08:00
erio
19925e22d9
chore: bump version to 0.1.87.3
2026-02-28 14:09:02 +08:00
erio
94bdde32bb
chore: bump version to 0.1.87.2
2026-02-28 10:37:42 +08:00