dsh-unified-router 0.7.7 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/DESIGN-STANDARDS.md +2 -2
- package/lib/backend.js +72 -7
- package/lib/channel-contract.js +5 -0
- package/lib/client.js +17 -5
- package/package.json +1 -1
package/docs/DESIGN-STANDARDS.md
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
1. **定位问题。** 渠道网格显示当前选择、连接状态和账号、模型数量。进入上次查看的渠道。
|
|
23
23
|
2. **选择模型。** 打开设置或切换渠道后默认显示模型目录。模型页查目录、控制模型显示、调参数。
|
|
24
|
-
3. **管理账号与渠道。**
|
|
24
|
+
3. **管理账号与渠道。** 账号与额度页显示订阅类型、剩余额度和最近更新时间。有多个百分比窗口时摘要显示最紧张的窗口。展开「管理」查看额度包、重置时间、奖励和维护操作。渠道页负责提供方开关及连接表单。订阅类型标签始终展示上游返回的原文(TRAE 的 `Free`/`Pro`/`Pro+`/`Ultra`/`Express` 来自只读付费状态接口,60 秒缓存,读取失败或无数据源时不显示、不编造、不影响账号列表;Raccoon 用 `体验版`/`订阅`/`套餐未知` 映射;WorkBuddy 与自管渠道用上游 `plan` 文案,如 `Free plan`/`体验版`)。
|
|
25
25
|
|
|
26
26
|
### 1.2 统一界面
|
|
27
27
|
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
|
|
83
83
|
- 额度药丸随当前模型渠道切换,触发按钮只显示当前额度或余量摘要,不重复拼渠道名(渠道名在悬浮提示与浮层标题中显示)。收起样式与 dsh-subusage 药丸同款:全圆胶囊(1px 中性描边、600 粗体,告警只染描边与底色、文字不着色),逐窗迷你余量条每根按该窗口自身档位着色(1/2/3 根时高度 6/5/4px),触发文本只剩最紧窗的一个余量数字(如 `30%`、`1,500 积分`),不带「剩余」前缀、不枚举窗口、不拼临时/永久分项——窗口枚举与分项进悬浮提示,逐窗明细在浮层。额度条一律表示剩余,条的长度、颜色、名称和数值对应同一额度。只有实际可计算的余量才绘制额度条;绝对积分、AStudio 积分包或现金余额直接显示数值。Agnes 额度读取为 0 时直接标为「免费用户」。积分包到期、周期重置和采集更新时间分别标注;没有可信时间时省略。Raccoon 两侧只展示各自可用的账号。商汤 Token Plan 从控制台读取积分池,按当前模型 ID 匹配,命中专属池时优先展示专属池。
|
|
84
84
|
- 与设置页读取同一份公开额度快照;调用账号从宿主内存单独读取,两者均不触发上游查询。额度读取失败时保留最近读数,显示「显示上次结果」。额度未知与实际余额为 0 分开显示。
|
|
85
|
-
- 有匹配调用时以命中账号为准,浮层标记当前或最近调用,其他账号默认折叠。无匹配调用时,账号池、多账号 AStudio 及可计算积分余额的多账号 WorkBuddy
|
|
85
|
+
- 有匹配调用时以命中账号为准,浮层标记当前或最近调用,其他账号默认折叠。无匹配调用时,账号池、多账号 AStudio 及可计算积分余额的多账号 WorkBuddy 在药丸上显示可用账号总积分(临时/永久分项只在悬浮提示与浮层区分),其余多账号纯比例渠道显示账号数;点开浮层默认展示当前候选账号的额度并可在账号列表间切换,切换查看不改摘要和选号,账号列表行显示账号名、订阅类型(有上游数据时)和该账号的一个余量数字、窗口枚举进悬浮提示。WorkBuddy 在存在可计算积分额度(如 `Total credits` / `Credits`)时于设置页与药丸均直接显示 `积分`(`credits` 统一显示为 `积分`),仅含纯百分比或 `Token` 窗口时回退显示剩余比例;主摘要只使用当前模型适用的额度:WorkBuddy 遵守窗口适用范围,CodeArts 区分免费日额度与积分包,云知声赠送额度按模型 ID 匹配。独立积分包及参考窗口不挤占主摘要。
|
|
86
86
|
- 使用宿主主题与原生轻触关闭浮层;可用键盘打开、Esc 关闭,窄屏内可滚动查看完整内容。回归见 `test/quota-pill.test.mjs`。
|
|
87
87
|
|
|
88
88
|
### 3.4 默认输出上限
|
package/lib/backend.js
CHANGED
|
@@ -3475,14 +3475,20 @@ var TRAE_AGENT_HOST = "https://trae-api-cn.mchost.guru";
|
|
|
3475
3475
|
var TRAE_UG_HOST = "https://api.trae.cn";
|
|
3476
3476
|
var TRAE_OAUTH_HOST = "https://api.trae.com.cn";
|
|
3477
3477
|
var TRAE_CONSOLE_HOST = "https://www.trae.cn";
|
|
3478
|
+
var TRAE_SUBSCRIPTION_ONLY_MODELS = /* @__PURE__ */ new Set([
|
|
3479
|
+
"qwen4-max",
|
|
3480
|
+
"glm-5.4",
|
|
3481
|
+
"kimi-k3.1-pro",
|
|
3482
|
+
"kimi-k3.1-pro-highspeed"
|
|
3483
|
+
]);
|
|
3478
3484
|
var TRAE_EFFORTS_2 = Object.freeze({ options: ["light", "high"], defaultLevel: "high", supportThinking: true });
|
|
3479
3485
|
var TRAE_EFFORTS_3_HIGH = Object.freeze({ options: ["light", "high", "extra_high"], defaultLevel: "high", supportThinking: true });
|
|
3480
3486
|
var TRAE_EFFORTS_3_XHIGH = Object.freeze({ options: ["light", "high", "extra_high"], defaultLevel: "extra_high", supportThinking: true });
|
|
3481
3487
|
var TRAE_FALLBACK_MODELS = [
|
|
3482
3488
|
{ id: "Doubao-Seed-2.1-Turbo", name: "Seed-2.1-Turbo", contextWindow: 256e3, multimodal: true, reasoningConfig: TRAE_EFFORTS_2 },
|
|
3483
3489
|
{ id: "Doubao-Seed-2.1-Pro", name: "Seed-2.1-Pro-0915", contextWindow: 256e3, multimodal: true, reasoningConfig: TRAE_EFFORTS_2 },
|
|
3484
|
-
//
|
|
3485
|
-
{ id: "Doubao-Seed-Evolving", name: "Seed-Evolving", contextWindow: 256e3, multimodal: true
|
|
3490
|
+
// Seed-Evolving 曾为会员限定,2026-11-26 用户核实已不再限定(普通账号可调用)。
|
|
3491
|
+
{ id: "Doubao-Seed-Evolving", name: "Seed-Evolving", contextWindow: 256e3, multimodal: true },
|
|
3486
3492
|
// 远端目录已由同用途的 Seed-2.0-Code 接替(兜底表不收该 id,只能靠策展标记
|
|
3487
3493
|
// 表达「旧版默认关」;远端真拉时由 model-catalog 的 TRAE 命名后继规则表达)。
|
|
3488
3494
|
{ id: "Doubao-Seed-Code", name: "Seed-Code", contextWindow: 256e3, multimodal: true, reasoningConfig: TRAE_EFFORTS_2, stale: true, staleReason: "\u4E0A\u6E38\u76EE\u5F55\u5DF2\u6709\u540C\u7528\u9014\u540E\u7EE7 Seed-2.0-Code\u3002" },
|
|
@@ -3491,8 +3497,10 @@ var TRAE_FALLBACK_MODELS = [
|
|
|
3491
3497
|
{ id: "glm-5.3", name: "GLM-5.3", contextWindow: 2e5, multimodal: false, reasoningConfig: TRAE_EFFORTS_3_XHIGH },
|
|
3492
3498
|
{ id: "deepseek-v4.1-flash", name: "DeepSeek-V4.1-Flash", contextWindow: 2e5, multimodal: true, reasoningConfig: TRAE_EFFORTS_3_HIGH },
|
|
3493
3499
|
{ id: "DeepSeek-V4-Pro-Official", name: "DeepSeek-V4-Pro", contextWindow: 2e5, multimodal: false, reasoningConfig: TRAE_EFFORTS_3_HIGH },
|
|
3494
|
-
|
|
3495
|
-
|
|
3500
|
+
// 订阅限定:Qwen4 / GLM-5.4 / Kimi-K3.1 系列仅付费订阅账号可调用(见
|
|
3501
|
+
// TRAE_SUBSCRIPTION_ONLY_MODELS;远端目录不下发该标志)。
|
|
3502
|
+
{ id: "kimi-k3.1-pro-highspeed", name: "Kimi-K3.1-Pro-Highspeed", contextWindow: 2e5, multimodal: true, reasoningConfig: TRAE_EFFORTS_3_XHIGH, subscriptionOnly: true },
|
|
3503
|
+
{ id: "kimi-k3.1-pro", name: "Kimi-K3.1-Pro", contextWindow: 2e5, multimodal: true, reasoningConfig: TRAE_EFFORTS_3_XHIGH, subscriptionOnly: true },
|
|
3496
3504
|
// 同族已有更新一代(kimi-k3.1-pro / -highspeed)在同一目录里,故默认不选。
|
|
3497
3505
|
{ id: "kimi-k3", name: "Kimi-K3", contextWindow: 2e5, multimodal: true, reasoningConfig: TRAE_EFFORTS_3_XHIGH, stale: true, staleReason: "\u540C\u76EE\u5F55\u5DF2\u6709 Kimi-K3.1-Pro\u3002" },
|
|
3498
3506
|
{ id: "mimo-v2.6-flash", name: "MiMo-V2.6-Flash", contextWindow: 2e5, multimodal: true },
|
|
@@ -3501,7 +3509,7 @@ var TRAE_FALLBACK_MODELS = [
|
|
|
3501
3509
|
// 同族已有 MiniMax-M3.1-Flash。
|
|
3502
3510
|
{ id: "minimax-m3", name: "MiniMax-M3", contextWindow: 2e5, multimodal: true, stale: true, staleReason: "\u540C\u76EE\u5F55\u5DF2\u6709 MiniMax-M3.1-Flash\u3002" },
|
|
3503
3511
|
{ id: "step-5-preview", name: "Step-5-Preview", contextWindow: 2e5, multimodal: true, reasoningConfig: TRAE_EFFORTS_2 },
|
|
3504
|
-
{ id: "qwen4-max", name: "Qwen4-Max", contextWindow: 2e5, multimodal: true, reasoningConfig: TRAE_EFFORTS_3_HIGH },
|
|
3512
|
+
{ id: "qwen4-max", name: "Qwen4-Max", contextWindow: 2e5, multimodal: true, reasoningConfig: TRAE_EFFORTS_3_HIGH, subscriptionOnly: true },
|
|
3505
3513
|
{ id: "qwen3.8-flash", name: "Qwen3.8-Flash", contextWindow: 2e5, multimodal: true, reasoningConfig: TRAE_EFFORTS_3_HIGH },
|
|
3506
3514
|
{ id: "qwen3.8-max", name: "Qwen3.8-Max", contextWindow: 2e5, multimodal: true, reasoningConfig: TRAE_EFFORTS_3_HIGH }
|
|
3507
3515
|
];
|
|
@@ -4424,6 +4432,7 @@ var TRAE_USER_INFO_PATH = "/cloudide/api/v3/trae/GetUserInfo";
|
|
|
4424
4432
|
var TRAE_CHECKIN_STATUS_PATH = "/trae/api/v2/ug/checkin_credits/status";
|
|
4425
4433
|
var TRAE_CHECKIN_CLAIM_PATH = "/trae/api/v2/ug/checkin_credits/claim";
|
|
4426
4434
|
var TRAE_ENT_USAGE_PATH = "/trae/api/v2/pay/ide_user_ent_usage";
|
|
4435
|
+
var TRAE_PAY_STATUS_PATH = "/trae/api/v2/pay/ide_user_pay_status";
|
|
4427
4436
|
var TRAE_REQUEST_TIMEOUT_MS = 3e4;
|
|
4428
4437
|
var TRAE_LOGIN_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
4429
4438
|
function traeCredentialExpiresAtMs(credential) {
|
|
@@ -4506,6 +4515,9 @@ function traeCheckinHeaders(credential, product, userId) {
|
|
|
4506
4515
|
function deriveDeviceId15(userId) {
|
|
4507
4516
|
return seededDigits(15, userId, "devid");
|
|
4508
4517
|
}
|
|
4518
|
+
function traePayStatusDeviceId(userId) {
|
|
4519
|
+
return deriveDeviceId15(userId);
|
|
4520
|
+
}
|
|
4509
4521
|
function deriveMarketUserId(userId) {
|
|
4510
4522
|
const bs = seededStream(userId, "market", 16);
|
|
4511
4523
|
bs[6] = bs[6] & 15 | 64;
|
|
@@ -5288,6 +5300,45 @@ async function fetchTraeCreditBalance(credential, _product, fetcher = fetch) {
|
|
|
5288
5300
|
}
|
|
5289
5301
|
return { total, packages, expiredTotal };
|
|
5290
5302
|
}
|
|
5303
|
+
var PAY_STATUS_CACHE_TTL_MS = 6e4;
|
|
5304
|
+
var payStatusCache = /* @__PURE__ */ new Map();
|
|
5305
|
+
var payStatusInFlight = /* @__PURE__ */ new Map();
|
|
5306
|
+
async function fetchTraePayStatus(credential, _product, fetcher = fetch) {
|
|
5307
|
+
const cached2 = payStatusCache.get(credential.uid);
|
|
5308
|
+
if (cached2 !== void 0 && Date.now() - cached2.at < PAY_STATUS_CACHE_TTL_MS) {
|
|
5309
|
+
return cached2.value;
|
|
5310
|
+
}
|
|
5311
|
+
const inFlight = payStatusInFlight.get(credential.uid);
|
|
5312
|
+
if (inFlight !== void 0) return inFlight;
|
|
5313
|
+
const request = (async () => {
|
|
5314
|
+
try {
|
|
5315
|
+
const result = await postJson(
|
|
5316
|
+
TRAE_PAY_STATUS_PATH,
|
|
5317
|
+
credential,
|
|
5318
|
+
JSON.stringify({ trae_client: "IDE", device_id: traePayStatusDeviceId(credential.uid) }),
|
|
5319
|
+
fetcher,
|
|
5320
|
+
credential.uid
|
|
5321
|
+
);
|
|
5322
|
+
if (!result.ok) return null;
|
|
5323
|
+
const identity = readString3(result.body, "user_pay_identity_str");
|
|
5324
|
+
if (identity.length === 0) return null;
|
|
5325
|
+
const expiresAt = readNumber2(result.body, "last_pro_entitlement_expire_time");
|
|
5326
|
+
const value2 = {
|
|
5327
|
+
identity,
|
|
5328
|
+
...expiresAt !== void 0 && expiresAt > 0 ? { proEntitlementExpiresAt: expiresAt } : {}
|
|
5329
|
+
};
|
|
5330
|
+
return value2;
|
|
5331
|
+
} catch {
|
|
5332
|
+
return null;
|
|
5333
|
+
} finally {
|
|
5334
|
+
payStatusInFlight.delete(credential.uid);
|
|
5335
|
+
}
|
|
5336
|
+
})();
|
|
5337
|
+
payStatusInFlight.set(credential.uid, request);
|
|
5338
|
+
const value = await request;
|
|
5339
|
+
payStatusCache.set(credential.uid, { at: Date.now(), value });
|
|
5340
|
+
return value;
|
|
5341
|
+
}
|
|
5291
5342
|
|
|
5292
5343
|
// vendor/channel-pack/src/account-probe.ts
|
|
5293
5344
|
import { credentialRef as credentialRef2 } from "@deepseek-ai/dsh-credentials";
|
|
@@ -8849,8 +8900,9 @@ var TraeAdapter = class extends LlmAdapter2 {
|
|
|
8849
8900
|
efforts: reasoning.efforts.map((effort) => effort.id)
|
|
8850
8901
|
} : {},
|
|
8851
8902
|
...reasoning?.defaultEffort !== void 0 ? { defaultEffort: reasoning.defaultEffort } : {},
|
|
8852
|
-
//
|
|
8853
|
-
|
|
8903
|
+
// 订阅限定来自策展表的官方会员门槛声明 + 付费专用 id 集合(远端目录不下发该标志;
|
|
8904
|
+
// glm-5.4 等不在兜底表里的远端条目只能靠集合标注)。
|
|
8905
|
+
...curated?.subscriptionOnly === true || TRAE_SUBSCRIPTION_ONLY_MODELS.has(model.id) ? { subscriptionOnly: true } : {},
|
|
8854
8906
|
...curated?.stale === true ? { stale: true } : {},
|
|
8855
8907
|
...curated?.staleReason === void 0 ? {} : { staleReason: curated.staleReason }
|
|
8856
8908
|
};
|
|
@@ -10740,6 +10792,19 @@ function registerChannelPackEndpoints(ctx, pool, qoder, qoderCn, trae, raccoon,
|
|
|
10740
10792
|
case "account.list": {
|
|
10741
10793
|
const req = payload;
|
|
10742
10794
|
const accounts = await pool.listAccounts(req.provider);
|
|
10795
|
+
if (req.provider === TRAE.id) {
|
|
10796
|
+
for (const account2 of accounts) {
|
|
10797
|
+
if (account2.enabled === false) continue;
|
|
10798
|
+
try {
|
|
10799
|
+
const resolved = await pool.resolveCredentialForAccount(account2.id);
|
|
10800
|
+
const credential = resolved;
|
|
10801
|
+
if (credential === void 0 || typeof credential.access_token !== "string" || credential.access_token.length === 0) continue;
|
|
10802
|
+
const payStatus = await fetchTraePayStatus(credential, TRAE);
|
|
10803
|
+
if (payStatus !== null) account2.planLabel = payStatus.identity;
|
|
10804
|
+
} catch {
|
|
10805
|
+
}
|
|
10806
|
+
}
|
|
10807
|
+
}
|
|
10743
10808
|
if (config.nativeOnly && payload.forCheckin === true) {
|
|
10744
10809
|
const ready = await Promise.all(accounts.map(async (account2) => (account2.expiresAt == null || account2.expiresAt > Date.now()) && !!await pool.resolveCredentialForAccount(account2.id)));
|
|
10745
10810
|
return { ok: true, value: { accounts: accounts.filter((_account, index) => ready[index]) } };
|
package/lib/channel-contract.js
CHANGED
|
@@ -37,11 +37,14 @@ const WIRE_PLANS = ['free', 'pro', 'unknown']
|
|
|
37
37
|
* - `expiresAt`:凭据到期毫秒数;`null` 表示未知(**保留属性**,客户端据此区分「未知」与「无过期」)。
|
|
38
38
|
* - `refreshable`:是否有续期端点。
|
|
39
39
|
* - `plan`:套餐档位(白名单枚举,脏值不参与展示与分流)。
|
|
40
|
+
* - `planLabel`:订阅类型文案(TRAE `Free`/`Pro`/…、WorkBuddy `Free plan` 等)。
|
|
41
|
+
* 仅展示用,不参与 Raccoon 家族按套餐分流的 `plan` 枚举。
|
|
40
42
|
* - `modelRateLimits`:模型 → 解禁时刻(只保留有限正数)。
|
|
41
43
|
*/
|
|
42
44
|
export function accountWire(raw) {
|
|
43
45
|
const source = raw && typeof raw === 'object' ? raw : {}
|
|
44
46
|
const plan = source.plan
|
|
47
|
+
const planLabel = wireText(source.planLabel, 40)
|
|
45
48
|
return {
|
|
46
49
|
id: wireText(source.id, 256),
|
|
47
50
|
provider: wireText(source.provider, 64),
|
|
@@ -50,6 +53,7 @@ export function accountWire(raw) {
|
|
|
50
53
|
expiresAt: wireFinite(source.expiresAt),
|
|
51
54
|
refreshable: source.refreshable === true,
|
|
52
55
|
...(WIRE_PLANS.includes(plan) ? { plan: wireText(plan, 20) } : {}),
|
|
56
|
+
...(planLabel ? { planLabel } : {}),
|
|
53
57
|
modelRateLimits: Object.fromEntries(Object.entries(source.modelRateLimits ?? {})
|
|
54
58
|
.filter(([, at]) => Number.isFinite(at) && at > 0)),
|
|
55
59
|
}
|
|
@@ -70,6 +74,7 @@ export function accountView(wire, provider) {
|
|
|
70
74
|
enabled: source.enabled !== false,
|
|
71
75
|
expiresAt: wireFinite(source.expiresAt),
|
|
72
76
|
plan: WIRE_PLANS.includes(source.plan) ? source.plan : '',
|
|
77
|
+
planLabel: wireText(source.planLabel, 40),
|
|
73
78
|
modelRateLimits: Object.fromEntries(Object.entries(source.modelRateLimits ?? {})
|
|
74
79
|
.filter(([, at]) => Number.isFinite(at) && at > Date.now())),
|
|
75
80
|
}
|
package/lib/client.js
CHANGED
|
@@ -621,11 +621,14 @@ const WIRE_PLANS = ['free', 'pro', 'unknown']
|
|
|
621
621
|
* - `expiresAt`:凭据到期毫秒数;`null` 表示未知(**保留属性**,客户端据此区分「未知」与「无过期」)。
|
|
622
622
|
* - `refreshable`:是否有续期端点。
|
|
623
623
|
* - `plan`:套餐档位(白名单枚举,脏值不参与展示与分流)。
|
|
624
|
+
* - `planLabel`:订阅类型文案(TRAE `Free`/`Pro`/…、WorkBuddy `Free plan` 等)。
|
|
625
|
+
* 仅展示用,不参与 Raccoon 家族按套餐分流的 `plan` 枚举。
|
|
624
626
|
* - `modelRateLimits`:模型 → 解禁时刻(只保留有限正数)。
|
|
625
627
|
*/
|
|
626
628
|
function accountWire(raw) {
|
|
627
629
|
const source = raw && typeof raw === 'object' ? raw : {}
|
|
628
630
|
const plan = source.plan
|
|
631
|
+
const planLabel = wireText(source.planLabel, 40)
|
|
629
632
|
return {
|
|
630
633
|
id: wireText(source.id, 256),
|
|
631
634
|
provider: wireText(source.provider, 64),
|
|
@@ -634,6 +637,7 @@ function accountWire(raw) {
|
|
|
634
637
|
expiresAt: wireFinite(source.expiresAt),
|
|
635
638
|
refreshable: source.refreshable === true,
|
|
636
639
|
...(WIRE_PLANS.includes(plan) ? { plan: wireText(plan, 20) } : {}),
|
|
640
|
+
...(planLabel ? { planLabel } : {}),
|
|
637
641
|
modelRateLimits: Object.fromEntries(Object.entries(source.modelRateLimits ?? {})
|
|
638
642
|
.filter(([, at]) => Number.isFinite(at) && at > 0)),
|
|
639
643
|
}
|
|
@@ -654,6 +658,7 @@ function accountView(wire, provider) {
|
|
|
654
658
|
enabled: source.enabled !== false,
|
|
655
659
|
expiresAt: wireFinite(source.expiresAt),
|
|
656
660
|
plan: WIRE_PLANS.includes(source.plan) ? source.plan : '',
|
|
661
|
+
planLabel: wireText(source.planLabel, 40),
|
|
657
662
|
modelRateLimits: Object.fromEntries(Object.entries(source.modelRateLimits ?? {})
|
|
658
663
|
.filter(([, at]) => Number.isFinite(at) && at > Date.now())),
|
|
659
664
|
}
|
|
@@ -4314,7 +4319,7 @@ function packSettings(provider) {
|
|
|
4314
4319
|
],
|
|
4315
4320
|
login: state.login && { url: state.login.url, canCheck: true },
|
|
4316
4321
|
rows: state.accounts.map(account => {
|
|
4317
|
-
const { id: accountId, nickname, enabled, plan } = account
|
|
4322
|
+
const { id: accountId, nickname, enabled, plan, planLabel } = account
|
|
4318
4323
|
const limited = Object.values(account.modelRateLimits).filter(expires => expires > Date.now()).length
|
|
4319
4324
|
const balance = balances.get(accountId)
|
|
4320
4325
|
const onboarding = caps.onboarding ? taskEntry(state, id, 'claimRewards', accountId) : null
|
|
@@ -4329,9 +4334,12 @@ function packSettings(provider) {
|
|
|
4329
4334
|
id: accountId, name: nickname, enabled,
|
|
4330
4335
|
toggle: ['save', accountId, nickname, !enabled],
|
|
4331
4336
|
tags: [
|
|
4337
|
+
// 订阅类型文案(TRAE 的 Free/Pro/Pro+/Ultra/Express 等)优先展示;
|
|
4338
|
+
// Raccoon 家族没有 planLabel,继续走 plan 枚举映射。
|
|
4339
|
+
planLabel && [planLabel, 'info'],
|
|
4332
4340
|
// 统一模型开关打开后不再区分体验/订阅:合并的意义就是「一个模型面」,
|
|
4333
4341
|
// 再挂套餐标签会让人以为还要按套餐挑账号。关闭时照旧按套餐标注。
|
|
4334
|
-
caps.accountPlan && !unifiedModelsOn(state)
|
|
4342
|
+
!planLabel && caps.accountPlan && !unifiedModelsOn(state)
|
|
4335
4343
|
&& (plan === 'pro' ? ['订阅', 'info'] : plan === 'free' ? ['体验版', 'success'] : ['套餐未知', 'warn']),
|
|
4336
4344
|
!enabled && ['已停用'],
|
|
4337
4345
|
account.expiresAt > 0 && account.expiresAt <= Date.now() && ['凭据过期', 'warn'],
|
|
@@ -6219,7 +6227,8 @@ function quotaPillData(id, type, snapshot, selection, viewedId, model) {
|
|
|
6219
6227
|
const packages = bal?.packages ?? []
|
|
6220
6228
|
const shownPackages = displayCreditPackages(packages)
|
|
6221
6229
|
return { id: account.id, label: account.nickname, at: bal?.updatedAt, stale: bal?.stale,
|
|
6222
|
-
|
|
6230
|
+
// 订阅类型文案优先(TRAE 的 Free/Pro/…);Raccoon 家族回落到 plan 枚举映射。
|
|
6231
|
+
plan: unified ? '' : (account.planLabel || (account.plan === 'free' ? '体验版' : account.plan === 'pro' ? '订阅' : '')),
|
|
6223
6232
|
amount: bal?.total ?? null, unit: '积分', packages, details: shownPackages.map(pkg => ({
|
|
6224
6233
|
label: pkg.name || '额度包', value: pkg.remaining === null ? '' : quotaValue(pkg.remaining, pkg.unit),
|
|
6225
6234
|
expires: pkg.active === false ? null : pkg.expiresAt, note: pkg.active === false ? '已失效' : '',
|
|
@@ -6290,7 +6299,7 @@ function quotaPillData(id, type, snapshot, selection, viewedId, model) {
|
|
|
6290
6299
|
}
|
|
6291
6300
|
const pkgBalances = windows.map(windowRemainingAmount).filter(value => Number.isFinite(value))
|
|
6292
6301
|
const derivedAmount = wbCredits?.amount ?? account.balance ?? (windowsAsCredits && pkgBalances.length ? pkgBalances.reduce((a, b) => a + b, 0) : null)
|
|
6293
|
-
return { id: account.id, label: account.name, plan: account.plan,
|
|
6302
|
+
return { id: account.id, label: account.name, plan: account.planLabel || account.plan,
|
|
6294
6303
|
amount: modelUnknown || gatedModel?.free ? null : derivedAmount,
|
|
6295
6304
|
toneFraction: wbCredits?.fraction ?? null,
|
|
6296
6305
|
packages: windowsAsCredits ? windows : (wbCredits?.packages ?? []),
|
|
@@ -6360,7 +6369,10 @@ function QuotaAccountList({ rows, accountMetrics, activeId, viewedId, onView })
|
|
|
6360
6369
|
return h('button', { key: row.id, type: 'button', className: 'eac-quota-account-row', 'aria-pressed': pressed,
|
|
6361
6370
|
'data-tone': row.stale ? 'neutral' : quotaTone(tone ?? tight), title: [row.label, windowSummary].filter(Boolean).join(' · '),
|
|
6362
6371
|
onClick: () => onView(row.id === viewedId ? '' : row.id) },
|
|
6363
|
-
|
|
6372
|
+
// 账号身份信息(名称 + 订阅类型)必须可见:它解释「哪些账号能调用订阅限定模型」。
|
|
6373
|
+
h('span', null, row.label,
|
|
6374
|
+
row.plan ? h('span', { className: 'eac-quota-plan', style: { marginLeft: '6px' } }, row.plan) : null),
|
|
6375
|
+
h('strong', null, summary || '暂无额度'))
|
|
6364
6376
|
}))
|
|
6365
6377
|
}
|
|
6366
6378
|
|