feat(provider): add Zhipu team plan quota query support (#5128)

智谱团队套餐(Team Plan)的额度查询与个人版不同:同一 quota 端点加
`?type=2`,需额外 `bigmodel-organization` / `bigmodel-project` 请求头
(api_key + 组织 ID + 项目 ID 三者缺一不可),且仅存在于国内站
open.bigmodel.cn。参考 token-monitor/src/shared/zaiTeamLimits.js 实现。

- Backend (services/coding_plan.rs): 新增 query_zhipu_team(固定 CN 站、
  ?type=2、org/project 头);抽出 zhipu_quota_from_body 与个人版共用解析;
  入口 get_coding_plan_quota 靠显式 coding_plan_provider == "zhipu_team"
  路由(base_url 与个人版智谱相同,detect_provider 无法区分)。新字段经
  UsageScript、IPC 命令、后台查询路径(query_provider_usage_inner)透传。
- Frontend: UsageScriptModal 新增「Zhipu GLM Team」选项 + 组织/项目 ID
  输入;模板切换时保留 team 字段;测试与保存逻辑按 team 传参。
- i18n: en/zh/zh-TW/ja 四个 locale 更新。
- Tests: 凭据校验/路由(缺任一凭据 → NotFound,标识大小写不敏感)+ 本地
  server 验证 ?type=2 与 org/project 请求头形状。

Co-authored-by: XuZhanXin <1239576606@qq.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
zhanxin.xu
2026-07-09 09:21:10 +08:00
committed by GitHub
parent 3538b39246
commit 95c917b337
14 changed files with 426 additions and 17 deletions
+7
View File
@@ -12,12 +12,19 @@ export const subscriptionApi = {
// 火山方舟用账号 AK/SK 签名查询用量;其他供应商不传。
accessKeyId?: string,
secretAccessKey?: string,
// 智谱团队版(zhipu_team)靠显式标识路由(base_url 与个人版相同无法区分)。
codingPlanProvider?: string,
teamOrganizationId?: string,
teamProjectId?: string,
): Promise<SubscriptionQuota> =>
invoke("get_coding_plan_quota", {
baseUrl,
apiKey,
accessKeyId,
secretAccessKey,
codingPlanProvider,
teamOrganizationId,
teamProjectId,
}),
getBalance: (
baseUrl: string,