dsh-sub2api 0.12.1 → 0.13.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 +12 -0
- package/lib/adapter.js +12 -0
- package/lib/client.js +24 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.13.0
|
|
4
|
+
|
|
5
|
+
- **Out of balance now says so, and where to fix it.** The gateway answers both
|
|
6
|
+
`/v1/models` and `/v1/chat/completions` with `INSUFFICIENT_BALANCE` on a
|
|
7
|
+
zero-balance account, and the plugin passed that raw 403 through — a message
|
|
8
|
+
that reads like a key or permission problem. Measured on a live gateway: 62 of
|
|
9
|
+
108 accounts carry a zero balance, so this is the single most common reason a
|
|
10
|
+
fresh install cannot talk. It is now a sentence with the next step.
|
|
11
|
+
- The empty conversation screen also warns while the balance is zero, next to
|
|
12
|
+
the existing "not signed in" line, so the wall is visible before the first
|
|
13
|
+
message instead of after it.
|
|
14
|
+
|
|
3
15
|
## 0.12.1
|
|
4
16
|
|
|
5
17
|
- **An English README.** The plugin list judges language by the share of CJK
|
package/lib/adapter.js
CHANGED
|
@@ -342,6 +342,18 @@ export function describeStreamFailure(error, emitted, attempts) {
|
|
|
342
342
|
const status = failureStatus(error);
|
|
343
343
|
const said = plainText(error?.message ?? error);
|
|
344
344
|
|
|
345
|
+
// Out of balance is the most common reason a fresh install cannot talk, and
|
|
346
|
+
// the raw error is `INSUFFICIENT_BALANCE` from a 403 — which reads like a
|
|
347
|
+
// permissions or key problem. It is neither: the account simply has no
|
|
348
|
+
// credit. Naming that, and where to fix it, is the difference between a user
|
|
349
|
+
// topping up and a user uninstalling.
|
|
350
|
+
if (/INSUFFICIENT_BALANCE|insufficient.*balance|余额不足|quota.*exceed/i.test(said)) {
|
|
351
|
+
return new Sub2ApiError(
|
|
352
|
+
`账户余额不足,无法调用模型${retryNote}。打开 设置 → dsh-sub2api 点「去充值」,到账后会自动恢复。`,
|
|
353
|
+
{ code: "QUOTA", status, cause: error },
|
|
354
|
+
);
|
|
355
|
+
}
|
|
356
|
+
|
|
345
357
|
if (status !== undefined && status >= 500) {
|
|
346
358
|
// sub2api answers this exact sentence for "my upstream failed", which in
|
|
347
359
|
// practice means the account pool has nothing usable for this model — a
|
package/lib/client.js
CHANGED
|
@@ -1567,7 +1567,30 @@ window.__ModuleLoader__.load({
|
|
|
1567
1567
|
*/
|
|
1568
1568
|
function LoginNudge() {
|
|
1569
1569
|
const { state } = useStatus();
|
|
1570
|
-
if (state === null
|
|
1570
|
+
if (state === null) return null;
|
|
1571
|
+
|
|
1572
|
+
// Signed in with no credit is the second wall a new user hits, and it is
|
|
1573
|
+
// silent until they send a message. Say it on the same line that covers
|
|
1574
|
+
// "not signed in", because both mean "you cannot use this yet".
|
|
1575
|
+
if (state.loggedIn === true) {
|
|
1576
|
+
const balance = Number(state.profile?.balance);
|
|
1577
|
+
if (Number.isFinite(balance) && balance <= 0) {
|
|
1578
|
+
return h("button", {
|
|
1579
|
+
type: "button",
|
|
1580
|
+
"data-sub2api": "",
|
|
1581
|
+
onClick: () => toastStore.push("打开 设置 → dsh-sub2api,点「去充值」", "ok"),
|
|
1582
|
+
style: {
|
|
1583
|
+
display: "inline-flex", alignItems: "center", gap: 8,
|
|
1584
|
+
padding: "8px 14px", borderRadius: 999,
|
|
1585
|
+
border: "0.5px solid " + C.bad, background: C.surface,
|
|
1586
|
+
color: C.bad, fontSize: 12.5, cursor: "pointer", maxWidth: "100%",
|
|
1587
|
+
},
|
|
1588
|
+
},
|
|
1589
|
+
h("span", { style: { width: 7, height: 7, borderRadius: 999, background: C.bad, flex: "0 0 7px" } }),
|
|
1590
|
+
h("span", null, "账户余额为 0,现在还不能调用模型 —— 去 设置 → dsh-sub2api 充值"));
|
|
1591
|
+
}
|
|
1592
|
+
return null;
|
|
1593
|
+
}
|
|
1571
1594
|
|
|
1572
1595
|
return h("button", {
|
|
1573
1596
|
type: "button",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-sub2api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Sub2API provider for DeepSeek Harness (DSH): email sign-in, automatic API key and model provisioning, one panel for balance and recharge. Works with the hosted gateway or your own sub2api deployment",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "GPL-3.0-only",
|