mslxdff 0.1.144 → 0.1.145
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/package.json
CHANGED
|
@@ -51,10 +51,19 @@ export function createModelsService({ id, baseUrl, modelsPath, fetchImpl, dispat
|
|
|
51
51
|
const res = await fetchImpl(url, opts);
|
|
52
52
|
if (!res.ok) return fallbackList();
|
|
53
53
|
const json = await res.json().catch(() => ({}));
|
|
54
|
-
if (isClineBotHost(resolvedBase) &&
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
if (isClineBotHost(resolvedBase) && json && typeof json === "object") {
|
|
55
|
+
const all = [];
|
|
56
|
+
for (const k of ["free", "clinePass"]) {
|
|
57
|
+
const arr = Array.isArray(json[k]) ? json[k] : null;
|
|
58
|
+
if (!arr || !arr.length) continue;
|
|
59
|
+
for (const m of arr) {
|
|
60
|
+
if (!m || typeof m.id !== "string") continue;
|
|
61
|
+
const mid = joinModelId(id, m.id);
|
|
62
|
+
if (!all.some((x) => x.id === mid)) all.push({ ...m, id: mid });
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (!all.length) return fallbackList();
|
|
66
|
+
cache = all; fetchedAt = now; return all;
|
|
58
67
|
}
|
|
59
68
|
const raw = Array.isArray(json.data) ? json.data : Array.isArray(json.models) ? json.models : Array.isArray(json) ? json : [];
|
|
60
69
|
const out = raw.filter((m) => m && typeof m.id === "string").map((m) => ({ ...m, id: joinModelId(id, m.id) }));
|
|
@@ -108,8 +117,8 @@ export function createModelsService({ id, baseUrl, modelsPath, fetchImpl, dispat
|
|
|
108
117
|
return { ok: httpOk, status: cat.status, ...(httpOk ? {} : { error: cat.error }), ms: ms() };
|
|
109
118
|
}
|
|
110
119
|
const valid = cat.models;
|
|
111
|
-
|
|
112
|
-
|
|
120
|
+
// 注意:只做快照 diff,不碰 listModels 的合并缓存——缓存里是 free+clinePass 全量,
|
|
121
|
+
// 这里 cat.models 只有 free,写进去会把 pass 挤掉 10 分钟(daemon 启动后 /v1/models 就缺 pass)。
|
|
113
122
|
let change = null;
|
|
114
123
|
if (snapshotPath) { try { change = detectFreeChanges(valid.map((m) => m.id)); } catch {} }
|
|
115
124
|
return {
|