dsh-model-health 0.2.6 → 0.2.8

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/dist/client.js CHANGED
@@ -613,12 +613,14 @@
613
613
  const models = data.models || [];
614
614
  const activeLang = locale && typeof locale.getLocale === "function" ? locale.getLocale().active : "zh";
615
615
  const updatedAt = new Date(data.updatedAt || Date.now()).toLocaleString(activeLang === "en" ? "en-US" : "zh-CN");
616
+ const validKeys = new Set(models.map((m) => m.key));
616
617
  const stats = {
617
618
  ok: 0,
618
619
  fail: 0,
619
620
  skip: 0
620
621
  };
621
622
  for (const k in run.results) {
623
+ if (!validKeys.has(k)) continue;
622
624
  const s = run.results[k].status;
623
625
  if (s === "ok") stats.ok++;
624
626
  else if (s === "fail") stats.fail++;
package/dist/index.js CHANGED
@@ -53,37 +53,43 @@ function collectModels(cfg) {
53
53
  for (const [route, p] of Object.entries(providers)) {
54
54
  if (!p || typeof p !== "object") continue;
55
55
  const models = Array.isArray(p.models) ? p.models : [];
56
- for (const m of models) rows.push({
57
- key: `${route}/${m.id || ""}`,
58
- provider: route,
59
- displayName: p.displayName || route,
60
- modelId: m.id || "",
61
- modelName: m.name || m.id || "",
62
- contextWindow: m.contextWindow ?? p.defaultContextWindow ?? "-",
63
- maxTokens: m.maxTokens ?? p.defaultMaxTokens ?? "-",
64
- input: Array.isArray(m.input) ? m.input.join("/") : (p.defaultInput || ["text"]).join("/"),
65
- api: p.api || "-",
66
- baseURL: p.baseURL || "-",
67
- apiKeyEnv: p.apiKeyEnv || ""
68
- });
56
+ for (const m of models) {
57
+ if (!m || typeof m !== "object" || !m.id) continue;
58
+ rows.push({
59
+ key: `pi-ai/${route}/${m.id}`,
60
+ provider: route,
61
+ displayName: p.displayName || route,
62
+ modelId: m.id || "",
63
+ modelName: m.name || m.id || "",
64
+ contextWindow: m.contextWindow ?? p.defaultContextWindow ?? "-",
65
+ maxTokens: m.maxTokens ?? p.defaultMaxTokens ?? "-",
66
+ input: Array.isArray(m.input) ? m.input.join("/") : (p.defaultInput || ["text"]).join("/"),
67
+ api: p.api || "-",
68
+ baseURL: p.baseURL || "-",
69
+ apiKeyEnv: p.apiKeyEnv || ""
70
+ });
71
+ }
69
72
  }
70
73
  }
71
74
  const ds = cfg["llm-deepseek"];
72
75
  if (ds && typeof ds === "object") {
73
76
  const models = Array.isArray(ds.models) ? ds.models : [];
74
- for (const m of models) rows.push({
75
- key: `deepseek/${m.id || ""}`,
76
- provider: "deepseek",
77
- displayName: "DeepSeek",
78
- modelId: m.id || "",
79
- modelName: m.name || m.id || "",
80
- contextWindow: m.contextWindow ?? "-",
81
- maxTokens: m.maxTokens ?? "-",
82
- input: Array.isArray(m.input) ? m.input.join("/") : "text",
83
- api: "deepseek",
84
- baseURL: "https://api.deepseek.com",
85
- apiKeyEnv: ds.apiKeyEnv || "DEEPSEEK_API_KEY"
86
- });
77
+ for (const m of models) {
78
+ if (!m || typeof m !== "object" || !m.id) continue;
79
+ rows.push({
80
+ key: `deepseek/${m.id}`,
81
+ provider: "deepseek",
82
+ displayName: "DeepSeek",
83
+ modelId: m.id || "",
84
+ modelName: m.name || m.id || "",
85
+ contextWindow: m.contextWindow ?? "-",
86
+ maxTokens: m.maxTokens ?? "-",
87
+ input: Array.isArray(m.input) ? m.input.join("/") : "text",
88
+ api: "deepseek",
89
+ baseURL: "https://api.deepseek.com",
90
+ apiKeyEnv: ds.apiKeyEnv || "DEEPSEEK_API_KEY"
91
+ });
92
+ }
87
93
  }
88
94
  return rows;
89
95
  }
@@ -158,13 +164,16 @@ async function probeModel(row, apiKey) {
158
164
  }),
159
165
  signal: controller.signal
160
166
  });
161
- clearTimeout(timer);
162
167
  const latency = Date.now() - start;
163
- if (resp.ok) return {
164
- status: "ok",
165
- latency
166
- };
168
+ if (resp.ok) {
169
+ clearTimeout(timer);
170
+ return {
171
+ status: "ok",
172
+ latency
173
+ };
174
+ }
167
175
  const text = await resp.text().catch(() => "");
176
+ clearTimeout(timer);
168
177
  return {
169
178
  status: "fail",
170
179
  latency,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-model-health",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "description": "DSH plugin that lists all configured models with availability/latency testing, by reading $DSH_HOME/settings.yaml.",
5
5
  "license": "MIT",
6
6
  "repository": {