@eddyskywalker/dsh-chatgpt-subscription 0.20.0 → 0.21.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/CHANGELOG.md +9 -0
- package/lib/client.js +17 -16
- package/lib/client.js.map +1 -1
- package/lib/index.js +60 -22
- package/lib/types/client/ollama/OllamaSection.d.ts.map +1 -1
- package/lib/types/client/ollama/api.d.ts +2 -2
- package/lib/types/client/ollama/api.d.ts.map +1 -1
- package/lib/types/host/ollama/adapter.d.ts.map +1 -1
- package/lib/types/host/ollama/routes.d.ts.map +1 -1
- package/lib/types/host/ollama/token-store.d.ts +8 -3
- package/lib/types/host/ollama/token-store.d.ts.map +1 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/shared/ollama-contracts.d.ts +8 -1
- package/lib/types/shared/ollama-contracts.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.21.0 - 2026-10-12
|
|
6
|
+
- **[Ollama] 修复添加 Key 后「订阅服务」整页空白;补齐线路启停开关;「全不选」与勾选状态实时同步到模型选择器**
|
|
7
|
+
- **问题 1(整页空白)**:`/ollama/api/accounts` 的 `add` 分支独自返回 `{ id }`,其余动作都返回完整 status。客户端把动作回包直接当作渲染状态,`status.models` 为 `undefined` 时渲染期 `TypeError` 把设置页整棵 React 子树打崩。修法:add 与其他动作一样回落到统一的完整 status 应答;客户端渲染路径对残缺 status 一律降级为空区块(`status?.models ?? []`),任何残缺载荷永不再崩页。
|
|
8
|
+
- **问题 2(缺开关)**:总览卡片里 Ollama 是唯一没有启停开关的线路(`canToggle: false` 硬编码)。适配器其实早已读取 `enabled` 旗标,缺的只是接线:新增 `POST /ollama/api/settings { enabled }`(与其余线路同形同义),hub 描述符接上开关,总览聚合回报真实旗标而非恒 `true`。
|
|
9
|
+
- **问题 3(「全不选」弹回全选)**:`enabledModelIds` 的「空数组 = 不过滤」语义使「全不选」写入 `[]` 后被读回成全选,长清单永远无法收窄。改为三态:`null` = 不过滤(全部,含日后新同步的模型)、数组 = 显式选择(`[]` = 全不选)。设置文件写入 `version: 2` 标记;旧文件的空数组只能解释为「未动过的默认」,读回 `null`,存量用户行为不变。手动勾满整张清单时客户端归一化回 `null`,「全部」继续跟随目录而非冻结在凑巧完整的那一刻。
|
|
10
|
+
- **问题 4(取消勾选后选择器仍显示)**:Ollama 是唯一不在设置变更后发 `llm/adapters-updated` 的线路,模型选择器只能等别的线路碰巧发事件才刷新。`/models` 与 `/settings` 的实际写入现在都发该事件,与其余线路逐字对齐。
|
|
11
|
+
- **测试**:路由层 8 例新增(add/delete 应答必须是完整 status、全不选持久化为 `[]`、`null` 恢复不过滤、version-2 前后文件各自读法、开关往返、只读不发事件);适配器层按三态改写 3 例;客户端层 3 例(残缺动作回包不崩页、全不选后全部不勾且计数 0/2、勾满归一化为 `null`)。反向验证:撤掉客户端加固后「残缺回包」用例以原样 `TypeError: Cannot read properties of undefined (reading 'length')` 失败,恢复后全绿。
|
|
12
|
+
- **验证:`npm run typecheck` 0 错误;全量 `npm test` 215 passed | 1 skipped(216 文件)、3494 passed | 7 skipped | 0 failed。**
|
|
13
|
+
|
|
5
14
|
## 0.20.0 - 2026-10-12
|
|
6
15
|
- **[MiniMax Code] 新增「限额重置卡」:查看可用卡与近 30 天流水,选卡确认后重置套餐限额**
|
|
7
16
|
- **能力来源**:MiniMax 官方桌面端 v3.1.1(2026-10-04)起提供「限额重置」——订阅用户可在用量页查看可用重置卡与近 30 天获得/使用记录,**选择一张卡并确认后**重置对应限额。本插件复刻它,接同一组上游接口。
|
package/lib/client.js
CHANGED
|
@@ -10240,13 +10240,13 @@ window.__ModuleLoader__.load({
|
|
|
10240
10240
|
const [key, setKey] = (0, react.useState)("");
|
|
10241
10241
|
const [alias, setAlias] = (0, react.useState)("");
|
|
10242
10242
|
const [showKeyForm, setShowKeyForm] = (0, react.useState)(false);
|
|
10243
|
-
/** Ids the user has switched on.
|
|
10244
|
-
const [enabled, setEnabled] = (0, react.useState)(
|
|
10243
|
+
/** Ids the user has switched on. Null means 'no filter', i.e. all of them. */
|
|
10244
|
+
const [enabled, setEnabled] = (0, react.useState)(null);
|
|
10245
10245
|
const reload = (0, react.useCallback)(async () => {
|
|
10246
10246
|
try {
|
|
10247
10247
|
const next = await API.status();
|
|
10248
10248
|
setStatus(next);
|
|
10249
|
-
setEnabled(new Set(next.enabledModelIds));
|
|
10249
|
+
setEnabled(next.enabledModelIds == null ? null : new Set(next.enabledModelIds));
|
|
10250
10250
|
} catch (cause) {
|
|
10251
10251
|
setError(cause instanceof Error ? cause.message : String(cause));
|
|
10252
10252
|
}
|
|
@@ -10292,31 +10292,32 @@ window.__ModuleLoader__.load({
|
|
|
10292
10292
|
});
|
|
10293
10293
|
}, [run]);
|
|
10294
10294
|
const isModelEnabled = (0, react.useCallback)((id) => {
|
|
10295
|
-
return enabled
|
|
10295
|
+
return enabled === null || enabled.has(id);
|
|
10296
10296
|
}, [enabled]);
|
|
10297
10297
|
const applyEnabled = (0, react.useCallback)((next) => {
|
|
10298
10298
|
run("models", async () => {
|
|
10299
10299
|
const result = await API.setEnabledModels(next);
|
|
10300
|
-
setEnabled(new Set(result.enabledModelIds));
|
|
10300
|
+
setEnabled(result.enabledModelIds == null ? null : new Set(result.enabledModelIds));
|
|
10301
10301
|
return API.status();
|
|
10302
10302
|
});
|
|
10303
10303
|
}, [run]);
|
|
10304
10304
|
const toggleModel = (0, react.useCallback)((id, checked) => {
|
|
10305
10305
|
if (status === null) return;
|
|
10306
|
-
const
|
|
10306
|
+
const all = status.models ?? [];
|
|
10307
|
+
const current = all.filter((model) => isModelEnabled(model.id)).map((model) => model.id);
|
|
10307
10308
|
const next = checked ? [.../* @__PURE__ */ new Set([...current, id])] : current.filter((entry) => entry !== id);
|
|
10308
|
-
applyEnabled(next);
|
|
10309
|
+
applyEnabled(next.length === all.length ? null : next);
|
|
10309
10310
|
}, [
|
|
10310
10311
|
status,
|
|
10311
10312
|
isModelEnabled,
|
|
10312
10313
|
applyEnabled
|
|
10313
10314
|
]);
|
|
10314
10315
|
const setAllModels = (0, react.useCallback)((selectAll) => {
|
|
10315
|
-
|
|
10316
|
-
|
|
10317
|
-
}, [status, applyEnabled]);
|
|
10316
|
+
applyEnabled(selectAll ? null : []);
|
|
10317
|
+
}, [applyEnabled]);
|
|
10318
10318
|
const t = zh$1;
|
|
10319
10319
|
const pool = status?.pool;
|
|
10320
|
+
const models = status?.models ?? [];
|
|
10320
10321
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [
|
|
10321
10322
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
10322
10323
|
className: "dsha-group",
|
|
@@ -10457,21 +10458,21 @@ window.__ModuleLoader__.load({
|
|
|
10457
10458
|
style: { fontSize: 12 },
|
|
10458
10459
|
children: t.wireNote
|
|
10459
10460
|
}),
|
|
10460
|
-
status !== null &&
|
|
10461
|
+
status !== null && models.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
10461
10462
|
className: "dsha-empty",
|
|
10462
10463
|
children: status.catalogSynced ? t.catalogEmpty : t.catalogNeverSynced
|
|
10463
10464
|
}),
|
|
10464
|
-
status !== null &&
|
|
10465
|
+
status !== null && models.length === 0 && !status.usable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
10465
10466
|
className: "dsha-muted",
|
|
10466
10467
|
style: { fontSize: 12 },
|
|
10467
10468
|
children: t.catalogNeedKey
|
|
10468
10469
|
}),
|
|
10469
|
-
status !== null &&
|
|
10470
|
+
status !== null && models.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
10470
10471
|
className: "dsha-muted",
|
|
10471
10472
|
style: { fontSize: 12 },
|
|
10472
|
-
children: t.modelCount.replace("{count}", String(
|
|
10473
|
+
children: t.modelCount.replace("{count}", String(models.length))
|
|
10473
10474
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModelChecklist, {
|
|
10474
|
-
items:
|
|
10475
|
+
items: models.map((model) => ({
|
|
10475
10476
|
id: model.id,
|
|
10476
10477
|
name: model.name ?? model.id,
|
|
10477
10478
|
enabled: isModelEnabled(model.id)
|
|
@@ -10595,7 +10596,7 @@ window.__ModuleLoader__.load({
|
|
|
10595
10596
|
{
|
|
10596
10597
|
id: "ollama",
|
|
10597
10598
|
name: "Ollama",
|
|
10598
|
-
setEnabled:
|
|
10599
|
+
setEnabled: (enabled) => postLineSettings("/ollama/api", { enabled }),
|
|
10599
10600
|
renderDetail: ({ onModelChange }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OllamaSection, { onModelChange })
|
|
10600
10601
|
}
|
|
10601
10602
|
];
|