dsh-unified-router 0.8.3 → 0.8.5

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.
@@ -30,6 +30,7 @@
30
30
  - 模型一律使用列表行,显示名称与 ID,支持搜索。普通目录分页,Raccoon 的免费与订阅目录各显示在自己的组里。可调模型使用共同的「参数」入口。保存成功或失败后保留当前编辑位置。
31
31
  - 渠道提供方开关和连接都使用相同的设置行。仅提供实际支持的操作。账号或 API Key 未配置时,从相关分区直达对应表单。
32
32
  - 每个分区的主操作放在标题右侧。页头「刷新」负责账号与额度,模型目录的刷新入口位于模型分区。
33
+ - 渠道网格下方、当前渠道工作区上方放置可折叠的「全局设置」,默认收起,切换渠道时保留展开状态。额度上报和智能选号只在此处编辑;全局区同时提供自动签到、自动领取奖励、自动完成任务和思考循环保护的默认值。支持这些功能的渠道用「跟随全局 / 单独开启 / 单独关闭」三选一;跟随时显示当前实际开关状态,已有覆盖不随全局改变。手动领取、执行和查询状态仍可独立操作。小浣熊模型合并仍属于本渠道。回归见 `test/automation-and-ux.test.mjs`。
33
34
 
34
35
  ---
35
36
 
@@ -68,8 +69,9 @@
68
69
  | 输出快捷档最多提供 `512K`;模型能力更高时仍可通过自定义数值调整,受上下文和渠道限制 | 避免同为 `1M` 的上下文和输出产生无法选择的顶档 | `test/automation-and-ux.test.mjs` |
69
70
  | **同名模型(如 Raccoon 免费/订阅)必须显示模型 id**;其它情况可只在重名时显示 | 免费/付费两侧展示名相同,只有 `-p` 后缀能区分 | 渲染核对(窄屏 id 换行显示) |
70
71
  | **倍率只由选择器原生 badge 显示**,`name` 里不得再拼「· x0.75 / · 免费」。只显示上游或已核验目录的扣费倍率、优惠和免费状态;商汤和云知声目录没有已核验的逐模型倍率 | 同一信息出现一次,统一设置页和会话选择器 | `test/model-rate-badge.test.mjs`、`test/model-rate-badge-paths.test.mjs` |
72
+ | 上游同时给出多档倍率、无法选定单一生效档时,设置页和选择器显示范围(如 `x0.09–x0.18`),不挑一档冒充当前价 | CodeArts 的峰谷倍率都能看见,模型名和实际扣费不受影响 | `test/model-rate-badge-paths.test.mjs`、`test/web-client.test.mjs` |
71
73
  | **订阅限定(仅付费会员可用)挂独立「订阅限定」徽标(info)**,与倍率/免费徽标并存、互不覆盖。判据来自官方会员门槛声明或上游目录的订阅标志,**不按倍率推断**;缺失即不挂标。TRAE 的 Qwen4、GLM-5.4、Kimi-K3.1 系列为付费专用 | 用户要求区分 TRAE/Qoder 的订阅限定模型;倍率高低不等于会员门槛 | `test/model-rate-badge.test.mjs` 与 `test/web-client.test.mjs` 订阅限定用例 |
72
- | **小浣熊「统一免费与订阅模型」开关在渠道分区(默认关)**:开启后模型分区只显示一个「统一模型」组,统一 id = 免费侧 id,订阅侧条目去 `-p` 合并、免费侧条目优先(徽标与思考档以免费面为准);额度药丸显示全部账号。关闭时恢复免费/订阅两组与按套餐过滤 | 同名模型只出现一次;免费额度用尽自动改用订阅账号,订阅账号出站请求自动加 `-p`、限流键按本侧真实 id 记 | `test/raccoon-unified.test.mjs`、`test/quota-pill.test.mjs` |
74
+ | **小浣熊「统一免费与订阅模型」开关在渠道分区(默认关)**:开启后模型分区只显示一个「统一模型」组,订阅侧条目去 `-p` 合并、免费侧条目优先(徽标与思考档以免费面为准);额度药丸显示全部账号。关闭时恢复免费/订阅两组与按套餐过滤 | 同名模型只出现一次;订阅独有模型直接走订阅账号;两侧共有的模型才在免费侧不可用时改走订阅。出站与限流键使用目录里的本侧实际 ID | `test/raccoon-unified.test.mjs`、`test/quota-pill.test.mjs` |
73
75
  | 设置列表和会话选择器统一清理 ID 格式的展示名,即使上游的名称与请求 ID 不同。内部代号(`qmodel_38max` / `qfmodel`…)使用已知别名,请求 ID 原样保留 | 「模型名显示的是内部代号」 | `test/qoder-cli.test.mjs` 别名用例 |
