Commit Graph
5 Commits
Author SHA1 Message Date
alfadb ea8489cd41 fix(admin): mirror the full quota platform list in the frontend
后端对 default_platform_quotas(setting_update.go)与用户平台配额
(user_handler.go PUT)都是整体替换语义,且以 AllowedQuotaPlatforms
(11 平台)为白名单。前端配额平台镜像此前只硬编码 5 平台
(anthropic/openai/gemini/antigravity/grok),导致:

- 保存 Settings 会静默丢弃 kimi/zhipu/deepseek/minimax/opencode_go/
  ollama_cloud 六个平台的默认配额;
- 管理员在用户配额弹窗不做修改直接保存,就会软删该用户经 API 配置的
  ollama_cloud 等平台配额行(缺行等价于不限额 → 限额 fail-open)。

- settings.ts 新增单一常量 QUOTA_PLATFORMS(对齐后端
  AllowedQuotaPlatforms 全部 11 平台),PlatformType/PlatformQuotaPlatform
  由它派生,删除其余 5 平台硬编码副本(users.ts、配额弹窗、
  UserPlatformQuotaCell、SettingsView 两处模板字面量);
- normalizePlatformQuotasMap / sanitizePlatformQuotasMap 保留输入中
  前端未知(后端新加)的平台 key;用户配额弹窗保留响应中的未知平台行,
  避免后端先行加平台时再次静默删数据;
- 测试:用户配额弹窗预置 ollama_cloud 不修改直接保存仍包含该配额;
  Settings 同路径覆盖;kimi/zhipu/deepseek/minimax/opencode_go 不再
  被丢;未知平台 key 保留。
2026-10-08 15:24:05 +08:00
Heatherm Huang 39be1ec97f feat: add grok subscription support 2026-06-26 10:36:09 +08:00
DaydreamCodingandClaude Opus 4.7 6b39b344d8 feat(quota): 用户 × 平台 USD 配额
为用户在 anthropic/openai/gemini/antigravity 四个平台上提供日/周/月
三个窗口的 USD 配额管控。配额语义:未设置=不限制,0=禁用,>0=美元上限。

两层模型:
- 配置层:系统默认配额,以及 email/linuxdo/oidc/wechat/github/google/
  dingtalk 七个鉴权来源的默认配额,存于 settings,以嵌套 JSON 整体读写
  (系统 1 个 key + 每个来源 1 个 key),整体替换语义。
- 运行时层:user_platform_quota 表按用户记录实际配额,与配置层解耦。

后端:新增 ent schema 与 140_user_platform_quotas.sql 迁移、repository
与 service 端口、计费链路集成、管理端与用户端读写接口。
前端:管理端设置页配额编辑、用户配额管理 Modal、用户 Dashboard 展示、
中英文案。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 10:49:20 +08:00
IanShaw027 2cebb0dc60 feat(settings): support dual-mode wechat oauth defaults 2026-04-21 20:36:10 +08:00
IanShaw027 e9de839d87 feat: rebuild auth identity foundation flow 2026-04-20 17:39:57 +08:00