dsh-model-health 0.2.7 → 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/index.js +40 -31
- package/package.json +1 -1
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)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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)
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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)
|
|
164
|
-
|
|
165
|
-
|
|
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