74
76
 
75
77
  ### 3.1 会话输入栏的上下文窗口药丸
@@ -92,7 +94,7 @@
92
94
 
93
95
  ### 3.4 智能选号模式
94
96
 
95
- - 「渠道」分区提供**全局四档单选**(`routingMode`,默认手动顺序;旧布尔开关 `preferExpiringQuota` 双向兼容:开启=临期优先):**手动**(账号列表顺序)、**免费优先**(先花每日额度与免费赠送,计费额度临期与否不参与)、**临期优先**(每日 → 赠送 → 7 天内到期,同档先到期先用)、**缓存优先**(同一模型沿用最近实际服务的前台账号,直到它用尽或受限才切换;按模型全局粘滞,重启后重新学习)。只有可参与自动选号的渠道显示入口:独立模式下 Raccoon、Qoder 中国版、TRAE,以及 AStudio、CodeArts;共用模式的账号池由原插件选择。
97
+ - 「全局设置」提供**四档单选**(`routingMode`,默认手动顺序;旧布尔开关 `preferExpiringQuota` 双向兼容:开启=临期优先):**手动**(账号列表顺序)、**免费优先**(先花每日额度与免费赠送,计费额度临期与否不参与)、**临期优先**(每日 → 赠送 → 7 天内到期,同档先到期先用)、**缓存优先**(同一模型沿用最近实际服务的前台账号,直到它用尽或受限才切换;按模型全局粘滞,重启后重新学习)。按宿主公布的选号支持范围显示,不取决于当前渠道;共用模式的账号池由原插件选择。
96
98
  - 所有模式只**重排已过滤候选**(限流/停用/黑名单过滤不变),不新增账号、不改写手动顺序、不触发上游查询;证据失效的额度不参与排名。缓存优先在池内生效。统一小浣熊的免费侧优先于粘滞(免费侧恢复可用时回到免费侧)。后台用途(会话标题等)不写粘滞记录。
97
99
 
98
100
  ---
@@ -22,6 +22,12 @@
22
22
  | **AStudio** (`astudio`) | 本机导入(读取 `astron-session.json` / `config.toml`)、微信扫码 SSO、粘贴 JWT/JSON | 目录 `GET .../api/v1/model-manager/models`(自动补位 `xdeepseek-flash-in`);推理走 `POST .../model-gateway/v1/responses`(`store:false`,关闭思考发 `reasoning.effort:"none"`) | 余额 `points/balance` + `membership/me`(字段 `totalBalance` / `activityTotal+activityBalance` / `memberTotal+memberBalance` / `buyTotal+buyBalance` / `sparkTotalBalance`,实测口径 `totalBalance` = 各分项余额之和);每日签到(先查北京时间 `points/details` GRANT 流水零写判重,无则 `init-app` + 关闭 `DAILY_REWARD_DIALOG`);`claimRewards` 领取新人弹窗 | **积分只认 `ssoSessionId`**:实测 `points/balance` 单独带 `account_id`、单独带 `token`、或两者同带都回 `code 80000`,只有 `ssoSessionId` 能通。故仅粘贴 `modelBearerToken` 的账号读不到积分,报 `no_web_session`(界面显示「仅推理 Token · 不读积分」),不再显示「额度待更新」或误判登录失效 |
