@linxin666/dsh-usage 0.4.0 → 0.4.2
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/README.i18n.yaml +2 -2
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/lib/client.js +8 -9
- package/lib/client.js.map +1 -1
- package/lib/index.js +42 -9
- package/lib/types/core/adapters.d.ts +45 -0
- package/package.json +14 -14
- package/src/client/UsageSectionCard.tsx +8 -1
- package/src/client/index.ts +5 -2
- package/src/core/adapters.ts +56 -0
- package/src/host/usage-service.ts +19 -2
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# node scripts/verify-docs.mjs --write <dir>
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: 2397df7cc658e2f6f5f447312723de5bee7cb490
|
|
6
|
+
README.zh.md: 34535e95511e0d66198e801d37ef5ba6b5d1a288
|
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ It covers the official DeepSeek routes only — relay traffic billed elsewhere (
|
|
|
24
24
|
|
|
25
25
|
## Install
|
|
26
26
|
|
|
27
|
-
Requires DSH 0.1.7-rc.
|
|
27
|
+
Requires DSH 0.1.7-rc.2 or later: the plugin is developed against the 0.1.7-rc.2 DSH cohort (its settings page is the Host-generated page of the plugin's own Config schema) and its `@deepseek-ai/*` runtime imports are provided by the host itself.
|
|
28
28
|
|
|
29
29
|
In your profile (e.g. `~/.dsh/profiles/web`):
|
|
30
30
|
|
package/README.zh.md
CHANGED
|
@@ -24,7 +24,7 @@ dsh Web GUI 的使用统计插件:多 provider 余额与编程套餐用量检
|
|
|
24
24
|
|
|
25
25
|
## 安装
|
|
26
26
|
|
|
27
|
-
要求 DSH 0.1.7-rc.
|
|
27
|
+
要求 DSH 0.1.7-rc.2 或更高:插件基于 0.1.7-rc.2 DSH cohort 开发(其设置页即宿主根据插件自身 Config schema 生成的页面),`@deepseek-ai/*` 运行时导入由宿主本体提供。
|
|
28
28
|
|
|
29
29
|
在 profile(如 `~/.dsh/profiles/web`)中:
|
|
30
30
|
|
package/lib/client.js
CHANGED
|
@@ -303,16 +303,11 @@ window.__ModuleLoader__.load({
|
|
|
303
303
|
function bearer(apiKey) {
|
|
304
304
|
return { authorization: `Bearer ${apiKey}` };
|
|
305
305
|
}
|
|
306
|
-
/**
|
|
307
|
-
* The official pay-as-you-go balance. `deepseek` is the configurable-catalog
|
|
308
|
-
* route key; `deepseek-official` is the live provider route the llm-deepseek
|
|
309
|
-
* adapter registers (sessions and agent-default-model carry it), so both ids
|
|
310
|
-
* must resolve here or the current provider would never be probed.
|
|
311
|
-
*/
|
|
312
306
|
const DEEPSEEK = {
|
|
313
307
|
ids: ["deepseek", "deepseek-official"],
|
|
314
308
|
displayName: "DeepSeek",
|
|
315
309
|
balance: {
|
|
310
|
+
origin: "https://api.deepseek.com",
|
|
316
311
|
build: ({ apiKey }) => ({
|
|
317
312
|
url: "https://api.deepseek.com/user/balance",
|
|
318
313
|
headers: bearer(apiKey)
|
|
@@ -1019,6 +1014,10 @@ window.__ModuleLoader__.load({
|
|
|
1019
1014
|
className: usage_module_css_default.muted,
|
|
1020
1015
|
children: t("usage.balance.noCredential")
|
|
1021
1016
|
});
|
|
1017
|
+
if (provider.balanceSupported === false) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1018
|
+
className: usage_module_css_default.muted,
|
|
1019
|
+
children: t("usage.balance.unsupported")
|
|
1020
|
+
});
|
|
1022
1021
|
if (!provider.supported) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1023
1022
|
className: usage_module_css_default.muted,
|
|
1024
1023
|
children: t("usage.balance.unsupported")
|
|
@@ -1224,7 +1223,7 @@ window.__ModuleLoader__.load({
|
|
|
1224
1223
|
}),
|
|
1225
1224
|
(() => {
|
|
1226
1225
|
const configured = snapshot.providers.filter(isConfigured);
|
|
1227
|
-
const rows = configured.filter((provider) => provider.balanceSupported === true || provider.balanceSupported === void 0 && provider.supported);
|
|
1226
|
+
const rows = configured.filter((provider) => provider.balanceSupported === true || provider.balanceSupported === false || provider.balanceSupported === void 0 && provider.supported);
|
|
1228
1227
|
if (rows.length === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1229
1228
|
className: usage_module_css_default.muted,
|
|
1230
1229
|
children: configured.length === 0 ? t("usage.balance.noneConfigured") : t("usage.balance.unsupported")
|
|
@@ -2131,8 +2130,8 @@ window.__ModuleLoader__.load({
|
|
|
2131
2130
|
return await response.json();
|
|
2132
2131
|
}
|
|
2133
2132
|
const usageApi = {
|
|
2134
|
-
overview: () => usageFetch("
|
|
2135
|
-
refresh: () => usageFetch("
|
|
2133
|
+
overview: () => usageFetch("api/dsh-usage/overview", "GET"),
|
|
2134
|
+
refresh: () => usageFetch("api/dsh-usage/refresh", "POST")
|
|
2136
2135
|
};
|
|
2137
2136
|
/** Settings namespace the section edits (dsh-web-settings maps it onto this row's profile entry id). */
|
|
2138
2137
|
const USAGE_SETTINGS_NS = "dsh-usage";
|