@eddyskywalker/dsh-chatgpt-subscription 0.78.0 → 0.79.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 +18 -0
- package/README.md +10 -5
- package/lib/client.js +1410 -539
- package/lib/client.js.map +1 -1
- package/lib/index.js +4705 -1795
- package/lib/types/client/hub/brand-icons.d.ts +1 -1
- package/lib/types/client/hub/brand-icons.d.ts.map +1 -1
- package/lib/types/client/hub/providers.d.ts.map +1 -1
- package/lib/types/client/index.d.ts +2 -0
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/locales-ru/hub.d.ts.map +1 -1
- package/lib/types/client/locales-ru/index.d.ts.map +1 -1
- package/lib/types/client/locales-ru/relayone.d.ts +3 -0
- package/lib/types/client/locales-ru/relayone.d.ts.map +1 -0
- package/lib/types/client/locales.d.ts +3 -1
- package/lib/types/client/locales.d.ts.map +1 -1
- package/lib/types/client/relayone/RelayOneComposerQuota.d.ts +14 -0
- package/lib/types/client/relayone/RelayOneComposerQuota.d.ts.map +1 -0
- package/lib/types/client/relayone/RelayOneSection.d.ts +4 -0
- package/lib/types/client/relayone/RelayOneSection.d.ts.map +1 -0
- package/lib/types/client/relayone/api.d.ts +5 -0
- package/lib/types/client/relayone/api.d.ts.map +1 -0
- package/lib/types/client/relayone/locales.d.ts +157 -0
- package/lib/types/client/relayone/locales.d.ts.map +1 -0
- package/lib/types/client/relayone/quota-format.d.ts +6 -0
- package/lib/types/client/relayone/quota-format.d.ts.map +1 -0
- package/lib/types/client/relayone/styles.d.ts +3 -0
- package/lib/types/client/relayone/styles.d.ts.map +1 -0
- package/lib/types/client/relayone/useRelayOneSection.d.ts +30 -0
- package/lib/types/client/relayone/useRelayOneSection.d.ts.map +1 -0
- package/lib/types/compat.d.ts +1 -1
- package/lib/types/host/common/i18n/en.d.ts.map +1 -1
- package/lib/types/host/common/i18n/ru.d.ts.map +1 -1
- package/lib/types/host/common/i18n/zh.d.ts +1 -0
- package/lib/types/host/common/i18n/zh.d.ts.map +1 -1
- package/lib/types/host/common/model-request-control.d.ts +1 -1
- package/lib/types/host/common/model-request-control.d.ts.map +1 -1
- package/lib/types/host/common/prompt-cache-policy.d.ts.map +1 -1
- package/lib/types/host/common/request-diagnostics.d.ts +1 -1
- package/lib/types/host/common/request-diagnostics.d.ts.map +1 -1
- package/lib/types/host/relayone/adapter.d.ts +46 -0
- package/lib/types/host/relayone/adapter.d.ts.map +1 -0
- package/lib/types/host/relayone/catalog-manager.d.ts +44 -0
- package/lib/types/host/relayone/catalog-manager.d.ts.map +1 -0
- package/lib/types/host/relayone/client.d.ts +5 -0
- package/lib/types/host/relayone/client.d.ts.map +1 -0
- package/lib/types/host/relayone/image-tool.d.ts +9 -0
- package/lib/types/host/relayone/image-tool.d.ts.map +1 -0
- package/lib/types/host/relayone/mapper-anthropic.d.ts +49 -0
- package/lib/types/host/relayone/mapper-anthropic.d.ts.map +1 -0
- package/lib/types/host/relayone/mapper-openai.d.ts +36 -0
- package/lib/types/host/relayone/mapper-openai.d.ts.map +1 -0
- package/lib/types/host/relayone/mapper-shared.d.ts +23 -0
- package/lib/types/host/relayone/mapper-shared.d.ts.map +1 -0
- package/lib/types/host/relayone/media-shared.d.ts +18 -0
- package/lib/types/host/relayone/media-shared.d.ts.map +1 -0
- package/lib/types/host/relayone/model-catalog.d.ts +59 -0
- package/lib/types/host/relayone/model-catalog.d.ts.map +1 -0
- package/lib/types/host/relayone/quota.d.ts +28 -0
- package/lib/types/host/relayone/quota.d.ts.map +1 -0
- package/lib/types/host/relayone/routes.d.ts +17 -0
- package/lib/types/host/relayone/routes.d.ts.map +1 -0
- package/lib/types/host/relayone/token-store.d.ts +49 -0
- package/lib/types/host/relayone/token-store.d.ts.map +1 -0
- package/lib/types/host/relayone/types.d.ts +22 -0
- package/lib/types/host/relayone/types.d.ts.map +1 -0
- package/lib/types/host/relayone/video-tool.d.ts +10 -0
- package/lib/types/host/relayone/video-tool.d.ts.map +1 -0
- package/lib/types/index.d.ts +8 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/shared/contracts.d.ts +1 -1
- package/lib/types/shared/contracts.d.ts.map +1 -1
- package/lib/types/shared/relayone-contracts.d.ts +80 -0
- package/lib/types/shared/relayone-contracts.d.ts.map +1 -0
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -577,6 +577,13 @@ window.__ModuleLoader__.load({
|
|
|
577
577
|
fit: "cover"
|
|
578
578
|
},
|
|
579
579
|
tile: "#FFFFFF"
|
|
580
|
+
},
|
|
581
|
+
relayone: {
|
|
582
|
+
image: {
|
|
583
|
+
src: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNTYiIGhlaWdodD0iMjU2IiB2aWV3Qm94PSIwIDAgMjU2IDI1NiIgcm9sZT0iaW1nIiBhcmlhLWxhYmVsPSJSZWxheU9uZSBtYXJrIj4KICA8ZyBmaWxsPSJub25lIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPgogICAgPHJlY3QgeD0iMTAwIiB5PSI4MiIgd2lkdGg9IjY4IiBoZWlnaHQ9IjkyIiByeD0iMjAiIHN0cm9rZT0iIzNGNTEzNiIgc3Ryb2tlLXdpZHRoPSIxMiIvPgogICAgPHBhdGggZD0iTTI4IDEwNEgxMDBNMjggMTI4SDEwME0yOCAxNTJIMTAwIiBzdHJva2U9IiM3RDhGNkEiIHN0cm9rZS13aWR0aD0iNyIvPgogICAgPHBhdGggZD0iTTE2OCAxMjhIMjI4IiBzdHJva2U9IiNBOTY1NEIiIHN0cm9rZS13aWR0aD0iOSIvPgogICAgPGNpcmNsZSBjeD0iMjgiIGN5PSIxMDQiIHI9IjMuNSIgZmlsbD0iIzdEOEY2QSIgc3Ryb2tlPSJub25lIi8+CiAgICA8Y2lyY2xlIGN4PSIyOCIgY3k9IjEyOCIgcj0iMy41IiBmaWxsPSIjN0Q4RjZBIiBzdHJva2U9Im5vbmUiLz4KICAgIDxjaXJjbGUgY3g9IjI4IiBjeT0iMTUyIiByPSIzLjUiIGZpbGw9IiM3RDhGNkEiIHN0cm9rZT0ibm9uZSIvPgogICAgPGNpcmNsZSBjeD0iMTM0IiBjeT0iMTI4IiByPSI4IiBmaWxsPSIjQTk2NTRCIiBzdHJva2U9Im5vbmUiLz4KICA8L2c+Cjwvc3ZnPgo=",
|
|
584
|
+
fit: "contain"
|
|
585
|
+
},
|
|
586
|
+
tile: "#E7EBDD"
|
|
580
587
|
}
|
|
581
588
|
};
|
|
582
589
|
/** One brand mark at a given box size; the artwork is decorative. */
|
|
@@ -994,10 +1001,10 @@ window.__ModuleLoader__.load({
|
|
|
994
1001
|
//#region src/client/api.ts
|
|
995
1002
|
var SubscriptionApi = class {
|
|
996
1003
|
status() {
|
|
997
|
-
return request$
|
|
1004
|
+
return request$5(`${ROUTE_PREFIX}/status`);
|
|
998
1005
|
}
|
|
999
1006
|
startLogin() {
|
|
1000
|
-
return post$
|
|
1007
|
+
return post$8(`${ROUTE_PREFIX}/login/start`, {});
|
|
1001
1008
|
}
|
|
1002
1009
|
/**
|
|
1003
1010
|
* Start a device-code sign-in instead of the browser callback.
|
|
@@ -1007,14 +1014,14 @@ window.__ModuleLoader__.load({
|
|
|
1007
1014
|
* wait for confirmation arrives on the same event stream as any other login.
|
|
1008
1015
|
*/
|
|
1009
1016
|
startDeviceLogin() {
|
|
1010
|
-
return post$
|
|
1017
|
+
return post$8(`${ROUTE_PREFIX}/login/device/start`, {});
|
|
1011
1018
|
}
|
|
1012
1019
|
cancelLogin(loginId) {
|
|
1013
|
-
return post$
|
|
1020
|
+
return post$8(`${ROUTE_PREFIX}/login/cancel`, { loginId });
|
|
1014
1021
|
}
|
|
1015
1022
|
/** Sign out one pooled account; without an id, the active one. */
|
|
1016
1023
|
logout(accountId) {
|
|
1017
|
-
return post$
|
|
1024
|
+
return post$8(`${ROUTE_PREFIX}/logout`, accountId === void 0 ? {} : { accountId });
|
|
1018
1025
|
}
|
|
1019
1026
|
/**
|
|
1020
1027
|
* One account-pool action, returning the refreshed status.
|
|
@@ -1023,7 +1030,7 @@ window.__ModuleLoader__.load({
|
|
|
1023
1030
|
* never has to guess what the pool looks like after a change.
|
|
1024
1031
|
*/
|
|
1025
1032
|
accountAction(action, body = {}) {
|
|
1026
|
-
return post$
|
|
1033
|
+
return post$8(`${ROUTE_PREFIX}/accounts`, {
|
|
1027
1034
|
action,
|
|
1028
1035
|
...body
|
|
1029
1036
|
});
|
|
@@ -1038,11 +1045,11 @@ window.__ModuleLoader__.load({
|
|
|
1038
1045
|
* call the host always answers with a 400.
|
|
1039
1046
|
*/
|
|
1040
1047
|
adoptLocalLogin(source) {
|
|
1041
|
-
return post$
|
|
1048
|
+
return post$8(`${ROUTE_PREFIX}/adopt`, { source });
|
|
1042
1049
|
}
|
|
1043
1050
|
/** Forget every imported snapshot. The CLIs' own files are never touched. */
|
|
1044
1051
|
disableAdoptedLocalLogins() {
|
|
1045
|
-
return post$
|
|
1052
|
+
return post$8(`${ROUTE_PREFIX}/adopt/disable`, {});
|
|
1046
1053
|
}
|
|
1047
1054
|
/**
|
|
1048
1055
|
* Choose the account-pool store, answering with the refreshed status.
|
|
@@ -1051,39 +1058,39 @@ window.__ModuleLoader__.load({
|
|
|
1051
1058
|
* back already names the store the pools will read and write from here on.
|
|
1052
1059
|
*/
|
|
1053
1060
|
setPoolStorage(mode) {
|
|
1054
|
-
return post$
|
|
1061
|
+
return post$8(`${ROUTE_PREFIX}/storage`, { mode });
|
|
1055
1062
|
}
|
|
1056
1063
|
refresh() {
|
|
1057
|
-
return post$
|
|
1064
|
+
return post$8(`${ROUTE_PREFIX}/token/refresh`, {});
|
|
1058
1065
|
}
|
|
1059
1066
|
refreshQuota() {
|
|
1060
|
-
return post$
|
|
1067
|
+
return post$8(`${ROUTE_PREFIX}/quota/refresh`, {});
|
|
1061
1068
|
}
|
|
1062
1069
|
useResetCredit() {
|
|
1063
|
-
return post$
|
|
1070
|
+
return post$8(`${ROUTE_PREFIX}/quota/reset-credit/use`, {});
|
|
1064
1071
|
}
|
|
1065
1072
|
testConnection() {
|
|
1066
|
-
return post$
|
|
1073
|
+
return post$8(`${ROUTE_PREFIX}/connection/test`, {});
|
|
1067
1074
|
}
|
|
1068
1075
|
updatePreferences(patch) {
|
|
1069
|
-
return post$
|
|
1076
|
+
return post$8(`${ROUTE_PREFIX}/preferences/update`, patch);
|
|
1070
1077
|
}
|
|
1071
1078
|
/** Every route a compaction summary may be pointed at, read per call. */
|
|
1072
1079
|
compactionCandidates() {
|
|
1073
|
-
return post$
|
|
1080
|
+
return post$8(`${ROUTE_PREFIX}/compaction/candidates`, {});
|
|
1074
1081
|
}
|
|
1075
1082
|
events(loginId) {
|
|
1076
1083
|
return new EventSource(`${ROUTE_PREFIX}/login/events?loginId=${encodeURIComponent(loginId)}`);
|
|
1077
1084
|
}
|
|
1078
1085
|
};
|
|
1079
|
-
async function post$
|
|
1080
|
-
return request$
|
|
1086
|
+
async function post$8(url, body) {
|
|
1087
|
+
return request$5(url, {
|
|
1081
1088
|
method: "POST",
|
|
1082
1089
|
headers: { "content-type": "application/json" },
|
|
1083
1090
|
body: JSON.stringify(body)
|
|
1084
1091
|
});
|
|
1085
1092
|
}
|
|
1086
|
-
async function request$
|
|
1093
|
+
async function request$5(url, init) {
|
|
1087
1094
|
const response = await fetch(url, {
|
|
1088
1095
|
...init,
|
|
1089
1096
|
credentials: "same-origin"
|
|
@@ -1103,7 +1110,7 @@ window.__ModuleLoader__.load({
|
|
|
1103
1110
|
//#endregion
|
|
1104
1111
|
//#region src/client/locales.ts
|
|
1105
1112
|
const NS = "dsh-chatgpt-subscription";
|
|
1106
|
-
const zh$
|
|
1113
|
+
const zh$17 = {
|
|
1107
1114
|
...accountPoolZh,
|
|
1108
1115
|
title: "ChatGPT",
|
|
1109
1116
|
hubTitle: "订阅服务",
|
|
@@ -1318,6 +1325,7 @@ window.__ModuleLoader__.load({
|
|
|
1318
1325
|
"cardName.workbuddy": "WorkBuddy",
|
|
1319
1326
|
"cardName.antigravity-acp": "Antigravity(ACP)",
|
|
1320
1327
|
"cardName.qianwen-token-plan": "Qwen Token Plan(千问)",
|
|
1328
|
+
"cardName.relayone": "RelayOne",
|
|
1321
1329
|
modelChecklistCount: "已启用 {count}/{total}",
|
|
1322
1330
|
codeRunTitle: "代码",
|
|
1323
1331
|
codeRunOutput: "输出",
|
|
@@ -1331,8 +1339,8 @@ window.__ModuleLoader__.load({
|
|
|
1331
1339
|
codeRunFailed: "失败",
|
|
1332
1340
|
codeRunStopped: "已停止"
|
|
1333
1341
|
};
|
|
1334
|
-
const dictionaries$
|
|
1335
|
-
zh: zh$
|
|
1342
|
+
const dictionaries$17 = {
|
|
1343
|
+
zh: zh$17,
|
|
1336
1344
|
en: {
|
|
1337
1345
|
...accountPoolEn,
|
|
1338
1346
|
title: "ChatGPT",
|
|
@@ -1548,6 +1556,7 @@ window.__ModuleLoader__.load({
|
|
|
1548
1556
|
"cardName.workbuddy": "WorkBuddy",
|
|
1549
1557
|
"cardName.antigravity-acp": "Antigravity (ACP)",
|
|
1550
1558
|
"cardName.qianwen-token-plan": "Qwen Token Plan",
|
|
1559
|
+
"cardName.relayone": "RelayOne",
|
|
1551
1560
|
modelChecklistCount: "{count}/{total} enabled",
|
|
1552
1561
|
codeRunTitle: "Code",
|
|
1553
1562
|
codeRunOutput: "Output",
|
|
@@ -1673,7 +1682,7 @@ window.__ModuleLoader__.load({
|
|
|
1673
1682
|
* reads).
|
|
1674
1683
|
*/
|
|
1675
1684
|
function LineProxySection({ line, fetchSnapshot, onSave, idPrefix, snapshot: provided }) {
|
|
1676
|
-
const labels = useLineDict(NS, zh$
|
|
1685
|
+
const labels = useLineDict(NS, zh$17);
|
|
1677
1686
|
const readSnapshotFromRoute = (0, react.useCallback)(() => (fetchSnapshot ?? (() => fetchLineProxySnapshot("/api/dsh-chatgpt-subscription")))(), [fetchSnapshot]);
|
|
1678
1687
|
const writePreferences = (0, react.useCallback)((patch) => (onSave ?? ((next) => savePreferences("/api/dsh-chatgpt-subscription", next)))(patch), [onSave]);
|
|
1679
1688
|
const [readSnapshot, setReadSnapshot] = (0, react.useState)(null);
|
|
@@ -2546,7 +2555,7 @@ window.__ModuleLoader__.load({
|
|
|
2546
2555
|
load(true);
|
|
2547
2556
|
});
|
|
2548
2557
|
} catch (cause) {
|
|
2549
|
-
if (!quiet) setError(messageOf$
|
|
2558
|
+
if (!quiet) setError(messageOf$6(cause));
|
|
2550
2559
|
}
|
|
2551
2560
|
}, []);
|
|
2552
2561
|
(0, react.useEffect)(() => {
|
|
@@ -2626,7 +2635,7 @@ window.__ModuleLoader__.load({
|
|
|
2626
2635
|
} catch (cause) {
|
|
2627
2636
|
popup?.close();
|
|
2628
2637
|
setBusy(null);
|
|
2629
|
-
setError(messageOf$
|
|
2638
|
+
setError(messageOf$6(cause));
|
|
2630
2639
|
}
|
|
2631
2640
|
};
|
|
2632
2641
|
/**
|
|
@@ -2651,8 +2660,8 @@ window.__ModuleLoader__.load({
|
|
|
2651
2660
|
setBusy(null);
|
|
2652
2661
|
await load(true);
|
|
2653
2662
|
} catch (cause) {
|
|
2654
|
-
if (deviceLogin === null) setError(messageOf$
|
|
2655
|
-
else setDeviceError(messageOf$
|
|
2663
|
+
if (deviceLogin === null) setError(messageOf$6(cause));
|
|
2664
|
+
else setDeviceError(messageOf$6(cause));
|
|
2656
2665
|
setBusy(null);
|
|
2657
2666
|
}
|
|
2658
2667
|
};
|
|
@@ -2708,7 +2717,7 @@ window.__ModuleLoader__.load({
|
|
|
2708
2717
|
setDeviceError(null);
|
|
2709
2718
|
await load();
|
|
2710
2719
|
} catch (cause) {
|
|
2711
|
-
setError(messageOf$
|
|
2720
|
+
setError(messageOf$6(cause));
|
|
2712
2721
|
} finally {
|
|
2713
2722
|
setBusy(null);
|
|
2714
2723
|
}
|
|
@@ -2928,7 +2937,7 @@ window.__ModuleLoader__.load({
|
|
|
2928
2937
|
const next = await apiRef.current.accountAction("relogin", { accountId });
|
|
2929
2938
|
setStatus(next);
|
|
2930
2939
|
} catch (cause) {
|
|
2931
|
-
setError(messageOf$
|
|
2940
|
+
setError(messageOf$6(cause));
|
|
2932
2941
|
return;
|
|
2933
2942
|
}
|
|
2934
2943
|
await startLogin();
|
|
@@ -2941,7 +2950,7 @@ window.__ModuleLoader__.load({
|
|
|
2941
2950
|
try {
|
|
2942
2951
|
await task();
|
|
2943
2952
|
} catch (cause) {
|
|
2944
|
-
setError(messageOf$
|
|
2953
|
+
setError(messageOf$6(cause));
|
|
2945
2954
|
} finally {
|
|
2946
2955
|
setBusy(null);
|
|
2947
2956
|
}
|
|
@@ -3769,7 +3778,7 @@ window.__ModuleLoader__.load({
|
|
|
3769
3778
|
return absolute;
|
|
3770
3779
|
}
|
|
3771
3780
|
}
|
|
3772
|
-
function messageOf$
|
|
3781
|
+
function messageOf$6(error) {
|
|
3773
3782
|
return error instanceof Error ? error.message : String(error);
|
|
3774
3783
|
}
|
|
3775
3784
|
//#endregion
|
|
@@ -3929,7 +3938,7 @@ window.__ModuleLoader__.load({
|
|
|
3929
3938
|
//#endregion
|
|
3930
3939
|
//#region src/client/command-code/locales.ts
|
|
3931
3940
|
const NS_COMMAND_CODE = "dsh-command-code";
|
|
3932
|
-
const zh$
|
|
3941
|
+
const zh$16 = {
|
|
3933
3942
|
...accountPoolZh,
|
|
3934
3943
|
title: "Command Code",
|
|
3935
3944
|
pageDesc: "登录 Command Code,管理可用模型、上下文窗口与额度。",
|
|
@@ -3997,7 +4006,7 @@ window.__ModuleLoader__.load({
|
|
|
3997
4006
|
loginFailed: "登录失败",
|
|
3998
4007
|
tokens: "tokens"
|
|
3999
4008
|
};
|
|
4000
|
-
const en$
|
|
4009
|
+
const en$16 = {
|
|
4001
4010
|
...accountPoolEn,
|
|
4002
4011
|
title: "Command Code",
|
|
4003
4012
|
pageDesc: "Sign in to Command Code and manage models, context windows, and quota.",
|
|
@@ -4065,11 +4074,11 @@ window.__ModuleLoader__.load({
|
|
|
4065
4074
|
loginFailed: "Sign-in failed",
|
|
4066
4075
|
tokens: "tokens"
|
|
4067
4076
|
};
|
|
4068
|
-
const dictionaries$
|
|
4069
|
-
zh: zh$
|
|
4070
|
-
"zh-CN": zh$
|
|
4071
|
-
en: en$
|
|
4072
|
-
"en-US": en$
|
|
4077
|
+
const dictionaries$16 = {
|
|
4078
|
+
zh: zh$16,
|
|
4079
|
+
"zh-CN": zh$16,
|
|
4080
|
+
en: en$16,
|
|
4081
|
+
"en-US": en$16
|
|
4073
4082
|
};
|
|
4074
4083
|
//#endregion
|
|
4075
4084
|
//#region src/client/command-code/CommandCodeSection.tsx
|
|
@@ -4086,7 +4095,7 @@ window.__ModuleLoader__.load({
|
|
|
4086
4095
|
xhigh: "X-High",
|
|
4087
4096
|
max: "Max"
|
|
4088
4097
|
};
|
|
4089
|
-
const api$
|
|
4098
|
+
const api$16 = createLineApi("/command-code/api", "Command Code");
|
|
4090
4099
|
/**
|
|
4091
4100
|
* Route name shown next to a model.
|
|
4092
4101
|
*
|
|
@@ -4110,7 +4119,7 @@ window.__ModuleLoader__.load({
|
|
|
4110
4119
|
const [apiKey, setApiKey] = (0, react.useState)("");
|
|
4111
4120
|
/** Follow-up poll owed while the host refreshes the quota behind an answer. */
|
|
4112
4121
|
const quotaFollowUp = (0, react.useRef)(null);
|
|
4113
|
-
const t = useLineDict(NS_COMMAND_CODE, zh$
|
|
4122
|
+
const t = useLineDict(NS_COMMAND_CODE, zh$16);
|
|
4114
4123
|
const notifyChange = (0, react.useCallback)(() => {
|
|
4115
4124
|
onModelChange?.();
|
|
4116
4125
|
loadModelDirectory?.();
|
|
@@ -4118,7 +4127,7 @@ window.__ModuleLoader__.load({
|
|
|
4118
4127
|
const loadStatus = (0, react.useCallback)(async (quiet = false) => {
|
|
4119
4128
|
if (!quiet) setError(null);
|
|
4120
4129
|
try {
|
|
4121
|
-
const data = await api$
|
|
4130
|
+
const data = await api$16.request("/status");
|
|
4122
4131
|
setStatus(data);
|
|
4123
4132
|
setContextDrafts(contextDraftsFor(data));
|
|
4124
4133
|
quotaFollowUp.current ??= createQuotaFollowUp();
|
|
@@ -4149,12 +4158,12 @@ window.__ModuleLoader__.load({
|
|
|
4149
4158
|
setBusy("login");
|
|
4150
4159
|
setError(null);
|
|
4151
4160
|
setLoginProgress(null);
|
|
4152
|
-
const flow = await api$
|
|
4161
|
+
const flow = await api$16.request("/login", { method: "POST" });
|
|
4153
4162
|
if (flow.authUrl) window.open(flow.authUrl, "_blank");
|
|
4154
4163
|
const pollTimer = window.setInterval(() => {
|
|
4155
4164
|
(async () => {
|
|
4156
4165
|
try {
|
|
4157
|
-
const poll = await api$
|
|
4166
|
+
const poll = await api$16.request("/login/status");
|
|
4158
4167
|
if (poll.progress) setLoginProgress(poll.progress);
|
|
4159
4168
|
if (poll.status === "complete") {
|
|
4160
4169
|
window.clearInterval(pollTimer);
|
|
@@ -4186,7 +4195,7 @@ window.__ModuleLoader__.load({
|
|
|
4186
4195
|
try {
|
|
4187
4196
|
setBusy("apikey");
|
|
4188
4197
|
setError(null);
|
|
4189
|
-
const updated = await api$
|
|
4198
|
+
const updated = await api$16.request("/login/apikey", {
|
|
4190
4199
|
method: "POST",
|
|
4191
4200
|
body: JSON.stringify({ apiKey })
|
|
4192
4201
|
});
|
|
@@ -4204,7 +4213,7 @@ window.__ModuleLoader__.load({
|
|
|
4204
4213
|
try {
|
|
4205
4214
|
setBusy(`${action}-${accountId}`);
|
|
4206
4215
|
setError(null);
|
|
4207
|
-
const updated = await api$
|
|
4216
|
+
const updated = await api$16.request("/accounts", {
|
|
4208
4217
|
method: "POST",
|
|
4209
4218
|
body: JSON.stringify({
|
|
4210
4219
|
action,
|
|
@@ -4223,7 +4232,7 @@ window.__ModuleLoader__.load({
|
|
|
4223
4232
|
try {
|
|
4224
4233
|
setBusy("strategy");
|
|
4225
4234
|
setError(null);
|
|
4226
|
-
const updated = await api$
|
|
4235
|
+
const updated = await api$16.request("/accounts", {
|
|
4227
4236
|
method: "POST",
|
|
4228
4237
|
body: JSON.stringify({
|
|
4229
4238
|
action: "strategy",
|
|
@@ -4246,7 +4255,7 @@ window.__ModuleLoader__.load({
|
|
|
4246
4255
|
const handleRelogin = (accountId) => {
|
|
4247
4256
|
(async () => {
|
|
4248
4257
|
try {
|
|
4249
|
-
const updated = await api$
|
|
4258
|
+
const updated = await api$16.request("/accounts", {
|
|
4250
4259
|
method: "POST",
|
|
4251
4260
|
body: JSON.stringify({
|
|
4252
4261
|
action: "relogin",
|
|
@@ -4265,7 +4274,7 @@ window.__ModuleLoader__.load({
|
|
|
4265
4274
|
try {
|
|
4266
4275
|
setBusy("quota");
|
|
4267
4276
|
setError(null);
|
|
4268
|
-
const updated = await api$
|
|
4277
|
+
const updated = await api$16.request("/quota", { method: "POST" });
|
|
4269
4278
|
setStatus(updated);
|
|
4270
4279
|
} catch (err) {
|
|
4271
4280
|
setError(err instanceof Error ? err.message : String(err));
|
|
@@ -4277,7 +4286,7 @@ window.__ModuleLoader__.load({
|
|
|
4277
4286
|
try {
|
|
4278
4287
|
setBusy("catalog");
|
|
4279
4288
|
setError(null);
|
|
4280
|
-
const updated = await api$
|
|
4289
|
+
const updated = await api$16.request("/catalog/refresh", { method: "POST" });
|
|
4281
4290
|
setStatus(updated);
|
|
4282
4291
|
setContextDrafts(contextDraftsFor(updated));
|
|
4283
4292
|
notifyChange();
|
|
@@ -4291,7 +4300,7 @@ window.__ModuleLoader__.load({
|
|
|
4291
4300
|
try {
|
|
4292
4301
|
setBusy("connection");
|
|
4293
4302
|
setError(null);
|
|
4294
|
-
await api$
|
|
4303
|
+
await api$16.post("/connection/test");
|
|
4295
4304
|
await loadStatus(true);
|
|
4296
4305
|
} catch (err) {
|
|
4297
4306
|
setError(err instanceof Error ? err.message : String(err));
|
|
@@ -4301,7 +4310,7 @@ window.__ModuleLoader__.load({
|
|
|
4301
4310
|
};
|
|
4302
4311
|
const applyEnabled = async (enabledModelIds) => {
|
|
4303
4312
|
try {
|
|
4304
|
-
const updated = await api$
|
|
4313
|
+
const updated = await api$16.request("/models", {
|
|
4305
4314
|
method: "POST",
|
|
4306
4315
|
body: JSON.stringify({ enabledModelIds })
|
|
4307
4316
|
});
|
|
@@ -4324,7 +4333,7 @@ window.__ModuleLoader__.load({
|
|
|
4324
4333
|
};
|
|
4325
4334
|
const handleUpdateEffort = async (effort) => {
|
|
4326
4335
|
try {
|
|
4327
|
-
const updated = await api$
|
|
4336
|
+
const updated = await api$16.request("/settings", {
|
|
4328
4337
|
method: "POST",
|
|
4329
4338
|
body: JSON.stringify({ defaultReasoningEffort: effort })
|
|
4330
4339
|
});
|
|
@@ -4344,7 +4353,7 @@ window.__ModuleLoader__.load({
|
|
|
4344
4353
|
try {
|
|
4345
4354
|
setSavingModel(modelId);
|
|
4346
4355
|
setError(null);
|
|
4347
|
-
const updated = await api$
|
|
4356
|
+
const updated = await api$16.request("/settings", {
|
|
4348
4357
|
method: "POST",
|
|
4349
4358
|
body: JSON.stringify({ contextWindowOverrides: { [modelId]: parsed } })
|
|
4350
4359
|
});
|
|
@@ -4365,7 +4374,7 @@ window.__ModuleLoader__.load({
|
|
|
4365
4374
|
try {
|
|
4366
4375
|
setSavingModel(modelId);
|
|
4367
4376
|
setError(null);
|
|
4368
|
-
const updated = await api$
|
|
4377
|
+
const updated = await api$16.request("/settings", {
|
|
4369
4378
|
method: "POST",
|
|
4370
4379
|
body: JSON.stringify({ contextWindowOverrides: { [modelId]: null } })
|
|
4371
4380
|
});
|
|
@@ -4392,7 +4401,7 @@ window.__ModuleLoader__.load({
|
|
|
4392
4401
|
try {
|
|
4393
4402
|
setBusy("context");
|
|
4394
4403
|
setError(null);
|
|
4395
|
-
const updated = await api$
|
|
4404
|
+
const updated = await api$16.request("/settings", {
|
|
4396
4405
|
method: "POST",
|
|
4397
4406
|
body: JSON.stringify({ contextWindowOverrides: Object.fromEntries(models.map((model) => [model, null])) })
|
|
4398
4407
|
});
|
|
@@ -4872,7 +4881,7 @@ window.__ModuleLoader__.load({
|
|
|
4872
4881
|
//#endregion
|
|
4873
4882
|
//#region src/client/kimi-code/locales.ts
|
|
4874
4883
|
const NS_KIMI_CODE = "dsh-kimi-code";
|
|
4875
|
-
const zh$
|
|
4884
|
+
const zh$15 = {
|
|
4876
4885
|
...accountPoolZh,
|
|
4877
4886
|
title: "Kimi Code",
|
|
4878
4887
|
pageDesc: "登录 Kimi Code 订阅,管理模型、思考档位、上下文窗口与额度。",
|
|
@@ -5059,7 +5068,7 @@ window.__ModuleLoader__.load({
|
|
|
5059
5068
|
compactionRouteNoImage: "该模型不接受图片:摘要里的截图会被替换为占位文本。",
|
|
5060
5069
|
compactionRouteEmpty: "没有可用的线路——先登录任意一条线路再回来设置。"
|
|
5061
5070
|
};
|
|
5062
|
-
const en$
|
|
5071
|
+
const en$15 = {
|
|
5063
5072
|
...accountPoolEn,
|
|
5064
5073
|
title: "Kimi Code",
|
|
5065
5074
|
pageDesc: "Sign in to the Kimi Code subscription and manage models, thinking level, context windows, and quota.",
|
|
@@ -5246,11 +5255,11 @@ window.__ModuleLoader__.load({
|
|
|
5246
5255
|
compactionRouteNoImage: "This model takes no images: screenshots become placeholder text in the summary.",
|
|
5247
5256
|
compactionRouteEmpty: "No route is available — sign in to one first."
|
|
5248
5257
|
};
|
|
5249
|
-
const dictionaries$
|
|
5250
|
-
zh: zh$
|
|
5251
|
-
"zh-CN": zh$
|
|
5252
|
-
en: en$
|
|
5253
|
-
"en-US": en$
|
|
5258
|
+
const dictionaries$15 = {
|
|
5259
|
+
zh: zh$15,
|
|
5260
|
+
"zh-CN": zh$15,
|
|
5261
|
+
en: en$15,
|
|
5262
|
+
"en-US": en$15
|
|
5254
5263
|
};
|
|
5255
5264
|
//#endregion
|
|
5256
5265
|
//#region src/shared/kimi-code-contracts.ts
|
|
@@ -5362,7 +5371,7 @@ window.__ModuleLoader__.load({
|
|
|
5362
5371
|
return `${value}x`;
|
|
5363
5372
|
}
|
|
5364
5373
|
function KimiModelCapabilities({ models }) {
|
|
5365
|
-
const t = useLineDict(NS_KIMI_CODE, zh$
|
|
5374
|
+
const t = useLineDict(NS_KIMI_CODE, zh$15);
|
|
5366
5375
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
5367
5376
|
className: "dsha-cap-table",
|
|
5368
5377
|
children: [
|
|
@@ -5764,7 +5773,7 @@ window.__ModuleLoader__.load({
|
|
|
5764
5773
|
}
|
|
5765
5774
|
//#endregion
|
|
5766
5775
|
//#region src/client/kimi-code/KimiCodeSection.tsx
|
|
5767
|
-
const api$
|
|
5776
|
+
const api$15 = createLineApi("/kimi-code/api", "Kimi Code");
|
|
5768
5777
|
/**
|
|
5769
5778
|
* One token count as the card prints it.
|
|
5770
5779
|
*
|
|
@@ -5891,7 +5900,7 @@ window.__ModuleLoader__.load({
|
|
|
5891
5900
|
statusGeneration.current += 1;
|
|
5892
5901
|
setStatus(next);
|
|
5893
5902
|
}, []);
|
|
5894
|
-
const t = useLineDict(NS_KIMI_CODE, zh$
|
|
5903
|
+
const t = useLineDict(NS_KIMI_CODE, zh$15);
|
|
5895
5904
|
const notifyChange = (0, react.useCallback)(() => {
|
|
5896
5905
|
onModelChange?.();
|
|
5897
5906
|
loadModelDirectory?.();
|
|
@@ -5900,7 +5909,7 @@ window.__ModuleLoader__.load({
|
|
|
5900
5909
|
const generation = ++statusGeneration.current;
|
|
5901
5910
|
if (!quiet) setError(null);
|
|
5902
5911
|
try {
|
|
5903
|
-
const data = await api$
|
|
5912
|
+
const data = await api$15.request("/status");
|
|
5904
5913
|
if (generation !== statusGeneration.current) return;
|
|
5905
5914
|
setStatus(data);
|
|
5906
5915
|
setContextDrafts(contextDraftsFor(data));
|
|
@@ -5942,7 +5951,7 @@ window.__ModuleLoader__.load({
|
|
|
5942
5951
|
const timer = window.setInterval(() => {
|
|
5943
5952
|
(async () => {
|
|
5944
5953
|
try {
|
|
5945
|
-
const poll = await api$
|
|
5954
|
+
const poll = await api$15.request("/login/status");
|
|
5946
5955
|
setFlow(poll);
|
|
5947
5956
|
if (poll.status === "complete") {
|
|
5948
5957
|
await loadStatus();
|
|
@@ -5964,7 +5973,7 @@ window.__ModuleLoader__.load({
|
|
|
5964
5973
|
setBusy("login");
|
|
5965
5974
|
setError(null);
|
|
5966
5975
|
setCopied(false);
|
|
5967
|
-
const next = await api$
|
|
5976
|
+
const next = await api$15.request("/login", {
|
|
5968
5977
|
method: "POST",
|
|
5969
5978
|
body: JSON.stringify(accountId === void 0 ? {} : { accountId })
|
|
5970
5979
|
});
|
|
@@ -5977,7 +5986,7 @@ window.__ModuleLoader__.load({
|
|
|
5977
5986
|
};
|
|
5978
5987
|
const handleCancelLogin = async () => {
|
|
5979
5988
|
try {
|
|
5980
|
-
await api$
|
|
5989
|
+
await api$15.request("/login/cancel", { method: "POST" });
|
|
5981
5990
|
setFlow({ status: "idle" });
|
|
5982
5991
|
} catch (err) {
|
|
5983
5992
|
setError(err instanceof Error ? err.message : String(err));
|
|
@@ -5997,7 +6006,7 @@ window.__ModuleLoader__.load({
|
|
|
5997
6006
|
try {
|
|
5998
6007
|
setBusy(`${action}-${accountId}`);
|
|
5999
6008
|
setError(null);
|
|
6000
|
-
const updated = await api$
|
|
6009
|
+
const updated = await api$15.request("/accounts", {
|
|
6001
6010
|
method: "POST",
|
|
6002
6011
|
body: JSON.stringify({
|
|
6003
6012
|
action,
|
|
@@ -6017,7 +6026,7 @@ window.__ModuleLoader__.load({
|
|
|
6017
6026
|
try {
|
|
6018
6027
|
setBusy("strategy");
|
|
6019
6028
|
setError(null);
|
|
6020
|
-
const updated = await api$
|
|
6029
|
+
const updated = await api$15.request("/accounts", {
|
|
6021
6030
|
method: "POST",
|
|
6022
6031
|
body: JSON.stringify({
|
|
6023
6032
|
action: "strategy",
|
|
@@ -6040,7 +6049,7 @@ window.__ModuleLoader__.load({
|
|
|
6040
6049
|
const handleRelogin = (accountId) => {
|
|
6041
6050
|
(async () => {
|
|
6042
6051
|
try {
|
|
6043
|
-
const updated = await api$
|
|
6052
|
+
const updated = await api$15.request("/accounts", {
|
|
6044
6053
|
method: "POST",
|
|
6045
6054
|
body: JSON.stringify({
|
|
6046
6055
|
action: "relogin",
|
|
@@ -6059,7 +6068,7 @@ window.__ModuleLoader__.load({
|
|
|
6059
6068
|
try {
|
|
6060
6069
|
setBusy("quota");
|
|
6061
6070
|
setError(null);
|
|
6062
|
-
const updated = await api$
|
|
6071
|
+
const updated = await api$15.request("/quota", { method: "POST" });
|
|
6063
6072
|
applyStatus(updated);
|
|
6064
6073
|
} catch (err) {
|
|
6065
6074
|
setError(err instanceof Error ? err.message : String(err));
|
|
@@ -6072,7 +6081,7 @@ window.__ModuleLoader__.load({
|
|
|
6072
6081
|
try {
|
|
6073
6082
|
setBusy("catalog");
|
|
6074
6083
|
setError(null);
|
|
6075
|
-
const updated = await api$
|
|
6084
|
+
const updated = await api$15.request("/catalog/refresh", { method: "POST" });
|
|
6076
6085
|
applyStatus(updated);
|
|
6077
6086
|
setContextDrafts(contextDraftsFor(updated));
|
|
6078
6087
|
notifyChange();
|
|
@@ -6087,7 +6096,7 @@ window.__ModuleLoader__.load({
|
|
|
6087
6096
|
setBusy("connection");
|
|
6088
6097
|
setError(null);
|
|
6089
6098
|
setConnectionNotice(null);
|
|
6090
|
-
const result = await api$
|
|
6099
|
+
const result = await api$15.request("/connection/test", { method: "POST" });
|
|
6091
6100
|
setConnectionNotice(result.connected ? `${t.testSuccess} · ${result.latencyMs} ms` : t.testFailed);
|
|
6092
6101
|
await loadStatus(true);
|
|
6093
6102
|
} catch (err) {
|
|
@@ -6098,7 +6107,7 @@ window.__ModuleLoader__.load({
|
|
|
6098
6107
|
};
|
|
6099
6108
|
const applyEnabled = async (enabledModelIds) => {
|
|
6100
6109
|
try {
|
|
6101
|
-
const updated = await api$
|
|
6110
|
+
const updated = await api$15.request("/models", {
|
|
6102
6111
|
method: "POST",
|
|
6103
6112
|
body: JSON.stringify({ enabledModelIds })
|
|
6104
6113
|
});
|
|
@@ -6121,7 +6130,7 @@ window.__ModuleLoader__.load({
|
|
|
6121
6130
|
};
|
|
6122
6131
|
const handleUpdateEffort = async (effort) => {
|
|
6123
6132
|
try {
|
|
6124
|
-
const updated = await api$
|
|
6133
|
+
const updated = await api$15.request("/settings", {
|
|
6125
6134
|
method: "POST",
|
|
6126
6135
|
body: JSON.stringify({ defaultReasoningEffort: effort })
|
|
6127
6136
|
});
|
|
@@ -6141,7 +6150,7 @@ window.__ModuleLoader__.load({
|
|
|
6141
6150
|
try {
|
|
6142
6151
|
setSavingModel(modelId);
|
|
6143
6152
|
setError(null);
|
|
6144
|
-
const updated = await api$
|
|
6153
|
+
const updated = await api$15.request("/settings", {
|
|
6145
6154
|
method: "POST",
|
|
6146
6155
|
body: JSON.stringify({ contextWindowOverrides: { [modelId]: parsed } })
|
|
6147
6156
|
});
|
|
@@ -6162,7 +6171,7 @@ window.__ModuleLoader__.load({
|
|
|
6162
6171
|
try {
|
|
6163
6172
|
setSavingModel(modelId);
|
|
6164
6173
|
setError(null);
|
|
6165
|
-
const updated = await api$
|
|
6174
|
+
const updated = await api$15.request("/settings", {
|
|
6166
6175
|
method: "POST",
|
|
6167
6176
|
body: JSON.stringify({ contextWindowOverrides: { [modelId]: null } })
|
|
6168
6177
|
});
|
|
@@ -6189,7 +6198,7 @@ window.__ModuleLoader__.load({
|
|
|
6189
6198
|
try {
|
|
6190
6199
|
setBusy("context");
|
|
6191
6200
|
setError(null);
|
|
6192
|
-
const updated = await api$
|
|
6201
|
+
const updated = await api$15.request("/settings", {
|
|
6193
6202
|
method: "POST",
|
|
6194
6203
|
body: JSON.stringify({ contextWindowOverrides: Object.fromEntries(models.map((model) => [model, null])) })
|
|
6195
6204
|
});
|
|
@@ -6670,11 +6679,11 @@ window.__ModuleLoader__.load({
|
|
|
6670
6679
|
* The names stay as they were so the hook that consumes them does not have to
|
|
6671
6680
|
* change with the reader.
|
|
6672
6681
|
*/
|
|
6673
|
-
const api$
|
|
6674
|
-
api$
|
|
6675
|
-
const get$
|
|
6676
|
-
const post$
|
|
6677
|
-
function messageOf$
|
|
6682
|
+
const api$14 = createLineApi(MINIMAX_CODE_ROUTE_PREFIX, "MiniMax Code");
|
|
6683
|
+
api$14.request;
|
|
6684
|
+
const get$5 = api$14.get;
|
|
6685
|
+
const post$7 = api$14.post;
|
|
6686
|
+
function messageOf$5(cause) {
|
|
6678
6687
|
return cause instanceof Error ? cause.message : String(cause);
|
|
6679
6688
|
}
|
|
6680
6689
|
/**
|
|
@@ -6684,7 +6693,7 @@ window.__ModuleLoader__.load({
|
|
|
6684
6693
|
* produces the reader's "restart DSH" sentence rather than a bare parse crash.
|
|
6685
6694
|
*/
|
|
6686
6695
|
function fetchResetCards() {
|
|
6687
|
-
return get$
|
|
6696
|
+
return get$5("/reset-cards");
|
|
6688
6697
|
}
|
|
6689
6698
|
/**
|
|
6690
6699
|
* Spend one card.
|
|
@@ -6695,12 +6704,12 @@ window.__ModuleLoader__.load({
|
|
|
6695
6704
|
* looks the card up and sends the key it found.
|
|
6696
6705
|
*/
|
|
6697
6706
|
function useResetCard(cardId) {
|
|
6698
|
-
return post$
|
|
6707
|
+
return post$7("/reset-cards/use", { cardId });
|
|
6699
6708
|
}
|
|
6700
6709
|
//#endregion
|
|
6701
6710
|
//#region src/client/minimax-code/locales.ts
|
|
6702
6711
|
const NS_MINIMAX_CODE = "dsh-minimax-code";
|
|
6703
|
-
const zh$
|
|
6712
|
+
const zh$14 = {
|
|
6704
6713
|
...accountPoolZh,
|
|
6705
6714
|
title: "MiniMax Code",
|
|
6706
6715
|
pageDesc: "登录 MiniMax Code 编程订阅(设备码 OAuth),复用本机 MiniMax Code 的登录态,管理账号、连接与模型。",
|
|
@@ -6898,7 +6907,7 @@ window.__ModuleLoader__.load({
|
|
|
6898
6907
|
videoHistoryEncrypted: "已由系统凭据后端加密",
|
|
6899
6908
|
videoHistoryPlain: "本机没有可用的凭据后端,记录为明文"
|
|
6900
6909
|
};
|
|
6901
|
-
const en$
|
|
6910
|
+
const en$14 = {
|
|
6902
6911
|
...accountPoolEn,
|
|
6903
6912
|
title: "MiniMax Code",
|
|
6904
6913
|
pageDesc: "Sign in to the MiniMax Code coding subscription (device-code OAuth) and reuse the local MiniMax Code sign-in to manage the account, connection, and models.",
|
|
@@ -7096,11 +7105,11 @@ window.__ModuleLoader__.load({
|
|
|
7096
7105
|
videoHistoryEncrypted: "Encrypted by the platform credential backend",
|
|
7097
7106
|
videoHistoryPlain: "No credential backend on this host; stored as plain text"
|
|
7098
7107
|
};
|
|
7099
|
-
const dictionaries$
|
|
7100
|
-
zh: zh$
|
|
7101
|
-
"zh-CN": zh$
|
|
7102
|
-
en: en$
|
|
7103
|
-
"en-US": en$
|
|
7108
|
+
const dictionaries$14 = {
|
|
7109
|
+
zh: zh$14,
|
|
7110
|
+
"zh-CN": zh$14,
|
|
7111
|
+
en: en$14,
|
|
7112
|
+
"en-US": en$14
|
|
7104
7113
|
};
|
|
7105
7114
|
//#endregion
|
|
7106
7115
|
//#region src/client/minimax-code/useMinimaxCodeSection.ts
|
|
@@ -7114,7 +7123,7 @@ window.__ModuleLoader__.load({
|
|
|
7114
7123
|
* rather than inferred from the JSX.
|
|
7115
7124
|
*/
|
|
7116
7125
|
/** The card's own dictionary; stable identity keeps effect dependencies intact. */
|
|
7117
|
-
const fallbackTranslate$7 = (key) => zh$
|
|
7126
|
+
const fallbackTranslate$7 = (key) => zh$14[key];
|
|
7118
7127
|
/**
|
|
7119
7128
|
* The shared pool card's labels, resolved through this card's dictionary.
|
|
7120
7129
|
*
|
|
@@ -7227,7 +7236,7 @@ window.__ModuleLoader__.load({
|
|
|
7227
7236
|
const loadStatus = (0, react.useCallback)(async (quiet = false) => {
|
|
7228
7237
|
if (!quiet) setError(null);
|
|
7229
7238
|
try {
|
|
7230
|
-
const next = await get$
|
|
7239
|
+
const next = await get$5("/status");
|
|
7231
7240
|
setStatus(next);
|
|
7232
7241
|
setContextDrafts(contextDraftsFor(next));
|
|
7233
7242
|
quotaFollowUp.current ??= createQuotaFollowUp();
|
|
@@ -7235,7 +7244,7 @@ window.__ModuleLoader__.load({
|
|
|
7235
7244
|
loadStatus(true);
|
|
7236
7245
|
});
|
|
7237
7246
|
} catch (cause) {
|
|
7238
|
-
if (!quiet) setError(messageOf$
|
|
7247
|
+
if (!quiet) setError(messageOf$5(cause));
|
|
7239
7248
|
} finally {
|
|
7240
7249
|
setLoading(false);
|
|
7241
7250
|
}
|
|
@@ -7264,7 +7273,7 @@ window.__ModuleLoader__.load({
|
|
|
7264
7273
|
const timer = window.setInterval(() => {
|
|
7265
7274
|
(async () => {
|
|
7266
7275
|
try {
|
|
7267
|
-
const poll = await post$
|
|
7276
|
+
const poll = await post$7("/login/poll", { loginId });
|
|
7268
7277
|
if (stopped || poll.status === "pending") return;
|
|
7269
7278
|
stopped = true;
|
|
7270
7279
|
window.clearInterval(timer);
|
|
@@ -7305,7 +7314,7 @@ window.__ModuleLoader__.load({
|
|
|
7305
7314
|
quotaRequested.current = true;
|
|
7306
7315
|
(async () => {
|
|
7307
7316
|
try {
|
|
7308
|
-
setStatus(await post$
|
|
7317
|
+
setStatus(await post$7("/quota"));
|
|
7309
7318
|
} catch {}
|
|
7310
7319
|
})();
|
|
7311
7320
|
}, [authenticated, status?.quota]);
|
|
@@ -7362,7 +7371,7 @@ window.__ModuleLoader__.load({
|
|
|
7362
7371
|
await loadResetCards();
|
|
7363
7372
|
await refreshQuota();
|
|
7364
7373
|
} catch (cause) {
|
|
7365
|
-
setError(messageOf$
|
|
7374
|
+
setError(messageOf$5(cause));
|
|
7366
7375
|
} finally {
|
|
7367
7376
|
setBusy(null);
|
|
7368
7377
|
}
|
|
@@ -7373,7 +7382,7 @@ window.__ModuleLoader__.load({
|
|
|
7373
7382
|
setError(null);
|
|
7374
7383
|
setConnectionNotice(null);
|
|
7375
7384
|
setCopied(false);
|
|
7376
|
-
const started = await post$
|
|
7385
|
+
const started = await post$7("/login/start");
|
|
7377
7386
|
const next = started.login ?? (typeof started.loginId === "string" ? started : void 0);
|
|
7378
7387
|
if (next === void 0) {
|
|
7379
7388
|
setError(t("loginFailed"));
|
|
@@ -7381,7 +7390,7 @@ window.__ModuleLoader__.load({
|
|
|
7381
7390
|
}
|
|
7382
7391
|
setFlow(next);
|
|
7383
7392
|
} catch (cause) {
|
|
7384
|
-
setError(messageOf$
|
|
7393
|
+
setError(messageOf$5(cause));
|
|
7385
7394
|
} finally {
|
|
7386
7395
|
setBusy(null);
|
|
7387
7396
|
}
|
|
@@ -7391,9 +7400,9 @@ window.__ModuleLoader__.load({
|
|
|
7391
7400
|
setFlow(null);
|
|
7392
7401
|
if (pending === null) return;
|
|
7393
7402
|
try {
|
|
7394
|
-
await post$
|
|
7403
|
+
await post$7("/login/cancel", { loginId: pending.loginId });
|
|
7395
7404
|
} catch (cause) {
|
|
7396
|
-
setError(messageOf$
|
|
7405
|
+
setError(messageOf$5(cause));
|
|
7397
7406
|
}
|
|
7398
7407
|
};
|
|
7399
7408
|
const copyCode = async () => {
|
|
@@ -7411,12 +7420,12 @@ window.__ModuleLoader__.load({
|
|
|
7411
7420
|
setError(null);
|
|
7412
7421
|
setConnectionNotice(null);
|
|
7413
7422
|
setFlow(null);
|
|
7414
|
-
const result = await post$
|
|
7423
|
+
const result = await post$7("/logout");
|
|
7415
7424
|
if (result.native === true) setConnectionNotice(result.error ?? t("logoutOwnedByApp"));
|
|
7416
7425
|
await loadStatus(true);
|
|
7417
7426
|
onModelChange?.();
|
|
7418
7427
|
} catch (cause) {
|
|
7419
|
-
setError(messageOf$
|
|
7428
|
+
setError(messageOf$5(cause));
|
|
7420
7429
|
await loadStatus(true);
|
|
7421
7430
|
} finally {
|
|
7422
7431
|
setBusy(null);
|
|
@@ -7431,7 +7440,7 @@ window.__ModuleLoader__.load({
|
|
|
7431
7440
|
/** Re-read the pool slice, which lives beside the status on its own route. */
|
|
7432
7441
|
const loadPool = (0, react.useCallback)(async () => {
|
|
7433
7442
|
try {
|
|
7434
|
-
const next = await get$
|
|
7443
|
+
const next = await get$5("/accounts");
|
|
7435
7444
|
setPool(next);
|
|
7436
7445
|
} catch {
|
|
7437
7446
|
setPool(void 0);
|
|
@@ -7442,7 +7451,7 @@ window.__ModuleLoader__.load({
|
|
|
7442
7451
|
try {
|
|
7443
7452
|
setBusy(action);
|
|
7444
7453
|
setError(null);
|
|
7445
|
-
await post$
|
|
7454
|
+
await post$7("/accounts", {
|
|
7446
7455
|
action,
|
|
7447
7456
|
accountId
|
|
7448
7457
|
});
|
|
@@ -7450,7 +7459,7 @@ window.__ModuleLoader__.load({
|
|
|
7450
7459
|
await loadStatus(true);
|
|
7451
7460
|
onModelChange?.();
|
|
7452
7461
|
} catch (cause) {
|
|
7453
|
-
setError(messageOf$
|
|
7462
|
+
setError(messageOf$5(cause));
|
|
7454
7463
|
} finally {
|
|
7455
7464
|
setBusy(null);
|
|
7456
7465
|
}
|
|
@@ -7459,13 +7468,13 @@ window.__ModuleLoader__.load({
|
|
|
7459
7468
|
try {
|
|
7460
7469
|
setBusy("strategy");
|
|
7461
7470
|
setError(null);
|
|
7462
|
-
await post$
|
|
7471
|
+
await post$7("/accounts", {
|
|
7463
7472
|
action: "strategy",
|
|
7464
7473
|
strategy
|
|
7465
7474
|
});
|
|
7466
7475
|
await loadPool();
|
|
7467
7476
|
} catch (cause) {
|
|
7468
|
-
setError(messageOf$
|
|
7477
|
+
setError(messageOf$5(cause));
|
|
7469
7478
|
} finally {
|
|
7470
7479
|
setBusy(null);
|
|
7471
7480
|
}
|
|
@@ -7473,12 +7482,12 @@ window.__ModuleLoader__.load({
|
|
|
7473
7482
|
const applyEnabled = async (enabledModelIds) => {
|
|
7474
7483
|
try {
|
|
7475
7484
|
setError(null);
|
|
7476
|
-
const updated = await post$
|
|
7485
|
+
const updated = await post$7("/models", { enabledModelIds });
|
|
7477
7486
|
setStatus(updated);
|
|
7478
7487
|
setContextDrafts(contextDraftsFor(updated));
|
|
7479
7488
|
onModelChange?.();
|
|
7480
7489
|
} catch (cause) {
|
|
7481
|
-
setError(messageOf$
|
|
7490
|
+
setError(messageOf$5(cause));
|
|
7482
7491
|
}
|
|
7483
7492
|
};
|
|
7484
7493
|
/** Flip the check-in scheduler's own switch, through the same settings route. */
|
|
@@ -7486,10 +7495,10 @@ window.__ModuleLoader__.load({
|
|
|
7486
7495
|
try {
|
|
7487
7496
|
setBusy("checkin");
|
|
7488
7497
|
setError(null);
|
|
7489
|
-
const updated = await post$
|
|
7498
|
+
const updated = await post$7("/settings", { checkin: { enabled } });
|
|
7490
7499
|
setStatus(updated);
|
|
7491
7500
|
} catch (cause) {
|
|
7492
|
-
setError(messageOf$
|
|
7501
|
+
setError(messageOf$5(cause));
|
|
7493
7502
|
} finally {
|
|
7494
7503
|
setBusy(null);
|
|
7495
7504
|
}
|
|
@@ -7499,10 +7508,10 @@ window.__ModuleLoader__.load({
|
|
|
7499
7508
|
try {
|
|
7500
7509
|
setBusy("checkin");
|
|
7501
7510
|
setError(null);
|
|
7502
|
-
const updated = await post$
|
|
7511
|
+
const updated = await post$7("/checkin/now");
|
|
7503
7512
|
setStatus(updated);
|
|
7504
7513
|
} catch (cause) {
|
|
7505
|
-
setError(messageOf$
|
|
7514
|
+
setError(messageOf$5(cause));
|
|
7506
7515
|
} finally {
|
|
7507
7516
|
setBusy(null);
|
|
7508
7517
|
}
|
|
@@ -7520,11 +7529,11 @@ window.__ModuleLoader__.load({
|
|
|
7520
7529
|
const updateEffort = async (effort) => {
|
|
7521
7530
|
try {
|
|
7522
7531
|
setError(null);
|
|
7523
|
-
const updated = await post$
|
|
7532
|
+
const updated = await post$7("/settings", { defaultReasoningEffort: effort });
|
|
7524
7533
|
setStatus(updated);
|
|
7525
7534
|
onModelChange?.();
|
|
7526
7535
|
} catch (cause) {
|
|
7527
|
-
setError(messageOf$
|
|
7536
|
+
setError(messageOf$5(cause));
|
|
7528
7537
|
}
|
|
7529
7538
|
};
|
|
7530
7539
|
const saveContextWindow = async (modelId) => {
|
|
@@ -7537,7 +7546,7 @@ window.__ModuleLoader__.load({
|
|
|
7537
7546
|
try {
|
|
7538
7547
|
setSavingModel(modelId);
|
|
7539
7548
|
setError(null);
|
|
7540
|
-
const updated = await post$
|
|
7549
|
+
const updated = await post$7("/settings", { contextWindowOverrides: { [modelId]: parsed } });
|
|
7541
7550
|
setStatus(updated);
|
|
7542
7551
|
setContextDrafts((prev) => ({
|
|
7543
7552
|
...prev,
|
|
@@ -7545,7 +7554,7 @@ window.__ModuleLoader__.load({
|
|
|
7545
7554
|
}));
|
|
7546
7555
|
onModelChange?.();
|
|
7547
7556
|
} catch (cause) {
|
|
7548
|
-
setError(messageOf$
|
|
7557
|
+
setError(messageOf$5(cause));
|
|
7549
7558
|
} finally {
|
|
7550
7559
|
setSavingModel(null);
|
|
7551
7560
|
}
|
|
@@ -7554,7 +7563,7 @@ window.__ModuleLoader__.load({
|
|
|
7554
7563
|
try {
|
|
7555
7564
|
setSavingModel(modelId);
|
|
7556
7565
|
setError(null);
|
|
7557
|
-
const updated = await post$
|
|
7566
|
+
const updated = await post$7("/settings", { contextWindowOverrides: { [modelId]: null } });
|
|
7558
7567
|
setStatus(updated);
|
|
7559
7568
|
const model = updated.models.find((entry) => entry.id === modelId);
|
|
7560
7569
|
if (model !== void 0) setContextDrafts((prev) => ({
|
|
@@ -7563,7 +7572,7 @@ window.__ModuleLoader__.load({
|
|
|
7563
7572
|
}));
|
|
7564
7573
|
onModelChange?.();
|
|
7565
7574
|
} catch (cause) {
|
|
7566
|
-
setError(messageOf$
|
|
7575
|
+
setError(messageOf$5(cause));
|
|
7567
7576
|
} finally {
|
|
7568
7577
|
setSavingModel(null);
|
|
7569
7578
|
}
|
|
@@ -7573,12 +7582,12 @@ window.__ModuleLoader__.load({
|
|
|
7573
7582
|
if (ids.length === 0) return;
|
|
7574
7583
|
try {
|
|
7575
7584
|
setError(null);
|
|
7576
|
-
const updated = await post$
|
|
7585
|
+
const updated = await post$7("/settings", { contextWindowOverrides: Object.fromEntries(ids.map((id) => [id, null])) });
|
|
7577
7586
|
setStatus(updated);
|
|
7578
7587
|
setContextDrafts(contextDraftsFor(updated));
|
|
7579
7588
|
onModelChange?.();
|
|
7580
7589
|
} catch (cause) {
|
|
7581
|
-
setError(messageOf$
|
|
7590
|
+
setError(messageOf$5(cause));
|
|
7582
7591
|
}
|
|
7583
7592
|
};
|
|
7584
7593
|
/** Force one usage read through `/quota` and render the fresh status. */
|
|
@@ -7586,9 +7595,9 @@ window.__ModuleLoader__.load({
|
|
|
7586
7595
|
try {
|
|
7587
7596
|
setBusy("quota");
|
|
7588
7597
|
setError(null);
|
|
7589
|
-
setStatus(await post$
|
|
7598
|
+
setStatus(await post$7("/quota"));
|
|
7590
7599
|
} catch (cause) {
|
|
7591
|
-
setError(messageOf$
|
|
7600
|
+
setError(messageOf$5(cause));
|
|
7592
7601
|
} finally {
|
|
7593
7602
|
setBusy(null);
|
|
7594
7603
|
}
|
|
@@ -7598,14 +7607,14 @@ window.__ModuleLoader__.load({
|
|
|
7598
7607
|
setBusy("test");
|
|
7599
7608
|
setError(null);
|
|
7600
7609
|
setConnectionNotice(null);
|
|
7601
|
-
const result = await post$
|
|
7610
|
+
const result = await post$7("/test");
|
|
7602
7611
|
if (result.ok === true) {
|
|
7603
7612
|
setConnectionNotice(result.model === void 0 || result.model === "" ? t("testSuccess") : t("testSuccessModel").replace("{model}", result.model));
|
|
7604
7613
|
return;
|
|
7605
7614
|
}
|
|
7606
7615
|
setConnectionNotice(result.error === void 0 || result.error === "" ? t("testFailed") : `${t("testFailed")}:${result.error}`);
|
|
7607
7616
|
} catch (cause) {
|
|
7608
|
-
setConnectionNotice(`${t("testFailed")}:${messageOf$
|
|
7617
|
+
setConnectionNotice(`${t("testFailed")}:${messageOf$5(cause)}`);
|
|
7609
7618
|
} finally {
|
|
7610
7619
|
setBusy(null);
|
|
7611
7620
|
}
|
|
@@ -8340,13 +8349,13 @@ window.__ModuleLoader__.load({
|
|
|
8340
8349
|
}, []);
|
|
8341
8350
|
const load = (0, react.useCallback)(async () => {
|
|
8342
8351
|
try {
|
|
8343
|
-
const value = await get$
|
|
8352
|
+
const value = await get$5("/video-history");
|
|
8344
8353
|
if (!alive.current) return;
|
|
8345
8354
|
setData(parseVideoHistoryDto(value));
|
|
8346
8355
|
setFailure(null);
|
|
8347
8356
|
} catch (error) {
|
|
8348
8357
|
if (!alive.current) return;
|
|
8349
|
-
setFailure(messageOf$
|
|
8358
|
+
setFailure(messageOf$5(error));
|
|
8350
8359
|
} finally {
|
|
8351
8360
|
if (alive.current) setLoading(false);
|
|
8352
8361
|
}
|
|
@@ -9173,7 +9182,7 @@ window.__ModuleLoader__.load({
|
|
|
9173
9182
|
* 键名重合的会被渲染成 ChatGPT 的措辞,不重合的会把键名本身打印出来)。
|
|
9174
9183
|
*/
|
|
9175
9184
|
const NS_GLM_CODING_PLAN = "dsh-glm-coding-plan";
|
|
9176
|
-
const zh$
|
|
9185
|
+
const zh$13 = {
|
|
9177
9186
|
...accountPoolZh,
|
|
9178
9187
|
title: "GLM(ZCode 账号)",
|
|
9179
9188
|
pageDesc: "用 ZCode 账号授权接入 GLM Coding Plan(国区 bigmodel.cn / 国际区 z.ai),管理账号池、套餐额度与模型勾选。两个区域的凭据各自独立,池内可以同时存在两区账号。",
|
|
@@ -9267,7 +9276,7 @@ window.__ModuleLoader__.load({
|
|
|
9267
9276
|
quotaAllowanceUnknown: "未判定",
|
|
9268
9277
|
quotaAllowanceHint: "登录时探活认定的额度来源。「免费体验额度」指新用户注册后自动获得、首次使用起 5 天内每天 800 万 token 的体验额度。"
|
|
9269
9278
|
};
|
|
9270
|
-
const en$
|
|
9279
|
+
const en$13 = {
|
|
9271
9280
|
...accountPoolEn,
|
|
9272
9281
|
title: "GLM (ZCode account)",
|
|
9273
9282
|
pageDesc: "Sign in with a ZCode account to reach GLM Coding Plan (China bigmodel.cn / International z.ai), and manage the account pool, plan quota and model selection. The two regions hold independent credentials, so a pool can carry accounts from both.",
|
|
@@ -9361,11 +9370,11 @@ window.__ModuleLoader__.load({
|
|
|
9361
9370
|
quotaAllowanceUnknown: "Undetermined",
|
|
9362
9371
|
quotaAllowanceHint: "The allowance source established by the sign-in probe. “Free trial allowance” means 8M tokens per day for 5 days from first use, granted automatically to new accounts."
|
|
9363
9372
|
};
|
|
9364
|
-
const dictionaries$
|
|
9365
|
-
zh: zh$
|
|
9366
|
-
"zh-CN": zh$
|
|
9367
|
-
en: en$
|
|
9368
|
-
"en-US": en$
|
|
9373
|
+
const dictionaries$13 = {
|
|
9374
|
+
zh: zh$13,
|
|
9375
|
+
"zh-CN": zh$13,
|
|
9376
|
+
en: en$13,
|
|
9377
|
+
"en-US": en$13
|
|
9369
9378
|
};
|
|
9370
9379
|
/** 一个配额窗口的键到「窗口长度(分钟)」的映射。 */
|
|
9371
9380
|
const QUOTA_WINDOW_MINUTES$1 = {
|
|
@@ -9424,10 +9433,10 @@ window.__ModuleLoader__.load({
|
|
|
9424
9433
|
* 除 adopt 与 connection/test 外,全部走共享的 { ok, value } 信封,
|
|
9425
9434
|
* 因此答案都是裸 DTO——createLineApi 已经把信封拆掉了。
|
|
9426
9435
|
*/
|
|
9427
|
-
const api$
|
|
9428
|
-
const get$
|
|
9429
|
-
const post$
|
|
9430
|
-
function messageOf$
|
|
9436
|
+
const api$13 = createLineApi(GLM_CODING_PLAN_ROUTE_PREFIX, GLM_CODING_PLAN_PROVIDER_NAME);
|
|
9437
|
+
const get$4 = api$13.get;
|
|
9438
|
+
const post$6 = api$13.post;
|
|
9439
|
+
function messageOf$4(cause) {
|
|
9431
9440
|
return cause instanceof Error ? cause.message : String(cause);
|
|
9432
9441
|
}
|
|
9433
9442
|
//#endregion
|
|
@@ -9446,7 +9455,7 @@ window.__ModuleLoader__.load({
|
|
|
9446
9455
|
/** 登录状态机的轮询节奏。真实超时与间隔由 host 拥有,卡片只是跟随。 */
|
|
9447
9456
|
const LOGIN_POLL_INTERVAL_MS$2 = 2e3;
|
|
9448
9457
|
/** 本卡片的字典;身份稳定,依赖它的 effect 才不会每次渲染重建。 */
|
|
9449
|
-
const fallbackTranslate$6 = (key) => zh$
|
|
9458
|
+
const fallbackTranslate$6 = (key) => zh$13[key];
|
|
9450
9459
|
/**
|
|
9451
9460
|
* 共享账号池卡片需要的标签集,按本卡片的字典逐键查出来。
|
|
9452
9461
|
*
|
|
@@ -9527,7 +9536,7 @@ window.__ModuleLoader__.load({
|
|
|
9527
9536
|
const loadStatus = (0, react.useCallback)(async (quiet = false) => {
|
|
9528
9537
|
if (!quiet) setError(null);
|
|
9529
9538
|
try {
|
|
9530
|
-
const next = await get$
|
|
9539
|
+
const next = await get$4("/status");
|
|
9531
9540
|
setStatus(next);
|
|
9532
9541
|
setContextDrafts(contextDraftsFor(next));
|
|
9533
9542
|
if (!regionTouched.current) setRegionState(next.region);
|
|
@@ -9536,7 +9545,7 @@ window.__ModuleLoader__.load({
|
|
|
9536
9545
|
loadStatus(true);
|
|
9537
9546
|
});
|
|
9538
9547
|
} catch (cause) {
|
|
9539
|
-
if (!quiet) setError(messageOf$
|
|
9548
|
+
if (!quiet) setError(messageOf$4(cause));
|
|
9540
9549
|
} finally {
|
|
9541
9550
|
setLoading(false);
|
|
9542
9551
|
}
|
|
@@ -9561,7 +9570,7 @@ window.__ModuleLoader__.load({
|
|
|
9561
9570
|
const timer = window.setInterval(() => {
|
|
9562
9571
|
(async () => {
|
|
9563
9572
|
try {
|
|
9564
|
-
const poll = await get$
|
|
9573
|
+
const poll = await get$4("/login/status");
|
|
9565
9574
|
if (stopped) return;
|
|
9566
9575
|
if (poll.status === "complete") {
|
|
9567
9576
|
setPasteValue("");
|
|
@@ -9594,13 +9603,13 @@ window.__ModuleLoader__.load({
|
|
|
9594
9603
|
setError(null);
|
|
9595
9604
|
setConnection(null);
|
|
9596
9605
|
setPasteValue("");
|
|
9597
|
-
const flow = await post$
|
|
9606
|
+
const flow = await post$6("/login/start", { region: loginRegion });
|
|
9598
9607
|
await loadStatus(true);
|
|
9599
9608
|
if (flow.authorizeUrl !== void 0 && flow.authorizeUrl !== "") try {
|
|
9600
9609
|
window.open(flow.authorizeUrl, "_blank", "noopener,noreferrer");
|
|
9601
9610
|
} catch {}
|
|
9602
9611
|
} catch (cause) {
|
|
9603
|
-
setError(messageOf$
|
|
9612
|
+
setError(messageOf$4(cause));
|
|
9604
9613
|
} finally {
|
|
9605
9614
|
setBusy(null);
|
|
9606
9615
|
}
|
|
@@ -9609,10 +9618,10 @@ window.__ModuleLoader__.load({
|
|
|
9609
9618
|
try {
|
|
9610
9619
|
setBusy("login:cancel");
|
|
9611
9620
|
setError(null);
|
|
9612
|
-
await post$
|
|
9621
|
+
await post$6("/login/cancel", { region });
|
|
9613
9622
|
await loadStatus(true);
|
|
9614
9623
|
} catch (cause) {
|
|
9615
|
-
setError(messageOf$
|
|
9624
|
+
setError(messageOf$4(cause));
|
|
9616
9625
|
} finally {
|
|
9617
9626
|
setBusy(null);
|
|
9618
9627
|
}
|
|
@@ -9625,14 +9634,14 @@ window.__ModuleLoader__.load({
|
|
|
9625
9634
|
try {
|
|
9626
9635
|
setBusy("login-manual");
|
|
9627
9636
|
setError(null);
|
|
9628
|
-
setStatus(await post$
|
|
9637
|
+
setStatus(await post$6("/login/manual", {
|
|
9629
9638
|
region,
|
|
9630
9639
|
code: pasteValue.trim()
|
|
9631
9640
|
}));
|
|
9632
9641
|
setPasteValue("");
|
|
9633
9642
|
onModelChange?.();
|
|
9634
9643
|
} catch (cause) {
|
|
9635
|
-
setError(messageOf$
|
|
9644
|
+
setError(messageOf$4(cause));
|
|
9636
9645
|
} finally {
|
|
9637
9646
|
setBusy(null);
|
|
9638
9647
|
}
|
|
@@ -9641,12 +9650,12 @@ window.__ModuleLoader__.load({
|
|
|
9641
9650
|
try {
|
|
9642
9651
|
setBusy("adopt");
|
|
9643
9652
|
setError(null);
|
|
9644
|
-
const result = await post$
|
|
9653
|
+
const result = await post$6("/adopt", { region });
|
|
9645
9654
|
setAdoptResult(result);
|
|
9646
9655
|
await loadStatus(true);
|
|
9647
9656
|
if (result.adopted) onModelChange?.();
|
|
9648
9657
|
} catch (cause) {
|
|
9649
|
-
setError(messageOf$
|
|
9658
|
+
setError(messageOf$4(cause));
|
|
9650
9659
|
} finally {
|
|
9651
9660
|
setBusy(null);
|
|
9652
9661
|
}
|
|
@@ -9655,13 +9664,13 @@ window.__ModuleLoader__.load({
|
|
|
9655
9664
|
try {
|
|
9656
9665
|
setBusy(`account:${action}:${accountId}`);
|
|
9657
9666
|
setError(null);
|
|
9658
|
-
setStatus(await post$
|
|
9667
|
+
setStatus(await post$6("/accounts", {
|
|
9659
9668
|
action,
|
|
9660
9669
|
accountId
|
|
9661
9670
|
}));
|
|
9662
9671
|
onModelChange?.();
|
|
9663
9672
|
} catch (cause) {
|
|
9664
|
-
setError(messageOf$
|
|
9673
|
+
setError(messageOf$4(cause));
|
|
9665
9674
|
} finally {
|
|
9666
9675
|
setBusy(null);
|
|
9667
9676
|
}
|
|
@@ -9670,12 +9679,12 @@ window.__ModuleLoader__.load({
|
|
|
9670
9679
|
try {
|
|
9671
9680
|
setBusy("strategy");
|
|
9672
9681
|
setError(null);
|
|
9673
|
-
setStatus(await post$
|
|
9682
|
+
setStatus(await post$6("/accounts", {
|
|
9674
9683
|
action: "strategy",
|
|
9675
9684
|
strategy
|
|
9676
9685
|
}));
|
|
9677
9686
|
} catch (cause) {
|
|
9678
|
-
setError(messageOf$
|
|
9687
|
+
setError(messageOf$4(cause));
|
|
9679
9688
|
} finally {
|
|
9680
9689
|
setBusy(null);
|
|
9681
9690
|
}
|
|
@@ -9684,12 +9693,12 @@ window.__ModuleLoader__.load({
|
|
|
9684
9693
|
const applyEnabledModels = async (enabledModelIds) => {
|
|
9685
9694
|
try {
|
|
9686
9695
|
setError(null);
|
|
9687
|
-
const updated = await post$
|
|
9696
|
+
const updated = await post$6("/settings", { enabledModelIds });
|
|
9688
9697
|
setStatus(updated);
|
|
9689
9698
|
setContextDrafts(contextDraftsFor(updated));
|
|
9690
9699
|
onModelChange?.();
|
|
9691
9700
|
} catch (cause) {
|
|
9692
|
-
setError(messageOf$
|
|
9701
|
+
setError(messageOf$4(cause));
|
|
9693
9702
|
}
|
|
9694
9703
|
};
|
|
9695
9704
|
const toggleModel = (modelId, enabled) => {
|
|
@@ -9712,14 +9721,14 @@ window.__ModuleLoader__.load({
|
|
|
9712
9721
|
try {
|
|
9713
9722
|
setSavingModel(modelId);
|
|
9714
9723
|
setError(null);
|
|
9715
|
-
setStatus(await post$
|
|
9724
|
+
setStatus(await post$6("/settings", { contextWindowOverrides: { [modelId]: parsed } }));
|
|
9716
9725
|
setContextDrafts((previous) => ({
|
|
9717
9726
|
...previous,
|
|
9718
9727
|
[modelId]: formatCapacity$1(parsed)
|
|
9719
9728
|
}));
|
|
9720
9729
|
onModelChange?.();
|
|
9721
9730
|
} catch (cause) {
|
|
9722
|
-
setError(messageOf$
|
|
9731
|
+
setError(messageOf$4(cause));
|
|
9723
9732
|
} finally {
|
|
9724
9733
|
setSavingModel(null);
|
|
9725
9734
|
}
|
|
@@ -9728,7 +9737,7 @@ window.__ModuleLoader__.load({
|
|
|
9728
9737
|
try {
|
|
9729
9738
|
setSavingModel(modelId);
|
|
9730
9739
|
setError(null);
|
|
9731
|
-
const updated = await post$
|
|
9740
|
+
const updated = await post$6("/settings", { contextWindowOverrides: { [modelId]: null } });
|
|
9732
9741
|
setStatus(updated);
|
|
9733
9742
|
const model = updated.models.find((entry) => entry.id === modelId);
|
|
9734
9743
|
if (model !== void 0) setContextDrafts((previous) => ({
|
|
@@ -9737,7 +9746,7 @@ window.__ModuleLoader__.load({
|
|
|
9737
9746
|
}));
|
|
9738
9747
|
onModelChange?.();
|
|
9739
9748
|
} catch (cause) {
|
|
9740
|
-
setError(messageOf$
|
|
9749
|
+
setError(messageOf$4(cause));
|
|
9741
9750
|
} finally {
|
|
9742
9751
|
setSavingModel(null);
|
|
9743
9752
|
}
|
|
@@ -9747,21 +9756,21 @@ window.__ModuleLoader__.load({
|
|
|
9747
9756
|
if (ids.length === 0) return;
|
|
9748
9757
|
try {
|
|
9749
9758
|
setError(null);
|
|
9750
|
-
const updated = await post$
|
|
9759
|
+
const updated = await post$6("/settings", { contextWindowOverrides: Object.fromEntries(ids.map((id) => [id, null])) });
|
|
9751
9760
|
setStatus(updated);
|
|
9752
9761
|
setContextDrafts(contextDraftsFor(updated));
|
|
9753
9762
|
onModelChange?.();
|
|
9754
9763
|
} catch (cause) {
|
|
9755
|
-
setError(messageOf$
|
|
9764
|
+
setError(messageOf$4(cause));
|
|
9756
9765
|
}
|
|
9757
9766
|
};
|
|
9758
9767
|
const refreshQuota = async () => {
|
|
9759
9768
|
try {
|
|
9760
9769
|
setBusy("quota");
|
|
9761
9770
|
setError(null);
|
|
9762
|
-
setStatus(await post$
|
|
9771
|
+
setStatus(await post$6("/quota", {}));
|
|
9763
9772
|
} catch (cause) {
|
|
9764
|
-
setError(messageOf$
|
|
9773
|
+
setError(messageOf$4(cause));
|
|
9765
9774
|
} finally {
|
|
9766
9775
|
setBusy(null);
|
|
9767
9776
|
}
|
|
@@ -9770,9 +9779,9 @@ window.__ModuleLoader__.load({
|
|
|
9770
9779
|
try {
|
|
9771
9780
|
setBusy("catalog");
|
|
9772
9781
|
setError(null);
|
|
9773
|
-
setStatus(await post$
|
|
9782
|
+
setStatus(await post$6("/catalog/refresh", {}));
|
|
9774
9783
|
} catch (cause) {
|
|
9775
|
-
setError(messageOf$
|
|
9784
|
+
setError(messageOf$4(cause));
|
|
9776
9785
|
} finally {
|
|
9777
9786
|
setBusy(null);
|
|
9778
9787
|
}
|
|
@@ -9781,9 +9790,9 @@ window.__ModuleLoader__.load({
|
|
|
9781
9790
|
try {
|
|
9782
9791
|
setBusy("connection");
|
|
9783
9792
|
setError(null);
|
|
9784
|
-
setConnection(await post$
|
|
9793
|
+
setConnection(await post$6("/connection/test", {}));
|
|
9785
9794
|
} catch (cause) {
|
|
9786
|
-
setError(messageOf$
|
|
9795
|
+
setError(messageOf$4(cause));
|
|
9787
9796
|
} finally {
|
|
9788
9797
|
setBusy(null);
|
|
9789
9798
|
}
|
|
@@ -9872,7 +9881,7 @@ window.__ModuleLoader__.load({
|
|
|
9872
9881
|
const { status, loading, busy, error, connection, adoptResult, pasteValue, region, pasteOpen, contextDrafts, savingModel } = state;
|
|
9873
9882
|
const { accounts, models, contextModels, overrideCount, login, quota, authenticated, poolLabels } = derived;
|
|
9874
9883
|
const { setRegion, login: startLogin, cancelLogin, submitPaste, setPasteValue, togglePaste, adopt, clearAdoptResult, accountAction, setStrategy, toggleModel, setAllModels, saveContextWindow, resetContextWindow, resetAllContextWindows, updateContextDraft, refreshQuota, refreshCatalog, testConnection } = actions;
|
|
9875
|
-
const t = useLineDict(NS_GLM_CODING_PLAN, zh$
|
|
9884
|
+
const t = useLineDict(NS_GLM_CODING_PLAN, zh$13);
|
|
9876
9885
|
if (loading) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
9877
9886
|
className: "dsha-page",
|
|
9878
9887
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -10338,7 +10347,7 @@ window.__ModuleLoader__.load({
|
|
|
10338
10347
|
* provider — the same reason every sibling line has one.
|
|
10339
10348
|
*/
|
|
10340
10349
|
const NS_CLAUDE = "dsh-claude";
|
|
10341
|
-
const zh$
|
|
10350
|
+
const zh$12 = {
|
|
10342
10351
|
...accountPoolZh,
|
|
10343
10352
|
title: "Claude(订阅)",
|
|
10344
10353
|
pageDesc: "登录 Claude Pro/Max 订阅,管理模型、思考档位、上下文窗口与额度。",
|
|
@@ -10455,7 +10464,7 @@ window.__ModuleLoader__.load({
|
|
|
10455
10464
|
copy: "复制",
|
|
10456
10465
|
copied: "已复制"
|
|
10457
10466
|
};
|
|
10458
|
-
const en$
|
|
10467
|
+
const en$12 = {
|
|
10459
10468
|
...accountPoolEn,
|
|
10460
10469
|
title: "Claude (subscription)",
|
|
10461
10470
|
pageDesc: "Sign in to a Claude Pro/Max subscription and manage models, thinking levels, context windows and quota.",
|
|
@@ -10572,11 +10581,11 @@ window.__ModuleLoader__.load({
|
|
|
10572
10581
|
copy: "Copy",
|
|
10573
10582
|
copied: "Copied"
|
|
10574
10583
|
};
|
|
10575
|
-
const dictionaries$
|
|
10576
|
-
zh: zh$
|
|
10577
|
-
"zh-CN": zh$
|
|
10578
|
-
en: en$
|
|
10579
|
-
"en-US": en$
|
|
10584
|
+
const dictionaries$12 = {
|
|
10585
|
+
zh: zh$12,
|
|
10586
|
+
"zh-CN": zh$12,
|
|
10587
|
+
en: en$12,
|
|
10588
|
+
"en-US": en$12
|
|
10580
10589
|
};
|
|
10581
10590
|
//#endregion
|
|
10582
10591
|
//#region src/client/claude/useClaudeSection.ts
|
|
@@ -10589,7 +10598,7 @@ window.__ModuleLoader__.load({
|
|
|
10589
10598
|
* `ClaudeSectionView` — so the contract between the two is visible here rather
|
|
10590
10599
|
* than inferred from a thousand lines of JSX.
|
|
10591
10600
|
*/
|
|
10592
|
-
const api$
|
|
10601
|
+
const api$12 = createLineApi("/claude/api", "Claude");
|
|
10593
10602
|
/**
|
|
10594
10603
|
* The poll cadence of a pending sign-in.
|
|
10595
10604
|
*
|
|
@@ -10610,7 +10619,7 @@ window.__ModuleLoader__.load({
|
|
|
10610
10619
|
const [connection, setConnection] = (0, react.useState)(null);
|
|
10611
10620
|
/** Follow-up poll owed while the host refreshes the quota behind an answer. */
|
|
10612
10621
|
const quotaFollowUp = (0, react.useRef)(null);
|
|
10613
|
-
const t = useLineDict(NS_CLAUDE, zh$
|
|
10622
|
+
const t = useLineDict(NS_CLAUDE, zh$12);
|
|
10614
10623
|
const notifyChange = (0, react.useCallback)(() => {
|
|
10615
10624
|
onModelChange?.();
|
|
10616
10625
|
loadModelDirectory?.();
|
|
@@ -10622,7 +10631,7 @@ window.__ModuleLoader__.load({
|
|
|
10622
10631
|
const loadStatus = (0, react.useCallback)(async (quiet = false) => {
|
|
10623
10632
|
if (!quiet) setError(null);
|
|
10624
10633
|
try {
|
|
10625
|
-
const data = await api$
|
|
10634
|
+
const data = await api$12.request("/status");
|
|
10626
10635
|
setStatus(data);
|
|
10627
10636
|
setContextDrafts(contextDraftsFor(data));
|
|
10628
10637
|
quotaFollowUp.current ??= createQuotaFollowUp();
|
|
@@ -10653,7 +10662,7 @@ window.__ModuleLoader__.load({
|
|
|
10653
10662
|
const timer = window.setInterval(() => {
|
|
10654
10663
|
(async () => {
|
|
10655
10664
|
try {
|
|
10656
|
-
const poll = await api$
|
|
10665
|
+
const poll = await api$12.request("/login/status");
|
|
10657
10666
|
setFlow(poll);
|
|
10658
10667
|
if (poll.status === "complete") {
|
|
10659
10668
|
setPasteValue("");
|
|
@@ -10675,7 +10684,7 @@ window.__ModuleLoader__.load({
|
|
|
10675
10684
|
setBusy("login");
|
|
10676
10685
|
setError(null);
|
|
10677
10686
|
setPasteValue("");
|
|
10678
|
-
const next = await api$
|
|
10687
|
+
const next = await api$12.request("/login", {
|
|
10679
10688
|
method: "POST",
|
|
10680
10689
|
body: JSON.stringify({})
|
|
10681
10690
|
});
|
|
@@ -10689,7 +10698,7 @@ window.__ModuleLoader__.load({
|
|
|
10689
10698
|
};
|
|
10690
10699
|
const cancelLogin = async () => {
|
|
10691
10700
|
try {
|
|
10692
|
-
const next = await api$
|
|
10701
|
+
const next = await api$12.request("/login/cancel", { method: "POST" });
|
|
10693
10702
|
setFlow(next);
|
|
10694
10703
|
} catch (err) {
|
|
10695
10704
|
reportError(err);
|
|
@@ -10701,7 +10710,7 @@ window.__ModuleLoader__.load({
|
|
|
10701
10710
|
try {
|
|
10702
10711
|
setBusy("login-input");
|
|
10703
10712
|
setError(null);
|
|
10704
|
-
const updated = await api$
|
|
10713
|
+
const updated = await api$12.request("/login/input", {
|
|
10705
10714
|
method: "POST",
|
|
10706
10715
|
body: JSON.stringify({ input: pasteValue })
|
|
10707
10716
|
});
|
|
@@ -10725,7 +10734,7 @@ window.__ModuleLoader__.load({
|
|
|
10725
10734
|
try {
|
|
10726
10735
|
setBusy("adopt");
|
|
10727
10736
|
setError(null);
|
|
10728
|
-
const updated = await api$
|
|
10737
|
+
const updated = await api$12.request("/adopt", { method: "POST" });
|
|
10729
10738
|
setStatus(updated);
|
|
10730
10739
|
setContextDrafts(contextDraftsFor(updated));
|
|
10731
10740
|
notifyChange();
|
|
@@ -10740,7 +10749,7 @@ window.__ModuleLoader__.load({
|
|
|
10740
10749
|
try {
|
|
10741
10750
|
setBusy(accountId === void 0 ? "adopt-disable" : `adopt-disable-${accountId}`);
|
|
10742
10751
|
setError(null);
|
|
10743
|
-
const updated = await api$
|
|
10752
|
+
const updated = await api$12.request("/adopt/disable", {
|
|
10744
10753
|
method: "POST",
|
|
10745
10754
|
body: JSON.stringify(accountId === void 0 ? {} : { accountId })
|
|
10746
10755
|
});
|
|
@@ -10757,7 +10766,7 @@ window.__ModuleLoader__.load({
|
|
|
10757
10766
|
try {
|
|
10758
10767
|
setBusy(`${action}-${accountId}`);
|
|
10759
10768
|
setError(null);
|
|
10760
|
-
const updated = await api$
|
|
10769
|
+
const updated = await api$12.request("/accounts", {
|
|
10761
10770
|
method: "POST",
|
|
10762
10771
|
body: JSON.stringify({
|
|
10763
10772
|
action,
|
|
@@ -10776,7 +10785,7 @@ window.__ModuleLoader__.load({
|
|
|
10776
10785
|
try {
|
|
10777
10786
|
setBusy("strategy");
|
|
10778
10787
|
setError(null);
|
|
10779
|
-
const updated = await api$
|
|
10788
|
+
const updated = await api$12.request("/accounts", {
|
|
10780
10789
|
method: "POST",
|
|
10781
10790
|
body: JSON.stringify({
|
|
10782
10791
|
action: "strategy",
|
|
@@ -10803,7 +10812,7 @@ window.__ModuleLoader__.load({
|
|
|
10803
10812
|
setBusy(`relogin-${accountId}`);
|
|
10804
10813
|
setError(null);
|
|
10805
10814
|
setPasteValue("");
|
|
10806
|
-
const next = await api$
|
|
10815
|
+
const next = await api$12.request("/login", {
|
|
10807
10816
|
method: "POST",
|
|
10808
10817
|
body: JSON.stringify({ accountId })
|
|
10809
10818
|
});
|
|
@@ -10820,7 +10829,7 @@ window.__ModuleLoader__.load({
|
|
|
10820
10829
|
try {
|
|
10821
10830
|
setBusy("quota");
|
|
10822
10831
|
setError(null);
|
|
10823
|
-
const updated = await api$
|
|
10832
|
+
const updated = await api$12.request("/quota", { method: "POST" });
|
|
10824
10833
|
setStatus(updated);
|
|
10825
10834
|
} catch (err) {
|
|
10826
10835
|
reportError(err);
|
|
@@ -10833,7 +10842,7 @@ window.__ModuleLoader__.load({
|
|
|
10833
10842
|
try {
|
|
10834
10843
|
setBusy("catalog");
|
|
10835
10844
|
setError(null);
|
|
10836
|
-
const updated = await api$
|
|
10845
|
+
const updated = await api$12.request("/catalog/refresh", { method: "POST" });
|
|
10837
10846
|
setStatus(updated);
|
|
10838
10847
|
setContextDrafts(contextDraftsFor(updated));
|
|
10839
10848
|
notifyChange();
|
|
@@ -10848,7 +10857,7 @@ window.__ModuleLoader__.load({
|
|
|
10848
10857
|
setBusy("connection");
|
|
10849
10858
|
setError(null);
|
|
10850
10859
|
setConnection(null);
|
|
10851
|
-
const result = await api$
|
|
10860
|
+
const result = await api$12.request("/connection/test", { method: "POST" });
|
|
10852
10861
|
setConnection(result);
|
|
10853
10862
|
await loadStatus(true);
|
|
10854
10863
|
} catch (err) {
|
|
@@ -10859,7 +10868,7 @@ window.__ModuleLoader__.load({
|
|
|
10859
10868
|
};
|
|
10860
10869
|
const applyEnabled = async (enabledModelIds) => {
|
|
10861
10870
|
try {
|
|
10862
|
-
const updated = await api$
|
|
10871
|
+
const updated = await api$12.request("/models", {
|
|
10863
10872
|
method: "POST",
|
|
10864
10873
|
body: JSON.stringify({ enabledModelIds })
|
|
10865
10874
|
});
|
|
@@ -10882,7 +10891,7 @@ window.__ModuleLoader__.load({
|
|
|
10882
10891
|
};
|
|
10883
10892
|
const updateEffort = async (effort) => {
|
|
10884
10893
|
try {
|
|
10885
|
-
const updated = await api$
|
|
10894
|
+
const updated = await api$12.request("/settings", {
|
|
10886
10895
|
method: "POST",
|
|
10887
10896
|
body: JSON.stringify({ defaultReasoningEffort: effort })
|
|
10888
10897
|
});
|
|
@@ -10894,7 +10903,7 @@ window.__ModuleLoader__.load({
|
|
|
10894
10903
|
};
|
|
10895
10904
|
const updateCacheTtl = async (ttl) => {
|
|
10896
10905
|
try {
|
|
10897
|
-
const updated = await api$
|
|
10906
|
+
const updated = await api$12.request("/settings", {
|
|
10898
10907
|
method: "POST",
|
|
10899
10908
|
body: JSON.stringify({ cacheTtl: ttl })
|
|
10900
10909
|
});
|
|
@@ -10914,7 +10923,7 @@ window.__ModuleLoader__.load({
|
|
|
10914
10923
|
try {
|
|
10915
10924
|
setSavingModel(modelId);
|
|
10916
10925
|
setError(null);
|
|
10917
|
-
const updated = await api$
|
|
10926
|
+
const updated = await api$12.request("/settings", {
|
|
10918
10927
|
method: "POST",
|
|
10919
10928
|
body: JSON.stringify({ contextWindowOverrides: { [modelId]: parsed } })
|
|
10920
10929
|
});
|
|
@@ -10941,7 +10950,7 @@ window.__ModuleLoader__.load({
|
|
|
10941
10950
|
try {
|
|
10942
10951
|
setSavingModel(modelId);
|
|
10943
10952
|
setError(null);
|
|
10944
|
-
const updated = await api$
|
|
10953
|
+
const updated = await api$12.request("/settings", {
|
|
10945
10954
|
method: "POST",
|
|
10946
10955
|
body: JSON.stringify({ contextWindowOverrides: { [modelId]: null } })
|
|
10947
10956
|
});
|
|
@@ -10968,7 +10977,7 @@ window.__ModuleLoader__.load({
|
|
|
10968
10977
|
try {
|
|
10969
10978
|
setBusy("context");
|
|
10970
10979
|
setError(null);
|
|
10971
|
-
const updated = await api$
|
|
10980
|
+
const updated = await api$12.request("/settings", {
|
|
10972
10981
|
method: "POST",
|
|
10973
10982
|
body: JSON.stringify({ contextWindowOverrides: Object.fromEntries(models.map((model) => [model, null])) })
|
|
10974
10983
|
});
|
|
@@ -11057,11 +11066,11 @@ window.__ModuleLoader__.load({
|
|
|
11057
11066
|
* out here would hide a choice the host would accept and a catalog may expose.
|
|
11058
11067
|
*/
|
|
11059
11068
|
const EFFORT_LABELS$2 = {
|
|
11060
|
-
low: zh$
|
|
11061
|
-
medium: zh$
|
|
11062
|
-
high: zh$
|
|
11063
|
-
xhigh: zh$
|
|
11064
|
-
max: zh$
|
|
11069
|
+
low: zh$12.effortLow,
|
|
11070
|
+
medium: zh$12.effortMedium,
|
|
11071
|
+
high: zh$12.effortHigh,
|
|
11072
|
+
xhigh: zh$12.effortXHigh,
|
|
11073
|
+
max: zh$12.effortMax
|
|
11065
11074
|
};
|
|
11066
11075
|
/** One-line capability summary shown as a model pill's hover title. */
|
|
11067
11076
|
function modelFacts(model, t) {
|
|
@@ -11082,7 +11091,7 @@ window.__ModuleLoader__.load({
|
|
|
11082
11091
|
const { status, loading, busy, error, flow, connection, pasteValue, contextDrafts, savingModel } = state;
|
|
11083
11092
|
const { accounts, hasAdopted, contextModels, overrideCount, quota, windows, poolLabels } = derived;
|
|
11084
11093
|
const { login, cancelLogin, submitPaste, adopt, stopImporting, accountAction, setStrategy, relogin, refreshQuota, refreshCatalog, testConnection, toggleModel, setAllModels, updateEffort, updateCacheTtl, saveContextWindow, resetContextWindow, resetAllContextWindows, updateContextDraft, setPasteValue } = actions;
|
|
11085
|
-
const t = useLineDict(NS_CLAUDE, zh$
|
|
11094
|
+
const t = useLineDict(NS_CLAUDE, zh$12);
|
|
11086
11095
|
if (loading) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
11087
11096
|
className: "dsha-page",
|
|
11088
11097
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -11574,7 +11583,7 @@ window.__ModuleLoader__.load({
|
|
|
11574
11583
|
*/
|
|
11575
11584
|
var OllamaApi = class {
|
|
11576
11585
|
status() {
|
|
11577
|
-
return request$
|
|
11586
|
+
return request$3(`${API$9}/status`);
|
|
11578
11587
|
}
|
|
11579
11588
|
/**
|
|
11580
11589
|
* One pool action, returning the refreshed status.
|
|
@@ -11583,13 +11592,13 @@ window.__ModuleLoader__.load({
|
|
|
11583
11592
|
* never has to guess what the pool looks like after a change.
|
|
11584
11593
|
*/
|
|
11585
11594
|
accountAction(action, body = {}) {
|
|
11586
|
-
return post$
|
|
11595
|
+
return post$5(`${API$9}/accounts`, {
|
|
11587
11596
|
action,
|
|
11588
11597
|
...body
|
|
11589
11598
|
});
|
|
11590
11599
|
}
|
|
11591
11600
|
refreshCatalog() {
|
|
11592
|
-
return post$
|
|
11601
|
+
return post$5(`${API$9}/catalog/refresh`, {});
|
|
11593
11602
|
}
|
|
11594
11603
|
/**
|
|
11595
11604
|
* Store the default thinking level, answering with the refreshed status.
|
|
@@ -11604,7 +11613,7 @@ window.__ModuleLoader__.load({
|
|
|
11604
11613
|
* explicitly rather than left out of the body.
|
|
11605
11614
|
*/
|
|
11606
11615
|
setDefaultReasoningEffort(effort) {
|
|
11607
|
-
return post$
|
|
11616
|
+
return post$5(`${API$9}/settings`, { defaultReasoningEffort: effort }).then(() => this.status());
|
|
11608
11617
|
}
|
|
11609
11618
|
/**
|
|
11610
11619
|
* Replace the enabled-model selection.
|
|
@@ -11614,17 +11623,17 @@ window.__ModuleLoader__.load({
|
|
|
11614
11623
|
* selection before it could answer 'turn this one off'.
|
|
11615
11624
|
*/
|
|
11616
11625
|
setEnabledModels(enabledModelIds) {
|
|
11617
|
-
return post$
|
|
11626
|
+
return post$5(`${API$9}/models`, { enabledModelIds });
|
|
11618
11627
|
}
|
|
11619
11628
|
};
|
|
11620
|
-
async function post$
|
|
11621
|
-
return request$
|
|
11629
|
+
async function post$5(url, body) {
|
|
11630
|
+
return request$3(url, {
|
|
11622
11631
|
method: "POST",
|
|
11623
11632
|
headers: { "Content-Type": "application/json" },
|
|
11624
11633
|
body: JSON.stringify(body)
|
|
11625
11634
|
});
|
|
11626
11635
|
}
|
|
11627
|
-
async function request$
|
|
11636
|
+
async function request$3(url, init) {
|
|
11628
11637
|
const response = await fetch(url, {
|
|
11629
11638
|
...init,
|
|
11630
11639
|
credentials: "same-origin"
|
|
@@ -11674,7 +11683,7 @@ window.__ModuleLoader__.load({
|
|
|
11674
11683
|
//#endregion
|
|
11675
11684
|
//#region src/client/ollama/locales.ts
|
|
11676
11685
|
const NS_OLLAMA = "dsh-ollama";
|
|
11677
|
-
const zh$
|
|
11686
|
+
const zh$11 = {
|
|
11678
11687
|
...accountPoolZh,
|
|
11679
11688
|
relogin: "更换 Key",
|
|
11680
11689
|
needsRelogin: "Key 已失效",
|
|
@@ -11726,7 +11735,7 @@ window.__ModuleLoader__.load({
|
|
|
11726
11735
|
usageNone: "尚无请求",
|
|
11727
11736
|
usageHint: "按 Ollama 每次响应自带的 token 计数本地累加。"
|
|
11728
11737
|
};
|
|
11729
|
-
const en$
|
|
11738
|
+
const en$11 = {
|
|
11730
11739
|
...accountPoolEn,
|
|
11731
11740
|
relogin: "Replace Key",
|
|
11732
11741
|
needsRelogin: "Key rejected",
|
|
@@ -11778,11 +11787,11 @@ window.__ModuleLoader__.load({
|
|
|
11778
11787
|
usageNone: "No requests yet",
|
|
11779
11788
|
usageHint: "Summed locally from the token counts Ollama returns on each response."
|
|
11780
11789
|
};
|
|
11781
|
-
const dictionaries$
|
|
11782
|
-
zh: zh$
|
|
11783
|
-
"zh-CN": zh$
|
|
11784
|
-
en: en$
|
|
11785
|
-
"en-US": en$
|
|
11790
|
+
const dictionaries$11 = {
|
|
11791
|
+
zh: zh$11,
|
|
11792
|
+
"zh-CN": zh$11,
|
|
11793
|
+
en: en$11,
|
|
11794
|
+
"en-US": en$11
|
|
11786
11795
|
};
|
|
11787
11796
|
//#endregion
|
|
11788
11797
|
//#region src/client/ollama/OllamaSection.tsx
|
|
@@ -11908,7 +11917,7 @@ window.__ModuleLoader__.load({
|
|
|
11908
11917
|
const setEffort = (0, react.useCallback)((value) => {
|
|
11909
11918
|
run("effort", () => API$8.setDefaultReasoningEffort(value === "" ? null : value));
|
|
11910
11919
|
}, [run]);
|
|
11911
|
-
const t = useLineDict(NS_OLLAMA, zh$
|
|
11920
|
+
const t = useLineDict(NS_OLLAMA, zh$11);
|
|
11912
11921
|
const pool = status?.pool;
|
|
11913
11922
|
const models = status?.models ?? [];
|
|
11914
11923
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [
|
|
@@ -12023,7 +12032,7 @@ window.__ModuleLoader__.load({
|
|
|
12023
12032
|
className: "dsha-btn",
|
|
12024
12033
|
disabled: busy !== null,
|
|
12025
12034
|
onClick: () => setShowKeyForm(false),
|
|
12026
|
-
children: zh$
|
|
12035
|
+
children: zh$11.deleteAccount
|
|
12027
12036
|
})]
|
|
12028
12037
|
})
|
|
12029
12038
|
]
|
|
@@ -12145,19 +12154,19 @@ window.__ModuleLoader__.load({
|
|
|
12145
12154
|
*/
|
|
12146
12155
|
var AntigravityAcpApi = class {
|
|
12147
12156
|
status() {
|
|
12148
|
-
return request$
|
|
12157
|
+
return request$2(`${API$7}/status`);
|
|
12149
12158
|
}
|
|
12150
12159
|
/** Submit one settings patch and receive the refreshed status. */
|
|
12151
12160
|
update(patch) {
|
|
12152
|
-
return post$
|
|
12161
|
+
return post$4(`${API$7}/settings`, patch);
|
|
12153
12162
|
}
|
|
12154
12163
|
/** Force a live catalogue read. */
|
|
12155
12164
|
refresh() {
|
|
12156
|
-
return post$
|
|
12165
|
+
return post$4(`${API$7}/refresh`, {});
|
|
12157
12166
|
}
|
|
12158
12167
|
/** Run the line's self-check and return its one-line-per-stage report. */
|
|
12159
12168
|
doctor() {
|
|
12160
|
-
return post$
|
|
12169
|
+
return post$4(`${API$7}/doctor`, {});
|
|
12161
12170
|
}
|
|
12162
12171
|
/**
|
|
12163
12172
|
* Start the official sign-in.
|
|
@@ -12167,21 +12176,21 @@ window.__ModuleLoader__.load({
|
|
|
12167
12176
|
* producing two Google pages.
|
|
12168
12177
|
*/
|
|
12169
12178
|
startLogin() {
|
|
12170
|
-
return post$
|
|
12179
|
+
return post$4(`${API$7}/login/start`, {});
|
|
12171
12180
|
}
|
|
12172
12181
|
/** Re-read the auth state after a sign-in attempt. */
|
|
12173
12182
|
loginStatus() {
|
|
12174
|
-
return request$
|
|
12183
|
+
return request$2(`${API$7}/login/status`);
|
|
12175
12184
|
}
|
|
12176
12185
|
};
|
|
12177
|
-
async function post$
|
|
12178
|
-
return request$
|
|
12186
|
+
async function post$4(url, body) {
|
|
12187
|
+
return request$2(url, {
|
|
12179
12188
|
method: "POST",
|
|
12180
12189
|
headers: { "Content-Type": "application/json" },
|
|
12181
12190
|
body: JSON.stringify(body)
|
|
12182
12191
|
});
|
|
12183
12192
|
}
|
|
12184
|
-
async function request$
|
|
12193
|
+
async function request$2(url, init) {
|
|
12185
12194
|
const response = await fetch(url, {
|
|
12186
12195
|
...init,
|
|
12187
12196
|
credentials: "same-origin"
|
|
@@ -12222,7 +12231,7 @@ window.__ModuleLoader__.load({
|
|
|
12222
12231
|
//#endregion
|
|
12223
12232
|
//#region src/client/antigravity-acp/locales.ts
|
|
12224
12233
|
const NS_ANTIGRAVITY_ACP = "dsh-antigravity-acp";
|
|
12225
|
-
const zh$
|
|
12234
|
+
const zh$10 = {
|
|
12226
12235
|
title: "Antigravity(ACP)",
|
|
12227
12236
|
pageDesc: "通过 Google 官方 Antigravity CLI 的 Agent Client Protocol(ACP)接入:模型、工具与会话全部由官方进程驱动,登录态由官方进程自己保管。",
|
|
12228
12237
|
routeOwned: "模型路由由本插件提供",
|
|
@@ -12314,7 +12323,7 @@ window.__ModuleLoader__.load({
|
|
|
12314
12323
|
enabledHint: "该线路当前已启用。",
|
|
12315
12324
|
toggleHint: "可在「订阅服务」总览页的该线路卡片上随时停用。"
|
|
12316
12325
|
};
|
|
12317
|
-
const en$
|
|
12326
|
+
const en$10 = {
|
|
12318
12327
|
title: "Antigravity (ACP)",
|
|
12319
12328
|
pageDesc: "Connect through Google's official Antigravity CLI over the Agent Client Protocol (ACP): the model, its tools and its sessions all come from the official process, which also keeps its own sign-in state.",
|
|
12320
12329
|
routeOwned: "Model route served by this plugin",
|
|
@@ -12406,11 +12415,11 @@ window.__ModuleLoader__.load({
|
|
|
12406
12415
|
enabledHint: "This line is enabled.",
|
|
12407
12416
|
toggleHint: "You can switch it off at any time from its card in the subscription overview."
|
|
12408
12417
|
};
|
|
12409
|
-
const dictionaries$
|
|
12410
|
-
zh: zh$
|
|
12411
|
-
"zh-CN": zh$
|
|
12412
|
-
en: en$
|
|
12413
|
-
"en-US": en$
|
|
12418
|
+
const dictionaries$10 = {
|
|
12419
|
+
zh: zh$10,
|
|
12420
|
+
"zh-CN": zh$10,
|
|
12421
|
+
en: en$10,
|
|
12422
|
+
"en-US": en$10
|
|
12414
12423
|
};
|
|
12415
12424
|
//#endregion
|
|
12416
12425
|
//#region src/client/antigravity-acp/AntigravityAcpSection.tsx
|
|
@@ -12467,7 +12476,7 @@ window.__ModuleLoader__.load({
|
|
|
12467
12476
|
setBusy(null);
|
|
12468
12477
|
}
|
|
12469
12478
|
}, [props]);
|
|
12470
|
-
const t = useLineDict(NS_ANTIGRAVITY_ACP, zh$
|
|
12479
|
+
const t = useLineDict(NS_ANTIGRAVITY_ACP, zh$10);
|
|
12471
12480
|
const models = status?.models ?? [];
|
|
12472
12481
|
const auth = status?.auth;
|
|
12473
12482
|
const usage = status?.usage;
|
|
@@ -12958,7 +12967,7 @@ window.__ModuleLoader__.load({
|
|
|
12958
12967
|
* 键名重合的会被渲染成 ChatGPT 的措辞,不重合的会把键名本身打印出来)。
|
|
12959
12968
|
*/
|
|
12960
12969
|
const NS_STEP_CODE = "dsh-step-code";
|
|
12961
|
-
const zh$
|
|
12970
|
+
const zh$9 = {
|
|
12962
12971
|
...accountPoolZh,
|
|
12963
12972
|
title: "Step Code(Step Plan 订阅)",
|
|
12964
12973
|
pageDesc: "用 StepFun 的 Step Plan 订阅(国区 api.stepfun.com / 国际区 api.stepfun.ai)或开放平台 API Key 接入,管理账号池、套餐额度、缓存用量与模型勾选。区域是凭据的属性,两区凭据互不通用,因此号池里可以同时存在两区账号。",
|
|
@@ -13128,7 +13137,7 @@ window.__ModuleLoader__.load({
|
|
|
13128
13137
|
cacheExpiredHint: "缓存可能已过期:距上次请求约 {minutes} 分钟,下次会重新处理前缀。",
|
|
13129
13138
|
cacheHitRatioUnavailable: "—"
|
|
13130
13139
|
};
|
|
13131
|
-
const en$
|
|
13140
|
+
const en$9 = {
|
|
13132
13141
|
...accountPoolEn,
|
|
13133
13142
|
title: "Step Code (Step Plan subscription)",
|
|
13134
13143
|
pageDesc: "Reach StepFun with a Step Plan subscription (China api.stepfun.com / international api.stepfun.ai) or an open-platform API key, and manage the account pool, plan quota, cache usage and model selection. A region is a property of the credential and the two never share, so a pool can carry accounts from both.",
|
|
@@ -13296,11 +13305,11 @@ window.__ModuleLoader__.load({
|
|
|
13296
13305
|
cacheExpiredHint: "The cache has likely expired: about {minutes} minutes since the last request, so the next turn will reprocess the prefix.",
|
|
13297
13306
|
cacheHitRatioUnavailable: "—"
|
|
13298
13307
|
};
|
|
13299
|
-
const dictionaries$
|
|
13300
|
-
zh: zh$
|
|
13301
|
-
"zh-CN": zh$
|
|
13302
|
-
en: en$
|
|
13303
|
-
"en-US": en$
|
|
13308
|
+
const dictionaries$9 = {
|
|
13309
|
+
zh: zh$9,
|
|
13310
|
+
"zh-CN": zh$9,
|
|
13311
|
+
en: en$9,
|
|
13312
|
+
"en-US": en$9
|
|
13304
13313
|
};
|
|
13305
13314
|
/** 一个额度窗口的键到「窗口长度(分钟)」的映射。窗口名由共享组件按长度本地化。 */
|
|
13306
13315
|
const QUOTA_WINDOW_MINUTES = {
|
|
@@ -13392,10 +13401,10 @@ window.__ModuleLoader__.load({
|
|
|
13392
13401
|
* **仅有的两处**带秘密的形状,它们只在这两个函数调用点的字面量里出现,
|
|
13393
13402
|
* 既不进 URL、也不进日志,卡片那边同样没有别的地方可以读到它们。
|
|
13394
13403
|
*/
|
|
13395
|
-
const api$
|
|
13396
|
-
const get$
|
|
13397
|
-
const post$
|
|
13398
|
-
function messageOf$
|
|
13404
|
+
const api$11 = createLineApi(STEP_CODE_ROUTE_PREFIX, STEP_CODE_PROVIDER_NAME);
|
|
13405
|
+
const get$3 = api$11.get;
|
|
13406
|
+
const post$3 = api$11.post;
|
|
13407
|
+
function messageOf$3(cause) {
|
|
13399
13408
|
return cause instanceof Error ? cause.message : String(cause);
|
|
13400
13409
|
}
|
|
13401
13410
|
//#endregion
|
|
@@ -13418,7 +13427,7 @@ window.__ModuleLoader__.load({
|
|
|
13418
13427
|
/** 登录状态机的轮询节奏。真实超时与间隔由 host 拥有,卡片只是跟随。 */
|
|
13419
13428
|
const LOGIN_POLL_INTERVAL_MS$1 = 2e3;
|
|
13420
13429
|
/** 本卡片的字典;身份稳定,依赖它的 effect 才不会每次渲染重建。 */
|
|
13421
|
-
const fallbackTranslate$5 = (key) => zh$
|
|
13430
|
+
const fallbackTranslate$5 = (key) => zh$9[key];
|
|
13422
13431
|
/**
|
|
13423
13432
|
* 共享账号池卡片需要的标签集,按本卡片的字典逐键查出来。
|
|
13424
13433
|
*
|
|
@@ -13567,7 +13576,7 @@ window.__ModuleLoader__.load({
|
|
|
13567
13576
|
const loadStatus = (0, react.useCallback)(async (quiet = false) => {
|
|
13568
13577
|
if (!quiet) setError(null);
|
|
13569
13578
|
try {
|
|
13570
|
-
const next = await get$
|
|
13579
|
+
const next = await get$3("/status");
|
|
13571
13580
|
setStatus(next);
|
|
13572
13581
|
setContextDrafts(contextDraftsFor(next));
|
|
13573
13582
|
if (!profileTouched.current && isStepCodeProfile(next.profile)) setProfileState(next.profile);
|
|
@@ -13576,7 +13585,7 @@ window.__ModuleLoader__.load({
|
|
|
13576
13585
|
loadStatus(true);
|
|
13577
13586
|
});
|
|
13578
13587
|
} catch (cause) {
|
|
13579
|
-
if (!quiet) setError(messageOf$
|
|
13588
|
+
if (!quiet) setError(messageOf$3(cause));
|
|
13580
13589
|
} finally {
|
|
13581
13590
|
setLoading(false);
|
|
13582
13591
|
}
|
|
@@ -13601,7 +13610,7 @@ window.__ModuleLoader__.load({
|
|
|
13601
13610
|
const timer = window.setInterval(() => {
|
|
13602
13611
|
(async () => {
|
|
13603
13612
|
try {
|
|
13604
|
-
const poll = await get$
|
|
13613
|
+
const poll = await get$3("/login/status");
|
|
13605
13614
|
if (stopped) return;
|
|
13606
13615
|
if (poll.status === "complete") {
|
|
13607
13616
|
setPasteValue("");
|
|
@@ -13634,13 +13643,13 @@ window.__ModuleLoader__.load({
|
|
|
13634
13643
|
setError(null);
|
|
13635
13644
|
setConnection(null);
|
|
13636
13645
|
setPasteValue("");
|
|
13637
|
-
const flow = await post$
|
|
13646
|
+
const flow = await post$3("/login/start", { profile: loginProfile });
|
|
13638
13647
|
await loadStatus(true);
|
|
13639
13648
|
if (flow.authorizeUrl !== void 0 && flow.authorizeUrl !== "") try {
|
|
13640
13649
|
window.open(flow.authorizeUrl, "_blank", "noopener,noreferrer");
|
|
13641
13650
|
} catch {}
|
|
13642
13651
|
} catch (cause) {
|
|
13643
|
-
setError(messageOf$
|
|
13652
|
+
setError(messageOf$3(cause));
|
|
13644
13653
|
} finally {
|
|
13645
13654
|
setBusy(null);
|
|
13646
13655
|
}
|
|
@@ -13649,10 +13658,10 @@ window.__ModuleLoader__.load({
|
|
|
13649
13658
|
try {
|
|
13650
13659
|
setBusy("login:cancel");
|
|
13651
13660
|
setError(null);
|
|
13652
|
-
await post$
|
|
13661
|
+
await post$3("/login/cancel", {});
|
|
13653
13662
|
await loadStatus(true);
|
|
13654
13663
|
} catch (cause) {
|
|
13655
|
-
setError(messageOf$
|
|
13664
|
+
setError(messageOf$3(cause));
|
|
13656
13665
|
} finally {
|
|
13657
13666
|
setBusy(null);
|
|
13658
13667
|
}
|
|
@@ -13666,14 +13675,14 @@ window.__ModuleLoader__.load({
|
|
|
13666
13675
|
try {
|
|
13667
13676
|
setBusy("login-manual");
|
|
13668
13677
|
setError(null);
|
|
13669
|
-
setStatus(await post$
|
|
13678
|
+
setStatus(await post$3("/login/manual", {
|
|
13670
13679
|
profile,
|
|
13671
13680
|
apiKey
|
|
13672
13681
|
}));
|
|
13673
13682
|
setPasteValue("");
|
|
13674
13683
|
onModelChange?.();
|
|
13675
13684
|
} catch (cause) {
|
|
13676
|
-
setError(messageOf$
|
|
13685
|
+
setError(messageOf$3(cause));
|
|
13677
13686
|
} finally {
|
|
13678
13687
|
setPasteValue("");
|
|
13679
13688
|
setBusy(null);
|
|
@@ -13683,12 +13692,12 @@ window.__ModuleLoader__.load({
|
|
|
13683
13692
|
try {
|
|
13684
13693
|
setBusy("adopt");
|
|
13685
13694
|
setError(null);
|
|
13686
|
-
const result = await post$
|
|
13695
|
+
const result = await post$3("/adopt", {});
|
|
13687
13696
|
setAdoptResult(result);
|
|
13688
13697
|
await loadStatus(true);
|
|
13689
13698
|
if (result.adopted) onModelChange?.();
|
|
13690
13699
|
} catch (cause) {
|
|
13691
|
-
setError(messageOf$
|
|
13700
|
+
setError(messageOf$3(cause));
|
|
13692
13701
|
} finally {
|
|
13693
13702
|
setBusy(null);
|
|
13694
13703
|
}
|
|
@@ -13697,13 +13706,13 @@ window.__ModuleLoader__.load({
|
|
|
13697
13706
|
try {
|
|
13698
13707
|
setBusy(`account:${action}:${accountId}`);
|
|
13699
13708
|
setError(null);
|
|
13700
|
-
setStatus(await post$
|
|
13709
|
+
setStatus(await post$3("/accounts", {
|
|
13701
13710
|
action,
|
|
13702
13711
|
accountId
|
|
13703
13712
|
}));
|
|
13704
13713
|
onModelChange?.();
|
|
13705
13714
|
} catch (cause) {
|
|
13706
|
-
setError(messageOf$
|
|
13715
|
+
setError(messageOf$3(cause));
|
|
13707
13716
|
} finally {
|
|
13708
13717
|
setBusy(null);
|
|
13709
13718
|
}
|
|
@@ -13712,12 +13721,12 @@ window.__ModuleLoader__.load({
|
|
|
13712
13721
|
try {
|
|
13713
13722
|
setBusy("strategy");
|
|
13714
13723
|
setError(null);
|
|
13715
|
-
setStatus(await post$
|
|
13724
|
+
setStatus(await post$3("/accounts", {
|
|
13716
13725
|
action: "strategy",
|
|
13717
13726
|
strategy
|
|
13718
13727
|
}));
|
|
13719
13728
|
} catch (cause) {
|
|
13720
|
-
setError(messageOf$
|
|
13729
|
+
setError(messageOf$3(cause));
|
|
13721
13730
|
} finally {
|
|
13722
13731
|
setBusy(null);
|
|
13723
13732
|
}
|
|
@@ -13732,12 +13741,12 @@ window.__ModuleLoader__.load({
|
|
|
13732
13741
|
const applyEnabledModels = async (enabledModelIds) => {
|
|
13733
13742
|
try {
|
|
13734
13743
|
setError(null);
|
|
13735
|
-
const updated = await post$
|
|
13744
|
+
const updated = await post$3("/settings", { enabledModelIds });
|
|
13736
13745
|
setStatus(updated);
|
|
13737
13746
|
setContextDrafts(contextDraftsFor(updated));
|
|
13738
13747
|
onModelChange?.();
|
|
13739
13748
|
} catch (cause) {
|
|
13740
|
-
setError(messageOf$
|
|
13749
|
+
setError(messageOf$3(cause));
|
|
13741
13750
|
}
|
|
13742
13751
|
};
|
|
13743
13752
|
const toggleModel = (modelId, enabled) => {
|
|
@@ -13760,14 +13769,14 @@ window.__ModuleLoader__.load({
|
|
|
13760
13769
|
try {
|
|
13761
13770
|
setSavingModel(modelId);
|
|
13762
13771
|
setError(null);
|
|
13763
|
-
setStatus(await post$
|
|
13772
|
+
setStatus(await post$3("/settings", { contextWindowOverrides: { [modelId]: parsed } }));
|
|
13764
13773
|
setContextDrafts((previous) => ({
|
|
13765
13774
|
...previous,
|
|
13766
13775
|
[modelId]: formatCapacity$1(parsed)
|
|
13767
13776
|
}));
|
|
13768
13777
|
onModelChange?.();
|
|
13769
13778
|
} catch (cause) {
|
|
13770
|
-
setError(messageOf$
|
|
13779
|
+
setError(messageOf$3(cause));
|
|
13771
13780
|
} finally {
|
|
13772
13781
|
setSavingModel(null);
|
|
13773
13782
|
}
|
|
@@ -13776,7 +13785,7 @@ window.__ModuleLoader__.load({
|
|
|
13776
13785
|
try {
|
|
13777
13786
|
setSavingModel(modelId);
|
|
13778
13787
|
setError(null);
|
|
13779
|
-
const updated = await post$
|
|
13788
|
+
const updated = await post$3("/settings", { contextWindowOverrides: { [modelId]: null } });
|
|
13780
13789
|
setStatus(updated);
|
|
13781
13790
|
const model = updated.models.find((entry) => entry.id === modelId);
|
|
13782
13791
|
if (model !== void 0) setContextDrafts((previous) => ({
|
|
@@ -13785,7 +13794,7 @@ window.__ModuleLoader__.load({
|
|
|
13785
13794
|
}));
|
|
13786
13795
|
onModelChange?.();
|
|
13787
13796
|
} catch (cause) {
|
|
13788
|
-
setError(messageOf$
|
|
13797
|
+
setError(messageOf$3(cause));
|
|
13789
13798
|
} finally {
|
|
13790
13799
|
setSavingModel(null);
|
|
13791
13800
|
}
|
|
@@ -13795,21 +13804,21 @@ window.__ModuleLoader__.load({
|
|
|
13795
13804
|
if (ids.length === 0) return;
|
|
13796
13805
|
try {
|
|
13797
13806
|
setError(null);
|
|
13798
|
-
const updated = await post$
|
|
13807
|
+
const updated = await post$3("/settings", { contextWindowOverrides: Object.fromEntries(ids.map((id) => [id, null])) });
|
|
13799
13808
|
setStatus(updated);
|
|
13800
13809
|
setContextDrafts(contextDraftsFor(updated));
|
|
13801
13810
|
onModelChange?.();
|
|
13802
13811
|
} catch (cause) {
|
|
13803
|
-
setError(messageOf$
|
|
13812
|
+
setError(messageOf$3(cause));
|
|
13804
13813
|
}
|
|
13805
13814
|
};
|
|
13806
13815
|
const setDefaultReasoningEffort = async (effort) => {
|
|
13807
13816
|
try {
|
|
13808
13817
|
setBusy("effort");
|
|
13809
13818
|
setError(null);
|
|
13810
|
-
setStatus(await post$
|
|
13819
|
+
setStatus(await post$3("/settings", { defaultReasoningEffort: effort }));
|
|
13811
13820
|
} catch (cause) {
|
|
13812
|
-
setError(messageOf$
|
|
13821
|
+
setError(messageOf$3(cause));
|
|
13813
13822
|
} finally {
|
|
13814
13823
|
setBusy(null);
|
|
13815
13824
|
}
|
|
@@ -13818,9 +13827,9 @@ window.__ModuleLoader__.load({
|
|
|
13818
13827
|
try {
|
|
13819
13828
|
setBusy("cache-params");
|
|
13820
13829
|
setError(null);
|
|
13821
|
-
setStatus(await post$
|
|
13830
|
+
setStatus(await post$3("/settings", { cacheRequestParams: enabled }));
|
|
13822
13831
|
} catch (cause) {
|
|
13823
|
-
setError(messageOf$
|
|
13832
|
+
setError(messageOf$3(cause));
|
|
13824
13833
|
} finally {
|
|
13825
13834
|
setBusy(null);
|
|
13826
13835
|
}
|
|
@@ -13829,9 +13838,9 @@ window.__ModuleLoader__.load({
|
|
|
13829
13838
|
try {
|
|
13830
13839
|
setBusy("quota");
|
|
13831
13840
|
setError(null);
|
|
13832
|
-
setStatus(await post$
|
|
13841
|
+
setStatus(await post$3("/quota", {}));
|
|
13833
13842
|
} catch (cause) {
|
|
13834
|
-
setError(messageOf$
|
|
13843
|
+
setError(messageOf$3(cause));
|
|
13835
13844
|
} finally {
|
|
13836
13845
|
setBusy(null);
|
|
13837
13846
|
}
|
|
@@ -13840,9 +13849,9 @@ window.__ModuleLoader__.load({
|
|
|
13840
13849
|
try {
|
|
13841
13850
|
setBusy("catalog");
|
|
13842
13851
|
setError(null);
|
|
13843
|
-
setStatus(await post$
|
|
13852
|
+
setStatus(await post$3("/catalog/refresh", {}));
|
|
13844
13853
|
} catch (cause) {
|
|
13845
|
-
setError(messageOf$
|
|
13854
|
+
setError(messageOf$3(cause));
|
|
13846
13855
|
} finally {
|
|
13847
13856
|
setBusy(null);
|
|
13848
13857
|
}
|
|
@@ -13851,9 +13860,9 @@ window.__ModuleLoader__.load({
|
|
|
13851
13860
|
try {
|
|
13852
13861
|
setBusy("connection");
|
|
13853
13862
|
setError(null);
|
|
13854
|
-
setConnection(await post$
|
|
13863
|
+
setConnection(await post$3("/connection/test", {}));
|
|
13855
13864
|
} catch (cause) {
|
|
13856
|
-
setError(messageOf$
|
|
13865
|
+
setError(messageOf$3(cause));
|
|
13857
13866
|
} finally {
|
|
13858
13867
|
setBusy(null);
|
|
13859
13868
|
}
|
|
@@ -13885,7 +13894,7 @@ window.__ModuleLoader__.load({
|
|
|
13885
13894
|
try {
|
|
13886
13895
|
setBusy(`quota-credential:${mode}`);
|
|
13887
13896
|
setError(null);
|
|
13888
|
-
setStatus(await post$
|
|
13897
|
+
setStatus(await post$3("/quota/credential", mode === "password" ? {
|
|
13889
13898
|
mode,
|
|
13890
13899
|
account,
|
|
13891
13900
|
password
|
|
@@ -13894,7 +13903,7 @@ window.__ModuleLoader__.load({
|
|
|
13894
13903
|
token
|
|
13895
13904
|
} : { mode }));
|
|
13896
13905
|
} catch (cause) {
|
|
13897
|
-
setError(messageOf$
|
|
13906
|
+
setError(messageOf$3(cause));
|
|
13898
13907
|
} finally {
|
|
13899
13908
|
setQuotaPassword("");
|
|
13900
13909
|
setQuotaToken("");
|
|
@@ -14104,7 +14113,7 @@ window.__ModuleLoader__.load({
|
|
|
14104
14113
|
const { status, loading, busy, error, connection, adoptResult, pasteValue, profile, pasteOpen, contextDrafts, savingModel, quotaAccount, quotaPassword, quotaToken } = state;
|
|
14105
14114
|
const { accounts, models, contextModels, overrideCount, login, quota, authenticated, poolLabels, cache, cacheHitRatio: hitRatio, quotaCredential } = derived;
|
|
14106
14115
|
const { setProfile, login: startLogin, cancelLogin, submitPaste, setPasteValue, togglePaste, adopt, clearAdoptResult, accountAction, setStrategy, toggleModel, setAllModels, saveContextWindow, resetContextWindow, resetAllContextWindows, updateContextDraft, setDefaultReasoningEffort, setCacheRequestParams, refreshQuota, refreshCatalog, testConnection, setQuotaAccount, setQuotaPassword, setQuotaToken, submitQuotaPassword, submitQuotaToken, clearQuotaCredential } = actions;
|
|
14107
|
-
const t = useLineDict(NS_STEP_CODE, zh$
|
|
14116
|
+
const t = useLineDict(NS_STEP_CODE, zh$9);
|
|
14108
14117
|
if (loading) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
14109
14118
|
className: "dsha-page",
|
|
14110
14119
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -14894,7 +14903,7 @@ window.__ModuleLoader__.load({
|
|
|
14894
14903
|
}
|
|
14895
14904
|
//#endregion
|
|
14896
14905
|
//#region src/client/cline-pass/api.ts
|
|
14897
|
-
const api$
|
|
14906
|
+
const api$10 = createLineApi(CLINE_PASS_ROUTE_PREFIX, "Cline Pass");
|
|
14898
14907
|
/**
|
|
14899
14908
|
* Whether the host is refreshing the quota behind this answer.
|
|
14900
14909
|
*
|
|
@@ -14925,62 +14934,62 @@ window.__ModuleLoader__.load({
|
|
|
14925
14934
|
* raw quota payload.
|
|
14926
14935
|
*/
|
|
14927
14936
|
status(refresh = false) {
|
|
14928
|
-
if (!refresh) return api$
|
|
14929
|
-
return api$
|
|
14937
|
+
if (!refresh) return api$10.get("/status");
|
|
14938
|
+
return api$10.post("/usage", {}).then((outcome) => outcome.status);
|
|
14930
14939
|
}
|
|
14931
14940
|
updateSettings(patch) {
|
|
14932
|
-
return api$
|
|
14941
|
+
return api$10.post("/settings", patch).then(() => this.status());
|
|
14933
14942
|
}
|
|
14934
14943
|
accountAction(action, body = {}) {
|
|
14935
|
-
return api$
|
|
14944
|
+
return api$10.post("/accounts", {
|
|
14936
14945
|
action,
|
|
14937
14946
|
...body
|
|
14938
14947
|
});
|
|
14939
14948
|
}
|
|
14940
14949
|
/** Verify a key without storing it; the host answers the verdict directly. */
|
|
14941
14950
|
testKey(body) {
|
|
14942
|
-
return api$
|
|
14951
|
+
return api$10.post("/accounts", {
|
|
14943
14952
|
action: "test",
|
|
14944
14953
|
...body
|
|
14945
14954
|
});
|
|
14946
14955
|
}
|
|
14947
14956
|
/** Start the Cline device-code sign-in. */
|
|
14948
14957
|
startLogin() {
|
|
14949
|
-
return api$
|
|
14958
|
+
return api$10.post("/login/start", {});
|
|
14950
14959
|
}
|
|
14951
14960
|
/** One poll of the pending sign-in; the host throttles it to WorkOS's interval. */
|
|
14952
14961
|
loginStatus(id) {
|
|
14953
|
-
return api$
|
|
14962
|
+
return api$10.get(`/login/status?id=${encodeURIComponent(id)}`);
|
|
14954
14963
|
}
|
|
14955
14964
|
cancelLogin(id) {
|
|
14956
|
-
return api$
|
|
14965
|
+
return api$10.post("/login/cancel", { id });
|
|
14957
14966
|
}
|
|
14958
14967
|
setEnabledModels(enabledModelIds) {
|
|
14959
|
-
return api$
|
|
14968
|
+
return api$10.post("/models", { enabledModelIds });
|
|
14960
14969
|
}
|
|
14961
14970
|
setContextWindow(model, contextWindow) {
|
|
14962
|
-
return api$
|
|
14971
|
+
return api$10.post("/models/context-window", {
|
|
14963
14972
|
model,
|
|
14964
14973
|
contextWindow
|
|
14965
14974
|
});
|
|
14966
14975
|
}
|
|
14967
14976
|
test(model) {
|
|
14968
|
-
return api$
|
|
14977
|
+
return api$10.post("/models/test", { model });
|
|
14969
14978
|
}
|
|
14970
14979
|
setVisibility(model, visible) {
|
|
14971
|
-
return api$
|
|
14980
|
+
return api$10.post("/models/visibility", {
|
|
14972
14981
|
model,
|
|
14973
14982
|
visible
|
|
14974
14983
|
});
|
|
14975
14984
|
}
|
|
14976
14985
|
setVisibilityAll(mode) {
|
|
14977
|
-
return api$
|
|
14986
|
+
return api$10.post("/models/visibility-all", { mode });
|
|
14978
14987
|
}
|
|
14979
14988
|
refreshCatalog() {
|
|
14980
|
-
return api$
|
|
14989
|
+
return api$10.post("/catalog/refresh", {});
|
|
14981
14990
|
}
|
|
14982
14991
|
searchCatalog(query) {
|
|
14983
|
-
return api$
|
|
14992
|
+
return api$10.get("/catalog/search?q=" + encodeURIComponent(query));
|
|
14984
14993
|
}
|
|
14985
14994
|
/**
|
|
14986
14995
|
* Add one search hit.
|
|
@@ -14989,26 +14998,26 @@ window.__ModuleLoader__.load({
|
|
|
14989
14998
|
* refuses it until the caller acknowledges that (`acknowledgeBilling`).
|
|
14990
14999
|
*/
|
|
14991
15000
|
addCatalogModel(model, acknowledgeBilling = false) {
|
|
14992
|
-
return api$
|
|
15001
|
+
return api$10.post("/catalog/add", acknowledgeBilling ? {
|
|
14993
15002
|
model,
|
|
14994
15003
|
acknowledgeBilling: true
|
|
14995
15004
|
} : { model });
|
|
14996
15005
|
}
|
|
14997
15006
|
readUsage() {
|
|
14998
|
-
return api$
|
|
15007
|
+
return api$10.post("/usage", {});
|
|
14999
15008
|
}
|
|
15000
15009
|
history(limit = 25, model = "") {
|
|
15001
15010
|
const query = new URLSearchParams({
|
|
15002
15011
|
limit: String(limit),
|
|
15003
15012
|
...model === "" ? {} : { model }
|
|
15004
15013
|
});
|
|
15005
|
-
return api$
|
|
15014
|
+
return api$10.get("/history?" + query.toString());
|
|
15006
15015
|
}
|
|
15007
15016
|
};
|
|
15008
15017
|
//#endregion
|
|
15009
15018
|
//#region src/client/cline-pass/locales.ts
|
|
15010
15019
|
const NS_CLINE_PASS = "dsh-cline-pass";
|
|
15011
|
-
const zh$
|
|
15020
|
+
const zh$8 = {
|
|
15012
15021
|
...accountPoolZh,
|
|
15013
15022
|
relogin: "重新登录",
|
|
15014
15023
|
needsRelogin: "登录已失效",
|
|
@@ -15132,7 +15141,7 @@ window.__ModuleLoader__.load({
|
|
|
15132
15141
|
limitRoute: "模型路由按 provider id 抢占:若已有其他插件占用 cline-pass,本卡仍可配置,但请求由对方服务。",
|
|
15133
15142
|
limitQuota: "额度窗口来自网关的 usage-limits 接口;接口失败时卡片保留上一次读数并显示原因。"
|
|
15134
15143
|
};
|
|
15135
|
-
const en$
|
|
15144
|
+
const en$8 = {
|
|
15136
15145
|
...accountPoolEn,
|
|
15137
15146
|
relogin: "Sign in again",
|
|
15138
15147
|
needsRelogin: "Sign-in expired",
|
|
@@ -15256,11 +15265,11 @@ window.__ModuleLoader__.load({
|
|
|
15256
15265
|
limitRoute: "The route is claimed by provider id: if another plugin already serves cline-pass, this card still configures the line but that provider answers the requests.",
|
|
15257
15266
|
limitQuota: "Quota windows come from the gateway usage-limits endpoint; when it fails the card keeps the previous reading and says why."
|
|
15258
15267
|
};
|
|
15259
|
-
const dictionaries$
|
|
15260
|
-
zh: zh$
|
|
15261
|
-
"zh-CN": zh$
|
|
15262
|
-
en: en$
|
|
15263
|
-
"en-US": en$
|
|
15268
|
+
const dictionaries$8 = {
|
|
15269
|
+
zh: zh$8,
|
|
15270
|
+
"zh-CN": zh$8,
|
|
15271
|
+
en: en$8,
|
|
15272
|
+
"en-US": en$8
|
|
15264
15273
|
};
|
|
15265
15274
|
//#endregion
|
|
15266
15275
|
//#region src/client/cline-pass/ClinePassSection.tsx
|
|
@@ -15379,10 +15388,10 @@ window.__ModuleLoader__.load({
|
|
|
15379
15388
|
API$5.loginStatus(flow.id).then((next) => {
|
|
15380
15389
|
setLoginFlow(next);
|
|
15381
15390
|
if (next.status === "complete") {
|
|
15382
|
-
setNotice(zh$
|
|
15391
|
+
setNotice(zh$8.loginComplete.replace("{account}", next.accountAlias === "" ? "Cline Pass" : next.accountAlias));
|
|
15383
15392
|
setShowKeyForm(false);
|
|
15384
15393
|
loadStatus();
|
|
15385
|
-
} else if (next.status === "failed") setError(zh$
|
|
15394
|
+
} else if (next.status === "failed") setError(zh$8.loginFailed.replace("{detail}", next.error));
|
|
15386
15395
|
}).catch((cause) => setError(detail$1(cause)));
|
|
15387
15396
|
}, Math.max(2, flow.intervalSeconds) * 1e3);
|
|
15388
15397
|
return () => window.clearInterval(timer);
|
|
@@ -15456,7 +15465,7 @@ window.__ModuleLoader__.load({
|
|
|
15456
15465
|
apiKey: trimmed,
|
|
15457
15466
|
...keyBaseURL.trim() === "" ? {} : { baseURL: keyBaseURL.trim() }
|
|
15458
15467
|
}).then((result) => {
|
|
15459
|
-
setNotice(result.authorized ? zh$
|
|
15468
|
+
setNotice(result.authorized ? zh$8.keyTestOk.replace("{ms}", String(Math.round(result.ms))) : zh$8.keyTestFailed.replace("{detail}", result.error));
|
|
15460
15469
|
}).catch((cause) => setError(detail$1(cause))).finally(() => setBusy(null));
|
|
15461
15470
|
}, [key, keyBaseURL]);
|
|
15462
15471
|
const testStored = (0, react.useCallback)((accountId) => {
|
|
@@ -15464,7 +15473,7 @@ window.__ModuleLoader__.load({
|
|
|
15464
15473
|
setError(null);
|
|
15465
15474
|
setNotice(null);
|
|
15466
15475
|
API$5.testKey({ accountId }).then((result) => {
|
|
15467
|
-
setNotice(result.authorized ? zh$
|
|
15476
|
+
setNotice(result.authorized ? zh$8.keyTestOk.replace("{ms}", String(Math.round(result.ms))) : zh$8.keyTestFailed.replace("{detail}", result.error));
|
|
15468
15477
|
}).catch((cause) => setError(detail$1(cause))).finally(() => setBusy(null));
|
|
15469
15478
|
}, []);
|
|
15470
15479
|
const enabledModels = (0, react.useMemo)(() => (status?.models ?? []).filter((model) => model.enabled), [status]);
|
|
@@ -15490,7 +15499,7 @@ window.__ModuleLoader__.load({
|
|
|
15490
15499
|
if (model === void 0) return;
|
|
15491
15500
|
const parsed = parsePositiveCapacity$1(drafts[id] ?? formatCapacity$1(model.contextWindow));
|
|
15492
15501
|
if (parsed === null) {
|
|
15493
|
-
setError(zh$
|
|
15502
|
+
setError(zh$8.error.replace("{detail}", zh$8.defaultContextWindow));
|
|
15494
15503
|
return;
|
|
15495
15504
|
}
|
|
15496
15505
|
run("ctx:" + id, () => API$5.setContextWindow(id, parsed));
|
|
@@ -15512,7 +15521,7 @@ window.__ModuleLoader__.load({
|
|
|
15512
15521
|
}, [run, status]);
|
|
15513
15522
|
const resetAllContext = (0, react.useCallback)(() => {
|
|
15514
15523
|
if (status === null) return;
|
|
15515
|
-
if (typeof window !== "undefined" && !window.confirm(zh$
|
|
15524
|
+
if (typeof window !== "undefined" && !window.confirm(zh$8.contextResetAll)) return;
|
|
15516
15525
|
const overridden = status.models.filter((model) => model.contextWindowOverride !== void 0);
|
|
15517
15526
|
run("ctx-all", async () => {
|
|
15518
15527
|
let next = status;
|
|
@@ -15553,7 +15562,7 @@ window.__ModuleLoader__.load({
|
|
|
15553
15562
|
const refreshUsage = (0, react.useCallback)(() => {
|
|
15554
15563
|
run("usage", async () => {
|
|
15555
15564
|
const outcome = await API$5.readUsage();
|
|
15556
|
-
setNotice(outcome.usage.accounts.some((account) => account.ok) ? "" : zh$
|
|
15565
|
+
setNotice(outcome.usage.accounts.some((account) => account.ok) ? "" : zh$8.usageEmpty);
|
|
15557
15566
|
return outcome.status;
|
|
15558
15567
|
});
|
|
15559
15568
|
}, [run]);
|
|
@@ -15573,7 +15582,7 @@ window.__ModuleLoader__.load({
|
|
|
15573
15582
|
};
|
|
15574
15583
|
const invalid = Object.entries(numbers).find(([, value]) => !Number.isSafeInteger(value) || value < 0);
|
|
15575
15584
|
if (invalid !== void 0) {
|
|
15576
|
-
setError(zh$
|
|
15585
|
+
setError(zh$8.error.replace("{detail}", invalid[0]));
|
|
15577
15586
|
return;
|
|
15578
15587
|
}
|
|
15579
15588
|
setBusy("settings");
|
|
@@ -15584,7 +15593,7 @@ window.__ModuleLoader__.load({
|
|
|
15584
15593
|
}).then((next) => {
|
|
15585
15594
|
applyStatus(next);
|
|
15586
15595
|
setSettingsForm(settingsFormOf$1(next));
|
|
15587
|
-
setNotice(zh$
|
|
15596
|
+
setNotice(zh$8.saved);
|
|
15588
15597
|
}).catch((cause) => setError(detail$1(cause))).finally(() => setBusy(null));
|
|
15589
15598
|
}, [settingsForm, applyStatus]);
|
|
15590
15599
|
const toggleTools = (0, react.useCallback)(() => {
|
|
@@ -15595,10 +15604,10 @@ window.__ModuleLoader__.load({
|
|
|
15595
15604
|
API$5.updateSettings({ exposeTools: value }).then((next) => {
|
|
15596
15605
|
applyStatus(next);
|
|
15597
15606
|
setSettingsForm(settingsFormOf$1(next));
|
|
15598
|
-
setNotice(zh$
|
|
15607
|
+
setNotice(zh$8.restartRequired);
|
|
15599
15608
|
}).catch((cause) => setError(detail$1(cause))).finally(() => setBusy(null));
|
|
15600
15609
|
}, [status, applyStatus]);
|
|
15601
|
-
const t = useLineDict(NS_CLINE_PASS, zh$
|
|
15610
|
+
const t = useLineDict(NS_CLINE_PASS, zh$8);
|
|
15602
15611
|
const errorPrefix = t.error.split("{detail}")[0] ?? "";
|
|
15603
15612
|
const pool = status?.pool;
|
|
15604
15613
|
const accounts = (0, react.useMemo)(() => {
|
|
@@ -16373,7 +16382,7 @@ window.__ModuleLoader__.load({
|
|
|
16373
16382
|
* 'settings.section' 上的那张座位(那张座绑定的是 ChatGPT 的键集)。
|
|
16374
16383
|
*/
|
|
16375
16384
|
const NS_QODER = "dsh-qoder";
|
|
16376
|
-
const zh$
|
|
16385
|
+
const zh$7 = {
|
|
16377
16386
|
modelRowEfforts: "档位 {list}",
|
|
16378
16387
|
modelRowNoEfforts: "无档位",
|
|
16379
16388
|
modelRowOutput: "输出 {cap}",
|
|
@@ -16497,8 +16506,8 @@ window.__ModuleLoader__.load({
|
|
|
16497
16506
|
quotaWindow: "额度窗口"
|
|
16498
16507
|
};
|
|
16499
16508
|
/** 两套字典。 */
|
|
16500
|
-
const dictionaries$
|
|
16501
|
-
zh: zh$
|
|
16509
|
+
const dictionaries$7 = {
|
|
16510
|
+
zh: zh$7,
|
|
16502
16511
|
en: {
|
|
16503
16512
|
modelRowEfforts: "efforts {list}",
|
|
16504
16513
|
modelRowNoEfforts: "no efforts",
|
|
@@ -16675,10 +16684,10 @@ window.__ModuleLoader__.load({
|
|
|
16675
16684
|
* 凭据边界也写在这里:/login/manual 的请求体是本文件里**唯一**带秘密的形状,
|
|
16676
16685
|
* 它只在这个函数调用点的字面量里出现,既不进 URL、也不进日志。
|
|
16677
16686
|
*/
|
|
16678
|
-
const api$
|
|
16679
|
-
const get$
|
|
16680
|
-
const post$
|
|
16681
|
-
function messageOf$
|
|
16687
|
+
const api$9 = createLineApi(QODER_ROUTE_PREFIX, QODER_PROVIDER_NAME);
|
|
16688
|
+
const get$2 = api$9.get;
|
|
16689
|
+
const post$2 = api$9.post;
|
|
16690
|
+
function messageOf$2(cause) {
|
|
16682
16691
|
return cause instanceof Error ? cause.message : String(cause);
|
|
16683
16692
|
}
|
|
16684
16693
|
//#endregion
|
|
@@ -16699,7 +16708,7 @@ window.__ModuleLoader__.load({
|
|
|
16699
16708
|
/** 登录状态机的轮询节奏。真实超时与间隔由 host 拥有,卡片只是跟随。 */
|
|
16700
16709
|
const LOGIN_POLL_INTERVAL_MS = 2e3;
|
|
16701
16710
|
/** 本卡片的字典;身份稳定,依赖它的 effect 才不会每次渲染重建。 */
|
|
16702
|
-
const fallbackTranslate$4 = (key) => zh$
|
|
16711
|
+
const fallbackTranslate$4 = (key) => zh$7[key];
|
|
16703
16712
|
/**
|
|
16704
16713
|
* 共享账号池卡片需要的标签集,按本卡片的字典逐键查出来。
|
|
16705
16714
|
*
|
|
@@ -16838,7 +16847,7 @@ window.__ModuleLoader__.load({
|
|
|
16838
16847
|
if (catalogPullAttempted.current) return;
|
|
16839
16848
|
catalogPullAttempted.current = true;
|
|
16840
16849
|
try {
|
|
16841
|
-
const next = await post$
|
|
16850
|
+
const next = await post$2("/catalog/refresh", {});
|
|
16842
16851
|
setStatus(next);
|
|
16843
16852
|
setContextDrafts(contextDraftsFor(next));
|
|
16844
16853
|
} catch {}
|
|
@@ -16846,7 +16855,7 @@ window.__ModuleLoader__.load({
|
|
|
16846
16855
|
const loadStatus = (0, react.useCallback)(async (quiet = false) => {
|
|
16847
16856
|
if (!quiet) setError(null);
|
|
16848
16857
|
try {
|
|
16849
|
-
const next = await get$
|
|
16858
|
+
const next = await get$2("/status");
|
|
16850
16859
|
setStatus(next);
|
|
16851
16860
|
setContextDrafts(contextDraftsFor(next));
|
|
16852
16861
|
if (!regionTouched.current && isQoderRegion(next.region)) setRegionState(next.region);
|
|
@@ -16856,7 +16865,7 @@ window.__ModuleLoader__.load({
|
|
|
16856
16865
|
});
|
|
16857
16866
|
if (next.catalogRefreshing === true) pullCatalogQuietly();
|
|
16858
16867
|
} catch (cause) {
|
|
16859
|
-
if (!quiet) setError(messageOf$
|
|
16868
|
+
if (!quiet) setError(messageOf$2(cause));
|
|
16860
16869
|
} finally {
|
|
16861
16870
|
setLoading(false);
|
|
16862
16871
|
}
|
|
@@ -16881,7 +16890,7 @@ window.__ModuleLoader__.load({
|
|
|
16881
16890
|
const timer = window.setInterval(() => {
|
|
16882
16891
|
(async () => {
|
|
16883
16892
|
try {
|
|
16884
|
-
const poll = await get$
|
|
16893
|
+
const poll = await get$2("/login/status");
|
|
16885
16894
|
if (stopped) return;
|
|
16886
16895
|
if (poll.status === "complete") {
|
|
16887
16896
|
setPasteValue("");
|
|
@@ -16914,13 +16923,13 @@ window.__ModuleLoader__.load({
|
|
|
16914
16923
|
setError(null);
|
|
16915
16924
|
setConnection(null);
|
|
16916
16925
|
setPasteValue("");
|
|
16917
|
-
const flow = await post$
|
|
16926
|
+
const flow = await post$2("/login/start", { region: loginRegion });
|
|
16918
16927
|
await loadStatus(true);
|
|
16919
16928
|
if (flow.authorizeUrl !== void 0 && flow.authorizeUrl !== "") try {
|
|
16920
16929
|
window.open(flow.authorizeUrl, "_blank", "noopener,noreferrer");
|
|
16921
16930
|
} catch {}
|
|
16922
16931
|
} catch (cause) {
|
|
16923
|
-
setError(messageOf$
|
|
16932
|
+
setError(messageOf$2(cause));
|
|
16924
16933
|
} finally {
|
|
16925
16934
|
setBusy(null);
|
|
16926
16935
|
}
|
|
@@ -16929,10 +16938,10 @@ window.__ModuleLoader__.load({
|
|
|
16929
16938
|
try {
|
|
16930
16939
|
setBusy("login:cancel");
|
|
16931
16940
|
setError(null);
|
|
16932
|
-
await post$
|
|
16941
|
+
await post$2("/login/cancel", {});
|
|
16933
16942
|
await loadStatus(true);
|
|
16934
16943
|
} catch (cause) {
|
|
16935
|
-
setError(messageOf$
|
|
16944
|
+
setError(messageOf$2(cause));
|
|
16936
16945
|
} finally {
|
|
16937
16946
|
setBusy(null);
|
|
16938
16947
|
}
|
|
@@ -16946,13 +16955,13 @@ window.__ModuleLoader__.load({
|
|
|
16946
16955
|
try {
|
|
16947
16956
|
setBusy("login-manual");
|
|
16948
16957
|
setError(null);
|
|
16949
|
-
setStatus(await post$
|
|
16958
|
+
setStatus(await post$2("/login/manual", {
|
|
16950
16959
|
region,
|
|
16951
16960
|
token
|
|
16952
16961
|
}));
|
|
16953
16962
|
onModelChange?.();
|
|
16954
16963
|
} catch (cause) {
|
|
16955
|
-
setError(messageOf$
|
|
16964
|
+
setError(messageOf$2(cause));
|
|
16956
16965
|
} finally {
|
|
16957
16966
|
setPasteValue("");
|
|
16958
16967
|
setBusy(null);
|
|
@@ -16962,12 +16971,12 @@ window.__ModuleLoader__.load({
|
|
|
16962
16971
|
try {
|
|
16963
16972
|
setBusy("adopt");
|
|
16964
16973
|
setError(null);
|
|
16965
|
-
const result = await post$
|
|
16974
|
+
const result = await post$2("/adopt", {});
|
|
16966
16975
|
setAdoptResult(result);
|
|
16967
16976
|
await loadStatus(true);
|
|
16968
16977
|
if (result.adopted) onModelChange?.();
|
|
16969
16978
|
} catch (cause) {
|
|
16970
|
-
setError(messageOf$
|
|
16979
|
+
setError(messageOf$2(cause));
|
|
16971
16980
|
} finally {
|
|
16972
16981
|
setBusy(null);
|
|
16973
16982
|
}
|
|
@@ -16976,13 +16985,13 @@ window.__ModuleLoader__.load({
|
|
|
16976
16985
|
try {
|
|
16977
16986
|
setBusy("account:" + action + ":" + accountId);
|
|
16978
16987
|
setError(null);
|
|
16979
|
-
setStatus(await post$
|
|
16988
|
+
setStatus(await post$2("/accounts", {
|
|
16980
16989
|
action,
|
|
16981
16990
|
accountId
|
|
16982
16991
|
}));
|
|
16983
16992
|
onModelChange?.();
|
|
16984
16993
|
} catch (cause) {
|
|
16985
|
-
setError(messageOf$
|
|
16994
|
+
setError(messageOf$2(cause));
|
|
16986
16995
|
} finally {
|
|
16987
16996
|
setBusy(null);
|
|
16988
16997
|
}
|
|
@@ -16991,12 +17000,12 @@ window.__ModuleLoader__.load({
|
|
|
16991
17000
|
try {
|
|
16992
17001
|
setBusy("strategy");
|
|
16993
17002
|
setError(null);
|
|
16994
|
-
setStatus(await post$
|
|
17003
|
+
setStatus(await post$2("/accounts", {
|
|
16995
17004
|
action: "strategy",
|
|
16996
17005
|
strategy
|
|
16997
17006
|
}));
|
|
16998
17007
|
} catch (cause) {
|
|
16999
|
-
setError(messageOf$
|
|
17008
|
+
setError(messageOf$2(cause));
|
|
17000
17009
|
} finally {
|
|
17001
17010
|
setBusy(null);
|
|
17002
17011
|
}
|
|
@@ -17011,12 +17020,12 @@ window.__ModuleLoader__.load({
|
|
|
17011
17020
|
const applyEnabledModels = async (enabledModelIds) => {
|
|
17012
17021
|
try {
|
|
17013
17022
|
setError(null);
|
|
17014
|
-
const updated = await post$
|
|
17023
|
+
const updated = await post$2("/settings", { enabledModelIds });
|
|
17015
17024
|
setStatus(updated);
|
|
17016
17025
|
setContextDrafts(contextDraftsFor(updated));
|
|
17017
17026
|
onModelChange?.();
|
|
17018
17027
|
} catch (cause) {
|
|
17019
|
-
setError(messageOf$
|
|
17028
|
+
setError(messageOf$2(cause));
|
|
17020
17029
|
}
|
|
17021
17030
|
};
|
|
17022
17031
|
const toggleModel = (modelId, enabled) => {
|
|
@@ -17039,14 +17048,14 @@ window.__ModuleLoader__.load({
|
|
|
17039
17048
|
try {
|
|
17040
17049
|
setSavingModel(modelId);
|
|
17041
17050
|
setError(null);
|
|
17042
|
-
setStatus(await post$
|
|
17051
|
+
setStatus(await post$2("/settings", { contextWindowOverrides: { [modelId]: parsed } }));
|
|
17043
17052
|
setContextDrafts((previous) => ({
|
|
17044
17053
|
...previous,
|
|
17045
17054
|
[modelId]: formatCapacity$1(parsed)
|
|
17046
17055
|
}));
|
|
17047
17056
|
onModelChange?.();
|
|
17048
17057
|
} catch (cause) {
|
|
17049
|
-
setError(messageOf$
|
|
17058
|
+
setError(messageOf$2(cause));
|
|
17050
17059
|
} finally {
|
|
17051
17060
|
setSavingModel(null);
|
|
17052
17061
|
}
|
|
@@ -17055,7 +17064,7 @@ window.__ModuleLoader__.load({
|
|
|
17055
17064
|
try {
|
|
17056
17065
|
setSavingModel(modelId);
|
|
17057
17066
|
setError(null);
|
|
17058
|
-
const updated = await post$
|
|
17067
|
+
const updated = await post$2("/settings", { contextWindowOverrides: { [modelId]: null } });
|
|
17059
17068
|
setStatus(updated);
|
|
17060
17069
|
const model = updated.models.find((entry) => entry.id === modelId);
|
|
17061
17070
|
if (model !== void 0) setContextDrafts((previous) => ({
|
|
@@ -17064,7 +17073,7 @@ window.__ModuleLoader__.load({
|
|
|
17064
17073
|
}));
|
|
17065
17074
|
onModelChange?.();
|
|
17066
17075
|
} catch (cause) {
|
|
17067
|
-
setError(messageOf$
|
|
17076
|
+
setError(messageOf$2(cause));
|
|
17068
17077
|
} finally {
|
|
17069
17078
|
setSavingModel(null);
|
|
17070
17079
|
}
|
|
@@ -17074,21 +17083,21 @@ window.__ModuleLoader__.load({
|
|
|
17074
17083
|
if (ids.length === 0) return;
|
|
17075
17084
|
try {
|
|
17076
17085
|
setError(null);
|
|
17077
|
-
const updated = await post$
|
|
17086
|
+
const updated = await post$2("/settings", { contextWindowOverrides: Object.fromEntries(ids.map((id) => [id, null])) });
|
|
17078
17087
|
setStatus(updated);
|
|
17079
17088
|
setContextDrafts(contextDraftsFor(updated));
|
|
17080
17089
|
onModelChange?.();
|
|
17081
17090
|
} catch (cause) {
|
|
17082
|
-
setError(messageOf$
|
|
17091
|
+
setError(messageOf$2(cause));
|
|
17083
17092
|
}
|
|
17084
17093
|
};
|
|
17085
17094
|
const setDefaultReasoningEffort = async (effort) => {
|
|
17086
17095
|
try {
|
|
17087
17096
|
setBusy("effort");
|
|
17088
17097
|
setError(null);
|
|
17089
|
-
setStatus(await post$
|
|
17098
|
+
setStatus(await post$2("/settings", { defaultReasoningEffort: effort }));
|
|
17090
17099
|
} catch (cause) {
|
|
17091
|
-
setError(messageOf$
|
|
17100
|
+
setError(messageOf$2(cause));
|
|
17092
17101
|
} finally {
|
|
17093
17102
|
setBusy(null);
|
|
17094
17103
|
}
|
|
@@ -17097,9 +17106,9 @@ window.__ModuleLoader__.load({
|
|
|
17097
17106
|
try {
|
|
17098
17107
|
setBusy("quota");
|
|
17099
17108
|
setError(null);
|
|
17100
|
-
setStatus(await post$
|
|
17109
|
+
setStatus(await post$2("/quota", {}));
|
|
17101
17110
|
} catch (cause) {
|
|
17102
|
-
setError(messageOf$
|
|
17111
|
+
setError(messageOf$2(cause));
|
|
17103
17112
|
} finally {
|
|
17104
17113
|
setBusy(null);
|
|
17105
17114
|
}
|
|
@@ -17108,9 +17117,9 @@ window.__ModuleLoader__.load({
|
|
|
17108
17117
|
try {
|
|
17109
17118
|
setBusy("catalog");
|
|
17110
17119
|
setError(null);
|
|
17111
|
-
setStatus(await post$
|
|
17120
|
+
setStatus(await post$2("/catalog/refresh", {}));
|
|
17112
17121
|
} catch (cause) {
|
|
17113
|
-
setError(messageOf$
|
|
17122
|
+
setError(messageOf$2(cause));
|
|
17114
17123
|
} finally {
|
|
17115
17124
|
setBusy(null);
|
|
17116
17125
|
}
|
|
@@ -17119,9 +17128,9 @@ window.__ModuleLoader__.load({
|
|
|
17119
17128
|
try {
|
|
17120
17129
|
setBusy("connection");
|
|
17121
17130
|
setError(null);
|
|
17122
|
-
setConnection(await post$
|
|
17131
|
+
setConnection(await post$2("/connection/test", {}));
|
|
17123
17132
|
} catch (cause) {
|
|
17124
|
-
setError(messageOf$
|
|
17133
|
+
setError(messageOf$2(cause));
|
|
17125
17134
|
} finally {
|
|
17126
17135
|
setBusy(null);
|
|
17127
17136
|
}
|
|
@@ -17265,7 +17274,7 @@ window.__ModuleLoader__.load({
|
|
|
17265
17274
|
* `defaultMaxTokens`),客户端不按模型名推断任何一项。与 OpenDesign 卡同一写法:
|
|
17266
17275
|
* 数据一行,散文进折叠区。
|
|
17267
17276
|
*/
|
|
17268
|
-
function qoderModelRowHint(model, t = zh$
|
|
17277
|
+
function qoderModelRowHint(model, t = zh$7) {
|
|
17269
17278
|
return `${formatTokenCount(model.contextWindow)} · ${model.supportsImages ? "text+image" : "text"} · ${model.reasoningEfforts.length === 0 ? t.modelRowNoEfforts : t.modelRowEfforts.replace("{list}", model.reasoningEfforts.join("/"))} · ${t.modelRowOutput.replace("{cap}", formatTokenCount(model.defaultMaxTokens))}`;
|
|
17270
17279
|
}
|
|
17271
17280
|
function QoderSection({ onModelChange } = {}) {
|
|
@@ -17273,7 +17282,7 @@ window.__ModuleLoader__.load({
|
|
|
17273
17282
|
const { status, loading, busy, error, connection, adoptResult, pasteValue, region, pasteOpen, contextDrafts, savingModel } = state;
|
|
17274
17283
|
const { accounts, models, contextModels, overrideCount, login, quota, authenticated, poolLabels, cache, cacheHitRatio: hitRatio } = derived;
|
|
17275
17284
|
const { setRegion, login: startLogin, cancelLogin, submitPaste, setPasteValue, togglePaste, adopt, clearAdoptResult, accountAction, setStrategy, toggleModel, setAllModels, saveContextWindow, resetContextWindow, resetAllContextWindows, updateContextDraft, setDefaultReasoningEffort, refreshQuota, refreshCatalog, testConnection } = actions;
|
|
17276
|
-
const t = useLineDict(NS_QODER, zh$
|
|
17285
|
+
const t = useLineDict(NS_QODER, zh$7);
|
|
17277
17286
|
if (loading) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
17278
17287
|
className: "dsha-page",
|
|
17279
17288
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -17802,7 +17811,7 @@ window.__ModuleLoader__.load({
|
|
|
17802
17811
|
const OPENDESIGN_ROUTE_PREFIX = "/opendesign/api";
|
|
17803
17812
|
//#endregion
|
|
17804
17813
|
//#region src/client/opendesign/api.ts
|
|
17805
|
-
const api$
|
|
17814
|
+
const api$8 = createLineApi(OPENDESIGN_ROUTE_PREFIX, "OpenDesign");
|
|
17806
17815
|
/**
|
|
17807
17816
|
* The OpenDesign settings API, as the card uses it.
|
|
17808
17817
|
*
|
|
@@ -17811,65 +17820,65 @@ window.__ModuleLoader__.load({
|
|
|
17811
17820
|
*/
|
|
17812
17821
|
var OpenDesignApi = class {
|
|
17813
17822
|
status() {
|
|
17814
|
-
return api$
|
|
17823
|
+
return api$8.get("/status");
|
|
17815
17824
|
}
|
|
17816
17825
|
updateSettings(patch) {
|
|
17817
|
-
return api$
|
|
17826
|
+
return api$8.post("/settings", patch).then(() => this.status());
|
|
17818
17827
|
}
|
|
17819
17828
|
accountAction(action, body = {}) {
|
|
17820
|
-
return api$
|
|
17829
|
+
return api$8.post("/accounts", {
|
|
17821
17830
|
action,
|
|
17822
17831
|
...body
|
|
17823
17832
|
});
|
|
17824
17833
|
}
|
|
17825
17834
|
/** Verify a key without storing it; the host answers the verdict directly. */
|
|
17826
17835
|
testKey(body) {
|
|
17827
|
-
return api$
|
|
17836
|
+
return api$8.post("/accounts", {
|
|
17828
17837
|
action: "test",
|
|
17829
17838
|
...body
|
|
17830
17839
|
});
|
|
17831
17840
|
}
|
|
17832
17841
|
/** Start the browser device-authorization sign-in. */
|
|
17833
17842
|
startLogin() {
|
|
17834
|
-
return api$
|
|
17843
|
+
return api$8.post("/login/start", {});
|
|
17835
17844
|
}
|
|
17836
17845
|
/** One poll of the pending sign-in; the host throttles it to the advertised interval. */
|
|
17837
17846
|
loginStatus(id) {
|
|
17838
|
-
return api$
|
|
17847
|
+
return api$8.get(`/login/status?id=${encodeURIComponent(id)}`);
|
|
17839
17848
|
}
|
|
17840
17849
|
cancelLogin(id) {
|
|
17841
|
-
return api$
|
|
17850
|
+
return api$8.post("/login/cancel", { id });
|
|
17842
17851
|
}
|
|
17843
17852
|
/** Read each OAuth account's wallet balance once (one upstream call per account). */
|
|
17844
17853
|
readUsage() {
|
|
17845
|
-
return api$
|
|
17854
|
+
return api$8.post("/usage", {});
|
|
17846
17855
|
}
|
|
17847
17856
|
setEnabledModels(enabledModelIds) {
|
|
17848
|
-
return api$
|
|
17857
|
+
return api$8.post("/models", { enabledModelIds });
|
|
17849
17858
|
}
|
|
17850
17859
|
setContextWindow(model, contextWindow) {
|
|
17851
|
-
return api$
|
|
17860
|
+
return api$8.post("/models/context-window", {
|
|
17852
17861
|
model,
|
|
17853
17862
|
contextWindow
|
|
17854
17863
|
});
|
|
17855
17864
|
}
|
|
17856
17865
|
setVisibility(model, visible) {
|
|
17857
|
-
return api$
|
|
17866
|
+
return api$8.post("/models/visibility", {
|
|
17858
17867
|
model,
|
|
17859
17868
|
visible
|
|
17860
17869
|
});
|
|
17861
17870
|
}
|
|
17862
17871
|
setVisibilityAll(mode) {
|
|
17863
|
-
return api$
|
|
17872
|
+
return api$8.post("/models/visibility-all", { mode });
|
|
17864
17873
|
}
|
|
17865
17874
|
refreshCatalog() {
|
|
17866
|
-
return api$
|
|
17875
|
+
return api$8.post("/catalog/refresh", {});
|
|
17867
17876
|
}
|
|
17868
17877
|
};
|
|
17869
17878
|
//#endregion
|
|
17870
17879
|
//#region src/client/opendesign/locales.ts
|
|
17871
17880
|
const NS_OPENDESIGN = "dsh-opendesign";
|
|
17872
|
-
const zh$
|
|
17881
|
+
const zh$6 = {
|
|
17873
17882
|
...accountPoolZh,
|
|
17874
17883
|
relogin: "重新登录",
|
|
17875
17884
|
needsRelogin: "登录已失效",
|
|
@@ -17977,7 +17986,7 @@ window.__ModuleLoader__.load({
|
|
|
17977
17986
|
limitRoute: "模型路由按 provider id 抢占:若已有其他插件占用 opendesign,本卡仍可配置,但请求由对方服务。",
|
|
17978
17987
|
limitQuota: "套餐与额度读取只覆盖浏览器授权登录的账号;粘贴的 API Key 没有控制 Key,请在 OpenDesign Cloud 控制台查看用量。"
|
|
17979
17988
|
};
|
|
17980
|
-
const en$
|
|
17989
|
+
const en$6 = {
|
|
17981
17990
|
...accountPoolEn,
|
|
17982
17991
|
relogin: "Add again",
|
|
17983
17992
|
needsRelogin: "Key invalid",
|
|
@@ -18085,11 +18094,11 @@ window.__ModuleLoader__.load({
|
|
|
18085
18094
|
limitRoute: "The route is claimed by provider id: if another plugin already serves opendesign, this card still configures the line but that provider answers the requests.",
|
|
18086
18095
|
limitQuota: "Plan and credit reads cover browser-signed-in accounts only; a pasted API key has no control key, so see usage in the OpenDesign Cloud console."
|
|
18087
18096
|
};
|
|
18088
|
-
const dictionaries$
|
|
18089
|
-
zh: zh$
|
|
18090
|
-
"zh-CN": zh$
|
|
18091
|
-
en: en$
|
|
18092
|
-
"en-US": en$
|
|
18097
|
+
const dictionaries$6 = {
|
|
18098
|
+
zh: zh$6,
|
|
18099
|
+
"zh-CN": zh$6,
|
|
18100
|
+
en: en$6,
|
|
18101
|
+
"en-US": en$6
|
|
18093
18102
|
};
|
|
18094
18103
|
//#endregion
|
|
18095
18104
|
//#region src/client/opendesign/OpenDesignSection.tsx
|
|
@@ -18384,7 +18393,7 @@ window.__ModuleLoader__.load({
|
|
|
18384
18393
|
try {
|
|
18385
18394
|
const outcome = await API$4.readUsage();
|
|
18386
18395
|
setStatus(outcome.status);
|
|
18387
|
-
if (!silent) setNotice(outcome.usage.accounts.some((account) => account.ok) ? "" : zh$
|
|
18396
|
+
if (!silent) setNotice(outcome.usage.accounts.some((account) => account.ok) ? "" : zh$6.usageEmpty);
|
|
18388
18397
|
} catch (cause) {
|
|
18389
18398
|
if (!silent) setError(detail(cause));
|
|
18390
18399
|
}
|
|
@@ -18421,10 +18430,10 @@ window.__ModuleLoader__.load({
|
|
|
18421
18430
|
API$4.loginStatus(flow.id).then((next) => {
|
|
18422
18431
|
setLoginFlow(next);
|
|
18423
18432
|
if (next.status === "complete") {
|
|
18424
|
-
setNotice(zh$
|
|
18433
|
+
setNotice(zh$6.loginComplete.replace("{account}", next.accountAlias === "" ? "OpenDesign" : next.accountAlias));
|
|
18425
18434
|
setShowKeyForm(false);
|
|
18426
18435
|
reload();
|
|
18427
|
-
} else if (next.status === "failed") setError(zh$
|
|
18436
|
+
} else if (next.status === "failed") setError(zh$6.loginFailed.replace("{detail}", next.error));
|
|
18428
18437
|
}).catch((cause) => setError(detail(cause)));
|
|
18429
18438
|
}, Math.max(2, flow.intervalSeconds) * 1e3);
|
|
18430
18439
|
return () => window.clearInterval(timer);
|
|
@@ -18490,7 +18499,7 @@ window.__ModuleLoader__.load({
|
|
|
18490
18499
|
const refreshUsage = (0, react.useCallback)(() => {
|
|
18491
18500
|
run("usage", async () => {
|
|
18492
18501
|
const outcome = await API$4.readUsage();
|
|
18493
|
-
setNotice(outcome.usage.accounts.some((account) => account.ok) ? "" : zh$
|
|
18502
|
+
setNotice(outcome.usage.accounts.some((account) => account.ok) ? "" : zh$6.usageEmpty);
|
|
18494
18503
|
return outcome.status;
|
|
18495
18504
|
});
|
|
18496
18505
|
}, [run]);
|
|
@@ -18525,7 +18534,7 @@ window.__ModuleLoader__.load({
|
|
|
18525
18534
|
apiKey: trimmed,
|
|
18526
18535
|
...keyBaseURL.trim() === "" ? {} : { baseURL: keyBaseURL.trim() }
|
|
18527
18536
|
}).then((result) => {
|
|
18528
|
-
setNotice(result.authorized ? zh$
|
|
18537
|
+
setNotice(result.authorized ? zh$6.keyTestOk.replace("{ms}", String(Math.round(result.ms))).replace("{count}", String(result.modelCount)) : zh$6.keyTestFailed.replace("{detail}", result.error));
|
|
18529
18538
|
}).catch((cause) => setError(detail(cause))).finally(() => setBusy(null));
|
|
18530
18539
|
}, [key, keyBaseURL]);
|
|
18531
18540
|
const testStored = (0, react.useCallback)((accountId) => {
|
|
@@ -18533,7 +18542,7 @@ window.__ModuleLoader__.load({
|
|
|
18533
18542
|
setError(null);
|
|
18534
18543
|
setNotice(null);
|
|
18535
18544
|
API$4.testKey({ accountId }).then((result) => {
|
|
18536
|
-
setNotice(result.authorized ? zh$
|
|
18545
|
+
setNotice(result.authorized ? zh$6.keyTestOk.replace("{ms}", String(Math.round(result.ms))).replace("{count}", String(result.modelCount)) : zh$6.keyTestFailed.replace("{detail}", result.error));
|
|
18537
18546
|
}).catch((cause) => setError(detail(cause))).finally(() => setBusy(null));
|
|
18538
18547
|
}, []);
|
|
18539
18548
|
const enabledModels = (0, react.useMemo)(() => (status?.models ?? []).filter((model) => model.enabled), [status]);
|
|
@@ -18559,7 +18568,7 @@ window.__ModuleLoader__.load({
|
|
|
18559
18568
|
if (model === void 0) return;
|
|
18560
18569
|
const parsed = parsePositiveCapacity$1(drafts[id] ?? formatCapacity$1(model.contextWindow));
|
|
18561
18570
|
if (parsed === null) {
|
|
18562
|
-
setError(zh$
|
|
18571
|
+
setError(zh$6.error.replace("{detail}", zh$6.defaultContextWindow));
|
|
18563
18572
|
return;
|
|
18564
18573
|
}
|
|
18565
18574
|
run("ctx:" + id, () => API$4.setContextWindow(id, parsed));
|
|
@@ -18581,7 +18590,7 @@ window.__ModuleLoader__.load({
|
|
|
18581
18590
|
}, [run, status]);
|
|
18582
18591
|
const resetAllContext = (0, react.useCallback)(() => {
|
|
18583
18592
|
if (status === null) return;
|
|
18584
|
-
if (typeof window !== "undefined" && !window.confirm(zh$
|
|
18593
|
+
if (typeof window !== "undefined" && !window.confirm(zh$6.contextResetAll)) return;
|
|
18585
18594
|
const overridden = status.models.filter((model) => model.contextWindowOverride !== void 0);
|
|
18586
18595
|
run("ctx-all", async () => {
|
|
18587
18596
|
let next = status;
|
|
@@ -18597,7 +18606,7 @@ window.__ModuleLoader__.load({
|
|
|
18597
18606
|
const refreshCatalog = (0, react.useCallback)(() => {
|
|
18598
18607
|
run("catalog", async () => {
|
|
18599
18608
|
const outcome = await API$4.refreshCatalog();
|
|
18600
|
-
setNotice(zh$
|
|
18609
|
+
setNotice(zh$6.catalogSyncedNote.replace("{count}", String(outcome.status.catalogCount)));
|
|
18601
18610
|
return outcome.status;
|
|
18602
18611
|
});
|
|
18603
18612
|
}, [run]);
|
|
@@ -18611,7 +18620,7 @@ window.__ModuleLoader__.load({
|
|
|
18611
18620
|
};
|
|
18612
18621
|
const invalid = Object.entries(numbers).find(([, value]) => !Number.isSafeInteger(value) || value < 0);
|
|
18613
18622
|
if (invalid !== void 0) {
|
|
18614
|
-
setError(zh$
|
|
18623
|
+
setError(zh$6.error.replace("{detail}", invalid[0]));
|
|
18615
18624
|
return;
|
|
18616
18625
|
}
|
|
18617
18626
|
setBusy("settings");
|
|
@@ -18622,10 +18631,10 @@ window.__ModuleLoader__.load({
|
|
|
18622
18631
|
}).then((next) => {
|
|
18623
18632
|
applyStatus(next);
|
|
18624
18633
|
setSettingsForm(settingsFormOf(next));
|
|
18625
|
-
setNotice(zh$
|
|
18634
|
+
setNotice(zh$6.saved);
|
|
18626
18635
|
}).catch((cause) => setError(detail(cause))).finally(() => setBusy(null));
|
|
18627
18636
|
}, [settingsForm, applyStatus]);
|
|
18628
|
-
const t = useLineDict(NS_OPENDESIGN, zh$
|
|
18637
|
+
const t = useLineDict(NS_OPENDESIGN, zh$6);
|
|
18629
18638
|
const errorPrefix = t.error.split("{detail}")[0] ?? "";
|
|
18630
18639
|
const pool = status?.pool;
|
|
18631
18640
|
const accounts = pool?.accounts ?? [];
|
|
@@ -19143,7 +19152,7 @@ window.__ModuleLoader__.load({
|
|
|
19143
19152
|
* control that renders it instead.
|
|
19144
19153
|
*/
|
|
19145
19154
|
const NS_WORKBUDDY = "dsh-workbuddy";
|
|
19146
|
-
const zh$
|
|
19155
|
+
const zh$5 = {
|
|
19147
19156
|
title: "WorkBuddy",
|
|
19148
19157
|
pageDesc: "复用本机 CodeBuddy 桌面端登录态,管理 WorkBuddy(CodeBuddy 订阅)模型、上下文窗口与额度。",
|
|
19149
19158
|
account: "账号",
|
|
@@ -19269,7 +19278,7 @@ window.__ModuleLoader__.load({
|
|
|
19269
19278
|
modelCooldownActive: "模型限流中",
|
|
19270
19279
|
notRoutable: "当前不可路由"
|
|
19271
19280
|
};
|
|
19272
|
-
const en$
|
|
19281
|
+
const en$5 = {
|
|
19273
19282
|
title: "WorkBuddy",
|
|
19274
19283
|
pageDesc: "Reuse the local CodeBuddy desktop sign-in to manage WorkBuddy (CodeBuddy subscription) models, context windows, and quota.",
|
|
19275
19284
|
account: "Account",
|
|
@@ -19395,11 +19404,11 @@ window.__ModuleLoader__.load({
|
|
|
19395
19404
|
modelCooldownActive: "Model parked",
|
|
19396
19405
|
notRoutable: "Not routable right now"
|
|
19397
19406
|
};
|
|
19398
|
-
const dictionaries$
|
|
19399
|
-
zh: zh$
|
|
19400
|
-
"zh-CN": zh$
|
|
19401
|
-
en: en$
|
|
19402
|
-
"en-US": en$
|
|
19407
|
+
const dictionaries$5 = {
|
|
19408
|
+
zh: zh$5,
|
|
19409
|
+
"zh-CN": zh$5,
|
|
19410
|
+
en: en$5,
|
|
19411
|
+
"en-US": en$5
|
|
19403
19412
|
};
|
|
19404
19413
|
//#endregion
|
|
19405
19414
|
//#region src/client/workbuddy/useWorkBuddySection.ts
|
|
@@ -19440,7 +19449,7 @@ window.__ModuleLoader__.load({
|
|
|
19440
19449
|
* is exactly what a stale host half produces) be reported as such instead of as
|
|
19441
19450
|
* a bare "Unexpected end of JSON input".
|
|
19442
19451
|
*/
|
|
19443
|
-
const api$
|
|
19452
|
+
const api$7 = createLineApi(API$3, "WorkBuddy");
|
|
19444
19453
|
/**
|
|
19445
19454
|
* Reasoning levels the default-effort control may offer.
|
|
19446
19455
|
*
|
|
@@ -19497,7 +19506,7 @@ window.__ModuleLoader__.load({
|
|
|
19497
19506
|
const quotaFollowUp = (0, react.useRef)(null);
|
|
19498
19507
|
const [contextDrafts, setContextDrafts] = (0, react.useState)({});
|
|
19499
19508
|
const [savingModel, setSavingModel] = (0, react.useState)(null);
|
|
19500
|
-
const t = useLineDict(NS_WORKBUDDY, zh$
|
|
19509
|
+
const t = useLineDict(NS_WORKBUDDY, zh$5);
|
|
19501
19510
|
const notifyChange = (0, react.useCallback)(() => {
|
|
19502
19511
|
onModelChange?.();
|
|
19503
19512
|
loadModelDirectory?.();
|
|
@@ -19509,7 +19518,7 @@ window.__ModuleLoader__.load({
|
|
|
19509
19518
|
const loadStatus = (0, react.useCallback)(async (quiet = false) => {
|
|
19510
19519
|
if (!quiet) setError(null);
|
|
19511
19520
|
try {
|
|
19512
|
-
const data = await api$
|
|
19521
|
+
const data = await api$7.request("/status");
|
|
19513
19522
|
const normalized = normalizeStatus(data);
|
|
19514
19523
|
setStatus(normalized);
|
|
19515
19524
|
setStatusFailed(false);
|
|
@@ -19544,7 +19553,7 @@ window.__ModuleLoader__.load({
|
|
|
19544
19553
|
try {
|
|
19545
19554
|
setBusy("rescan");
|
|
19546
19555
|
setError(null);
|
|
19547
|
-
const updated = await api$
|
|
19556
|
+
const updated = await api$7.request("/rescan", { method: "POST" });
|
|
19548
19557
|
setStatus(normalizeStatus(updated));
|
|
19549
19558
|
notifyChange();
|
|
19550
19559
|
} catch (err) {
|
|
@@ -19558,7 +19567,7 @@ window.__ModuleLoader__.load({
|
|
|
19558
19567
|
setBusy(`login:${region}`);
|
|
19559
19568
|
setError(null);
|
|
19560
19569
|
setLoginProgress(t.loginWaiting);
|
|
19561
|
-
const flow = await api$
|
|
19570
|
+
const flow = await api$7.request("/accounts/login", {
|
|
19562
19571
|
method: "POST",
|
|
19563
19572
|
body: JSON.stringify({ region })
|
|
19564
19573
|
});
|
|
@@ -19568,7 +19577,7 @@ window.__ModuleLoader__.load({
|
|
|
19568
19577
|
const timer = window.setInterval(() => {
|
|
19569
19578
|
(async () => {
|
|
19570
19579
|
try {
|
|
19571
|
-
const poll = await api$
|
|
19580
|
+
const poll = await api$7.request("/accounts/login/status");
|
|
19572
19581
|
if (poll.progress) setLoginProgress(poll.progress);
|
|
19573
19582
|
if (poll.status === "complete") {
|
|
19574
19583
|
window.clearInterval(timer);
|
|
@@ -19577,7 +19586,7 @@ window.__ModuleLoader__.load({
|
|
|
19577
19586
|
loginTimeoutRef.current = null;
|
|
19578
19587
|
setBusy(null);
|
|
19579
19588
|
setLoginProgress(null);
|
|
19580
|
-
if (poll.accountId) await api$
|
|
19589
|
+
if (poll.accountId) await api$7.request("/settings", {
|
|
19581
19590
|
method: "POST",
|
|
19582
19591
|
body: JSON.stringify({ selectedAccountId: poll.accountId })
|
|
19583
19592
|
});
|
|
@@ -19617,7 +19626,7 @@ window.__ModuleLoader__.load({
|
|
|
19617
19626
|
try {
|
|
19618
19627
|
setBusy(`${action}:${accountId}`);
|
|
19619
19628
|
setError(null);
|
|
19620
|
-
const updated = await api$
|
|
19629
|
+
const updated = await api$7.request("/accounts/action", {
|
|
19621
19630
|
method: "POST",
|
|
19622
19631
|
body: JSON.stringify({
|
|
19623
19632
|
action,
|
|
@@ -19640,7 +19649,7 @@ window.__ModuleLoader__.load({
|
|
|
19640
19649
|
try {
|
|
19641
19650
|
setBusy("strategy");
|
|
19642
19651
|
setError(null);
|
|
19643
|
-
const updated = await api$
|
|
19652
|
+
const updated = await api$7.request("/accounts/strategy", {
|
|
19644
19653
|
method: "POST",
|
|
19645
19654
|
body: JSON.stringify({ strategy })
|
|
19646
19655
|
});
|
|
@@ -19655,7 +19664,7 @@ window.__ModuleLoader__.load({
|
|
|
19655
19664
|
try {
|
|
19656
19665
|
setBusy("connection");
|
|
19657
19666
|
setError(null);
|
|
19658
|
-
setConnection(await api$
|
|
19667
|
+
setConnection(await api$7.request("/connection/test", { method: "POST" }));
|
|
19659
19668
|
} catch (err) {
|
|
19660
19669
|
setError(err instanceof Error ? err.message : String(err));
|
|
19661
19670
|
} finally {
|
|
@@ -19666,7 +19675,7 @@ window.__ModuleLoader__.load({
|
|
|
19666
19675
|
try {
|
|
19667
19676
|
setBusy("quota");
|
|
19668
19677
|
setError(null);
|
|
19669
|
-
const updated = await api$
|
|
19678
|
+
const updated = await api$7.request("/quota", { method: "POST" });
|
|
19670
19679
|
setStatus(updated);
|
|
19671
19680
|
} catch (err) {
|
|
19672
19681
|
setError(err instanceof Error ? err.message : String(err));
|
|
@@ -19678,7 +19687,7 @@ window.__ModuleLoader__.load({
|
|
|
19678
19687
|
try {
|
|
19679
19688
|
setBusy("checkin");
|
|
19680
19689
|
setError(null);
|
|
19681
|
-
const updated = await api$
|
|
19690
|
+
const updated = await api$7.request("/checkin/now", { method: "POST" });
|
|
19682
19691
|
setStatus(normalizeStatus(updated));
|
|
19683
19692
|
} catch (err) {
|
|
19684
19693
|
setError(err instanceof Error ? err.message : String(err));
|
|
@@ -19690,7 +19699,7 @@ window.__ModuleLoader__.load({
|
|
|
19690
19699
|
try {
|
|
19691
19700
|
setBusy("checkin");
|
|
19692
19701
|
setError(null);
|
|
19693
|
-
const updated = await api$
|
|
19702
|
+
const updated = await api$7.request("/settings", {
|
|
19694
19703
|
method: "POST",
|
|
19695
19704
|
body: JSON.stringify({ checkin })
|
|
19696
19705
|
});
|
|
@@ -19706,7 +19715,7 @@ window.__ModuleLoader__.load({
|
|
|
19706
19715
|
try {
|
|
19707
19716
|
setBusy("outbound");
|
|
19708
19717
|
setError(null);
|
|
19709
|
-
const updated = await api$
|
|
19718
|
+
const updated = await api$7.request("/settings", {
|
|
19710
19719
|
method: "POST",
|
|
19711
19720
|
body: JSON.stringify({ outboundIdentity })
|
|
19712
19721
|
});
|
|
@@ -19722,7 +19731,7 @@ window.__ModuleLoader__.load({
|
|
|
19722
19731
|
try {
|
|
19723
19732
|
setBusy("guardrails");
|
|
19724
19733
|
setError(null);
|
|
19725
|
-
const updated = await api$
|
|
19734
|
+
const updated = await api$7.request("/settings", {
|
|
19726
19735
|
method: "POST",
|
|
19727
19736
|
body: JSON.stringify({ guardrails })
|
|
19728
19737
|
});
|
|
@@ -19738,7 +19747,7 @@ window.__ModuleLoader__.load({
|
|
|
19738
19747
|
try {
|
|
19739
19748
|
setBusy("atrest");
|
|
19740
19749
|
setError(null);
|
|
19741
|
-
const updated = await api$
|
|
19750
|
+
const updated = await api$7.request("/at-rest-key", {
|
|
19742
19751
|
method: "POST",
|
|
19743
19752
|
body: JSON.stringify({ key })
|
|
19744
19753
|
});
|
|
@@ -19754,7 +19763,7 @@ window.__ModuleLoader__.load({
|
|
|
19754
19763
|
try {
|
|
19755
19764
|
setBusy("atrest");
|
|
19756
19765
|
setError(null);
|
|
19757
|
-
const updated = await api$
|
|
19766
|
+
const updated = await api$7.request("/at-rest-key", { method: "DELETE" });
|
|
19758
19767
|
setStatus(normalizeStatus(updated));
|
|
19759
19768
|
} catch (err) {
|
|
19760
19769
|
setError(err instanceof Error ? err.message : String(err));
|
|
@@ -19769,7 +19778,7 @@ window.__ModuleLoader__.load({
|
|
|
19769
19778
|
try {
|
|
19770
19779
|
setBusy(`model:${modelId}`);
|
|
19771
19780
|
setError(null);
|
|
19772
|
-
const normalized = normalizeStatus(await api$
|
|
19781
|
+
const normalized = normalizeStatus(await api$7.request("/settings", {
|
|
19773
19782
|
method: "POST",
|
|
19774
19783
|
body: JSON.stringify({ enabledModelIds: next })
|
|
19775
19784
|
}));
|
|
@@ -19787,7 +19796,7 @@ window.__ModuleLoader__.load({
|
|
|
19787
19796
|
try {
|
|
19788
19797
|
setBusy("models-all");
|
|
19789
19798
|
setError(null);
|
|
19790
|
-
const normalized = normalizeStatus(await api$
|
|
19799
|
+
const normalized = normalizeStatus(await api$7.request("/settings", {
|
|
19791
19800
|
method: "POST",
|
|
19792
19801
|
body: JSON.stringify({ enabledModelIds: enabled ? status.models.map((model) => model.id) : [] })
|
|
19793
19802
|
}));
|
|
@@ -19804,7 +19813,7 @@ window.__ModuleLoader__.load({
|
|
|
19804
19813
|
try {
|
|
19805
19814
|
setBusy("effort");
|
|
19806
19815
|
setError(null);
|
|
19807
|
-
const updated = await api$
|
|
19816
|
+
const updated = await api$7.request("/settings", {
|
|
19808
19817
|
method: "POST",
|
|
19809
19818
|
body: JSON.stringify({ defaultReasoningEffort: effort })
|
|
19810
19819
|
});
|
|
@@ -19820,7 +19829,7 @@ window.__ModuleLoader__.load({
|
|
|
19820
19829
|
try {
|
|
19821
19830
|
setBusy("catalog");
|
|
19822
19831
|
setError(null);
|
|
19823
|
-
const normalized = normalizeStatus(await api$
|
|
19832
|
+
const normalized = normalizeStatus(await api$7.request("/catalog/refresh", { method: "POST" }));
|
|
19824
19833
|
setStatus(normalized);
|
|
19825
19834
|
setContextDrafts(contextDraftsFor(normalized));
|
|
19826
19835
|
notifyChange();
|
|
@@ -19840,7 +19849,7 @@ window.__ModuleLoader__.load({
|
|
|
19840
19849
|
try {
|
|
19841
19850
|
setSavingModel(modelId);
|
|
19842
19851
|
setError(null);
|
|
19843
|
-
const updated = await api$
|
|
19852
|
+
const updated = await api$7.request("/settings", {
|
|
19844
19853
|
method: "POST",
|
|
19845
19854
|
body: JSON.stringify({ contextWindowOverrides: { [modelId]: parsed } })
|
|
19846
19855
|
});
|
|
@@ -19861,7 +19870,7 @@ window.__ModuleLoader__.load({
|
|
|
19861
19870
|
try {
|
|
19862
19871
|
setSavingModel(modelId);
|
|
19863
19872
|
setError(null);
|
|
19864
|
-
const updated = normalizeStatus(await api$
|
|
19873
|
+
const updated = normalizeStatus(await api$7.request("/settings", {
|
|
19865
19874
|
method: "POST",
|
|
19866
19875
|
body: JSON.stringify({ contextWindowOverrides: { [modelId]: null } })
|
|
19867
19876
|
}));
|
|
@@ -19888,7 +19897,7 @@ window.__ModuleLoader__.load({
|
|
|
19888
19897
|
try {
|
|
19889
19898
|
setBusy("context");
|
|
19890
19899
|
setError(null);
|
|
19891
|
-
const updated = normalizeStatus(await api$
|
|
19900
|
+
const updated = normalizeStatus(await api$7.request("/settings", {
|
|
19892
19901
|
method: "POST",
|
|
19893
19902
|
body: JSON.stringify({ contextWindowOverrides: Object.fromEntries(models.map((model) => [model, null])) })
|
|
19894
19903
|
}));
|
|
@@ -20131,7 +20140,7 @@ window.__ModuleLoader__.load({
|
|
|
20131
20140
|
const timer = window.setInterval(() => setNow(Date.now()), 1e3);
|
|
20132
20141
|
return () => window.clearInterval(timer);
|
|
20133
20142
|
}, [pausedUntil]);
|
|
20134
|
-
const t = useLineDict(NS_WORKBUDDY, zh$
|
|
20143
|
+
const t = useLineDict(NS_WORKBUDDY, zh$5);
|
|
20135
20144
|
const poolState = poolStateLines(pool, t, now);
|
|
20136
20145
|
const storageLine = poolStorageLine(pool?.storage, t);
|
|
20137
20146
|
const storageUnavailable = pool?.storage === void 0 ? null : poolStorageUnavailableLabel(pool.storage, t);
|
|
@@ -20765,7 +20774,7 @@ window.__ModuleLoader__.load({
|
|
|
20765
20774
|
//#endregion
|
|
20766
20775
|
//#region src/client/qianwen-token-plan/locales.ts
|
|
20767
20776
|
const NS_QIANWEN = "dsh-qianwen-token-plan";
|
|
20768
|
-
const zh$
|
|
20777
|
+
const zh$4 = {
|
|
20769
20778
|
title: "Qwen Token Plan(千问)",
|
|
20770
20779
|
pageDesc: "使用千问 Token Plan 专属 API Key 调用 Qwen4,管理显式缓存、思考回放、推理档位、模型和视觉预算。",
|
|
20771
20780
|
loading: "加载中...",
|
|
@@ -20838,8 +20847,8 @@ window.__ModuleLoader__.load({
|
|
|
20838
20847
|
noQuota: "无配额数据",
|
|
20839
20848
|
proxy: "代理"
|
|
20840
20849
|
};
|
|
20841
|
-
const dictionaries$
|
|
20842
|
-
zh: zh$
|
|
20850
|
+
const dictionaries$4 = {
|
|
20851
|
+
zh: zh$4,
|
|
20843
20852
|
en: {
|
|
20844
20853
|
title: "Qwen Token Plan",
|
|
20845
20854
|
pageDesc: "Use a dedicated Qianwen Token Plan API key with Qwen4, explicit caching, thinking replay, all reasoning levels, models and visual budgets.",
|
|
@@ -20916,11 +20925,11 @@ window.__ModuleLoader__.load({
|
|
|
20916
20925
|
};
|
|
20917
20926
|
//#endregion
|
|
20918
20927
|
//#region src/client/qianwen-token-plan/api.ts
|
|
20919
|
-
const api$
|
|
20920
|
-
const get = api$
|
|
20921
|
-
const post = api$
|
|
20922
|
-
const request = api$
|
|
20923
|
-
const messageOf = (cause) => cause instanceof Error ? cause.message : String(cause);
|
|
20928
|
+
const api$6 = createLineApi(QIANWEN_TOKEN_PLAN_ROUTE_PREFIX, QIANWEN_TOKEN_PLAN_PROVIDER_NAME);
|
|
20929
|
+
const get$1 = api$6.get;
|
|
20930
|
+
const post$1 = api$6.post;
|
|
20931
|
+
const request$1 = api$6.request;
|
|
20932
|
+
const messageOf$1 = (cause) => cause instanceof Error ? cause.message : String(cause);
|
|
20924
20933
|
//#endregion
|
|
20925
20934
|
//#region src/client/qianwen-token-plan/useQianwenSection.ts
|
|
20926
20935
|
function qianwenCacheHitRatio(stats) {
|
|
@@ -20946,9 +20955,9 @@ window.__ModuleLoader__.load({
|
|
|
20946
20955
|
const loadStatus = (0, react.useCallback)(async (quiet = false) => {
|
|
20947
20956
|
if (!quiet) setError(null);
|
|
20948
20957
|
try {
|
|
20949
|
-
adopt(await get("/status"));
|
|
20958
|
+
adopt(await get$1("/status"));
|
|
20950
20959
|
} catch (cause) {
|
|
20951
|
-
if (!quiet) setError(messageOf(cause));
|
|
20960
|
+
if (!quiet) setError(messageOf$1(cause));
|
|
20952
20961
|
} finally {
|
|
20953
20962
|
setLoading(false);
|
|
20954
20963
|
}
|
|
@@ -20969,12 +20978,12 @@ window.__ModuleLoader__.load({
|
|
|
20969
20978
|
setBusy(label);
|
|
20970
20979
|
setError(null);
|
|
20971
20980
|
try {
|
|
20972
|
-
const next = await post("/settings", patch);
|
|
20981
|
+
const next = await post$1("/settings", patch);
|
|
20973
20982
|
adopt(next);
|
|
20974
20983
|
if (patch.enabled !== void 0 || patch.enabledModelIds !== void 0 || patch.defaultReasoningEffort !== void 0) onModelChange?.();
|
|
20975
20984
|
return next;
|
|
20976
20985
|
} catch (cause) {
|
|
20977
|
-
setError(messageOf(cause));
|
|
20986
|
+
setError(messageOf$1(cause));
|
|
20978
20987
|
throw cause;
|
|
20979
20988
|
} finally {
|
|
20980
20989
|
setBusy(null);
|
|
@@ -21002,7 +21011,7 @@ window.__ModuleLoader__.load({
|
|
|
21002
21011
|
setBusy("key");
|
|
21003
21012
|
setError(null);
|
|
21004
21013
|
try {
|
|
21005
|
-
adopt(await request("/credentials", {
|
|
21014
|
+
adopt(await request$1("/credentials", {
|
|
21006
21015
|
method: "PUT",
|
|
21007
21016
|
body: JSON.stringify({ apiKey })
|
|
21008
21017
|
}));
|
|
@@ -21010,7 +21019,7 @@ window.__ModuleLoader__.load({
|
|
|
21010
21019
|
setConnection(null);
|
|
21011
21020
|
onModelChange?.();
|
|
21012
21021
|
} catch (cause) {
|
|
21013
|
-
setError(messageOf(cause));
|
|
21022
|
+
setError(messageOf$1(cause));
|
|
21014
21023
|
} finally {
|
|
21015
21024
|
setBusy(null);
|
|
21016
21025
|
}
|
|
@@ -21023,11 +21032,11 @@ window.__ModuleLoader__.load({
|
|
|
21023
21032
|
setBusy("remove-key");
|
|
21024
21033
|
setError(null);
|
|
21025
21034
|
try {
|
|
21026
|
-
adopt(await request("/credentials", { method: "DELETE" }));
|
|
21035
|
+
adopt(await request$1("/credentials", { method: "DELETE" }));
|
|
21027
21036
|
setConnection(null);
|
|
21028
21037
|
onModelChange?.();
|
|
21029
21038
|
} catch (cause) {
|
|
21030
|
-
setError(messageOf(cause));
|
|
21039
|
+
setError(messageOf$1(cause));
|
|
21031
21040
|
} finally {
|
|
21032
21041
|
setBusy(null);
|
|
21033
21042
|
}
|
|
@@ -21036,9 +21045,9 @@ window.__ModuleLoader__.load({
|
|
|
21036
21045
|
setBusy("connection");
|
|
21037
21046
|
setError(null);
|
|
21038
21047
|
try {
|
|
21039
|
-
setConnection(await post("/connection", {}));
|
|
21048
|
+
setConnection(await post$1("/connection", {}));
|
|
21040
21049
|
} catch (cause) {
|
|
21041
|
-
setError(messageOf(cause));
|
|
21050
|
+
setError(messageOf$1(cause));
|
|
21042
21051
|
} finally {
|
|
21043
21052
|
setBusy(null);
|
|
21044
21053
|
}
|
|
@@ -21096,7 +21105,7 @@ window.__ModuleLoader__.load({
|
|
|
21096
21105
|
}
|
|
21097
21106
|
//#endregion
|
|
21098
21107
|
//#region src/client/qianwen-token-plan/QianwenTokenPlanSection.tsx
|
|
21099
|
-
const EFFORT_KEYS = {
|
|
21108
|
+
const EFFORT_KEYS$1 = {
|
|
21100
21109
|
none: "effortNone",
|
|
21101
21110
|
minimal: "effortMinimal",
|
|
21102
21111
|
low: "effortLow",
|
|
@@ -21112,7 +21121,7 @@ window.__ModuleLoader__.load({
|
|
|
21112
21121
|
});
|
|
21113
21122
|
}
|
|
21114
21123
|
function QianwenTokenPlanSection(props = {}) {
|
|
21115
|
-
const t = useLineDict(NS_QIANWEN, zh$
|
|
21124
|
+
const t = useLineDict(NS_QIANWEN, zh$4);
|
|
21116
21125
|
const view = useQianwenSection(props);
|
|
21117
21126
|
const { status, busy } = view;
|
|
21118
21127
|
if (view.loading && status === null) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -21283,7 +21292,7 @@ window.__ModuleLoader__.load({
|
|
|
21283
21292
|
children: t.effortDefault
|
|
21284
21293
|
}), QIANWEN_REASONING_EFFORTS.map((effort) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
21285
21294
|
value: effort,
|
|
21286
|
-
children: t[EFFORT_KEYS[effort]]
|
|
21295
|
+
children: t[EFFORT_KEYS$1[effort]]
|
|
21287
21296
|
}, effort))]
|
|
21288
21297
|
})]
|
|
21289
21298
|
}),
|
|
@@ -21443,6 +21452,702 @@ window.__ModuleLoader__.load({
|
|
|
21443
21452
|
});
|
|
21444
21453
|
}
|
|
21445
21454
|
//#endregion
|
|
21455
|
+
//#region src/shared/relayone-contracts.ts
|
|
21456
|
+
/** Public host/client contract for RelayOne. No API key crosses this boundary. */
|
|
21457
|
+
const RELAYONE_PROVIDER_ID = "relayone";
|
|
21458
|
+
const RELAYONE_PROVIDER_NAME = "RelayOne";
|
|
21459
|
+
const RELAYONE_ROUTE_PREFIX = "/relayone/api";
|
|
21460
|
+
const RELAYONE_REASONING_EFFORTS = [
|
|
21461
|
+
"none",
|
|
21462
|
+
"minimal",
|
|
21463
|
+
"low",
|
|
21464
|
+
"medium",
|
|
21465
|
+
"high",
|
|
21466
|
+
"xhigh",
|
|
21467
|
+
"max"
|
|
21468
|
+
];
|
|
21469
|
+
function isRelayOneReasoningEffort(value) {
|
|
21470
|
+
return typeof value === "string" && RELAYONE_REASONING_EFFORTS.includes(value);
|
|
21471
|
+
}
|
|
21472
|
+
const RELAYONE_IMAGE_TOOL_NAME = "relayone_generate_image";
|
|
21473
|
+
const RELAYONE_VIDEO_TOOL_NAME = "relayone_generate_video";
|
|
21474
|
+
//#endregion
|
|
21475
|
+
//#region src/client/relayone/locales.ts
|
|
21476
|
+
const NS_RELAYONE = "dsh-relayone";
|
|
21477
|
+
const zh$3 = {
|
|
21478
|
+
title: "RelayOne",
|
|
21479
|
+
pageDesc: "一个 API Key,动态接入当前分组可用的对话与媒体模型。",
|
|
21480
|
+
enabled: "启用 RelayOne",
|
|
21481
|
+
keySection: "API Key",
|
|
21482
|
+
keyPlaceholder: "sk-…",
|
|
21483
|
+
saveKey: "保存密钥",
|
|
21484
|
+
savingKey: "保存中…",
|
|
21485
|
+
removeKey: "移除密钥",
|
|
21486
|
+
removingKey: "移除中…",
|
|
21487
|
+
keyConfigured: "密钥已安全保存;不会显示在页面或日志中。",
|
|
21488
|
+
keyMissing: "尚未配置 API Key。请在 RelayOne 控制台创建令牌后粘贴到这里。",
|
|
21489
|
+
storagePath: "加密存储",
|
|
21490
|
+
testConnection: "测试连接",
|
|
21491
|
+
testingConnection: "测试中…",
|
|
21492
|
+
refreshCatalog: "刷新目录",
|
|
21493
|
+
refreshingCatalog: "刷新中…",
|
|
21494
|
+
connectionOk: "连接正常",
|
|
21495
|
+
connectionFailed: "连接失败",
|
|
21496
|
+
latency: "{ms} ms",
|
|
21497
|
+
modelCount: "{count} 个对话模型",
|
|
21498
|
+
routeOwned: "provider 路由由本插件接管。",
|
|
21499
|
+
routeConflict: "provider 路由冲突:{detail}",
|
|
21500
|
+
modelsSection: "对话模型",
|
|
21501
|
+
modelsHint: "目录来自当前 Key 的 /v1/models;分组与协议来自实时元数据。新 Key 不会继承旧 Key 的目录。",
|
|
21502
|
+
selectionHint: "未逐项选择时自动启用当前全部分组模型;清空列表则表示全部关闭。",
|
|
21503
|
+
selectAll: "全选",
|
|
21504
|
+
clearAll: "清空",
|
|
21505
|
+
catalogEmpty: "配置 Key 后自动发现模型。",
|
|
21506
|
+
catalogLoading: "正在读取当前分组…",
|
|
21507
|
+
catalogError: "目录同步失败",
|
|
21508
|
+
catalogStale: "显示上次成功目录;后台刷新失败。",
|
|
21509
|
+
contextSection: "上下文窗口",
|
|
21510
|
+
contextHint: "上游未公布精确窗口时使用保守预算;可在这里按实际模型调整。",
|
|
21511
|
+
tokens: "tokens",
|
|
21512
|
+
save: "保存",
|
|
21513
|
+
saving: "保存中…",
|
|
21514
|
+
reset: "重置",
|
|
21515
|
+
resetAll: "全部重置",
|
|
21516
|
+
contextEmpty: "没有已启用的对话模型。",
|
|
21517
|
+
reasoningSection: "推理",
|
|
21518
|
+
defaultEffort: "默认推理等级",
|
|
21519
|
+
effortHint: "仅向声明支持推理的模型发送;单次会话的选择优先。",
|
|
21520
|
+
effortDefault: "跟随上游",
|
|
21521
|
+
effortNone: "关闭",
|
|
21522
|
+
effortMinimal: "最低",
|
|
21523
|
+
effortLow: "低",
|
|
21524
|
+
effortMedium: "中",
|
|
21525
|
+
effortHigh: "高",
|
|
21526
|
+
effortXhigh: "更高",
|
|
21527
|
+
effortMax: "最高",
|
|
21528
|
+
mediaSection: "媒体生成",
|
|
21529
|
+
mediaHint: "生图与视频使用同一个 Key,并受插件“媒体工具”总开关控制;修改开关后重载插件生效。",
|
|
21530
|
+
imageModel: "默认生图模型",
|
|
21531
|
+
videoModel: "默认视频模型",
|
|
21532
|
+
mediaAuto: "自动选择第一个可用模型",
|
|
21533
|
+
mediaEmpty: "当前 Key 没有可用媒体模型。",
|
|
21534
|
+
moreNotes: "协议与接入说明",
|
|
21535
|
+
protocolNote: "OpenAI 优先 Responses,Claude 优先 Anthropic Messages,其余模型使用 Chat Completions。只有上游明确拒绝协议时才回退。",
|
|
21536
|
+
mediaNote: "支持 URL/base64 生图、参考图编辑及异步任务;视频轮询可取消,失败不会重复提交任务。",
|
|
21537
|
+
docs: "RelayOne 文档",
|
|
21538
|
+
dashboard: "打开控制台",
|
|
21539
|
+
composerLabel: "额度",
|
|
21540
|
+
quotaLabel: "当前 Key 剩余额度",
|
|
21541
|
+
quotaAvailable: "剩余",
|
|
21542
|
+
quotaUsed: "已用",
|
|
21543
|
+
quotaGranted: "授予",
|
|
21544
|
+
quotaUnlimited: "当前 Key 为无限额度",
|
|
21545
|
+
quotaStale: "额度数据可能已过期",
|
|
21546
|
+
composerTooltip: "{count} 个当前可用对话模型{groups}",
|
|
21547
|
+
composerGroups: " · 分组:",
|
|
21548
|
+
unknownGroup: "自动分组",
|
|
21549
|
+
invalidCapacity: "上下文窗口必须是正整数。",
|
|
21550
|
+
errorGeneric: "RelayOne 操作失败。"
|
|
21551
|
+
};
|
|
21552
|
+
const dictionaries$3 = {
|
|
21553
|
+
zh: zh$3,
|
|
21554
|
+
en: {
|
|
21555
|
+
title: "RelayOne",
|
|
21556
|
+
pageDesc: "One API key for the chat and media models visible to its current upstream group.",
|
|
21557
|
+
enabled: "Enable RelayOne",
|
|
21558
|
+
keySection: "API Key",
|
|
21559
|
+
keyPlaceholder: "sk-…",
|
|
21560
|
+
saveKey: "Save key",
|
|
21561
|
+
savingKey: "Saving…",
|
|
21562
|
+
removeKey: "Remove key",
|
|
21563
|
+
removingKey: "Removing…",
|
|
21564
|
+
keyConfigured: "The key is stored securely and never rendered or logged.",
|
|
21565
|
+
keyMissing: "No API key is configured. Create a token in the RelayOne console and paste it here.",
|
|
21566
|
+
storagePath: "Encrypted storage",
|
|
21567
|
+
testConnection: "Test connection",
|
|
21568
|
+
testingConnection: "Testing…",
|
|
21569
|
+
refreshCatalog: "Refresh catalog",
|
|
21570
|
+
refreshingCatalog: "Refreshing…",
|
|
21571
|
+
connectionOk: "Connected",
|
|
21572
|
+
connectionFailed: "Connection failed",
|
|
21573
|
+
latency: "{ms} ms",
|
|
21574
|
+
modelCount: "{count} chat models",
|
|
21575
|
+
routeOwned: "This plugin owns the provider route.",
|
|
21576
|
+
routeConflict: "Provider route conflict: {detail}",
|
|
21577
|
+
modelsSection: "Chat models",
|
|
21578
|
+
modelsHint: "Models come from this key's /v1/models; live metadata supplies groups and protocols. A new key never inherits the old key's catalog.",
|
|
21579
|
+
selectionHint: "With no explicit selection, every currently accessible chat model is enabled. An empty list explicitly disables all.",
|
|
21580
|
+
selectAll: "Select all",
|
|
21581
|
+
clearAll: "Clear all",
|
|
21582
|
+
catalogEmpty: "Configure a key to discover its models.",
|
|
21583
|
+
catalogLoading: "Reading the current groups…",
|
|
21584
|
+
catalogError: "Catalog sync failed",
|
|
21585
|
+
catalogStale: "Showing the last good catalog; background refresh failed.",
|
|
21586
|
+
contextSection: "Context windows",
|
|
21587
|
+
contextHint: "A conservative local budget is used when upstream publishes no exact window; adjust it for the actual model here.",
|
|
21588
|
+
tokens: "tokens",
|
|
21589
|
+
save: "Save",
|
|
21590
|
+
saving: "Saving…",
|
|
21591
|
+
reset: "Reset",
|
|
21592
|
+
resetAll: "Reset all",
|
|
21593
|
+
contextEmpty: "No chat models are enabled.",
|
|
21594
|
+
reasoningSection: "Reasoning",
|
|
21595
|
+
defaultEffort: "Default reasoning effort",
|
|
21596
|
+
effortHint: "Sent only to models that declare reasoning support; a per-session choice wins.",
|
|
21597
|
+
effortDefault: "Upstream default",
|
|
21598
|
+
effortNone: "Off",
|
|
21599
|
+
effortMinimal: "Minimal",
|
|
21600
|
+
effortLow: "Low",
|
|
21601
|
+
effortMedium: "Medium",
|
|
21602
|
+
effortHigh: "High",
|
|
21603
|
+
effortXhigh: "Extra high",
|
|
21604
|
+
effortMax: "Maximum",
|
|
21605
|
+
mediaSection: "Media generation",
|
|
21606
|
+
mediaHint: "Images and video use the same key and obey the plugin's Media tools switch; reload the plugin after changing that switch.",
|
|
21607
|
+
imageModel: "Default image model",
|
|
21608
|
+
videoModel: "Default video model",
|
|
21609
|
+
mediaAuto: "First available model",
|
|
21610
|
+
mediaEmpty: "This key has no accessible media models.",
|
|
21611
|
+
moreNotes: "Protocol and integration notes",
|
|
21612
|
+
protocolNote: "OpenAI prefers Responses, Claude prefers Anthropic Messages, and other models use Chat Completions. Fallback occurs only after an explicit protocol refusal.",
|
|
21613
|
+
mediaNote: "URL/base64 images, reference-image edits and asynchronous tasks are supported. Video polling is cancellable and failures never resubmit a task.",
|
|
21614
|
+
docs: "RelayOne documentation",
|
|
21615
|
+
dashboard: "Open console",
|
|
21616
|
+
composerLabel: "Quota",
|
|
21617
|
+
quotaLabel: "Effective quota remaining on this key",
|
|
21618
|
+
quotaAvailable: "Available",
|
|
21619
|
+
quotaUsed: "Used",
|
|
21620
|
+
quotaGranted: "Granted",
|
|
21621
|
+
quotaUnlimited: "This key has unlimited quota",
|
|
21622
|
+
quotaStale: "Quota data may be stale",
|
|
21623
|
+
composerTooltip: "{count} accessible chat models{groups}",
|
|
21624
|
+
composerGroups: " · Groups: ",
|
|
21625
|
+
unknownGroup: "Automatic group",
|
|
21626
|
+
invalidCapacity: "Context window must be a positive integer.",
|
|
21627
|
+
errorGeneric: "RelayOne operation failed."
|
|
21628
|
+
}
|
|
21629
|
+
};
|
|
21630
|
+
//#endregion
|
|
21631
|
+
//#region src/client/relayone/api.ts
|
|
21632
|
+
const api$5 = createLineApi(RELAYONE_ROUTE_PREFIX, RELAYONE_PROVIDER_NAME);
|
|
21633
|
+
const get = api$5.get;
|
|
21634
|
+
const post = api$5.post;
|
|
21635
|
+
const request = api$5.request;
|
|
21636
|
+
const messageOf = (cause) => cause instanceof Error ? cause.message : String(cause);
|
|
21637
|
+
//#endregion
|
|
21638
|
+
//#region src/client/relayone/useRelayOneSection.ts
|
|
21639
|
+
function useRelayOneSection({ onModelChange } = {}) {
|
|
21640
|
+
const [status, setStatus] = (0, react.useState)(null);
|
|
21641
|
+
const [loading, setLoading] = (0, react.useState)(true);
|
|
21642
|
+
const [busy, setBusy] = (0, react.useState)(null);
|
|
21643
|
+
const [error, setError] = (0, react.useState)(null);
|
|
21644
|
+
const [connection, setConnection] = (0, react.useState)(null);
|
|
21645
|
+
const [keyValue, setKeyValue] = (0, react.useState)("");
|
|
21646
|
+
const [contextDrafts, setContextDrafts] = (0, react.useState)({});
|
|
21647
|
+
const [savingModel, setSavingModel] = (0, react.useState)(null);
|
|
21648
|
+
const adopt = (0, react.useCallback)((next) => {
|
|
21649
|
+
setStatus(next);
|
|
21650
|
+
setContextDrafts(contextDraftsFor({
|
|
21651
|
+
models: next.models,
|
|
21652
|
+
contextWindowOverrides: next.contextWindowOverrides
|
|
21653
|
+
}));
|
|
21654
|
+
}, []);
|
|
21655
|
+
const loadStatus = (0, react.useCallback)(async (quiet = false) => {
|
|
21656
|
+
if (!quiet) setError(null);
|
|
21657
|
+
try {
|
|
21658
|
+
adopt(await get("/status"));
|
|
21659
|
+
} catch (cause) {
|
|
21660
|
+
if (!quiet) setError(messageOf(cause));
|
|
21661
|
+
} finally {
|
|
21662
|
+
setLoading(false);
|
|
21663
|
+
}
|
|
21664
|
+
}, [adopt]);
|
|
21665
|
+
(0, react.useEffect)(() => {
|
|
21666
|
+
loadStatus();
|
|
21667
|
+
const visible = () => {
|
|
21668
|
+
if (document.visibilityState === "visible") loadStatus(true);
|
|
21669
|
+
};
|
|
21670
|
+
const timer = window.setInterval(visible, 6e4);
|
|
21671
|
+
document.addEventListener("visibilitychange", visible);
|
|
21672
|
+
return () => {
|
|
21673
|
+
window.clearInterval(timer);
|
|
21674
|
+
document.removeEventListener("visibilitychange", visible);
|
|
21675
|
+
};
|
|
21676
|
+
}, [loadStatus]);
|
|
21677
|
+
const update = (0, react.useCallback)(async (patch, label = "settings") => {
|
|
21678
|
+
setBusy(label);
|
|
21679
|
+
setError(null);
|
|
21680
|
+
try {
|
|
21681
|
+
const next = await post("/settings", patch);
|
|
21682
|
+
adopt(next);
|
|
21683
|
+
if (patch.enabled !== void 0 || patch.enabledModelIds !== void 0 || patch.defaultReasoningEffort !== void 0) onModelChange?.();
|
|
21684
|
+
return next;
|
|
21685
|
+
} catch (cause) {
|
|
21686
|
+
setError(messageOf(cause));
|
|
21687
|
+
throw cause;
|
|
21688
|
+
} finally {
|
|
21689
|
+
setBusy(null);
|
|
21690
|
+
}
|
|
21691
|
+
}, [adopt, onModelChange]);
|
|
21692
|
+
return {
|
|
21693
|
+
status,
|
|
21694
|
+
loading,
|
|
21695
|
+
busy,
|
|
21696
|
+
error,
|
|
21697
|
+
connection,
|
|
21698
|
+
keyValue,
|
|
21699
|
+
contextDrafts,
|
|
21700
|
+
savingModel,
|
|
21701
|
+
setKeyValue,
|
|
21702
|
+
setContextDraft: (id, draft) => setContextDrafts((current) => ({
|
|
21703
|
+
...current,
|
|
21704
|
+
[id]: draft
|
|
21705
|
+
})),
|
|
21706
|
+
saveKey: (0, react.useCallback)(async () => {
|
|
21707
|
+
const apiKey = keyValue.trim();
|
|
21708
|
+
if (apiKey === "") return;
|
|
21709
|
+
setBusy("key");
|
|
21710
|
+
setError(null);
|
|
21711
|
+
try {
|
|
21712
|
+
adopt(await request("/credentials", {
|
|
21713
|
+
method: "PUT",
|
|
21714
|
+
body: JSON.stringify({ apiKey })
|
|
21715
|
+
}));
|
|
21716
|
+
setKeyValue("");
|
|
21717
|
+
setConnection(null);
|
|
21718
|
+
onModelChange?.();
|
|
21719
|
+
} catch (cause) {
|
|
21720
|
+
setError(messageOf(cause));
|
|
21721
|
+
} finally {
|
|
21722
|
+
setBusy(null);
|
|
21723
|
+
}
|
|
21724
|
+
}, [
|
|
21725
|
+
adopt,
|
|
21726
|
+
keyValue,
|
|
21727
|
+
onModelChange
|
|
21728
|
+
]),
|
|
21729
|
+
removeKey: (0, react.useCallback)(async () => {
|
|
21730
|
+
setBusy("remove-key");
|
|
21731
|
+
setError(null);
|
|
21732
|
+
try {
|
|
21733
|
+
adopt(await request("/credentials", { method: "DELETE" }));
|
|
21734
|
+
setConnection(null);
|
|
21735
|
+
onModelChange?.();
|
|
21736
|
+
} catch (cause) {
|
|
21737
|
+
setError(messageOf(cause));
|
|
21738
|
+
} finally {
|
|
21739
|
+
setBusy(null);
|
|
21740
|
+
}
|
|
21741
|
+
}, [adopt, onModelChange]),
|
|
21742
|
+
testConnection: (0, react.useCallback)(async () => {
|
|
21743
|
+
setBusy("connection");
|
|
21744
|
+
setError(null);
|
|
21745
|
+
try {
|
|
21746
|
+
setConnection(await post("/connection", {}));
|
|
21747
|
+
await loadStatus(true);
|
|
21748
|
+
} catch (cause) {
|
|
21749
|
+
setError(messageOf(cause));
|
|
21750
|
+
} finally {
|
|
21751
|
+
setBusy(null);
|
|
21752
|
+
}
|
|
21753
|
+
}, [loadStatus]),
|
|
21754
|
+
refreshCatalog: (0, react.useCallback)(async () => {
|
|
21755
|
+
setBusy("catalog");
|
|
21756
|
+
setError(null);
|
|
21757
|
+
try {
|
|
21758
|
+
adopt(await post("/catalog/refresh", {}));
|
|
21759
|
+
onModelChange?.();
|
|
21760
|
+
} catch (cause) {
|
|
21761
|
+
setError(messageOf(cause));
|
|
21762
|
+
} finally {
|
|
21763
|
+
setBusy(null);
|
|
21764
|
+
}
|
|
21765
|
+
}, [adopt, onModelChange]),
|
|
21766
|
+
update,
|
|
21767
|
+
toggleModel: (0, react.useCallback)((id, enabled) => {
|
|
21768
|
+
if (status === null) return;
|
|
21769
|
+
const ids = status.models.filter((model) => model.id === id ? enabled : model.enabled).map((model) => model.id);
|
|
21770
|
+
update({ enabledModelIds: ids }, "models").catch(() => void 0);
|
|
21771
|
+
}, [status, update]),
|
|
21772
|
+
setAllModels: (0, react.useCallback)((enabled) => {
|
|
21773
|
+
if (status === null) return;
|
|
21774
|
+
update({ enabledModelIds: enabled ? status.models.map((model) => model.id) : [] }, "models").catch(() => void 0);
|
|
21775
|
+
}, [status, update]),
|
|
21776
|
+
saveContextWindow: (0, react.useCallback)(async (id) => {
|
|
21777
|
+
const parsed = parsePositiveCapacity$1(contextDrafts[id] ?? "");
|
|
21778
|
+
if (parsed === null) {
|
|
21779
|
+
setError("Invalid capacity: " + (contextDrafts[id] ?? ""));
|
|
21780
|
+
return;
|
|
21781
|
+
}
|
|
21782
|
+
setSavingModel(id);
|
|
21783
|
+
try {
|
|
21784
|
+
await update({ contextWindowOverrides: { [id]: parsed } }, "context:" + id);
|
|
21785
|
+
} catch {} finally {
|
|
21786
|
+
setSavingModel(null);
|
|
21787
|
+
}
|
|
21788
|
+
}, [contextDrafts, update]),
|
|
21789
|
+
resetContextWindow: (0, react.useCallback)(async (id) => {
|
|
21790
|
+
setSavingModel(id);
|
|
21791
|
+
try {
|
|
21792
|
+
await update({ contextWindowOverrides: { [id]: null } }, "context:" + id);
|
|
21793
|
+
} catch {} finally {
|
|
21794
|
+
setSavingModel(null);
|
|
21795
|
+
}
|
|
21796
|
+
}, [update]),
|
|
21797
|
+
resetAllContextWindows: (0, react.useCallback)(async () => {
|
|
21798
|
+
const overrides = Object.fromEntries(Object.keys(status?.contextWindowOverrides ?? {}).map((id) => [id, null]));
|
|
21799
|
+
if (Object.keys(overrides).length > 0) await update({ contextWindowOverrides: overrides }, "context");
|
|
21800
|
+
}, [status, update]),
|
|
21801
|
+
setDefaultEffort: (defaultReasoningEffort) => update({ defaultReasoningEffort }, "effort"),
|
|
21802
|
+
setImageModel: (imageModel) => update({ imageModel }, "media"),
|
|
21803
|
+
setVideoModel: (videoModel) => update({ videoModel }, "media")
|
|
21804
|
+
};
|
|
21805
|
+
}
|
|
21806
|
+
//#endregion
|
|
21807
|
+
//#region src/client/relayone/quota-format.ts
|
|
21808
|
+
function relayOneQuotaAmount(value, quotaPerUnit) {
|
|
21809
|
+
if (value === null) return null;
|
|
21810
|
+
if (quotaPerUnit === null || quotaPerUnit <= 0) return String(value);
|
|
21811
|
+
const usd = value / quotaPerUnit;
|
|
21812
|
+
const digits = Math.abs(usd) >= 100 ? 2 : Math.abs(usd) >= 1 ? 3 : 4;
|
|
21813
|
+
return "$" + usd.toFixed(digits);
|
|
21814
|
+
}
|
|
21815
|
+
function relayOneQuotaIsUnlimited(quota) {
|
|
21816
|
+
return quota.state === "unlimited" || quota.state === "stale" && quota.fetchedAt !== null && quota.totalAvailable === null;
|
|
21817
|
+
}
|
|
21818
|
+
function relayOneQuotaText(quota) {
|
|
21819
|
+
if (relayOneQuotaIsUnlimited(quota)) return "∞";
|
|
21820
|
+
if (quota.state !== "ready" && quota.state !== "stale") return null;
|
|
21821
|
+
if (quota.totalAvailable === null) return null;
|
|
21822
|
+
if (quota.remainingPercent !== null) return Math.round(quota.remainingPercent) + "%";
|
|
21823
|
+
return relayOneQuotaAmount(quota.totalAvailable, quota.quotaPerUnit);
|
|
21824
|
+
}
|
|
21825
|
+
function relayOneQuotaAccountText(quota) {
|
|
21826
|
+
const text = relayOneQuotaText(quota);
|
|
21827
|
+
if (text === null) return null;
|
|
21828
|
+
if (relayOneQuotaIsUnlimited(quota)) return text;
|
|
21829
|
+
const amount = relayOneQuotaAmount(quota.totalAvailable, quota.quotaPerUnit);
|
|
21830
|
+
return amount !== null && amount !== text ? text + " · " + amount : text;
|
|
21831
|
+
}
|
|
21832
|
+
//#endregion
|
|
21833
|
+
//#region src/client/relayone/RelayOneSection.tsx
|
|
21834
|
+
const EFFORT_KEYS = {
|
|
21835
|
+
none: "effortNone",
|
|
21836
|
+
minimal: "effortMinimal",
|
|
21837
|
+
low: "effortLow",
|
|
21838
|
+
medium: "effortMedium",
|
|
21839
|
+
high: "effortHigh",
|
|
21840
|
+
xhigh: "effortXhigh",
|
|
21841
|
+
max: "effortMax"
|
|
21842
|
+
};
|
|
21843
|
+
function RelayOneSection(props = {}) {
|
|
21844
|
+
const t = useLineDict(NS_RELAYONE, zh$3);
|
|
21845
|
+
const view = useRelayOneSection(props);
|
|
21846
|
+
const { status, busy } = view;
|
|
21847
|
+
if (view.loading && status === null) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
21848
|
+
className: "dsha-empty",
|
|
21849
|
+
children: t.catalogLoading
|
|
21850
|
+
});
|
|
21851
|
+
const models = status?.models ?? [];
|
|
21852
|
+
const media = status?.mediaModels ?? [];
|
|
21853
|
+
const images = media.filter((model) => model.kind === "image");
|
|
21854
|
+
const videos = media.filter((model) => model.kind === "video");
|
|
21855
|
+
const enabledModels = models.filter((model) => model.enabled);
|
|
21856
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
21857
|
+
className: "dsha-page dshro-page",
|
|
21858
|
+
"data-provider": "relayone",
|
|
21859
|
+
children: [
|
|
21860
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
21861
|
+
className: "dsha-group dshro-account",
|
|
21862
|
+
children: [
|
|
21863
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
21864
|
+
className: "dsha-grouphead",
|
|
21865
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: t.title }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
21866
|
+
className: "dsha-actions",
|
|
21867
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
21868
|
+
className: "dsha-btn",
|
|
21869
|
+
disabled: busy !== null || !status?.authenticated,
|
|
21870
|
+
onClick: () => void view.testConnection(),
|
|
21871
|
+
children: busy === "connection" ? t.testingConnection : t.testConnection
|
|
21872
|
+
}), status?.authenticated && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
21873
|
+
className: "dsha-btn",
|
|
21874
|
+
disabled: busy !== null,
|
|
21875
|
+
onClick: () => void view.removeKey(),
|
|
21876
|
+
children: busy === "remove-key" ? t.removingKey : t.removeKey
|
|
21877
|
+
})]
|
|
21878
|
+
})]
|
|
21879
|
+
}),
|
|
21880
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
21881
|
+
className: "dsha-muted",
|
|
21882
|
+
children: t.pageDesc
|
|
21883
|
+
}),
|
|
21884
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
21885
|
+
className: "dsha-pref-row",
|
|
21886
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t.enabled }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
21887
|
+
type: "checkbox",
|
|
21888
|
+
"aria-label": t.enabled,
|
|
21889
|
+
checked: status?.enabled !== false,
|
|
21890
|
+
disabled: busy !== null,
|
|
21891
|
+
onChange: (event) => void view.update({ enabled: event.currentTarget.checked }).catch(() => void 0)
|
|
21892
|
+
})]
|
|
21893
|
+
}),
|
|
21894
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
21895
|
+
className: "dsha-empty",
|
|
21896
|
+
children: status?.authenticated ? t.keyConfigured : t.keyMissing
|
|
21897
|
+
}),
|
|
21898
|
+
status?.authenticated && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
21899
|
+
className: "dsha-row",
|
|
21900
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
21901
|
+
className: "dsha-label",
|
|
21902
|
+
children: t.storagePath
|
|
21903
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
21904
|
+
className: "dsha-value",
|
|
21905
|
+
children: status.storagePath
|
|
21906
|
+
})]
|
|
21907
|
+
}),
|
|
21908
|
+
status?.authenticated && status.quota !== void 0 && status.quota.state !== "idle" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
21909
|
+
className: "dsha-row dshro-quota-row",
|
|
21910
|
+
title: status.quota.error ?? void 0,
|
|
21911
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
21912
|
+
className: "dsha-label",
|
|
21913
|
+
children: t.quotaLabel
|
|
21914
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
21915
|
+
className: "dsha-value",
|
|
21916
|
+
children: relayOneQuotaAccountText(status.quota) ?? "—"
|
|
21917
|
+
})]
|
|
21918
|
+
}),
|
|
21919
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
21920
|
+
className: "dshro-key-row",
|
|
21921
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
21922
|
+
className: "dsha-select",
|
|
21923
|
+
type: "password",
|
|
21924
|
+
autoComplete: "off",
|
|
21925
|
+
"aria-label": t.keySection,
|
|
21926
|
+
placeholder: t.keyPlaceholder,
|
|
21927
|
+
value: view.keyValue,
|
|
21928
|
+
disabled: busy !== null,
|
|
21929
|
+
onChange: (event) => view.setKeyValue(event.currentTarget.value),
|
|
21930
|
+
onKeyDown: (event) => {
|
|
21931
|
+
if (event.key === "Enter") view.saveKey();
|
|
21932
|
+
}
|
|
21933
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
21934
|
+
className: "dsha-btn dsha-btn-primary",
|
|
21935
|
+
disabled: busy !== null || view.keyValue.trim() === "",
|
|
21936
|
+
onClick: () => void view.saveKey(),
|
|
21937
|
+
children: busy === "key" ? t.savingKey : t.saveKey
|
|
21938
|
+
})]
|
|
21939
|
+
}),
|
|
21940
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
21941
|
+
className: "dsha-muted",
|
|
21942
|
+
children: status?.serving === false && status.conflict ? t.routeConflict.replace("{detail}", status.conflict) : t.routeOwned
|
|
21943
|
+
}),
|
|
21944
|
+
view.connection !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
21945
|
+
className: view.connection.connected ? "dsha-muted" : "dsha-notice",
|
|
21946
|
+
children: view.connection.connected ? t.connectionOk + " · " + t.latency.replace("{ms}", String(view.connection.latencyMs)) + " · " + t.modelCount.replace("{count}", String(view.connection.modelCount)) : t.connectionFailed + ": " + (view.connection.error ?? "—")
|
|
21947
|
+
})
|
|
21948
|
+
]
|
|
21949
|
+
}),
|
|
21950
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
21951
|
+
className: "dsha-group dshro-models",
|
|
21952
|
+
children: [
|
|
21953
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
21954
|
+
className: "dsha-grouphead",
|
|
21955
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: t.modelsSection }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
21956
|
+
className: "dsha-actions",
|
|
21957
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
21958
|
+
className: "dsha-btn",
|
|
21959
|
+
disabled: busy !== null || !status?.authenticated,
|
|
21960
|
+
onClick: () => void view.refreshCatalog(),
|
|
21961
|
+
children: busy === "catalog" ? t.refreshingCatalog : t.refreshCatalog
|
|
21962
|
+
})
|
|
21963
|
+
})]
|
|
21964
|
+
}),
|
|
21965
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
21966
|
+
className: "dsha-muted",
|
|
21967
|
+
children: t.modelsHint
|
|
21968
|
+
}),
|
|
21969
|
+
status?.catalog.error && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
21970
|
+
className: "dsha-notice",
|
|
21971
|
+
children: [
|
|
21972
|
+
t.catalogError,
|
|
21973
|
+
": ",
|
|
21974
|
+
status.catalog.error
|
|
21975
|
+
]
|
|
21976
|
+
}),
|
|
21977
|
+
status?.catalog.state === "stale" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
21978
|
+
className: "dsha-muted",
|
|
21979
|
+
children: t.catalogStale
|
|
21980
|
+
}),
|
|
21981
|
+
models.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
21982
|
+
className: "dsha-empty",
|
|
21983
|
+
children: status?.authenticated ? t.catalogLoading : t.catalogEmpty
|
|
21984
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModelChecklist, {
|
|
21985
|
+
items: models.map((model) => ({
|
|
21986
|
+
id: model.id,
|
|
21987
|
+
name: model.name,
|
|
21988
|
+
hint: model.hint,
|
|
21989
|
+
enabled: model.enabled
|
|
21990
|
+
})),
|
|
21991
|
+
busy: busy !== null,
|
|
21992
|
+
onToggle: view.toggleModel,
|
|
21993
|
+
onToggleAll: view.setAllModels,
|
|
21994
|
+
labels: {
|
|
21995
|
+
selectAll: t.selectAll,
|
|
21996
|
+
clearAll: t.clearAll,
|
|
21997
|
+
list: t.modelsSection
|
|
21998
|
+
}
|
|
21999
|
+
}),
|
|
22000
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
22001
|
+
className: "dsha-muted",
|
|
22002
|
+
children: t.selectionHint
|
|
22003
|
+
})
|
|
22004
|
+
]
|
|
22005
|
+
}),
|
|
22006
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
22007
|
+
className: "dsha-group dshro-reasoning",
|
|
22008
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
22009
|
+
className: "dsha-grouphead",
|
|
22010
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: t.reasoningSection })
|
|
22011
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
22012
|
+
className: "dsha-pref-row",
|
|
22013
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t.defaultEffort }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
22014
|
+
className: "dsha-muted",
|
|
22015
|
+
children: t.effortHint
|
|
22016
|
+
})] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
|
|
22017
|
+
className: "dsha-select",
|
|
22018
|
+
"aria-label": t.defaultEffort,
|
|
22019
|
+
value: status?.defaultReasoningEffort ?? "",
|
|
22020
|
+
disabled: busy !== null,
|
|
22021
|
+
onChange: (event) => {
|
|
22022
|
+
const value = event.currentTarget.value;
|
|
22023
|
+
view.setDefaultEffort(isRelayOneReasoningEffort(value) ? value : null).catch(() => void 0);
|
|
22024
|
+
},
|
|
22025
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
22026
|
+
value: "",
|
|
22027
|
+
children: t.effortDefault
|
|
22028
|
+
}), RELAYONE_REASONING_EFFORTS.map((effort) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
22029
|
+
value: effort,
|
|
22030
|
+
children: t[EFFORT_KEYS[effort]]
|
|
22031
|
+
}, effort))]
|
|
22032
|
+
})]
|
|
22033
|
+
})]
|
|
22034
|
+
}),
|
|
22035
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
22036
|
+
className: "dsha-group dshro-media",
|
|
22037
|
+
children: [
|
|
22038
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
22039
|
+
className: "dsha-grouphead",
|
|
22040
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: t.mediaSection })
|
|
22041
|
+
}),
|
|
22042
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
22043
|
+
className: "dsha-muted",
|
|
22044
|
+
children: t.mediaHint
|
|
22045
|
+
}),
|
|
22046
|
+
media.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
22047
|
+
className: "dsha-empty",
|
|
22048
|
+
children: t.mediaEmpty
|
|
22049
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
22050
|
+
className: "dsha-pref-row dshro-media-row",
|
|
22051
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t.imageModel }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
|
|
22052
|
+
className: "dsha-select",
|
|
22053
|
+
"aria-label": t.imageModel,
|
|
22054
|
+
value: status?.imageModel ?? "",
|
|
22055
|
+
disabled: busy !== null || images.length === 0,
|
|
22056
|
+
onChange: (event) => void view.setImageModel(event.currentTarget.value || null).catch(() => void 0),
|
|
22057
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
22058
|
+
value: "",
|
|
22059
|
+
children: t.mediaAuto
|
|
22060
|
+
}), images.map((model) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
22061
|
+
value: model.id,
|
|
22062
|
+
children: model.name
|
|
22063
|
+
}, model.id))]
|
|
22064
|
+
})]
|
|
22065
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
22066
|
+
className: "dsha-pref-row dshro-media-row",
|
|
22067
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t.videoModel }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
|
|
22068
|
+
className: "dsha-select",
|
|
22069
|
+
"aria-label": t.videoModel,
|
|
22070
|
+
value: status?.videoModel ?? "",
|
|
22071
|
+
disabled: busy !== null || videos.length === 0,
|
|
22072
|
+
onChange: (event) => void view.setVideoModel(event.currentTarget.value || null).catch(() => void 0),
|
|
22073
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
22074
|
+
value: "",
|
|
22075
|
+
children: t.mediaAuto
|
|
22076
|
+
}), videos.map((model) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
22077
|
+
value: model.id,
|
|
22078
|
+
children: model.name
|
|
22079
|
+
}, model.id))]
|
|
22080
|
+
})]
|
|
22081
|
+
})] }),
|
|
22082
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", {
|
|
22083
|
+
className: "dshro-details",
|
|
22084
|
+
children: [
|
|
22085
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("summary", { children: t.moreNotes }),
|
|
22086
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t.protocolNote }),
|
|
22087
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t.mediaNote }),
|
|
22088
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
22089
|
+
href: "https://z1rry.cyou/docs",
|
|
22090
|
+
target: "_blank",
|
|
22091
|
+
rel: "noreferrer",
|
|
22092
|
+
children: t.docs
|
|
22093
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
22094
|
+
href: "https://z1rry.cyou/dashboard",
|
|
22095
|
+
target: "_blank",
|
|
22096
|
+
rel: "noreferrer",
|
|
22097
|
+
children: t.dashboard
|
|
22098
|
+
})] })
|
|
22099
|
+
]
|
|
22100
|
+
})
|
|
22101
|
+
]
|
|
22102
|
+
}),
|
|
22103
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
22104
|
+
className: "dsha-group dshro-context",
|
|
22105
|
+
children: [
|
|
22106
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
22107
|
+
className: "dsha-grouphead",
|
|
22108
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: t.contextSection })
|
|
22109
|
+
}),
|
|
22110
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
22111
|
+
className: "dsha-muted",
|
|
22112
|
+
children: t.contextHint
|
|
22113
|
+
}),
|
|
22114
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContextWindowEditor, {
|
|
22115
|
+
rows: enabledModels.map((model) => ({
|
|
22116
|
+
id: model.id,
|
|
22117
|
+
name: model.name,
|
|
22118
|
+
draft: view.contextDrafts[model.id] ?? "",
|
|
22119
|
+
meta: model.contextWindow !== model.defaultContextWindow ? formatCapacity$1(model.contextWindow) : void 0,
|
|
22120
|
+
inputLabel: model.name + " " + t.contextSection,
|
|
22121
|
+
hasOverride: status?.contextWindowOverrides[model.id] !== void 0,
|
|
22122
|
+
saving: view.savingModel === model.id
|
|
22123
|
+
})),
|
|
22124
|
+
labels: {
|
|
22125
|
+
tokens: t.tokens,
|
|
22126
|
+
save: t.save,
|
|
22127
|
+
saving: t.saving,
|
|
22128
|
+
reset: t.reset,
|
|
22129
|
+
resetAll: t.resetAll,
|
|
22130
|
+
empty: t.contextEmpty
|
|
22131
|
+
},
|
|
22132
|
+
busy: busy !== null,
|
|
22133
|
+
overrideCount: Object.keys(status?.contextWindowOverrides ?? {}).length,
|
|
22134
|
+
metaClassName: "dshro-model-meta",
|
|
22135
|
+
onDraftChange: view.setContextDraft,
|
|
22136
|
+
onCommit: (id) => void view.saveContextWindow(id),
|
|
22137
|
+
onReset: (id) => void view.resetContextWindow(id),
|
|
22138
|
+
onResetAll: () => void view.resetAllContextWindows().catch(() => void 0)
|
|
22139
|
+
})
|
|
22140
|
+
]
|
|
22141
|
+
}),
|
|
22142
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(LineProxySection, { line: "relayone" }),
|
|
22143
|
+
view.error !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
22144
|
+
className: "dsha-error",
|
|
22145
|
+
children: view.error
|
|
22146
|
+
})
|
|
22147
|
+
]
|
|
22148
|
+
});
|
|
22149
|
+
}
|
|
22150
|
+
//#endregion
|
|
21446
22151
|
//#region src/client/hub/providers.tsx
|
|
21447
22152
|
/** One POST to a line's settings endpoint, answered with that line's refreshed status. */
|
|
21448
22153
|
async function postLineSettings(prefix, body) {
|
|
@@ -21573,6 +22278,12 @@ window.__ModuleLoader__.load({
|
|
|
21573
22278
|
name: QIANWEN_TOKEN_PLAN_PROVIDER_NAME,
|
|
21574
22279
|
setEnabled: (enabled) => postLineSettings(QIANWEN_TOKEN_PLAN_ROUTE_PREFIX, { enabled }),
|
|
21575
22280
|
renderDetail: ({ onModelChange }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(QianwenTokenPlanSection, { onModelChange })
|
|
22281
|
+
},
|
|
22282
|
+
{
|
|
22283
|
+
id: "relayone",
|
|
22284
|
+
name: RELAYONE_PROVIDER_NAME,
|
|
22285
|
+
setEnabled: (enabled) => postLineSettings(RELAYONE_ROUTE_PREFIX, { enabled }),
|
|
22286
|
+
renderDetail: ({ onModelChange }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RelayOneSection, { onModelChange })
|
|
21576
22287
|
}
|
|
21577
22288
|
];
|
|
21578
22289
|
function hubProviderDescriptor(id) {
|
|
@@ -22410,7 +23121,7 @@ window.__ModuleLoader__.load({
|
|
|
22410
23121
|
* account-pool labels come from `./account-pool.ts`, with the same overrides the
|
|
22411
23122
|
* source applies on top of them.
|
|
22412
23123
|
*/
|
|
22413
|
-
const dictionary$
|
|
23124
|
+
const dictionary$16 = {
|
|
22414
23125
|
...accountPoolRu,
|
|
22415
23126
|
title: "Claude (подписка)",
|
|
22416
23127
|
pageDesc: "Войдите в подписку Claude Pro/Max и управляйте моделями, уровнями рассуждений, контекстными окнами и квотой.",
|
|
@@ -22529,7 +23240,7 @@ window.__ModuleLoader__.load({
|
|
|
22529
23240
|
};
|
|
22530
23241
|
//#endregion
|
|
22531
23242
|
//#region src/client/locales-ru/cline-pass.ts
|
|
22532
|
-
const dictionary$
|
|
23243
|
+
const dictionary$15 = {
|
|
22533
23244
|
...accountPoolRu,
|
|
22534
23245
|
relogin: "Войти заново",
|
|
22535
23246
|
needsRelogin: "Вход истёк",
|
|
@@ -22655,7 +23366,7 @@ window.__ModuleLoader__.load({
|
|
|
22655
23366
|
};
|
|
22656
23367
|
//#endregion
|
|
22657
23368
|
//#region src/client/locales-ru/command-code.ts
|
|
22658
|
-
const dictionary$
|
|
23369
|
+
const dictionary$14 = {
|
|
22659
23370
|
...accountPoolRu,
|
|
22660
23371
|
title: "Command Code",
|
|
22661
23372
|
pageDesc: "Войдите в Command Code и управляйте моделями, контекстными окнами и квотой.",
|
|
@@ -22725,7 +23436,7 @@ window.__ModuleLoader__.load({
|
|
|
22725
23436
|
};
|
|
22726
23437
|
//#endregion
|
|
22727
23438
|
//#region src/client/locales-ru/glm-coding-plan.ts
|
|
22728
|
-
const dictionary$
|
|
23439
|
+
const dictionary$13 = {
|
|
22729
23440
|
...accountPoolRu,
|
|
22730
23441
|
title: "GLM (аккаунт ZCode)",
|
|
22731
23442
|
pageDesc: "Вход аккаунтом ZCode подключает GLM Coding Plan (Китай — bigmodel.cn, международный — z.ai). Здесь же пул аккаунтов, квота тарифа и выбор моделей. Учётные данные двух регионов независимы, поэтому в одном пуле могут быть аккаунты обоих.",
|
|
@@ -22828,7 +23539,7 @@ window.__ModuleLoader__.load({
|
|
|
22828
23539
|
* account-pool labels come from `./account-pool.ts`, with the same overrides the
|
|
22829
23540
|
* source applies on top of them.
|
|
22830
23541
|
*/
|
|
22831
|
-
const dictionary$
|
|
23542
|
+
const dictionary$12 = {
|
|
22832
23543
|
...accountPoolRu,
|
|
22833
23544
|
title: "ChatGPT",
|
|
22834
23545
|
hubTitle: "Подписки",
|
|
@@ -23043,6 +23754,7 @@ window.__ModuleLoader__.load({
|
|
|
23043
23754
|
"cardName.workbuddy": "WorkBuddy",
|
|
23044
23755
|
"cardName.antigravity-acp": "Antigravity (ACP)",
|
|
23045
23756
|
"cardName.qianwen-token-plan": "Qwen Token Plan",
|
|
23757
|
+
"cardName.relayone": "RelayOne",
|
|
23046
23758
|
modelChecklistCount: "Включено {count}/{total}",
|
|
23047
23759
|
codeRunTitle: "Код",
|
|
23048
23760
|
codeRunOutput: "Вывод",
|
|
@@ -23058,7 +23770,7 @@ window.__ModuleLoader__.load({
|
|
|
23058
23770
|
};
|
|
23059
23771
|
//#endregion
|
|
23060
23772
|
//#region src/client/locales-ru/kimi-code.ts
|
|
23061
|
-
const dictionary$
|
|
23773
|
+
const dictionary$11 = {
|
|
23062
23774
|
...accountPoolRu,
|
|
23063
23775
|
title: "Kimi Code",
|
|
23064
23776
|
pageDesc: "Вход в подписку Kimi Code: модели, уровень рассуждений, контекстные окна и квота.",
|
|
@@ -23247,7 +23959,7 @@ window.__ModuleLoader__.load({
|
|
|
23247
23959
|
};
|
|
23248
23960
|
//#endregion
|
|
23249
23961
|
//#region src/client/locales-ru/minimax-code.ts
|
|
23250
|
-
const dictionary$
|
|
23962
|
+
const dictionary$10 = {
|
|
23251
23963
|
...accountPoolRu,
|
|
23252
23964
|
title: "MiniMax Code",
|
|
23253
23965
|
pageDesc: "Вход в подписку MiniMax Code для программирования (OAuth по коду устройства) с переиспользованием локального входа MiniMax Code: управление аккаунтом, подключением и моделями.",
|
|
@@ -23447,7 +24159,7 @@ window.__ModuleLoader__.load({
|
|
|
23447
24159
|
};
|
|
23448
24160
|
//#endregion
|
|
23449
24161
|
//#region src/client/locales-ru/ollama.ts
|
|
23450
|
-
const dictionary$
|
|
24162
|
+
const dictionary$9 = {
|
|
23451
24163
|
...accountPoolRu,
|
|
23452
24164
|
relogin: "Заменить ключ",
|
|
23453
24165
|
needsRelogin: "Ключ отклонён",
|
|
@@ -23501,7 +24213,7 @@ window.__ModuleLoader__.load({
|
|
|
23501
24213
|
};
|
|
23502
24214
|
//#endregion
|
|
23503
24215
|
//#region src/client/locales-ru/antigravity-acp.ts
|
|
23504
|
-
const dictionary$
|
|
24216
|
+
const dictionary$8 = {
|
|
23505
24217
|
title: "Antigravity (ACP)",
|
|
23506
24218
|
pageDesc: "Подключение через официальный Antigravity CLI от Google по Agent Client Protocol (ACP): модель, инструменты и сессии приходят от официального процесса, и он же хранит состояние входа.",
|
|
23507
24219
|
routeOwned: "Маршрут моделей обслуживает этот плагин",
|
|
@@ -23595,7 +24307,7 @@ window.__ModuleLoader__.load({
|
|
|
23595
24307
|
};
|
|
23596
24308
|
//#endregion
|
|
23597
24309
|
//#region src/client/locales-ru/opendesign.ts
|
|
23598
|
-
const dictionary$
|
|
24310
|
+
const dictionary$7 = {
|
|
23599
24311
|
...accountPoolRu,
|
|
23600
24312
|
relogin: "Добавить заново",
|
|
23601
24313
|
needsRelogin: "API-ключ недействителен",
|
|
@@ -23705,7 +24417,7 @@ window.__ModuleLoader__.load({
|
|
|
23705
24417
|
};
|
|
23706
24418
|
//#endregion
|
|
23707
24419
|
//#region src/client/locales-ru/dispatch-ledger.ts
|
|
23708
|
-
const dictionary$
|
|
24420
|
+
const dictionary$6 = {
|
|
23709
24421
|
mandateTitle: "Запуск субагента",
|
|
23710
24422
|
mandateTitleFork: "Запуск субагента (с контекстом)",
|
|
23711
24423
|
mandatePreparing: "Сборка задания",
|
|
@@ -23730,7 +24442,7 @@ window.__ModuleLoader__.load({
|
|
|
23730
24442
|
};
|
|
23731
24443
|
//#endregion
|
|
23732
24444
|
//#region src/client/locales-ru/progress-updates.ts
|
|
23733
|
-
const dictionary$
|
|
24445
|
+
const dictionary$5 = {
|
|
23734
24446
|
navTitle: "Ход работы",
|
|
23735
24447
|
progressTitle: "Ход работы",
|
|
23736
24448
|
progressGuideNote: "Каждый шаг, о котором сообщает агент, собирается здесь",
|
|
@@ -23786,7 +24498,7 @@ window.__ModuleLoader__.load({
|
|
|
23786
24498
|
};
|
|
23787
24499
|
//#endregion
|
|
23788
24500
|
//#region src/client/locales-ru/qoder.ts
|
|
23789
|
-
const dictionary$
|
|
24501
|
+
const dictionary$4 = {
|
|
23790
24502
|
modelRowEfforts: "уровни {list}",
|
|
23791
24503
|
modelRowNoEfforts: "без уровней",
|
|
23792
24504
|
modelRowOutput: "вывод {cap}",
|
|
@@ -23908,7 +24620,7 @@ window.__ModuleLoader__.load({
|
|
|
23908
24620
|
};
|
|
23909
24621
|
//#endregion
|
|
23910
24622
|
//#region src/client/locales-ru/step-code.ts
|
|
23911
|
-
const dictionary$
|
|
24623
|
+
const dictionary$3 = {
|
|
23912
24624
|
...accountPoolRu,
|
|
23913
24625
|
title: "Step Code (подписка Step Plan)",
|
|
23914
24626
|
pageDesc: "Подключение к StepFun по подписке Step Plan (Китай api.stepfun.com / международный api.stepfun.ai) или по API-ключу открытой платформы: пул аккаунтов, квота тарифа, расход кеша и выбор моделей. Регион — свойство учётных данных, и два региона несовместимы, поэтому в пуле могут быть аккаунты из обоих.",
|
|
@@ -24085,7 +24797,7 @@ window.__ModuleLoader__.load({
|
|
|
24085
24797
|
* dropped '{placeholder}' would turn a sentence into a bald claim. 'test/
|
|
24086
24798
|
* russian-locale.test.tsx' pins both rules.
|
|
24087
24799
|
*/
|
|
24088
|
-
const dictionary$
|
|
24800
|
+
const dictionary$2 = {
|
|
24089
24801
|
title: "WorkBuddy",
|
|
24090
24802
|
pageDesc: "Повторно использует локальный вход CodeBuddy, чтобы управлять моделями WorkBuddy (подписка CodeBuddy), контекстными окнами и квотой.",
|
|
24091
24803
|
account: "Аккаунт",
|
|
@@ -24213,7 +24925,7 @@ window.__ModuleLoader__.load({
|
|
|
24213
24925
|
};
|
|
24214
24926
|
//#endregion
|
|
24215
24927
|
//#region src/client/locales-ru/qianwen-token-plan.ts
|
|
24216
|
-
const dictionary = {
|
|
24928
|
+
const dictionary$1 = {
|
|
24217
24929
|
title: "Qwen Token Plan",
|
|
24218
24930
|
pageDesc: "Подключение Qwen4 по выделенному API-ключу Qianwen Token Plan: явный кеш, воспроизведение размышлений, уровни reasoning, модели и визуальный бюджет.",
|
|
24219
24931
|
loading: "Загрузка…",
|
|
@@ -24286,6 +24998,83 @@ window.__ModuleLoader__.load({
|
|
|
24286
24998
|
noQuota: "Нет данных квоты",
|
|
24287
24999
|
proxy: "Прокси"
|
|
24288
25000
|
};
|
|
25001
|
+
//#endregion
|
|
25002
|
+
//#region src/client/locales-ru/relayone.ts
|
|
25003
|
+
const dictionary = {
|
|
25004
|
+
title: "RelayOne",
|
|
25005
|
+
pageDesc: "Один API-ключ для диалоговых и медиамоделей, доступных в его текущей группе.",
|
|
25006
|
+
enabled: "Включить RelayOne",
|
|
25007
|
+
keySection: "API-ключ",
|
|
25008
|
+
keyPlaceholder: "sk-…",
|
|
25009
|
+
saveKey: "Сохранить ключ",
|
|
25010
|
+
savingKey: "Сохранение…",
|
|
25011
|
+
removeKey: "Удалить ключ",
|
|
25012
|
+
removingKey: "Удаление…",
|
|
25013
|
+
keyConfigured: "Ключ хранится в зашифрованном виде и не показывается на странице или в журналах.",
|
|
25014
|
+
keyMissing: "API-ключ не настроен. Создайте токен в консоли RelayOne и вставьте его здесь.",
|
|
25015
|
+
storagePath: "Зашифрованное хранилище",
|
|
25016
|
+
testConnection: "Проверить соединение",
|
|
25017
|
+
testingConnection: "Проверка…",
|
|
25018
|
+
refreshCatalog: "Обновить каталог",
|
|
25019
|
+
refreshingCatalog: "Обновление…",
|
|
25020
|
+
connectionOk: "Соединение работает",
|
|
25021
|
+
connectionFailed: "Ошибка соединения",
|
|
25022
|
+
latency: "{ms} мс",
|
|
25023
|
+
modelCount: "Диалоговых моделей: {count}",
|
|
25024
|
+
routeOwned: "Маршрутом провайдера управляет этот плагин.",
|
|
25025
|
+
routeConflict: "Конфликт маршрута провайдера: {detail}",
|
|
25026
|
+
modelsSection: "Диалоговые модели",
|
|
25027
|
+
modelsHint: "Модели берутся из /v1/models текущего ключа; группы и протоколы — из актуальных метаданных. Новый ключ не наследует старый каталог.",
|
|
25028
|
+
selectionHint: "Без явного выбора включены все доступные модели. Пустой список явно отключает все.",
|
|
25029
|
+
selectAll: "Выбрать все",
|
|
25030
|
+
clearAll: "Очистить",
|
|
25031
|
+
catalogEmpty: "Настройте ключ для обнаружения моделей.",
|
|
25032
|
+
catalogLoading: "Чтение текущих групп…",
|
|
25033
|
+
catalogError: "Ошибка синхронизации каталога",
|
|
25034
|
+
catalogStale: "Показан последний успешный каталог; фоновое обновление не удалось.",
|
|
25035
|
+
contextSection: "Контекстные окна",
|
|
25036
|
+
contextHint: "Если upstream не публикует точное окно, используется консервативный локальный бюджет; здесь его можно изменить.",
|
|
25037
|
+
tokens: "токенов",
|
|
25038
|
+
save: "Сохранить",
|
|
25039
|
+
saving: "Сохранение…",
|
|
25040
|
+
reset: "Сбросить",
|
|
25041
|
+
resetAll: "Сбросить все",
|
|
25042
|
+
contextEmpty: "Нет включённых диалоговых моделей.",
|
|
25043
|
+
reasoningSection: "Рассуждение",
|
|
25044
|
+
defaultEffort: "Уровень рассуждения по умолчанию",
|
|
25045
|
+
effortHint: "Передаётся только моделям с поддержкой рассуждения; выбор в текущей сессии имеет приоритет.",
|
|
25046
|
+
effortDefault: "По умолчанию upstream",
|
|
25047
|
+
effortNone: "Выкл.",
|
|
25048
|
+
effortMinimal: "Минимальный",
|
|
25049
|
+
effortLow: "Низкий",
|
|
25050
|
+
effortMedium: "Средний",
|
|
25051
|
+
effortHigh: "Высокий",
|
|
25052
|
+
effortXhigh: "Очень высокий",
|
|
25053
|
+
effortMax: "Максимальный",
|
|
25054
|
+
mediaSection: "Генерация медиа",
|
|
25055
|
+
mediaHint: "Изображения и видео используют тот же ключ и подчиняются общему переключателю «Медиаинструменты»; после его изменения перезагрузите плагин.",
|
|
25056
|
+
imageModel: "Модель изображений по умолчанию",
|
|
25057
|
+
videoModel: "Модель видео по умолчанию",
|
|
25058
|
+
mediaAuto: "Первая доступная модель",
|
|
25059
|
+
mediaEmpty: "Этому ключу недоступны медиамодели.",
|
|
25060
|
+
moreNotes: "Протоколы и интеграция",
|
|
25061
|
+
protocolNote: "OpenAI предпочитает Responses, Claude — Anthropic Messages, остальные модели — Chat Completions. Откат выполняется только после явного отказа протокола.",
|
|
25062
|
+
mediaNote: "Поддерживаются изображения URL/base64, редактирование по референсам и асинхронные задачи. Опрос видео можно отменить; ошибка не приводит к повторной отправке задачи.",
|
|
25063
|
+
docs: "Документация RelayOne",
|
|
25064
|
+
dashboard: "Открыть консоль",
|
|
25065
|
+
composerLabel: "Квота",
|
|
25066
|
+
quotaLabel: "Доступная квота ключа",
|
|
25067
|
+
quotaAvailable: "Доступно",
|
|
25068
|
+
quotaUsed: "Использовано",
|
|
25069
|
+
quotaGranted: "Выделено",
|
|
25070
|
+
quotaUnlimited: "Для этого ключа установлена безлимитная квота",
|
|
25071
|
+
quotaStale: "Данные квоты могут быть устаревшими",
|
|
25072
|
+
composerTooltip: "Доступных диалоговых моделей: {count}{groups}",
|
|
25073
|
+
composerGroups: " · Группы: ",
|
|
25074
|
+
unknownGroup: "Автоматическая группа",
|
|
25075
|
+
invalidCapacity: "Контекстное окно должно быть положительным целым числом.",
|
|
25076
|
+
errorGeneric: "Операция RelayOne не удалась."
|
|
25077
|
+
};
|
|
24289
25078
|
/**
|
|
24290
25079
|
* Register the Russian language and every dictionary it covers.
|
|
24291
25080
|
*
|
|
@@ -24308,22 +25097,23 @@ window.__ModuleLoader__.load({
|
|
|
24308
25097
|
}
|
|
24309
25098
|
}, "dsh-chatgpt-subscription: ru language");
|
|
24310
25099
|
const dictionaries = [
|
|
24311
|
-
[NS, dictionary$
|
|
24312
|
-
[NS_CLAUDE, dictionary$
|
|
24313
|
-
[NS_COMMAND_CODE, dictionary$
|
|
24314
|
-
[NS_KIMI_CODE, dictionary$
|
|
24315
|
-
[NS_MINIMAX_CODE, dictionary$
|
|
24316
|
-
[NS_GLM_CODING_PLAN, dictionary$
|
|
24317
|
-
[NS_OLLAMA, dictionary$
|
|
24318
|
-
[NS_STEP_CODE, dictionary$
|
|
24319
|
-
[NS_CLINE_PASS, dictionary$
|
|
24320
|
-
[NS_QODER, dictionary$
|
|
24321
|
-
[NS_OPENDESIGN, dictionary$
|
|
24322
|
-
[NS_PROGRESS_UPDATES, dictionary$
|
|
24323
|
-
[NS_WORKBUDDY, dictionary$
|
|
24324
|
-
[NS_DISPATCH_LEDGER, dictionary$
|
|
24325
|
-
[NS_ANTIGRAVITY_ACP, dictionary$
|
|
24326
|
-
[NS_QIANWEN, dictionary]
|
|
25100
|
+
[NS, dictionary$12],
|
|
25101
|
+
[NS_CLAUDE, dictionary$16],
|
|
25102
|
+
[NS_COMMAND_CODE, dictionary$14],
|
|
25103
|
+
[NS_KIMI_CODE, dictionary$11],
|
|
25104
|
+
[NS_MINIMAX_CODE, dictionary$10],
|
|
25105
|
+
[NS_GLM_CODING_PLAN, dictionary$13],
|
|
25106
|
+
[NS_OLLAMA, dictionary$9],
|
|
25107
|
+
[NS_STEP_CODE, dictionary$3],
|
|
25108
|
+
[NS_CLINE_PASS, dictionary$15],
|
|
25109
|
+
[NS_QODER, dictionary$4],
|
|
25110
|
+
[NS_OPENDESIGN, dictionary$7],
|
|
25111
|
+
[NS_PROGRESS_UPDATES, dictionary$5],
|
|
25112
|
+
[NS_WORKBUDDY, dictionary$2],
|
|
25113
|
+
[NS_DISPATCH_LEDGER, dictionary$6],
|
|
25114
|
+
[NS_ANTIGRAVITY_ACP, dictionary$8],
|
|
25115
|
+
[NS_QIANWEN, dictionary$1],
|
|
25116
|
+
[NS_RELAYONE, dictionary]
|
|
24327
25117
|
];
|
|
24328
25118
|
for (const [ns, dictionary] of dictionaries) ctx.effect(() => {
|
|
24329
25119
|
try {
|
|
@@ -24866,7 +25656,7 @@ window.__ModuleLoader__.load({
|
|
|
24866
25656
|
}
|
|
24867
25657
|
//#endregion
|
|
24868
25658
|
//#region src/client/claude/styles.ts
|
|
24869
|
-
const STYLE_ID$
|
|
25659
|
+
const STYLE_ID$9 = "dsh-claude-settings-style";
|
|
24870
25660
|
/**
|
|
24871
25661
|
* Claude-only additions to the shared settings design system.
|
|
24872
25662
|
*
|
|
@@ -24890,7 +25680,7 @@ window.__ModuleLoader__.load({
|
|
|
24890
25680
|
.dshcl-mono{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:11px;overflow-wrap:anywhere}
|
|
24891
25681
|
.dshcl-model-meta{color:var(--dsw-alias-label-tertiary);font-size:11px;margin-left:5px}
|
|
24892
25682
|
.dshcl-empty-inline{color:var(--dsw-alias-label-tertiary);font-size:12px}
|
|
24893
|
-
`, STYLE_ID$
|
|
25683
|
+
`, STYLE_ID$9);
|
|
24894
25684
|
}
|
|
24895
25685
|
//#endregion
|
|
24896
25686
|
//#region src/client/command-code/CommandCodeComposerQuota.tsx
|
|
@@ -25007,7 +25797,7 @@ window.__ModuleLoader__.load({
|
|
|
25007
25797
|
}
|
|
25008
25798
|
//#endregion
|
|
25009
25799
|
//#region src/client/kimi-code/styles.ts
|
|
25010
|
-
const STYLE_ID$
|
|
25800
|
+
const STYLE_ID$8 = "dsh-kimi-code-settings-style";
|
|
25011
25801
|
/**
|
|
25012
25802
|
* Node the base control styles come from.
|
|
25013
25803
|
*
|
|
@@ -25149,7 +25939,7 @@ window.__ModuleLoader__.load({
|
|
|
25149
25939
|
`;
|
|
25150
25940
|
/** Kimi-specific rules layered on top of the shared control styles. */
|
|
25151
25941
|
function installKimiCodeStyles() {
|
|
25152
|
-
installPluginStyle("kimi-code", BASE, STYLE_ID$
|
|
25942
|
+
installPluginStyle("kimi-code", BASE, STYLE_ID$8);
|
|
25153
25943
|
}
|
|
25154
25944
|
//#endregion
|
|
25155
25945
|
//#region src/client/minimax-code/MinimaxCodeComposerQuota.tsx
|
|
@@ -25285,7 +26075,7 @@ window.__ModuleLoader__.load({
|
|
|
25285
26075
|
//#region src/client/minimax-code/MinimaxVideoDocumentBody.tsx
|
|
25286
26076
|
/** 兜底翻译:只在没有 locale 座位时用到。 */
|
|
25287
26077
|
function translate$1(key) {
|
|
25288
|
-
return zh$
|
|
26078
|
+
return zh$14[key] ?? key;
|
|
25289
26079
|
}
|
|
25290
26080
|
/**
|
|
25291
26081
|
* 一个文件地址里的会话与路径。
|
|
@@ -25421,7 +26211,7 @@ window.__ModuleLoader__.load({
|
|
|
25421
26211
|
*/
|
|
25422
26212
|
/** 兜底翻译:只在没有 locale 座位时用到,走同一份 zh 字典。 */
|
|
25423
26213
|
function translate(key) {
|
|
25424
|
-
return zh$
|
|
26214
|
+
return zh$14[key] ?? key;
|
|
25425
26215
|
}
|
|
25426
26216
|
/**
|
|
25427
26217
|
* 一张视频工具卡片。
|
|
@@ -25691,7 +26481,7 @@ window.__ModuleLoader__.load({
|
|
|
25691
26481
|
}
|
|
25692
26482
|
//#endregion
|
|
25693
26483
|
//#region src/client/minimax-code/styles.ts
|
|
25694
|
-
const STYLE_ID$
|
|
26484
|
+
const STYLE_ID$7 = "dsh-minimax-code-settings-style";
|
|
25695
26485
|
/**
|
|
25696
26486
|
* MiniMax Code-only additions to the shared settings design system.
|
|
25697
26487
|
*
|
|
@@ -25860,7 +26650,7 @@ window.__ModuleLoader__.load({
|
|
|
25860
26650
|
.dshm-video-history-meta{color:var(--dsw-alias-label-tertiary);flex:none;font-size:11px;font-variant-numeric:tabular-nums}
|
|
25861
26651
|
@media(max-width:560px){.dshm-video-modal-root{padding:12px 8px}.dshm-video-modal{max-height:calc(100vh - 24px)}.dshm-video-field-row{flex-direction:column;gap:8px}.dshm-video-foot-hint{display:none}}
|
|
25862
26652
|
@media(prefers-reduced-motion:reduce){.dshm-video-skeleton span{animation:none;opacity:.6}}
|
|
25863
|
-
`, STYLE_ID$
|
|
26653
|
+
`, STYLE_ID$7);
|
|
25864
26654
|
}
|
|
25865
26655
|
//#endregion
|
|
25866
26656
|
//#region src/client/glm-coding-plan/GlmCodingPlanComposerQuota.tsx
|
|
@@ -25877,7 +26667,7 @@ window.__ModuleLoader__.load({
|
|
|
25877
26667
|
* 没有快照、没有窗口、或全部窗口都没有百分比时返回 null,即**不渲染胶囊**:
|
|
25878
26668
|
* 契约允许 quota 为 null,装一个占位数字比不显示更像坏了。
|
|
25879
26669
|
*/
|
|
25880
|
-
function selectBadgeFacts$3(status, lookup = (key) => zh$
|
|
26670
|
+
function selectBadgeFacts$3(status, lookup = (key) => zh$13[key]) {
|
|
25881
26671
|
const measured = (status?.quota?.windows ?? []).filter((window) => typeof window.usedPercent === "number" && Number.isFinite(window.usedPercent));
|
|
25882
26672
|
if (measured.length === 0) return null;
|
|
25883
26673
|
const tightest = measured.reduce((best, window) => {
|
|
@@ -25908,14 +26698,14 @@ window.__ModuleLoader__.load({
|
|
|
25908
26698
|
directory,
|
|
25909
26699
|
loadModelDirectory,
|
|
25910
26700
|
providerId: GLM_CODING_PLAN_PROVIDER_ID,
|
|
25911
|
-
readStatus: (refresh) => refresh ? post$
|
|
26701
|
+
readStatus: (refresh) => refresh ? post$6("/quota", {}) : get$4("/status"),
|
|
25912
26702
|
selectFacts: (status) => selectBadgeFacts$3(status, t),
|
|
25913
26703
|
label: t("composerLabel")
|
|
25914
26704
|
});
|
|
25915
26705
|
}
|
|
25916
26706
|
//#endregion
|
|
25917
26707
|
//#region src/client/glm-coding-plan/styles.ts
|
|
25918
|
-
const STYLE_ID$
|
|
26708
|
+
const STYLE_ID$6 = "dsh-glm-coding-plan-settings-style";
|
|
25919
26709
|
/**
|
|
25920
26710
|
* GLM(ZCode 账号)卡片独有的样式。
|
|
25921
26711
|
*
|
|
@@ -25955,7 +26745,7 @@ window.__ModuleLoader__.load({
|
|
|
25955
26745
|
:not(.dsha-btn-primary));通用 hover 修好后它只剩副作用:把 .dsha-btn 的次要
|
|
25956
26746
|
按钮也画成主按钮,故删除。 */
|
|
25957
26747
|
.dsha-account-add-actions{display:flex;flex-wrap:wrap;gap:8px}
|
|
25958
|
-
`, STYLE_ID$
|
|
26748
|
+
`, STYLE_ID$6);
|
|
25959
26749
|
}
|
|
25960
26750
|
//#endregion
|
|
25961
26751
|
//#region src/client/antigravity-acp/route.ts
|
|
@@ -25973,7 +26763,7 @@ window.__ModuleLoader__.load({
|
|
|
25973
26763
|
* single most misleading pixel on the page.
|
|
25974
26764
|
*/
|
|
25975
26765
|
function AntigravityAcpComposerBadge(props) {
|
|
25976
|
-
const t = useLineDict(NS_ANTIGRAVITY_ACP, zh$
|
|
26766
|
+
const t = useLineDict(NS_ANTIGRAVITY_ACP, zh$10);
|
|
25977
26767
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComposerQuotaBadge, {
|
|
25978
26768
|
directory: props.directory,
|
|
25979
26769
|
loadModelDirectory: props.loadModelDirectory,
|
|
@@ -26015,7 +26805,7 @@ window.__ModuleLoader__.load({
|
|
|
26015
26805
|
}
|
|
26016
26806
|
//#endregion
|
|
26017
26807
|
//#region src/client/antigravity-acp/styles.ts
|
|
26018
|
-
const STYLE_ID$
|
|
26808
|
+
const STYLE_ID$5 = "dsh-antigravity-acp-settings-style";
|
|
26019
26809
|
/**
|
|
26020
26810
|
* The Antigravity (ACP) card's own styles.
|
|
26021
26811
|
*
|
|
@@ -26041,7 +26831,7 @@ window.__ModuleLoader__.load({
|
|
|
26041
26831
|
.dshagy-details[open]>summary{color:var(--dsw-alias-label-primary)}
|
|
26042
26832
|
.dshagy-details>p{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:1.55;margin:9px 0 0}
|
|
26043
26833
|
.dshagy-boundary{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:1.55;margin:9px 0 0;padding-left:18px}
|
|
26044
|
-
`, STYLE_ID$
|
|
26834
|
+
`, STYLE_ID$5);
|
|
26045
26835
|
}
|
|
26046
26836
|
//#endregion
|
|
26047
26837
|
//#region src/client/step-code/StepCodeComposerQuota.tsx
|
|
@@ -26057,7 +26847,7 @@ window.__ModuleLoader__.load({
|
|
|
26057
26847
|
*
|
|
26058
26848
|
* 没有快照、没有窗口、或全部窗口都没有百分比时返回 null(见文件头)。
|
|
26059
26849
|
*/
|
|
26060
|
-
function selectBadgeFacts$2(status, lookup = (key) => zh$
|
|
26850
|
+
function selectBadgeFacts$2(status, lookup = (key) => zh$9[key]) {
|
|
26061
26851
|
const quota = status?.quota;
|
|
26062
26852
|
if (quota === null || quota === void 0) return null;
|
|
26063
26853
|
if (quota.kind !== "windowed") return null;
|
|
@@ -26098,14 +26888,14 @@ window.__ModuleLoader__.load({
|
|
|
26098
26888
|
directory,
|
|
26099
26889
|
loadModelDirectory,
|
|
26100
26890
|
providerId: STEP_CODE_PROVIDER_ID,
|
|
26101
|
-
readStatus: (refresh) => refresh ? post$
|
|
26891
|
+
readStatus: (refresh) => refresh ? post$3("/quota", {}) : get$3("/status"),
|
|
26102
26892
|
selectFacts: (status) => selectBadgeFacts$2(status, t),
|
|
26103
26893
|
label: t("composerLabel")
|
|
26104
26894
|
});
|
|
26105
26895
|
}
|
|
26106
26896
|
//#endregion
|
|
26107
26897
|
//#region src/client/step-code/styles.ts
|
|
26108
|
-
const STYLE_ID$
|
|
26898
|
+
const STYLE_ID$4 = "dsh-step-code-settings-style";
|
|
26109
26899
|
/**
|
|
26110
26900
|
* Step Code(Step Plan 订阅)卡片独有的样式。
|
|
26111
26901
|
*
|
|
@@ -26183,7 +26973,7 @@ window.__ModuleLoader__.load({
|
|
|
26183
26973
|
@media(max-width:560px){.dshsc-cred-grid,.dshsc-cred-grid-narrow{grid-template-columns:minmax(0,1fr)}}
|
|
26184
26974
|
|
|
26185
26975
|
.dsha-badge.dshsc-adopted{background:color-mix(in srgb,var(--dsw-alias-button-info-fill,#397ee8) 16%,var(--dsw-alias-bg-layer-1));border-color:color-mix(in srgb,var(--dsw-alias-button-info-fill,#397ee8) 45%,var(--dsw-alias-border-l2));color:var(--dsw-alias-label-primary)}
|
|
26186
|
-
`, STYLE_ID$
|
|
26976
|
+
`, STYLE_ID$4);
|
|
26187
26977
|
}
|
|
26188
26978
|
//#endregion
|
|
26189
26979
|
//#region src/client/cline-pass/ClinePassComposerQuota.tsx
|
|
@@ -26204,7 +26994,7 @@ window.__ModuleLoader__.load({
|
|
|
26204
26994
|
directory: props.directory,
|
|
26205
26995
|
loadModelDirectory: props.loadModelDirectory,
|
|
26206
26996
|
providerId: "cline-pass",
|
|
26207
|
-
label: zh$
|
|
26997
|
+
label: zh$8.composerLabel,
|
|
26208
26998
|
readStatus: (refresh) => API$1.status(refresh),
|
|
26209
26999
|
selectFacts: selectClinePassFacts
|
|
26210
27000
|
});
|
|
@@ -26290,7 +27080,7 @@ window.__ModuleLoader__.load({
|
|
|
26290
27080
|
* 另外那只可能还剩一大半。所以这里不平均、不取最小剩余,而是取最大已用比例。
|
|
26291
27081
|
* 没有快照、没有桶、或全部桶都没有总额时返回 null(见文件头)。
|
|
26292
27082
|
*/
|
|
26293
|
-
function selectBadgeFacts$1(status, lookup = (key) => zh$
|
|
27083
|
+
function selectBadgeFacts$1(status, lookup = (key) => zh$7[key]) {
|
|
26294
27084
|
const quota = status?.quota;
|
|
26295
27085
|
if (quota === null || quota === void 0) return null;
|
|
26296
27086
|
const measurable = quota.buckets.filter((bucket) => bucket.total !== null && bucket.total > 0 && bucket.used !== null);
|
|
@@ -26300,7 +27090,7 @@ window.__ModuleLoader__.load({
|
|
|
26300
27090
|
const remaining = Math.round((1 - used) * 100);
|
|
26301
27091
|
const unit = tightest.unit !== null && tightest.unit !== "" ? " " + tightest.unit : "";
|
|
26302
27092
|
const bucketLabel = quotaBucketText(tightest.kind, {
|
|
26303
|
-
...zh$
|
|
27093
|
+
...zh$7,
|
|
26304
27094
|
quotaBucketPersonal: lookup("quotaBucketPersonal"),
|
|
26305
27095
|
quotaBucketAddOn: lookup("quotaBucketAddOn"),
|
|
26306
27096
|
quotaBucketOrg: lookup("quotaBucketOrg")
|
|
@@ -26325,14 +27115,14 @@ window.__ModuleLoader__.load({
|
|
|
26325
27115
|
directory,
|
|
26326
27116
|
loadModelDirectory,
|
|
26327
27117
|
providerId: QODER_PROVIDER_ID,
|
|
26328
|
-
readStatus: (refresh) => refresh ? post$
|
|
27118
|
+
readStatus: (refresh) => refresh ? post$2("/quota", {}) : get$2("/status"),
|
|
26329
27119
|
selectFacts: (status) => selectBadgeFacts$1(status, t),
|
|
26330
27120
|
label: t("composerLabel")
|
|
26331
27121
|
});
|
|
26332
27122
|
}
|
|
26333
27123
|
//#endregion
|
|
26334
27124
|
//#region src/client/qoder/styles.ts
|
|
26335
|
-
const STYLE_ID$
|
|
27125
|
+
const STYLE_ID$3 = "dsh-qoder-settings-style";
|
|
26336
27126
|
/**
|
|
26337
27127
|
* Qoder(订阅)卡片独有的样式。
|
|
26338
27128
|
*
|
|
@@ -26387,7 +27177,7 @@ window.__ModuleLoader__.load({
|
|
|
26387
27177
|
.dshq-details>p{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:1.55;margin:9px 0 0}
|
|
26388
27178
|
|
|
26389
27179
|
.dsha-badge.dshq-adopted{background:color-mix(in srgb,var(--dsw-alias-button-info-fill,#397ee8) 16%,var(--dsw-alias-bg-layer-1));border-color:color-mix(in srgb,var(--dsw-alias-button-info-fill,#397ee8) 45%,var(--dsw-alias-border-l2));color:var(--dsw-alias-label-primary)}
|
|
26390
|
-
`, STYLE_ID$
|
|
27180
|
+
`, STYLE_ID$3);
|
|
26391
27181
|
}
|
|
26392
27182
|
//#endregion
|
|
26393
27183
|
//#region src/client/opendesign/OpenDesignComposerQuota.tsx
|
|
@@ -26411,7 +27201,7 @@ window.__ModuleLoader__.load({
|
|
|
26411
27201
|
directory: props.directory,
|
|
26412
27202
|
loadModelDirectory: props.loadModelDirectory,
|
|
26413
27203
|
providerId: "opendesign",
|
|
26414
|
-
label: zh$
|
|
27204
|
+
label: zh$6.composerLabel,
|
|
26415
27205
|
readStatus: () => API.status(),
|
|
26416
27206
|
selectFacts: selectOpenDesignFacts
|
|
26417
27207
|
});
|
|
@@ -26432,9 +27222,9 @@ window.__ModuleLoader__.load({
|
|
|
26432
27222
|
* is not), and one decimal is what keeps "1.5 小时" from reading as "2 小时".
|
|
26433
27223
|
*/
|
|
26434
27224
|
function planWindowName(seconds) {
|
|
26435
|
-
if (seconds >= 86400 && seconds % 86400 === 0) return zh$
|
|
26436
|
-
if (seconds >= 3600) return zh$
|
|
26437
|
-
return zh$
|
|
27225
|
+
if (seconds >= 86400 && seconds % 86400 === 0) return zh$6.usageWindowDays.replace("{count}", String(seconds / 86400));
|
|
27226
|
+
if (seconds >= 3600) return zh$6.usageWindowHours.replace("{count}", formatDecimal(seconds / 3600));
|
|
27227
|
+
return zh$6.usageWindowMinutes.replace("{count}", formatDecimal(seconds / 60));
|
|
26438
27228
|
}
|
|
26439
27229
|
/** What a window still has, from the grant and the remainder it states. */
|
|
26440
27230
|
function windowRemaining(limitCredits, remainingCredits) {
|
|
@@ -26467,7 +27257,7 @@ window.__ModuleLoader__.load({
|
|
|
26467
27257
|
const primaryId = status.pool.activeAccountId ?? status.pool.accounts.find((account) => account.isPrimary)?.id;
|
|
26468
27258
|
const reading = readings.find((account) => account.accountId === primaryId) ?? readings[0];
|
|
26469
27259
|
const amount = reading.balanceUsd;
|
|
26470
|
-
const readAt = zh$
|
|
27260
|
+
const readAt = zh$6.usageReadAt.replace("{time}", new Date(reading.fetchedAt).toLocaleTimeString());
|
|
26471
27261
|
const windows = planWindows(reading.codingPlan);
|
|
26472
27262
|
if (windows.length === 0) return {
|
|
26473
27263
|
text: `$${amount}`,
|
|
@@ -26476,8 +27266,8 @@ window.__ModuleLoader__.load({
|
|
|
26476
27266
|
};
|
|
26477
27267
|
const narrowest = windows[0];
|
|
26478
27268
|
return {
|
|
26479
|
-
text: zh$
|
|
26480
|
-
tooltip: `${reading.alias} · ${windows.map((window) => `${window.name} ${zh$
|
|
27269
|
+
text: zh$6.usageWindowRemaining.replace("{remaining}", formatDecimal(narrowest.remaining)),
|
|
27270
|
+
tooltip: `${reading.alias} · ${windows.map((window) => `${window.name} ${zh$6.usageWindowRemaining.replace("{remaining}", formatDecimal(window.remaining))}`).join(" · ")} · ${readAt}`,
|
|
26481
27271
|
level: quotaLevel(narrowest.remaining),
|
|
26482
27272
|
percent: narrowest.remaining
|
|
26483
27273
|
};
|
|
@@ -28306,7 +29096,7 @@ window.__ModuleLoader__.load({
|
|
|
28306
29096
|
}
|
|
28307
29097
|
/** 兜底翻译:只在没有 locale 服务时用到(测试、以及菜单渲染早于字典注册)。 */
|
|
28308
29098
|
function fallbackTranslate$3(key, params) {
|
|
28309
|
-
const template = zh$
|
|
29099
|
+
const template = zh$14[key] ?? key;
|
|
28310
29100
|
if (params === void 0) return template;
|
|
28311
29101
|
return template.replace(/\{(\w+)\}/g, (_match, name) => String(params[name] ?? ""));
|
|
28312
29102
|
}
|
|
@@ -57604,12 +58394,12 @@ window.__ModuleLoader__.load({
|
|
|
57604
58394
|
providerId: "workbuddy-subscription",
|
|
57605
58395
|
readStatus: (refresh) => refresh ? api.post("/quota") : api.get("/status"),
|
|
57606
58396
|
selectFacts: selectBadgeFacts,
|
|
57607
|
-
label: useLineDict(NS_WORKBUDDY, zh$
|
|
58397
|
+
label: useLineDict(NS_WORKBUDDY, zh$5).composerLabel
|
|
57608
58398
|
});
|
|
57609
58399
|
}
|
|
57610
58400
|
//#endregion
|
|
57611
58401
|
//#region src/client/workbuddy/styles.ts
|
|
57612
|
-
const STYLE_ID$
|
|
58402
|
+
const STYLE_ID$2 = "dsh-workbuddy-settings-style";
|
|
57613
58403
|
/**
|
|
57614
58404
|
* WorkBuddy-only additions to the shared settings design system.
|
|
57615
58405
|
*
|
|
@@ -57663,11 +58453,11 @@ window.__ModuleLoader__.load({
|
|
|
57663
58453
|
.dsh-wb-inputrow>input{background:var(--dsw-alias-bg-layer-2);border:0.5px solid var(--dsw-alias-border-l2);border-radius:7px;color:var(--dsw-alias-label-primary);font:inherit;font-size:12px;padding:7px 9px;flex:1 1 260px;min-width:220px;max-width:420px;box-sizing:border-box}
|
|
57664
58454
|
.dsh-wb-inputrow>input:disabled{opacity:.5}
|
|
57665
58455
|
|
|
57666
|
-
`, STYLE_ID$
|
|
58456
|
+
`, STYLE_ID$2);
|
|
57667
58457
|
}
|
|
57668
58458
|
//#endregion
|
|
57669
58459
|
//#region src/client/qianwen-token-plan/QianwenComposerQuota.tsx
|
|
57670
|
-
function selectQianwenBadgeFacts(status, lookup = (key) => zh$
|
|
58460
|
+
function selectQianwenBadgeFacts(status, lookup = (key) => zh$4[key]) {
|
|
57671
58461
|
const cache = status?.cacheStats;
|
|
57672
58462
|
if (cache === void 0 || cache === null) return null;
|
|
57673
58463
|
const ratio = qianwenCacheHitRatio(cache);
|
|
@@ -57684,14 +58474,14 @@ window.__ModuleLoader__.load({
|
|
|
57684
58474
|
directory,
|
|
57685
58475
|
loadModelDirectory,
|
|
57686
58476
|
providerId: QIANWEN_TOKEN_PLAN_PROVIDER_ID,
|
|
57687
|
-
readStatus: () => get("/status"),
|
|
58477
|
+
readStatus: () => get$1("/status"),
|
|
57688
58478
|
selectFacts: (status) => selectQianwenBadgeFacts(status, t),
|
|
57689
58479
|
label: t("composerLabel")
|
|
57690
58480
|
});
|
|
57691
58481
|
}
|
|
57692
58482
|
//#endregion
|
|
57693
58483
|
//#region src/client/qianwen-token-plan/styles.ts
|
|
57694
|
-
const STYLE_ID = "dsh-qianwen-token-plan-settings-style";
|
|
58484
|
+
const STYLE_ID$1 = "dsh-qianwen-token-plan-settings-style";
|
|
57695
58485
|
function installQianwenStyles() {
|
|
57696
58486
|
installPluginStyle("qianwen-token-plan", `
|
|
57697
58487
|
/* 输入行与上方 .dsha-row / .dsha-pref-row 的底部分界线保持间距,避免框线重合 */
|
|
@@ -57707,6 +58497,60 @@ window.__ModuleLoader__.load({
|
|
|
57707
58497
|
.dshqw-details>summary{color:var(--dsw-alias-label-secondary);cursor:pointer;font-size:12px;list-style:none}
|
|
57708
58498
|
.dshqw-details>p{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:1.55;margin:9px 0 0}
|
|
57709
58499
|
.dshqw-model-meta{color:var(--dsw-alias-label-tertiary);font-size:11px;margin-left:5px}
|
|
58500
|
+
`, STYLE_ID$1);
|
|
58501
|
+
}
|
|
58502
|
+
//#endregion
|
|
58503
|
+
//#region src/client/relayone/RelayOneComposerQuota.tsx
|
|
58504
|
+
function selectRelayOneBadgeFacts(status, lookup = (key) => zh$3[key]) {
|
|
58505
|
+
if (status === null || !status.authenticated || status.quota === void 0) return null;
|
|
58506
|
+
const quota = status.quota;
|
|
58507
|
+
const text = relayOneQuotaText(quota);
|
|
58508
|
+
if (text === null) return null;
|
|
58509
|
+
const available = relayOneQuotaAmount(quota.totalAvailable, quota.quotaPerUnit);
|
|
58510
|
+
const used = relayOneQuotaAmount(quota.totalUsed, quota.quotaPerUnit);
|
|
58511
|
+
const granted = relayOneQuotaAmount(quota.totalGranted, quota.quotaPerUnit);
|
|
58512
|
+
return {
|
|
58513
|
+
text,
|
|
58514
|
+
tooltip: "[RelayOne] " + (relayOneQuotaIsUnlimited(quota) ? lookup("quotaUnlimited") : [
|
|
58515
|
+
available === null ? null : lookup("quotaAvailable") + " " + available,
|
|
58516
|
+
used === null ? null : lookup("quotaUsed") + " " + used,
|
|
58517
|
+
granted === null ? null : lookup("quotaGranted") + " " + granted
|
|
58518
|
+
].filter(Boolean).join(" · ")) + (quota.state === "stale" ? " · " + lookup("quotaStale") : ""),
|
|
58519
|
+
level: quotaLevel(quota.remainingPercent ?? 100),
|
|
58520
|
+
...quota.remainingPercent === null ? {} : { percent: quota.remainingPercent }
|
|
58521
|
+
};
|
|
58522
|
+
}
|
|
58523
|
+
function RelayOneComposerQuota({ directory, loadModelDirectory, t }) {
|
|
58524
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComposerQuotaBadge, {
|
|
58525
|
+
directory,
|
|
58526
|
+
loadModelDirectory,
|
|
58527
|
+
providerId: RELAYONE_PROVIDER_ID,
|
|
58528
|
+
readStatus: (refresh) => refresh ? post("/catalog/refresh", {}) : get("/status"),
|
|
58529
|
+
selectFacts: (status) => selectRelayOneBadgeFacts(status, t),
|
|
58530
|
+
label: t("composerLabel")
|
|
58531
|
+
});
|
|
58532
|
+
}
|
|
58533
|
+
//#endregion
|
|
58534
|
+
//#region src/client/relayone/styles.ts
|
|
58535
|
+
const STYLE_ID = "dsh-relayone-settings-style";
|
|
58536
|
+
function installRelayOneStyles() {
|
|
58537
|
+
installPluginStyle("relayone", `
|
|
58538
|
+
.dshro-page{display:flex;flex-direction:column;gap:12px}
|
|
58539
|
+
.dshro-key-row{align-items:stretch;display:grid;gap:8px;grid-template-columns:minmax(0,1fr) auto;margin-top:10px;width:100%}
|
|
58540
|
+
.dshro-key-row input{box-sizing:border-box;display:block;height:32px;max-width:none;min-width:0;width:100%}
|
|
58541
|
+
.dshro-key-row .dsha-btn{align-items:center;display:inline-flex;height:32px;justify-content:center;min-width:80px;white-space:nowrap}
|
|
58542
|
+
.dshro-details{border-top:0.5px solid var(--dsw-alias-border-l2);margin-top:8px;padding:10px 0 2px;color:var(--dsw-alias-label-secondary,#888);font-size:12px}
|
|
58543
|
+
.dshro-details>summary{cursor:pointer;list-style:none}
|
|
58544
|
+
.dshro-details p{margin:9px 0 0;line-height:1.55}
|
|
58545
|
+
.dshro-details a{margin-right:12px}
|
|
58546
|
+
.dshro-media-row .dsha-select{min-width:180px;max-width:320px}
|
|
58547
|
+
.dshro-model-meta{color:var(--dsw-alias-label-tertiary);font-size:11px;margin-left:6px}
|
|
58548
|
+
@media(max-width:640px){
|
|
58549
|
+
.dshro-key-row{grid-template-columns:minmax(0,1fr)}
|
|
58550
|
+
.dshro-key-row .dsha-btn{width:100%}
|
|
58551
|
+
.dshro-media-row{align-items:stretch;flex-direction:column}
|
|
58552
|
+
.dshro-media-row .dsha-select{max-width:none;min-width:0;width:100%}
|
|
58553
|
+
}
|
|
57710
58554
|
`, STYLE_ID);
|
|
57711
58555
|
}
|
|
57712
58556
|
//#endregion
|
|
@@ -60978,7 +61822,7 @@ window.__ModuleLoader__.load({
|
|
|
60978
61822
|
* @module @eddyskywalker/dsh-chatgpt-subscription/client/codemode/CodeRunToolView
|
|
60979
61823
|
*/
|
|
60980
61824
|
function fallbackTranslate(key) {
|
|
60981
|
-
return zh$
|
|
61825
|
+
return zh$17[key] ?? key;
|
|
60982
61826
|
}
|
|
60983
61827
|
function firstLine(text) {
|
|
60984
61828
|
const nl = text.indexOf("\n");
|
|
@@ -61736,36 +62580,36 @@ window.__ModuleLoader__.load({
|
|
|
61736
62580
|
installLineLocale(ctx.locale);
|
|
61737
62581
|
ctx.effect(() => installHostLocaleMirror(ctx.locale), "dsh-chatgpt-subscription: host locale mirror");
|
|
61738
62582
|
installRussianLocale(ctx);
|
|
61739
|
-
ctx.effect(() => ctx.locale.register(NS, dictionaries$
|
|
62583
|
+
ctx.effect(() => ctx.locale.register(NS, dictionaries$17), "dsh-chatgpt-subscription: dictionaries");
|
|
61740
62584
|
ctx.effect(() => installStyles(), "dsh-chatgpt-subscription: styles");
|
|
61741
62585
|
ctx.effect(() => {
|
|
61742
62586
|
installHubStyles();
|
|
61743
62587
|
installModelChecklistStyles();
|
|
61744
62588
|
return () => {};
|
|
61745
62589
|
}, "dsh-chatgpt-subscription: hub styles");
|
|
61746
|
-
ctx.effect(() => ctx.locale.register(NS_CLAUDE, dictionaries$
|
|
62590
|
+
ctx.effect(() => ctx.locale.register(NS_CLAUDE, dictionaries$12), "dsh-claude: dictionaries");
|
|
61747
62591
|
ctx.effect(() => {
|
|
61748
62592
|
installClaudeStyles();
|
|
61749
62593
|
return () => {};
|
|
61750
62594
|
}, "dsh-claude: styles");
|
|
61751
|
-
ctx.effect(() => ctx.locale.register(NS_COMMAND_CODE, dictionaries$
|
|
61752
|
-
ctx.effect(() => ctx.locale.register(NS_KIMI_CODE, dictionaries$
|
|
62595
|
+
ctx.effect(() => ctx.locale.register(NS_COMMAND_CODE, dictionaries$16), "dsh-command-code: dictionaries");
|
|
62596
|
+
ctx.effect(() => ctx.locale.register(NS_KIMI_CODE, dictionaries$15), "dsh-kimi-code: dictionaries");
|
|
61753
62597
|
ctx.effect(() => {
|
|
61754
62598
|
installKimiCodeStyles();
|
|
61755
62599
|
return () => {};
|
|
61756
62600
|
}, "dsh-kimi-code: styles");
|
|
61757
|
-
ctx.effect(() => ctx.locale.register(NS_MINIMAX_CODE, dictionaries$
|
|
62601
|
+
ctx.effect(() => ctx.locale.register(NS_MINIMAX_CODE, dictionaries$14), "dsh-minimax-code: dictionaries");
|
|
61758
62602
|
ctx.effect(() => {
|
|
61759
62603
|
installMinimaxCodeStyles();
|
|
61760
62604
|
return () => {};
|
|
61761
62605
|
}, "dsh-minimax-code: styles");
|
|
61762
|
-
ctx.effect(() => ctx.locale.register(NS_GLM_CODING_PLAN, dictionaries$
|
|
62606
|
+
ctx.effect(() => ctx.locale.register(NS_GLM_CODING_PLAN, dictionaries$13), "dsh-glm-coding-plan: dictionaries");
|
|
61763
62607
|
ctx.effect(() => {
|
|
61764
62608
|
installGlmCodingPlanStyles();
|
|
61765
62609
|
return () => {};
|
|
61766
62610
|
}, "dsh-glm-coding-plan: styles");
|
|
61767
|
-
ctx.effect(() => ctx.locale.register(NS_OLLAMA, dictionaries$
|
|
61768
|
-
ctx.effect(() => ctx.locale.register(NS_ANTIGRAVITY_ACP, dictionaries$
|
|
62611
|
+
ctx.effect(() => ctx.locale.register(NS_OLLAMA, dictionaries$11), "dsh-ollama: dictionaries");
|
|
62612
|
+
ctx.effect(() => ctx.locale.register(NS_ANTIGRAVITY_ACP, dictionaries$10), "dsh-antigravity-acp: dictionaries");
|
|
61769
62613
|
ctx.effect(() => {
|
|
61770
62614
|
installAntigravityAcpStyles();
|
|
61771
62615
|
return () => {};
|
|
@@ -61775,36 +62619,41 @@ window.__ModuleLoader__.load({
|
|
|
61775
62619
|
installProgressUpdatesStyles();
|
|
61776
62620
|
return () => {};
|
|
61777
62621
|
}, "dsh-progress-updates: styles");
|
|
61778
|
-
ctx.effect(() => ctx.locale.register(NS_STEP_CODE, dictionaries$
|
|
62622
|
+
ctx.effect(() => ctx.locale.register(NS_STEP_CODE, dictionaries$9), "dsh-step-code: dictionaries");
|
|
61779
62623
|
ctx.effect(() => {
|
|
61780
62624
|
installStepCodeStyles();
|
|
61781
62625
|
return () => {};
|
|
61782
62626
|
}, "dsh-step-code: styles");
|
|
61783
|
-
ctx.effect(() => ctx.locale.register(NS_CLINE_PASS, dictionaries$
|
|
62627
|
+
ctx.effect(() => ctx.locale.register(NS_CLINE_PASS, dictionaries$8), "dsh-cline-pass: dictionaries");
|
|
61784
62628
|
ctx.effect(() => {
|
|
61785
62629
|
installClinePassStyles();
|
|
61786
62630
|
return () => {};
|
|
61787
62631
|
}, "dsh-cline-pass: styles");
|
|
61788
|
-
ctx.effect(() => ctx.locale.register(NS_QODER, dictionaries$
|
|
62632
|
+
ctx.effect(() => ctx.locale.register(NS_QODER, dictionaries$7), "dsh-qoder: dictionaries");
|
|
61789
62633
|
ctx.effect(() => {
|
|
61790
62634
|
installQoderStyles();
|
|
61791
62635
|
return () => {};
|
|
61792
62636
|
}, "dsh-qoder: styles");
|
|
61793
|
-
ctx.effect(() => ctx.locale.register(NS_OPENDESIGN, dictionaries$
|
|
62637
|
+
ctx.effect(() => ctx.locale.register(NS_OPENDESIGN, dictionaries$6), "dsh-opendesign: dictionaries");
|
|
61794
62638
|
ctx.effect(() => {
|
|
61795
62639
|
installOpenDesignStyles();
|
|
61796
62640
|
return () => {};
|
|
61797
62641
|
}, "dsh-opendesign: styles");
|
|
61798
|
-
ctx.effect(() => ctx.locale.register(NS_WORKBUDDY, dictionaries$
|
|
62642
|
+
ctx.effect(() => ctx.locale.register(NS_WORKBUDDY, dictionaries$5), "dsh-workbuddy: dictionaries");
|
|
61799
62643
|
ctx.effect(() => {
|
|
61800
62644
|
installWorkBuddyStyles();
|
|
61801
62645
|
return () => {};
|
|
61802
62646
|
}, "dsh-workbuddy: styles");
|
|
61803
|
-
ctx.effect(() => ctx.locale.register(NS_QIANWEN, dictionaries$
|
|
62647
|
+
ctx.effect(() => ctx.locale.register(NS_QIANWEN, dictionaries$4), "dsh-qianwen-token-plan: dictionaries");
|
|
61804
62648
|
ctx.effect(() => {
|
|
61805
62649
|
installQianwenStyles();
|
|
61806
62650
|
return () => {};
|
|
61807
62651
|
}, "dsh-qianwen-token-plan: styles");
|
|
62652
|
+
ctx.effect(() => ctx.locale.register(NS_RELAYONE, dictionaries$3), "dsh-relayone: dictionaries");
|
|
62653
|
+
ctx.effect(() => {
|
|
62654
|
+
installRelayOneStyles();
|
|
62655
|
+
return () => {};
|
|
62656
|
+
}, "dsh-relayone: styles");
|
|
61808
62657
|
ctx.effect(() => ctx.locale.register(NS_SUBAGENT, dictionaries), "dsh-subagent-settings: dictionaries");
|
|
61809
62658
|
ctx.effect(() => ctx.locale.register(NS_DISPATCH_LEDGER, dictionaries$2), "dsh-dispatch-ledger: dictionaries");
|
|
61810
62659
|
ctx.effect(() => {
|
|
@@ -61930,6 +62779,13 @@ window.__ModuleLoader__.load({
|
|
|
61930
62779
|
locale: NS_QIANWEN,
|
|
61931
62780
|
inject: (sessionId) => composerBadgeInject(ctx, sessionId)
|
|
61932
62781
|
}, QianwenComposerQuota));
|
|
62782
|
+
ctx.slots.inject("conversation.input.right", () => ctx.slots.register({
|
|
62783
|
+
name: "conversation.input.right",
|
|
62784
|
+
id: "relayone-quota",
|
|
62785
|
+
order: 50,
|
|
62786
|
+
locale: NS_RELAYONE,
|
|
62787
|
+
inject: (sessionId) => composerBadgeInject(ctx, sessionId)
|
|
62788
|
+
}, RelayOneComposerQuota));
|
|
61933
62789
|
ctx.slots.inject("tool.call.toolview", () => ctx.slots.register({
|
|
61934
62790
|
name: "tool.call.toolview",
|
|
61935
62791
|
key: CODEX_IMAGE_TOOL_NAME,
|
|
@@ -61945,6 +62801,21 @@ window.__ModuleLoader__.load({
|
|
|
61945
62801
|
readVideo: videoBytesLoader(ctx)
|
|
61946
62802
|
})
|
|
61947
62803
|
}, MinimaxVideoToolView));
|
|
62804
|
+
ctx.slots.inject("tool.call.toolview", () => ctx.slots.register({
|
|
62805
|
+
name: "tool.call.toolview",
|
|
62806
|
+
key: RELAYONE_IMAGE_TOOL_NAME,
|
|
62807
|
+
locale: NS,
|
|
62808
|
+
inject: (sessionId) => ({ loadImage: imageLoader(ctx, sessionId) })
|
|
62809
|
+
}, CodexImageToolView));
|
|
62810
|
+
ctx.slots.inject("tool.call.toolview", () => ctx.slots.register({
|
|
62811
|
+
name: "tool.call.toolview",
|
|
62812
|
+
key: RELAYONE_VIDEO_TOOL_NAME,
|
|
62813
|
+
locale: NS_MINIMAX_CODE,
|
|
62814
|
+
inject: (sessionId) => ({
|
|
62815
|
+
sessionId,
|
|
62816
|
+
readVideo: videoBytesLoader(ctx)
|
|
62817
|
+
})
|
|
62818
|
+
}, MinimaxVideoToolView));
|
|
61948
62819
|
ctx.slots.inject("tool.call.toolview", () => ctx.slots.register({
|
|
61949
62820
|
name: "tool.call.toolview",
|
|
61950
62821
|
key: CODE_RUN_TOOL_NAME,
|