23
23
  | **CodeArts** (`codearts`) | 本机导入(Windows 同用户 DPAPI + AES-256-GCM 解密 `%APPDATA%\codearts\secretStorage`,兼容 JSON 字符串形态的 DPoP JWK;导入与推理按账号单飞自动刷新)、浏览器 OAuth(PKCE 128-hex + ES256 DPoP,`127.0.0.1:>=10000/oauth/callback`,同时兼容 `code` 与 `secret` ticket 回调)、粘贴 JSON 凭据 | `GET /v1/model/builtin` + 免费权益 `opengw.../gateway/config`(`SDK-HMAC-SHA256` 签名);推理走 `/api/v2/chat/completions`(输出上限按 v2 `RANGE_VALIDATOR` 夹取 `65536`、合并相邻同角色消息、免费模型带 `maas_type:benefit`,遇 `APIG.0602` 令牌过期自动刷新重签重试一次) | `snap-manager/v1/statistics/plugin` + 免费日池 `user/tokens/balance`;每日签到(`events/trigger user.login` + `ops/delivery?channel=DESKTOP` + `claim` + `confirm`);`claimRewards` 领取可领活动福利 | `refresh_token` 为一次性轮换,与本机桌面端共用同一会话刷新会导致对端需要重新登录;本机导入账号在刷新失败或缺失 DPoP 密钥时回退重读本机 `secretStorage` 自愈 |
24
24
 
25
+ ### CodeArts 模型积分倍率
26
+
27
+ - 倍率直接读取 `GET /v1/model/builtin` 的 `builtinModels[].credit[].ratio_display`,兼容旧版的单对象 `credit`。2026-11-27 只读实测 12 个模型均返回倍率数组;同一倍率可能因输入或输出区间重复出现。
28
+ - 所有档位的倍率相同就显示单值;倍率不同就显示上游值的范围。比如 DeepSeek-V4.1-Flash 显示 `x0.09–x0.18`,DeepSeek-V4.1-Flash-1017 显示 `x0.12–x0.18`。范围不是某一时刻的生效价,不作为单一倍率参与推荐比较。峰谷时段见[华为云积分计费说明](https://support.huaweicloud.com/price-codeartsagent/codeartsagent_billing_0028.html)。
29
+ - 设置页和选择器共用解析后的模型目录;档位不全不挂倍率,仅在上游明确标免费或所有档位都是零时标「免费」。倍率随现有目录刷新更新,不新增请求。双入口见 [倍率回归](../test/model-rate-badge-paths.test.mjs)。
30
+
25
31
  ### 推理响应兼容
26
32
 
27
33
  - CodeArts 推理使用 `/api/v2/chat/completions`。`openpangu-2.0-flash` 在旧 v1 路径出现无正文的结束帧;同账号的 v2 请求返回标准 OpenAI 正文和用量帧。旧版累计 `text`、顶层 `delta.content` 和完整 `choices[].message` 仍转为增量,去除重复快照;已返回工具调用时将 `stop`、`other` 或仅有 `[DONE]` 的收尾归一为 `tool_calls`。裸断流不补成功终止,业务错误返回固定摘要。
package/lib/auto-tasks.js CHANGED
@@ -262,6 +262,9 @@ export function createAutoTasks({ dir, adapters, isEnabled, now = Date.now, onCh
262
262
  outcome: verdict.outcome, local: record,
263
263
  localIsDone: localDone, confirmed, confirmedIsDone: secured,
264
264
  })
265
+ if (verified && verdict.state === 'done' && !localDone && !secured) {
266
+ await onChange?.(provider, mode, outcome)
267
+ }
265
268
  results.push({ ...row, outcome, repeated: true, verified })
266
269
  }
267
270
  return results
@@ -78,6 +78,7 @@ function readInitialConfig(file, defaults) {
78
78
  routingMode: routingModeOf(saved.routingMode, saved.preferExpiringQuota === true ? 'expiring' : 'manual'),
79
79
  preferExpiringQuota: routingModeOf(saved.routingMode, saved.preferExpiringQuota === true ? 'expiring' : 'manual') === 'expiring',
80
80
  raccoonUnifiedModels: typeof saved.raccoonUnifiedModels === 'boolean' ? saved.raccoonUnifiedModels : base.raccoonUnifiedModels,
81
+ quotaIngest: typeof saved.quotaIngest === 'boolean' ? saved.quotaIngest : base.quotaIngest,
81
82
  providers,
82
83
  }
83
84
  } catch {
package/lib/backend.js CHANGED
@@ -14022,11 +14022,7 @@ var RaccoonAdapter = class extends LlmAdapter3 {
14022
14022
  this.options = options;
14023
14023
  this.product = options.product ?? RACCOON;
14024
14024
  this.fetchImpl = options.fetchImpl ?? fetch;
14025
- const cached2 = readCatalogCache(options.catalogFile);
14026
- if (cached2) {
14027
- this.remoteModels = cached2;
14028
- this.catalogSource = "cached";
14029
- }
14025
+ this.syncCatalogScope();
14030
14026
  this.fallbackIndex = new Map(this.product.fallbackModels.map((model) => [model.id, model]));
14031
14027
  }
14032
14028
  product;
@@ -14038,6 +14034,25 @@ var RaccoonAdapter = class extends LlmAdapter3 {
14038
14034
  /** 目录加载闸门:并发去重 + 失败/空结果冷却(见 `remote-catalog-gate.ts`)。 */
14039
14035
  catalogGate = new RemoteCatalogGate();
14040
14036
  catalogSource = "fallback";
14037
+ catalogScope;
14038
+ syncCatalogScope() {
14039
+ const scope = this.options.catalogScope?.() ?? "";
14040
+ if (scope !== this.catalogScope) {
14041
+ this.catalogScope = scope;
14042
+ this.remoteModels = readCatalogCache(this.catalogFileFor(scope), scope);
14043
+ this.catalogSource = this.remoteModels ? "cached" : "fallback";
14044
+ this.catalogGate.reset();
14045
+ }
14046
+ return scope;
14047
+ }
14048
+ catalogFileFor(scope) {
14049
+ const file = this.options.catalogFile;
14050
+ return file && scope ? `${file}.${scope}` : file;
14051
+ }
14052
+ unifiedAvailability(modelId) {
14053
+ this.syncCatalogScope();
14054
+ return this.remoteModels?.find((model) => model.id === modelId)?.unifiedAvailability;
14055
+ }
14041
14056
  /**
14042
14057
  * 描述本适配器拥有的 provider 路由。
14043
14058
  *
@@ -14057,12 +14072,15 @@ var RaccoonAdapter = class extends LlmAdapter3 {
14057
14072
  * 只有远端目录才是「上游全量」的证据,兜底表只是精选子集。
14058
14073
  */
14059
14074
  catalogStatus() {
14075
+ this.syncCatalogScope();
14060
14076
  return { source: this.catalogSource };
14061
14077
  }
14062
14078
  isRemoteCatalog() {
14079
+ this.syncCatalogScope();
14063
14080
  return this.remoteModels !== void 0 && this.catalogSource === "remote";
14064
14081
  }
14065
14082
  listAllModels() {
14083
+ this.syncCatalogScope();
14066
14084
  const source = this.remoteModels ?? this.product.fallbackModels.map(fallbackToRemote);
14067
14085
  return source.map((model) => {
14068
14086
  const fallback = this.fallbackIndex.get(model.id);
@@ -14094,15 +14112,16 @@ var RaccoonAdapter = class extends LlmAdapter3 {
14094
14112
  * 并用 {@link RemoteCatalogGate} 的冷却挡住「每模型重试一次」的放大。
14095
14113
  */
14096
14114
  async loadModels() {
14115
+ const scope = this.syncCatalogScope();
14097
14116
  if (this.remoteModels !== void 0) return this.remoteModels;
14098
14117
  const fetchRemote = this.options.fetchRemoteModels;
14099
14118
  if (fetchRemote !== void 0) {
14100
14119
  await this.catalogGate.run(async () => {
14101
14120
  const fetched = await fetchRemote();
14102
- if (fetched.length === 0) return false;
14121
+ if (this.syncCatalogScope() !== scope || fetched.length === 0) return false;
14103
14122
  this.remoteModels = fetched;
14104
14123
  this.catalogSource = "remote";
14105
- await saveCatalogCache(this.options.catalogFile, fetched).catch(() => {
14124
+ await saveCatalogCache(this.catalogFileFor(scope), fetched, scope).catch(() => {
14106
14125
  });
14107
14126
  return true;
14108
14127
  });
@@ -14112,20 +14131,21 @@ var RaccoonAdapter = class extends LlmAdapter3 {
14112
14131
  }
14113
14132
  /** Refresh without clearing the last successful catalog. */
14114
14133
  async refreshRemoteModels() {
14134
+ const scope = this.syncCatalogScope();
14115
14135
  const fetchRemote = this.options.fetchRemoteModels;
14116
14136
  if (fetchRemote && await providerCatalogVisible(this.options.accountPool, this.product.id)) {
14117
14137
  let updated = false;
14118
14138
  await this.catalogGate.run(async () => {
14119
14139
  const models = await fetchRemote();
14120
- if (!models.length) return false;
14140
+ if (this.syncCatalogScope() !== scope || !models.length) return false;
14121
14141
  this.remoteModels = models;
14122
14142
  this.catalogSource = "remote";
14123
14143
  updated = true;
14124
- await saveCatalogCache(this.options.catalogFile, models).catch(() => {
14144
+ await saveCatalogCache(this.catalogFileFor(scope), models, scope).catch(() => {
14125
14145
  });
14126
14146
  return true;
14127
14147
  }, { force: true });
14128
- if (!updated && this.remoteModels) this.catalogSource = "cached";
14148
+ if (!updated && this.syncCatalogScope() === scope && this.remoteModels) this.catalogSource = "cached";
14129
14149
  }
14130
14150
  return { count: this.remoteModels?.length ?? this.product.fallbackModels.length, source: this.catalogSource };
14131
14151
  }
@@ -14215,6 +14235,9 @@ var RaccoonAdapter = class extends LlmAdapter3 {
14215
14235
  }
14216
14236
  let credential = await this.options.resolveCredential(options.model);
14217
14237
  let accountId = credential === void 0 ? void 0 : await this.options.accountPool?.findAccountIdByCredential(this.product.id, credential.access_token);
14238
+ if (credential === void 0 && entry?.unifiedAvailability?.freeExcluded === true) {
14239
+ throw new LlmError9("raccoon: \u6B64\u6A21\u578B\u6CA1\u6709\u53EF\u7528\u8BA2\u9605\u8D26\u53F7", "MISSING_CREDENTIAL");
14240
+ }
14218
14241
  if (credential === void 0 || isRaccoonExpired(credential)) {
14219
14242
  credential = await this.options.refresh(accountId || void 0) ?? await this.options.resolveCredential(options.model);
14220
14243
  }
@@ -14389,12 +14412,21 @@ function registerRaccoonLlm(ctx, options) {
14389
14412
 
14390
14413
  // src/backend/providers/raccoon.ts
14391
14414
  function mergeUnifiedRaccoonCatalogs(freeModels, proModels) {
14392
- const seen = new Set(freeModels.map((model) => model.id));
14393
- const extra = proModels.flatMap((model) => {
14415
+ const proById = /* @__PURE__ */ new Map();
14416
+ for (const model of proModels) {
14394
14417
  const id = model.id.endsWith("-p") ? model.id.slice(0, -2) : model.id;
14395
- return seen.has(id) ? [] : [{ ...model, id }];
14418
+ if (!proById.has(id)) proById.set(id, model);
14419
+ }
14420
+ const free = freeModels.map((model) => {
14421
+ const pro = proById.get(model.id);
14422
+ proById.delete(model.id);
14423
+ return { ...model, unifiedAvailability: pro ? { proId: pro.id } : proModels.length ? { proId: null } : {} };
14396
14424
  });
14397
- return [...freeModels, ...extra];
14425
+ return [...free, ...[...proById].map(([id, model]) => ({
14426
+ ...model,
14427
+ id,
14428
+ unifiedAvailability: { ...freeModels.length ? { freeExcluded: true } : {}, proId: model.id }
14429
+ }))];
14398
14430
  }
14399
14431
  function mountRaccoon({ ctx, pool, throwIfAllAccountsRateLimited, readImage, readImageRequest, catalogFile, noteQuotaAccount }, isUnifiedModels) {
14400
14432
  const raccoonSideOf = (entry) => entry.plan === "pro" ? "pro" : "free";
@@ -14422,15 +14454,20 @@ function mountRaccoon({ ctx, pool, throwIfAllAccountsRateLimited, readImage, rea
14422
14454
  return typeof value === "function" ? value.bind(target) : value;
14423
14455
  }
14424
14456
  });
14457
+ const unifiedRoute = (modelId) => {
14458
+ const available = raccoonAdapter.unifiedAvailability(modelId);
14459
+ return {
14460
+ free: available?.freeExcluded !== true,
14461
+ proId: available?.proId === null ? null : available?.proId ?? (modelId ? `${modelId}-p` : null)
14462
+ };
14463
+ };
14425
14464
  const raccoonUnifiedPick = async (modelId, exclude) => {
14426
- if (modelId.length === 0) {
14427
- const free2 = await pool.getAvailableAccount(RACCOON.id, "", unionIds(exclude, raccoonOtherSideIds("free")));
14428
- return free2 ? { pick: free2, wire: "" } : null;
14429
- }
14430
- const free = await pool.getAvailableAccount(RACCOON.id, modelId, unionIds(exclude, raccoonOtherSideIds("free")));
14431
- if (free) return { pick: free, wire: modelId };
14432
- const pro = await pool.getAvailableAccount(RACCOON.id, `${modelId}-p`, unionIds(exclude, raccoonOtherSideIds("pro")));
14433
- return pro ? { pick: pro, wire: `${modelId}-p` } : null;
14465
+ const route = unifiedRoute(modelId);
14466
+ if (route.free) {
14467
+ const free = await pool.getAvailableAccount(RACCOON.id, modelId, unionIds(exclude, raccoonOtherSideIds("free")));
14468
+ if (free) return free;
14469
+ }
14470
+ return route.proId === null ? null : pool.getAvailableAccount(RACCOON.id, route.proId, unionIds(exclude, raccoonOtherSideIds("pro")));
14434
14471
  };
14435
14472
  const raccoonSideCredential = async (side) => {
14436
14473
  try {
@@ -14443,12 +14480,12 @@ function mountRaccoon({ ctx, pool, throwIfAllAccountsRateLimited, readImage, rea
14443
14480
  };
14444
14481
  const mountRaccoon2 = (product, auth, side, proRemoteFetch2) => registerRaccoonLlm(ctx, {
14445
14482
  catalogFile: catalogFile(product.id),
14483
+ ...side === "free" ? { catalogScope: () => unified() ? "unified-routing-v1" : "" } : {},
14446
14484
  credentialRef: credentialRef6(product.defaultCredentialRef),
14447
14485
  resolveCredential: async (modelId) => {
14448
14486
  let available = null;
14449
14487
  if (side === "free" && unified()) {
14450
- const pick = await raccoonUnifiedPick(modelId ?? "", /* @__PURE__ */ new Set());
14451
- available = pick?.pick ?? null;
14488
+ available = await raccoonUnifiedPick(modelId ?? "", /* @__PURE__ */ new Set());
14452
14489
  } else {
14453
14490
  available = await pool.getAvailableAccount(
14454
14491
  RACCOON.id,
@@ -14462,8 +14499,10 @@ function mountRaccoon({ ctx, pool, throwIfAllAccountsRateLimited, readImage, rea
14462
14499
  return available.credential;
14463
14500
  }
14464
14501
  if (side === "free" && unified()) {
14465
- throwIfAllAccountsRateLimited(product, modelId, raccoonAccountsOf("free"));
14466
- throwIfAllAccountsRateLimited(product, `${modelId ?? ""}-p`, raccoonAccountsOf("pro"));
14502
+ const route = unifiedRoute(modelId ?? "");
14503
+ if (route.free) throwIfAllAccountsRateLimited(product, modelId, raccoonAccountsOf("free"));
14504
+ if (route.proId !== null) throwIfAllAccountsRateLimited(product, route.proId, raccoonAccountsOf("pro"));
14505
+ if (!route.free) return void 0;
14467
14506
  } else {
14468
14507
  throwIfAllAccountsRateLimited(product, modelId, raccoonAccountsOf(side));
14469
14508
  }
@@ -14487,8 +14526,7 @@ function mountRaccoon({ ctx, pool, throwIfAllAccountsRateLimited, readImage, rea
14487
14526
  nextAccount: async (modelId, tried) => {
14488
14527
  let next = null;
14489
14528
  if (side === "free" && unified()) {
14490
- const pick = await raccoonUnifiedPick(modelId, tried);
14491
- next = pick?.pick ?? null;
14529
+ next = await raccoonUnifiedPick(modelId, tried);
14492
14530
  } else {
14493
14531
  const excluded = raccoonOtherSideIds(side);
14494
14532
  for (const id of tried) excluded.add(id);
@@ -14509,6 +14547,7 @@ function mountRaccoon({ ctx, pool, throwIfAllAccountsRateLimited, readImage, rea
14509
14547
  const credential = await raccoonSideCredential(side);
14510
14548
  const own = credential === void 0 ? [] : await auth.fetchModelsWithCredential(credential);
14511
14549
  if (side !== "free" || !unified() || proRemoteFetch2 === void 0) return own;
14550
+ if (own.length === 0 && raccoonAccountsOf("free").some((account) => account.enabled !== false)) return [];
14512
14551
  let proModels = [];
14513
14552
  try {
14514
14553
  proModels = await proRemoteFetch2();
@@ -14525,13 +14564,13 @@ function mountRaccoon({ ctx, pool, throwIfAllAccountsRateLimited, readImage, rea
14525
14564
  // 两侧都传「按 plan 门控」的池视图:门控只影响目录可见性判定,
14526
14565
  // 黑名单/限流/凭据读写仍落在真池上。
14527
14566
  accountPool: raccoonSidePool(side),
14528
- // 统一模式出站翻译:订阅账号把统一 id 还原成上游订阅线(`<id>-p`),
14567
+ // 统一模式出站翻译:订阅账号使用原始订阅 ID(目录未知时回退 `<id>-p`),
14529
14568
  // 免费账号原样。适配器据此构造请求体与限流标记,选号/账本仍记统一 id。
14530
14569
  ...side === "free" ? {
14531
14570
  outboundModelId: (modelId, accountId) => {
14532
14571
  if (!unified() || accountId === void 0) return modelId;
14533
14572
  const entry = pool.listAccountsByProvider(RACCOON.id).find((account) => account.id === accountId);
14534
- return raccoonSideOf(entry ?? {}) === "pro" ? `${modelId}-p` : modelId;
14573
+ return raccoonSideOf(entry ?? {}) === "pro" ? unifiedRoute(modelId).proId ?? modelId : modelId;
14535
14574
  }
14536
14575
  } : {},
14537
14576
  product
@@ -118,18 +118,20 @@ export function modelWire(raw) {
118
118
  /**
119
119
  * 倍率徽标 wire 投影。
120
120
  *
121
- * 只认「免费」或 `xN` 形态的文案,加上有限正倍率;未知形态一律不挂标
122
- * (不谎报免费、不编造倍率)。
121
+ * 只认「免费」、单倍率或多档倍率区间;区间不携带可比较的单一 multiplier。
123
122
  */
124
- function wireRate(value) {
125
- const label = wireText(value?.label ?? value?.text?.zh, 24)
126
- if (!(label === '免费' || /^(?:参考 )?x\d+(?:\.\d+)?$/.test(label))) return undefined
123
+ export function wireRate(value) {
124
+ const label = value?.label ?? value?.text?.zh
125
+ if (typeof label !== 'string' || label.length > 24) return undefined
126
+ const scalar = /^(?:参考 )?x\d+(?:\.\d+)?$/.test(label)
127
+ const range = /^x(\d+(?:\.\d+)?)–x(\d+(?:\.\d+)?)$/.exec(label)
128
+ if (label !== '免费' && !scalar && !(range && Number(range[1]) < Number(range[2]))) return undefined
127
129
  if (!['neutral', 'info', 'success', 'warning'].includes(value?.tone)) return undefined
128
130
  const multiplier = wireFinite(value?.multiplier)
129
131
  return {
130
132
  label,
131
133
  tone: value.tone,
132
- ...(multiplier !== null && multiplier > 0 ? { multiplier } : {}),
134
+ ...(!range && multiplier !== null && multiplier > 0 ? { multiplier } : {}),
133
135
  }
134
136
  }
135
137
 
@@ -166,15 +168,7 @@ export function modelView(wire, provider) {
166
168
 
167
169
  /** 倍率徽标视图收编(幂等:wire 形状再进一次也不变形)。 */
168
170
  export function viewRate(value) {
169
- const label = typeof value?.label === 'string' ? value.label : ''
170
- if (!(label === '免费' || /^(?:参考 )?x\d+(?:\.\d+)?$/.test(label))) return null
171
- if (!['neutral', 'info', 'success', 'warning'].includes(value?.tone)) return null
172
- const multiplier = wireFinite(value?.multiplier)
173
- return {
174
- label,
175
- tone: value.tone,
176
- ...(multiplier !== null && multiplier > 0 ? { multiplier } : {}),
177
- }
171
+ return wireRate(value) ?? null
178
172
  }
179
173
 
180
174
  /**