@eddyskywalker/dsh-chatgpt-subscription 0.76.1 → 0.78.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 +19 -0
- package/README.md +9 -7
- package/lib/client.js +1404 -512
- package/lib/client.js.map +1 -1
- package/lib/index.js +3829 -2190
- package/lib/tool-result-pruner.js +5 -1
- 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/kimi-code/locales.d.ts +2 -2
- 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/qianwen-token-plan.d.ts +3 -0
- package/lib/types/client/locales-ru/qianwen-token-plan.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/qianwen-token-plan/QianwenComposerQuota.d.ts +14 -0
- package/lib/types/client/qianwen-token-plan/QianwenComposerQuota.d.ts.map +1 -0
- package/lib/types/client/qianwen-token-plan/QianwenTokenPlanSection.d.ts +4 -0
- package/lib/types/client/qianwen-token-plan/QianwenTokenPlanSection.d.ts.map +1 -0
- package/lib/types/client/qianwen-token-plan/api.d.ts +5 -0
- package/lib/types/client/qianwen-token-plan/api.d.ts.map +1 -0
- package/lib/types/client/qianwen-token-plan/locales.d.ts +158 -0
- package/lib/types/client/qianwen-token-plan/locales.d.ts.map +1 -0
- package/lib/types/client/qianwen-token-plan/styles.d.ts +3 -0
- package/lib/types/client/qianwen-token-plan/styles.d.ts.map +1 -0
- package/lib/types/client/qianwen-token-plan/useQianwenSection.d.ts +32 -0
- package/lib/types/client/qianwen-token-plan/useQianwenSection.d.ts.map +1 -0
- package/lib/types/compat.d.ts +1 -1
- package/lib/types/entry-tool-result-pruner.d.ts.map +1 -1
- package/lib/types/host/cache-warmup/budget.d.ts.map +1 -1
- package/lib/types/host/cache-warmup/contracts.d.ts +4 -0
- package/lib/types/host/cache-warmup/contracts.d.ts.map +1 -1
- package/lib/types/host/cache-warmup/usage.d.ts.map +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 +4 -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/ptc-sdk-cache-guard.d.ts.map +1 -1
- package/lib/types/host/qianwen-token-plan/adapter.d.ts +39 -0
- package/lib/types/host/qianwen-token-plan/adapter.d.ts.map +1 -0
- package/lib/types/host/qianwen-token-plan/cache-stats.d.ts +17 -0
- package/lib/types/host/qianwen-token-plan/cache-stats.d.ts.map +1 -0
- package/lib/types/host/qianwen-token-plan/client.d.ts +5 -0
- package/lib/types/host/qianwen-token-plan/client.d.ts.map +1 -0
- package/lib/types/host/qianwen-token-plan/mapper.d.ts +71 -0
- package/lib/types/host/qianwen-token-plan/mapper.d.ts.map +1 -0
- package/lib/types/host/qianwen-token-plan/model-catalog.d.ts +28 -0
- package/lib/types/host/qianwen-token-plan/model-catalog.d.ts.map +1 -0
- package/lib/types/host/qianwen-token-plan/routes.d.ts +12 -0
- package/lib/types/host/qianwen-token-plan/routes.d.ts.map +1 -0
- package/lib/types/host/qianwen-token-plan/token-store.d.ts +56 -0
- package/lib/types/host/qianwen-token-plan/token-store.d.ts.map +1 -0
- package/lib/types/host/qianwen-token-plan/types.d.ts +13 -0
- package/lib/types/host/qianwen-token-plan/types.d.ts.map +1 -0
- package/lib/types/host/timeline-cache-guard.d.ts.map +1 -1
- package/lib/types/index.d.ts +5 -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/model-catalog.d.ts +25 -1
- package/lib/types/shared/model-catalog.d.ts.map +1 -1
- package/lib/types/shared/qianwen-token-plan-contracts.d.ts +94 -0
- package/lib/types/shared/qianwen-token-plan-contracts.d.ts.map +1 -0
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -570,6 +570,13 @@ window.__ModuleLoader__.load({
|
|
|
570
570
|
fit: "cover"
|
|
571
571
|
},
|
|
572
572
|
tile: "#FFFFFF"
|
|
573
|
+
},
|
|
574
|
+
"qianwen-token-plan": {
|
|
575
|
+
image: {
|
|
576
|
+
src: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAARGVYSWZNTQAqAAAACAABh2kABAAAAAEAAAAaAAAAAAADoAEAAwAAAAEAAQAAoAIABAAAAAEAAAAwoAMABAAAAAEAAAAwAAAAANs3bAwAAAlmSURBVGgFzVoJcFXVGf7OfS97gCAgDVshSYcSMkprDFsQtCOKdFrMdAswIrRxwCnU6TLtOJ3pVMeF6RScOqWA1bGt4AJSZKYLoy2rC4jayFJLISyBUGxACQIJ5N3T77vv3eQl5CX3vaSYf+bPvffcs3z/ev5z8wySJGvtUA4pId9EriQXkx1yKuRy0AHyC+Q95H3GmJO89iwRdD/yveS/ks+S/1+kubXGfHJet6XgJGHyfeR/ka81HeSCWjuckiAcWEiWNj5tEoaipITggHLysU8bedz6x3k/JZAQ7CjwZ+IG95bbegKZ3F4IE9/ADgV83kYeFt/ei+5riWUaM1WNj6kl/RF8GhtXkVMGv/kNYOYSi4WPWRzu+WQozMPJK2NY9dxKbPwOOWVauc7a9DLXpk1wbXiiawu+5tp/Hk15uq4GVvnIPQuwdz82POg3pnLdWW2hXSk7G8jNBU7Uc4c6lspMgcb8mJj7qqfvQnfzflSgoQk6hZmtHTqhCUU5LZ3P/uwJxnSjuZBjKzTeoSQKZJUE3SIfePwVmjkAnfwIeGq7xa4jNkDvli6zdaddbgh5vB66Q4baNpzNY1mB/mSMAEWlaLoCXLoM5OW0rnKRz8+9YbFqu4vac3Q9ut89Ew0evMNBOufogsqo/CESYCxZMdAtCsfcx4m5kAfeRMFvfs/iF69Y1F8AFtxmMG+awa7DFss2W1SftEjPAPpSMEsl/GGPRWWpxejruzSfMJdIgLLuIHep5E07WUoeBDIIxIRs1Aq0QAbjYO8xi3uftGjmIoqLRzZZrHvHovbjaFt2lsa0sqLyirJBMCqVAN8M1vfqXhcbgft/abF+O32R4KTJFjBUYIjA6ujflymkB5SrpVHAo2fZnxbL4LPfX8AvEXjJZ4D8vl1q3wdTKQFUz3dKzRGgsSnqo/EdtVltfJ1AMpkNPDDUvq/NGAZlopDexb1PUx/vmbPxvokC5lIBs8cZLJrkYABjISAVc5qWVNrhmL/tAh5eDZz+yGLRNwy+PQvIIWCR3EdABN4Jx4EXOLkBhVAYxIOPCso2Apdbib402uB7Uw3GDQms+ejA6NL+/dXX3XuBWQ9YNNEC8t8f0pdf3MIdb57BzElAEYuO8UwBO/ZbZNMlwr72dSUWyscbMt1GwS1tC7gb8/OxPNs9MM3BjDFJA9fMHnGqxFRDF7nE9JdFk6bRv3OYKapraOqHLeY8YnHkFPDKQwaPLjC4jjmhkYIKZER4OLNSZj+5g9/GayMt05879U/vdLCpKoTxnzU4T/dMlQxzqaeojib4C/17Ji2Q24cYqGFpz9ekrJLX12LBDIPvVxgooJdutNjwtsV13OQXs33eLVHN/p65fsU2Fw3M+7O+wP63OcimRVe86WLdPhcD+hh8d4LBl0c7cJI0RqcCCNTPf2vx9J8AbTpZSnnydwpi6PPK2xKkkK7wg7sNKqcYHP4Pczq1PrjdzvLheaCh0WLUQIP1rJt+TfDHGywyaVm5lJSzpiKE0vzkJOhUAN8qb38APL7G4tX3olGTkdE2YOU5V2jHGfxO8cxCBxm0VkfUxKhduD6Cv9dYb49Q6hVwMfWDX00P4c6C5AToNAZ8EDd/HlhPX3/2JwZjR7Lq5Brewso2XFwBrip0KwU9SAskokP1Fju5sWUxi/k7ty+AUm1WAsETzaf2QAKoo7JKRTnws3tMqwAx7fkg5Fbw6h+N6IB8wTUu5opyR6VWCfTEPyLYfNyNZq8OhnfUFFgAf7CykuezMe0LvLJOEzeFacUGnxvMhwRUNMBgSqHxNq4WK8aUoHL80HmLH70VweLXm7GP+04QSlqAQQxOmVubkIJYqXPYQGD5XAe/q3JwgjWOArY9/ZeF3EkG7VOzQnh8uoMhSrvEaGMCqIZKpyum0xLbP7SoerMZyz6IRFNz+8ningMFcVx/b/d9+S2L5X+2OHsJmFNusGS68faLZa+52Pi+RX+m3ftvcTC3NGqNtdUuVu1hGqX1vsJNa0lZCJlUwur3Xbx0yMUntF4mwbfs0nwn52YSxIrSEMoHJtZz0gL4wpwneGWVPkytT++wWL3ThbSsAJWLNRP7hvmOFztffyHiaVeWU7YZzH1iwY0UsNjBkXMWvzkQwdbTNAfHyQp+TDVxjsdKmJkGJxZAsqZEAr6D2l72qov9zDzK535pLKAu98cGqlAHHWk2ja4hYNm8P0fBl74TwbZTLlbeGsYTk8PYwvvV/3Zx4BO6EsdICSpPhmUnjikBT0mAd5kKl/MwsuVgtMbJ0Qbn+zJnlD9LZ94pjTct7/yA5VV1UzXj5SgDd0x/g1vzHUy43sHLtdyd6yIYmGVw30gHJdylOyMJoLpR63VJpz4GnqTGX2K5cJFazCRwb1duB94DzNm8AxnX93zbEywmjNKtVuS4+IN/Fp/nEnTFcG6GfB/qHLvwuhJA3+dL9NQZ1TOzVK6gu5yyyOGm5ZUVMeBescYFdVjxta25pBmB8NuiV+ulXaXRGQQ6IvdqlNmcNyAdkB6eD9K5juauOcPCjuDl4z4oJhZPw6OYShWg8t0rxKTjZD6zkYSIngc0hrs434/sZ7BsItMpM4y03g16URbYE2SCtBhoaVvgpUHVP+OGsaaf6uDm4QZrmBbXsrocRK0uLnMwhoVbLePF17yuyk43DDK4fah0123aLQH2kflRo/MvEwVcdN5kg+f41eAC/X8ENV7F49/sm4yXLQRlEUFX3uB4NU1GnGZbDvpsE2wJ3wMkzPvD/NJbxyPBbj7c3tmkOoA/9FUHd91osbeO54SxxttN24/J4z7QhhxaIGY9zxIC3yPKxy7OVCcLiNaSOxXA68U/E0Yasv/U9dU7E1PzUTfilQIovfYAPU/lq5rxaAP/Ho7d9+iFYRKtd2QFqYvC9IALHeFMfxRQTwBK0sD7pWroaSpixsnnGVh1zWVqX2XzF/t3e5VHiVkx4H0z8GZjHHBq8PAYzJW8QQH/HL9g8exRF6f5hWvOCAeTBviGDzhB226v8fEuCqAM3iqAHihEAS9bycPJvZFOENRUgq/xwbVRReyFPrWf8Tv0ois/SKIyHnxCbLTEFLL+tdlb6BiBlCcE3NELDigi95Z/dBd2hLHLNgrg/9RA//a/1qSfN6T+U4N46ThRHnk+WRa5Fj/20A9LeGrumpKuSjjxUE6r8ruU/C1yMblNMuBzUFKxqnJelcC75KR/bvM/oz335IdbWbMAAAAASUVORK5CYII=",
|
|
577
|
+
fit: "cover"
|
|
578
|
+
},
|
|
579
|
+
tile: "#FFFFFF"
|
|
573
580
|
}
|
|
574
581
|
};
|
|
575
582
|
/** One brand mark at a given box size; the artwork is decorative. */
|
|
@@ -931,6 +938,32 @@ window.__ModuleLoader__.load({
|
|
|
931
938
|
defaultReasoningEffort: "high",
|
|
932
939
|
reasoningProfile: "standard",
|
|
933
940
|
supportsReasoningSummary: false
|
|
941
|
+
},
|
|
942
|
+
{
|
|
943
|
+
id: "gpt-6.2-astra",
|
|
944
|
+
name: "6.2 Astra",
|
|
945
|
+
contextWindow: 272e3,
|
|
946
|
+
inputModalities: ["text", "image"],
|
|
947
|
+
defaultReasoningEffort: "low",
|
|
948
|
+
reasoningProfile: "gpt-6",
|
|
949
|
+
supportsReasoningSummary: true,
|
|
950
|
+
maxTokens: GPT_6_MAX_TOKENS,
|
|
951
|
+
supportsOutputVerbosity: true,
|
|
952
|
+
defaultOutputVerbosity: "low",
|
|
953
|
+
useResponsesLite: true
|
|
954
|
+
},
|
|
955
|
+
{
|
|
956
|
+
id: "gpt-6.2-sol",
|
|
957
|
+
name: "6.2 Sol",
|
|
958
|
+
contextWindow: 5e5,
|
|
959
|
+
inputModalities: ["text", "image"],
|
|
960
|
+
defaultReasoningEffort: "low",
|
|
961
|
+
reasoningProfile: "gpt-6",
|
|
962
|
+
supportsReasoningSummary: true,
|
|
963
|
+
maxTokens: GPT_6_MAX_TOKENS,
|
|
964
|
+
supportsOutputVerbosity: true,
|
|
965
|
+
defaultOutputVerbosity: "low",
|
|
966
|
+
useResponsesLite: true
|
|
934
967
|
}
|
|
935
968
|
];
|
|
936
969
|
const DEFAULT_VISIBLE_CODEX_MODEL_IDS = [
|
|
@@ -941,7 +974,9 @@ window.__ModuleLoader__.load({
|
|
|
941
974
|
"gpt-6-luna",
|
|
942
975
|
"gpt-5.6-sol",
|
|
943
976
|
"gpt-5.6-terra",
|
|
944
|
-
"gpt-5.6-luna"
|
|
977
|
+
"gpt-5.6-luna",
|
|
978
|
+
"gpt-6.2-astra",
|
|
979
|
+
"gpt-6.2-sol"
|
|
945
980
|
];
|
|
946
981
|
const DEFAULT_CODEX_MODEL = CODEX_MODEL_CATALOG[0];
|
|
947
982
|
/**
|
|
@@ -959,10 +994,10 @@ window.__ModuleLoader__.load({
|
|
|
959
994
|
//#region src/client/api.ts
|
|
960
995
|
var SubscriptionApi = class {
|
|
961
996
|
status() {
|
|
962
|
-
return request$
|
|
997
|
+
return request$4(`${ROUTE_PREFIX}/status`);
|
|
963
998
|
}
|
|
964
999
|
startLogin() {
|
|
965
|
-
return post$
|
|
1000
|
+
return post$7(`${ROUTE_PREFIX}/login/start`, {});
|
|
966
1001
|
}
|
|
967
1002
|
/**
|
|
968
1003
|
* Start a device-code sign-in instead of the browser callback.
|
|
@@ -972,14 +1007,14 @@ window.__ModuleLoader__.load({
|
|
|
972
1007
|
* wait for confirmation arrives on the same event stream as any other login.
|
|
973
1008
|
*/
|
|
974
1009
|
startDeviceLogin() {
|
|
975
|
-
return post$
|
|
1010
|
+
return post$7(`${ROUTE_PREFIX}/login/device/start`, {});
|
|
976
1011
|
}
|
|
977
1012
|
cancelLogin(loginId) {
|
|
978
|
-
return post$
|
|
1013
|
+
return post$7(`${ROUTE_PREFIX}/login/cancel`, { loginId });
|
|
979
1014
|
}
|
|
980
1015
|
/** Sign out one pooled account; without an id, the active one. */
|
|
981
1016
|
logout(accountId) {
|
|
982
|
-
return post$
|
|
1017
|
+
return post$7(`${ROUTE_PREFIX}/logout`, accountId === void 0 ? {} : { accountId });
|
|
983
1018
|
}
|
|
984
1019
|
/**
|
|
985
1020
|
* One account-pool action, returning the refreshed status.
|
|
@@ -988,7 +1023,7 @@ window.__ModuleLoader__.load({
|
|
|
988
1023
|
* never has to guess what the pool looks like after a change.
|
|
989
1024
|
*/
|
|
990
1025
|
accountAction(action, body = {}) {
|
|
991
|
-
return post$
|
|
1026
|
+
return post$7(`${ROUTE_PREFIX}/accounts`, {
|
|
992
1027
|
action,
|
|
993
1028
|
...body
|
|
994
1029
|
});
|
|
@@ -1003,11 +1038,11 @@ window.__ModuleLoader__.load({
|
|
|
1003
1038
|
* call the host always answers with a 400.
|
|
1004
1039
|
*/
|
|
1005
1040
|
adoptLocalLogin(source) {
|
|
1006
|
-
return post$
|
|
1041
|
+
return post$7(`${ROUTE_PREFIX}/adopt`, { source });
|
|
1007
1042
|
}
|
|
1008
1043
|
/** Forget every imported snapshot. The CLIs' own files are never touched. */
|
|
1009
1044
|
disableAdoptedLocalLogins() {
|
|
1010
|
-
return post$
|
|
1045
|
+
return post$7(`${ROUTE_PREFIX}/adopt/disable`, {});
|
|
1011
1046
|
}
|
|
1012
1047
|
/**
|
|
1013
1048
|
* Choose the account-pool store, answering with the refreshed status.
|
|
@@ -1016,39 +1051,39 @@ window.__ModuleLoader__.load({
|
|
|
1016
1051
|
* back already names the store the pools will read and write from here on.
|
|
1017
1052
|
*/
|
|
1018
1053
|
setPoolStorage(mode) {
|
|
1019
|
-
return post$
|
|
1054
|
+
return post$7(`${ROUTE_PREFIX}/storage`, { mode });
|
|
1020
1055
|
}
|
|
1021
1056
|
refresh() {
|
|
1022
|
-
return post$
|
|
1057
|
+
return post$7(`${ROUTE_PREFIX}/token/refresh`, {});
|
|
1023
1058
|
}
|
|
1024
1059
|
refreshQuota() {
|
|
1025
|
-
return post$
|
|
1060
|
+
return post$7(`${ROUTE_PREFIX}/quota/refresh`, {});
|
|
1026
1061
|
}
|
|
1027
1062
|
useResetCredit() {
|
|
1028
|
-
return post$
|
|
1063
|
+
return post$7(`${ROUTE_PREFIX}/quota/reset-credit/use`, {});
|
|
1029
1064
|
}
|
|
1030
1065
|
testConnection() {
|
|
1031
|
-
return post$
|
|
1066
|
+
return post$7(`${ROUTE_PREFIX}/connection/test`, {});
|
|
1032
1067
|
}
|
|
1033
1068
|
updatePreferences(patch) {
|
|
1034
|
-
return post$
|
|
1069
|
+
return post$7(`${ROUTE_PREFIX}/preferences/update`, patch);
|
|
1035
1070
|
}
|
|
1036
1071
|
/** Every route a compaction summary may be pointed at, read per call. */
|
|
1037
1072
|
compactionCandidates() {
|
|
1038
|
-
return post$
|
|
1073
|
+
return post$7(`${ROUTE_PREFIX}/compaction/candidates`, {});
|
|
1039
1074
|
}
|
|
1040
1075
|
events(loginId) {
|
|
1041
1076
|
return new EventSource(`${ROUTE_PREFIX}/login/events?loginId=${encodeURIComponent(loginId)}`);
|
|
1042
1077
|
}
|
|
1043
1078
|
};
|
|
1044
|
-
async function post$
|
|
1045
|
-
return request$
|
|
1079
|
+
async function post$7(url, body) {
|
|
1080
|
+
return request$4(url, {
|
|
1046
1081
|
method: "POST",
|
|
1047
1082
|
headers: { "content-type": "application/json" },
|
|
1048
1083
|
body: JSON.stringify(body)
|
|
1049
1084
|
});
|
|
1050
1085
|
}
|
|
1051
|
-
async function request$
|
|
1086
|
+
async function request$4(url, init) {
|
|
1052
1087
|
const response = await fetch(url, {
|
|
1053
1088
|
...init,
|
|
1054
1089
|
credentials: "same-origin"
|
|
@@ -1068,7 +1103,7 @@ window.__ModuleLoader__.load({
|
|
|
1068
1103
|
//#endregion
|
|
1069
1104
|
//#region src/client/locales.ts
|
|
1070
1105
|
const NS = "dsh-chatgpt-subscription";
|
|
1071
|
-
const zh$
|
|
1106
|
+
const zh$16 = {
|
|
1072
1107
|
...accountPoolZh,
|
|
1073
1108
|
title: "ChatGPT",
|
|
1074
1109
|
hubTitle: "订阅服务",
|
|
@@ -1282,6 +1317,7 @@ window.__ModuleLoader__.load({
|
|
|
1282
1317
|
"cardName.opendesign": "OpenDesign",
|
|
1283
1318
|
"cardName.workbuddy": "WorkBuddy",
|
|
1284
1319
|
"cardName.antigravity-acp": "Antigravity(ACP)",
|
|
1320
|
+
"cardName.qianwen-token-plan": "Qwen Token Plan(千问)",
|
|
1285
1321
|
modelChecklistCount: "已启用 {count}/{total}",
|
|
1286
1322
|
codeRunTitle: "代码",
|
|
1287
1323
|
codeRunOutput: "输出",
|
|
@@ -1295,8 +1331,8 @@ window.__ModuleLoader__.load({
|
|
|
1295
1331
|
codeRunFailed: "失败",
|
|
1296
1332
|
codeRunStopped: "已停止"
|
|
1297
1333
|
};
|
|
1298
|
-
const dictionaries$
|
|
1299
|
-
zh: zh$
|
|
1334
|
+
const dictionaries$16 = {
|
|
1335
|
+
zh: zh$16,
|
|
1300
1336
|
en: {
|
|
1301
1337
|
...accountPoolEn,
|
|
1302
1338
|
title: "ChatGPT",
|
|
@@ -1511,6 +1547,7 @@ window.__ModuleLoader__.load({
|
|
|
1511
1547
|
"cardName.opendesign": "OpenDesign",
|
|
1512
1548
|
"cardName.workbuddy": "WorkBuddy",
|
|
1513
1549
|
"cardName.antigravity-acp": "Antigravity (ACP)",
|
|
1550
|
+
"cardName.qianwen-token-plan": "Qwen Token Plan",
|
|
1514
1551
|
modelChecklistCount: "{count}/{total} enabled",
|
|
1515
1552
|
codeRunTitle: "Code",
|
|
1516
1553
|
codeRunOutput: "Output",
|
|
@@ -1636,7 +1673,7 @@ window.__ModuleLoader__.load({
|
|
|
1636
1673
|
* reads).
|
|
1637
1674
|
*/
|
|
1638
1675
|
function LineProxySection({ line, fetchSnapshot, onSave, idPrefix, snapshot: provided }) {
|
|
1639
|
-
const labels = useLineDict(NS, zh$
|
|
1676
|
+
const labels = useLineDict(NS, zh$16);
|
|
1640
1677
|
const readSnapshotFromRoute = (0, react.useCallback)(() => (fetchSnapshot ?? (() => fetchLineProxySnapshot("/api/dsh-chatgpt-subscription")))(), [fetchSnapshot]);
|
|
1641
1678
|
const writePreferences = (0, react.useCallback)((patch) => (onSave ?? ((next) => savePreferences("/api/dsh-chatgpt-subscription", next)))(patch), [onSave]);
|
|
1642
1679
|
const [readSnapshot, setReadSnapshot] = (0, react.useState)(null);
|
|
@@ -2509,7 +2546,7 @@ window.__ModuleLoader__.load({
|
|
|
2509
2546
|
load(true);
|
|
2510
2547
|
});
|
|
2511
2548
|
} catch (cause) {
|
|
2512
|
-
if (!quiet) setError(messageOf$
|
|
2549
|
+
if (!quiet) setError(messageOf$5(cause));
|
|
2513
2550
|
}
|
|
2514
2551
|
}, []);
|
|
2515
2552
|
(0, react.useEffect)(() => {
|
|
@@ -2589,7 +2626,7 @@ window.__ModuleLoader__.load({
|
|
|
2589
2626
|
} catch (cause) {
|
|
2590
2627
|
popup?.close();
|
|
2591
2628
|
setBusy(null);
|
|
2592
|
-
setError(messageOf$
|
|
2629
|
+
setError(messageOf$5(cause));
|
|
2593
2630
|
}
|
|
2594
2631
|
};
|
|
2595
2632
|
/**
|
|
@@ -2614,8 +2651,8 @@ window.__ModuleLoader__.load({
|
|
|
2614
2651
|
setBusy(null);
|
|
2615
2652
|
await load(true);
|
|
2616
2653
|
} catch (cause) {
|
|
2617
|
-
if (deviceLogin === null) setError(messageOf$
|
|
2618
|
-
else setDeviceError(messageOf$
|
|
2654
|
+
if (deviceLogin === null) setError(messageOf$5(cause));
|
|
2655
|
+
else setDeviceError(messageOf$5(cause));
|
|
2619
2656
|
setBusy(null);
|
|
2620
2657
|
}
|
|
2621
2658
|
};
|
|
@@ -2671,7 +2708,7 @@ window.__ModuleLoader__.load({
|
|
|
2671
2708
|
setDeviceError(null);
|
|
2672
2709
|
await load();
|
|
2673
2710
|
} catch (cause) {
|
|
2674
|
-
setError(messageOf$
|
|
2711
|
+
setError(messageOf$5(cause));
|
|
2675
2712
|
} finally {
|
|
2676
2713
|
setBusy(null);
|
|
2677
2714
|
}
|
|
@@ -2891,7 +2928,7 @@ window.__ModuleLoader__.load({
|
|
|
2891
2928
|
const next = await apiRef.current.accountAction("relogin", { accountId });
|
|
2892
2929
|
setStatus(next);
|
|
2893
2930
|
} catch (cause) {
|
|
2894
|
-
setError(messageOf$
|
|
2931
|
+
setError(messageOf$5(cause));
|
|
2895
2932
|
return;
|
|
2896
2933
|
}
|
|
2897
2934
|
await startLogin();
|
|
@@ -2904,7 +2941,7 @@ window.__ModuleLoader__.load({
|
|
|
2904
2941
|
try {
|
|
2905
2942
|
await task();
|
|
2906
2943
|
} catch (cause) {
|
|
2907
|
-
setError(messageOf$
|
|
2944
|
+
setError(messageOf$5(cause));
|
|
2908
2945
|
} finally {
|
|
2909
2946
|
setBusy(null);
|
|
2910
2947
|
}
|
|
@@ -3732,7 +3769,7 @@ window.__ModuleLoader__.load({
|
|
|
3732
3769
|
return absolute;
|
|
3733
3770
|
}
|
|
3734
3771
|
}
|
|
3735
|
-
function messageOf$
|
|
3772
|
+
function messageOf$5(error) {
|
|
3736
3773
|
return error instanceof Error ? error.message : String(error);
|
|
3737
3774
|
}
|
|
3738
3775
|
//#endregion
|
|
@@ -3892,7 +3929,7 @@ window.__ModuleLoader__.load({
|
|
|
3892
3929
|
//#endregion
|
|
3893
3930
|
//#region src/client/command-code/locales.ts
|
|
3894
3931
|
const NS_COMMAND_CODE = "dsh-command-code";
|
|
3895
|
-
const zh$
|
|
3932
|
+
const zh$15 = {
|
|
3896
3933
|
...accountPoolZh,
|
|
3897
3934
|
title: "Command Code",
|
|
3898
3935
|
pageDesc: "登录 Command Code,管理可用模型、上下文窗口与额度。",
|
|
@@ -3960,7 +3997,7 @@ window.__ModuleLoader__.load({
|
|
|
3960
3997
|
loginFailed: "登录失败",
|
|
3961
3998
|
tokens: "tokens"
|
|
3962
3999
|
};
|
|
3963
|
-
const en$
|
|
4000
|
+
const en$15 = {
|
|
3964
4001
|
...accountPoolEn,
|
|
3965
4002
|
title: "Command Code",
|
|
3966
4003
|
pageDesc: "Sign in to Command Code and manage models, context windows, and quota.",
|
|
@@ -4028,11 +4065,11 @@ window.__ModuleLoader__.load({
|
|
|
4028
4065
|
loginFailed: "Sign-in failed",
|
|
4029
4066
|
tokens: "tokens"
|
|
4030
4067
|
};
|
|
4031
|
-
const dictionaries$
|
|
4032
|
-
zh: zh$
|
|
4033
|
-
"zh-CN": zh$
|
|
4034
|
-
en: en$
|
|
4035
|
-
"en-US": en$
|
|
4068
|
+
const dictionaries$15 = {
|
|
4069
|
+
zh: zh$15,
|
|
4070
|
+
"zh-CN": zh$15,
|
|
4071
|
+
en: en$15,
|
|
4072
|
+
"en-US": en$15
|
|
4036
4073
|
};
|
|
4037
4074
|
//#endregion
|
|
4038
4075
|
//#region src/client/command-code/CommandCodeSection.tsx
|
|
@@ -4049,7 +4086,7 @@ window.__ModuleLoader__.load({
|
|
|
4049
4086
|
xhigh: "X-High",
|
|
4050
4087
|
max: "Max"
|
|
4051
4088
|
};
|
|
4052
|
-
const api$
|
|
4089
|
+
const api$15 = createLineApi("/command-code/api", "Command Code");
|
|
4053
4090
|
/**
|
|
4054
4091
|
* Route name shown next to a model.
|
|
4055
4092
|
*
|
|
@@ -4073,7 +4110,7 @@ window.__ModuleLoader__.load({
|
|
|
4073
4110
|
const [apiKey, setApiKey] = (0, react.useState)("");
|
|
4074
4111
|
/** Follow-up poll owed while the host refreshes the quota behind an answer. */
|
|
4075
4112
|
const quotaFollowUp = (0, react.useRef)(null);
|
|
4076
|
-
const t = useLineDict(NS_COMMAND_CODE, zh$
|
|
4113
|
+
const t = useLineDict(NS_COMMAND_CODE, zh$15);
|
|
4077
4114
|
const notifyChange = (0, react.useCallback)(() => {
|
|
4078
4115
|
onModelChange?.();
|
|
4079
4116
|
loadModelDirectory?.();
|
|
@@ -4081,7 +4118,7 @@ window.__ModuleLoader__.load({
|
|
|
4081
4118
|
const loadStatus = (0, react.useCallback)(async (quiet = false) => {
|
|
4082
4119
|
if (!quiet) setError(null);
|
|
4083
4120
|
try {
|
|
4084
|
-
const data = await api$
|
|
4121
|
+
const data = await api$15.request("/status");
|
|
4085
4122
|
setStatus(data);
|
|
4086
4123
|
setContextDrafts(contextDraftsFor(data));
|
|
4087
4124
|
quotaFollowUp.current ??= createQuotaFollowUp();
|
|
@@ -4112,12 +4149,12 @@ window.__ModuleLoader__.load({
|
|
|
4112
4149
|
setBusy("login");
|
|
4113
4150
|
setError(null);
|
|
4114
4151
|
setLoginProgress(null);
|
|
4115
|
-
const flow = await api$
|
|
4152
|
+
const flow = await api$15.request("/login", { method: "POST" });
|
|
4116
4153
|
if (flow.authUrl) window.open(flow.authUrl, "_blank");
|
|
4117
4154
|
const pollTimer = window.setInterval(() => {
|
|
4118
4155
|
(async () => {
|
|
4119
4156
|
try {
|
|
4120
|
-
const poll = await api$
|
|
4157
|
+
const poll = await api$15.request("/login/status");
|
|
4121
4158
|
if (poll.progress) setLoginProgress(poll.progress);
|
|
4122
4159
|
if (poll.status === "complete") {
|
|
4123
4160
|
window.clearInterval(pollTimer);
|
|
@@ -4149,7 +4186,7 @@ window.__ModuleLoader__.load({
|
|
|
4149
4186
|
try {
|
|
4150
4187
|
setBusy("apikey");
|
|
4151
4188
|
setError(null);
|
|
4152
|
-
const updated = await api$
|
|
4189
|
+
const updated = await api$15.request("/login/apikey", {
|
|
4153
4190
|
method: "POST",
|
|
4154
4191
|
body: JSON.stringify({ apiKey })
|
|
4155
4192
|
});
|
|
@@ -4167,7 +4204,7 @@ window.__ModuleLoader__.load({
|
|
|
4167
4204
|
try {
|
|
4168
4205
|
setBusy(`${action}-${accountId}`);
|
|
4169
4206
|
setError(null);
|
|
4170
|
-
const updated = await api$
|
|
4207
|
+
const updated = await api$15.request("/accounts", {
|
|
4171
4208
|
method: "POST",
|
|
4172
4209
|
body: JSON.stringify({
|
|
4173
4210
|
action,
|
|
@@ -4186,7 +4223,7 @@ window.__ModuleLoader__.load({
|
|
|
4186
4223
|
try {
|
|
4187
4224
|
setBusy("strategy");
|
|
4188
4225
|
setError(null);
|
|
4189
|
-
const updated = await api$
|
|
4226
|
+
const updated = await api$15.request("/accounts", {
|
|
4190
4227
|
method: "POST",
|
|
4191
4228
|
body: JSON.stringify({
|
|
4192
4229
|
action: "strategy",
|
|
@@ -4209,7 +4246,7 @@ window.__ModuleLoader__.load({
|
|
|
4209
4246
|
const handleRelogin = (accountId) => {
|
|
4210
4247
|
(async () => {
|
|
4211
4248
|
try {
|
|
4212
|
-
const updated = await api$
|
|
4249
|
+
const updated = await api$15.request("/accounts", {
|
|
4213
4250
|
method: "POST",
|
|
4214
4251
|
body: JSON.stringify({
|
|
4215
4252
|
action: "relogin",
|
|
@@ -4228,7 +4265,7 @@ window.__ModuleLoader__.load({
|
|
|
4228
4265
|
try {
|
|
4229
4266
|
setBusy("quota");
|
|
4230
4267
|
setError(null);
|
|
4231
|
-
const updated = await api$
|
|
4268
|
+
const updated = await api$15.request("/quota", { method: "POST" });
|
|
4232
4269
|
setStatus(updated);
|
|
4233
4270
|
} catch (err) {
|
|
4234
4271
|
setError(err instanceof Error ? err.message : String(err));
|
|
@@ -4240,7 +4277,7 @@ window.__ModuleLoader__.load({
|
|
|
4240
4277
|
try {
|
|
4241
4278
|
setBusy("catalog");
|
|
4242
4279
|
setError(null);
|
|
4243
|
-
const updated = await api$
|
|
4280
|
+
const updated = await api$15.request("/catalog/refresh", { method: "POST" });
|
|
4244
4281
|
setStatus(updated);
|
|
4245
4282
|
setContextDrafts(contextDraftsFor(updated));
|
|
4246
4283
|
notifyChange();
|
|
@@ -4254,7 +4291,7 @@ window.__ModuleLoader__.load({
|
|
|
4254
4291
|
try {
|
|
4255
4292
|
setBusy("connection");
|
|
4256
4293
|
setError(null);
|
|
4257
|
-
await api$
|
|
4294
|
+
await api$15.post("/connection/test");
|
|
4258
4295
|
await loadStatus(true);
|
|
4259
4296
|
} catch (err) {
|
|
4260
4297
|
setError(err instanceof Error ? err.message : String(err));
|
|
@@ -4264,7 +4301,7 @@ window.__ModuleLoader__.load({
|
|
|
4264
4301
|
};
|
|
4265
4302
|
const applyEnabled = async (enabledModelIds) => {
|
|
4266
4303
|
try {
|
|
4267
|
-
const updated = await api$
|
|
4304
|
+
const updated = await api$15.request("/models", {
|
|
4268
4305
|
method: "POST",
|
|
4269
4306
|
body: JSON.stringify({ enabledModelIds })
|
|
4270
4307
|
});
|
|
@@ -4287,7 +4324,7 @@ window.__ModuleLoader__.load({
|
|
|
4287
4324
|
};
|
|
4288
4325
|
const handleUpdateEffort = async (effort) => {
|
|
4289
4326
|
try {
|
|
4290
|
-
const updated = await api$
|
|
4327
|
+
const updated = await api$15.request("/settings", {
|
|
4291
4328
|
method: "POST",
|
|
4292
4329
|
body: JSON.stringify({ defaultReasoningEffort: effort })
|
|
4293
4330
|
});
|
|
@@ -4307,7 +4344,7 @@ window.__ModuleLoader__.load({
|
|
|
4307
4344
|
try {
|
|
4308
4345
|
setSavingModel(modelId);
|
|
4309
4346
|
setError(null);
|
|
4310
|
-
const updated = await api$
|
|
4347
|
+
const updated = await api$15.request("/settings", {
|
|
4311
4348
|
method: "POST",
|
|
4312
4349
|
body: JSON.stringify({ contextWindowOverrides: { [modelId]: parsed } })
|
|
4313
4350
|
});
|
|
@@ -4328,7 +4365,7 @@ window.__ModuleLoader__.load({
|
|
|
4328
4365
|
try {
|
|
4329
4366
|
setSavingModel(modelId);
|
|
4330
4367
|
setError(null);
|
|
4331
|
-
const updated = await api$
|
|
4368
|
+
const updated = await api$15.request("/settings", {
|
|
4332
4369
|
method: "POST",
|
|
4333
4370
|
body: JSON.stringify({ contextWindowOverrides: { [modelId]: null } })
|
|
4334
4371
|
});
|
|
@@ -4355,7 +4392,7 @@ window.__ModuleLoader__.load({
|
|
|
4355
4392
|
try {
|
|
4356
4393
|
setBusy("context");
|
|
4357
4394
|
setError(null);
|
|
4358
|
-
const updated = await api$
|
|
4395
|
+
const updated = await api$15.request("/settings", {
|
|
4359
4396
|
method: "POST",
|
|
4360
4397
|
body: JSON.stringify({ contextWindowOverrides: Object.fromEntries(models.map((model) => [model, null])) })
|
|
4361
4398
|
});
|
|
@@ -4835,7 +4872,7 @@ window.__ModuleLoader__.load({
|
|
|
4835
4872
|
//#endregion
|
|
4836
4873
|
//#region src/client/kimi-code/locales.ts
|
|
4837
4874
|
const NS_KIMI_CODE = "dsh-kimi-code";
|
|
4838
|
-
const zh$
|
|
4875
|
+
const zh$14 = {
|
|
4839
4876
|
...accountPoolZh,
|
|
4840
4877
|
title: "Kimi Code",
|
|
4841
4878
|
pageDesc: "登录 Kimi Code 订阅,管理模型、思考档位、上下文窗口与额度。",
|
|
@@ -5022,7 +5059,7 @@ window.__ModuleLoader__.load({
|
|
|
5022
5059
|
compactionRouteNoImage: "该模型不接受图片:摘要里的截图会被替换为占位文本。",
|
|
5023
5060
|
compactionRouteEmpty: "没有可用的线路——先登录任意一条线路再回来设置。"
|
|
5024
5061
|
};
|
|
5025
|
-
const en$
|
|
5062
|
+
const en$14 = {
|
|
5026
5063
|
...accountPoolEn,
|
|
5027
5064
|
title: "Kimi Code",
|
|
5028
5065
|
pageDesc: "Sign in to the Kimi Code subscription and manage models, thinking level, context windows, and quota.",
|
|
@@ -5209,11 +5246,11 @@ window.__ModuleLoader__.load({
|
|
|
5209
5246
|
compactionRouteNoImage: "This model takes no images: screenshots become placeholder text in the summary.",
|
|
5210
5247
|
compactionRouteEmpty: "No route is available — sign in to one first."
|
|
5211
5248
|
};
|
|
5212
|
-
const dictionaries$
|
|
5213
|
-
zh: zh$
|
|
5214
|
-
"zh-CN": zh$
|
|
5215
|
-
en: en$
|
|
5216
|
-
"en-US": en$
|
|
5249
|
+
const dictionaries$14 = {
|
|
5250
|
+
zh: zh$14,
|
|
5251
|
+
"zh-CN": zh$14,
|
|
5252
|
+
en: en$14,
|
|
5253
|
+
"en-US": en$14
|
|
5217
5254
|
};
|
|
5218
5255
|
//#endregion
|
|
5219
5256
|
//#region src/shared/kimi-code-contracts.ts
|
|
@@ -5325,7 +5362,7 @@ window.__ModuleLoader__.load({
|
|
|
5325
5362
|
return `${value}x`;
|
|
5326
5363
|
}
|
|
5327
5364
|
function KimiModelCapabilities({ models }) {
|
|
5328
|
-
const t = useLineDict(NS_KIMI_CODE, zh$
|
|
5365
|
+
const t = useLineDict(NS_KIMI_CODE, zh$14);
|
|
5329
5366
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
5330
5367
|
className: "dsha-cap-table",
|
|
5331
5368
|
children: [
|
|
@@ -5727,7 +5764,7 @@ window.__ModuleLoader__.load({
|
|
|
5727
5764
|
}
|
|
5728
5765
|
//#endregion
|
|
5729
5766
|
//#region src/client/kimi-code/KimiCodeSection.tsx
|
|
5730
|
-
const api$
|
|
5767
|
+
const api$14 = createLineApi("/kimi-code/api", "Kimi Code");
|
|
5731
5768
|
/**
|
|
5732
5769
|
* One token count as the card prints it.
|
|
5733
5770
|
*
|
|
@@ -5854,7 +5891,7 @@ window.__ModuleLoader__.load({
|
|
|
5854
5891
|
statusGeneration.current += 1;
|
|
5855
5892
|
setStatus(next);
|
|
5856
5893
|
}, []);
|
|
5857
|
-
const t = useLineDict(NS_KIMI_CODE, zh$
|
|
5894
|
+
const t = useLineDict(NS_KIMI_CODE, zh$14);
|
|
5858
5895
|
const notifyChange = (0, react.useCallback)(() => {
|
|
5859
5896
|
onModelChange?.();
|
|
5860
5897
|
loadModelDirectory?.();
|
|
@@ -5863,7 +5900,7 @@ window.__ModuleLoader__.load({
|
|
|
5863
5900
|
const generation = ++statusGeneration.current;
|
|
5864
5901
|
if (!quiet) setError(null);
|
|
5865
5902
|
try {
|
|
5866
|
-
const data = await api$
|
|
5903
|
+
const data = await api$14.request("/status");
|
|
5867
5904
|
if (generation !== statusGeneration.current) return;
|
|
5868
5905
|
setStatus(data);
|
|
5869
5906
|
setContextDrafts(contextDraftsFor(data));
|
|
@@ -5905,7 +5942,7 @@ window.__ModuleLoader__.load({
|
|
|
5905
5942
|
const timer = window.setInterval(() => {
|
|
5906
5943
|
(async () => {
|
|
5907
5944
|
try {
|
|
5908
|
-
const poll = await api$
|
|
5945
|
+
const poll = await api$14.request("/login/status");
|
|
5909
5946
|
setFlow(poll);
|
|
5910
5947
|
if (poll.status === "complete") {
|
|
5911
5948
|
await loadStatus();
|
|
@@ -5927,7 +5964,7 @@ window.__ModuleLoader__.load({
|
|
|
5927
5964
|
setBusy("login");
|
|
5928
5965
|
setError(null);
|
|
5929
5966
|
setCopied(false);
|
|
5930
|
-
const next = await api$
|
|
5967
|
+
const next = await api$14.request("/login", {
|
|
5931
5968
|
method: "POST",
|
|
5932
5969
|
body: JSON.stringify(accountId === void 0 ? {} : { accountId })
|
|
5933
5970
|
});
|
|
@@ -5940,7 +5977,7 @@ window.__ModuleLoader__.load({
|
|
|
5940
5977
|
};
|
|
5941
5978
|
const handleCancelLogin = async () => {
|
|
5942
5979
|
try {
|
|
5943
|
-
await api$
|
|
5980
|
+
await api$14.request("/login/cancel", { method: "POST" });
|
|
5944
5981
|
setFlow({ status: "idle" });
|
|
5945
5982
|
} catch (err) {
|
|
5946
5983
|
setError(err instanceof Error ? err.message : String(err));
|
|
@@ -5960,7 +5997,7 @@ window.__ModuleLoader__.load({
|
|
|
5960
5997
|
try {
|
|
5961
5998
|
setBusy(`${action}-${accountId}`);
|
|
5962
5999
|
setError(null);
|
|
5963
|
-
const updated = await api$
|
|
6000
|
+
const updated = await api$14.request("/accounts", {
|
|
5964
6001
|
method: "POST",
|
|
5965
6002
|
body: JSON.stringify({
|
|
5966
6003
|
action,
|
|
@@ -5980,7 +6017,7 @@ window.__ModuleLoader__.load({
|
|
|
5980
6017
|
try {
|
|
5981
6018
|
setBusy("strategy");
|
|
5982
6019
|
setError(null);
|
|
5983
|
-
const updated = await api$
|
|
6020
|
+
const updated = await api$14.request("/accounts", {
|
|
5984
6021
|
method: "POST",
|
|
5985
6022
|
body: JSON.stringify({
|
|
5986
6023
|
action: "strategy",
|
|
@@ -6003,7 +6040,7 @@ window.__ModuleLoader__.load({
|
|
|
6003
6040
|
const handleRelogin = (accountId) => {
|
|
6004
6041
|
(async () => {
|
|
6005
6042
|
try {
|
|
6006
|
-
const updated = await api$
|
|
6043
|
+
const updated = await api$14.request("/accounts", {
|
|
6007
6044
|
method: "POST",
|
|
6008
6045
|
body: JSON.stringify({
|
|
6009
6046
|
action: "relogin",
|
|
@@ -6022,7 +6059,7 @@ window.__ModuleLoader__.load({
|
|
|
6022
6059
|
try {
|
|
6023
6060
|
setBusy("quota");
|
|
6024
6061
|
setError(null);
|
|
6025
|
-
const updated = await api$
|
|
6062
|
+
const updated = await api$14.request("/quota", { method: "POST" });
|
|
6026
6063
|
applyStatus(updated);
|
|
6027
6064
|
} catch (err) {
|
|
6028
6065
|
setError(err instanceof Error ? err.message : String(err));
|
|
@@ -6035,7 +6072,7 @@ window.__ModuleLoader__.load({
|
|
|
6035
6072
|
try {
|
|
6036
6073
|
setBusy("catalog");
|
|
6037
6074
|
setError(null);
|
|
6038
|
-
const updated = await api$
|
|
6075
|
+
const updated = await api$14.request("/catalog/refresh", { method: "POST" });
|
|
6039
6076
|
applyStatus(updated);
|
|
6040
6077
|
setContextDrafts(contextDraftsFor(updated));
|
|
6041
6078
|
notifyChange();
|
|
@@ -6050,7 +6087,7 @@ window.__ModuleLoader__.load({
|
|
|
6050
6087
|
setBusy("connection");
|
|
6051
6088
|
setError(null);
|
|
6052
6089
|
setConnectionNotice(null);
|
|
6053
|
-
const result = await api$
|
|
6090
|
+
const result = await api$14.request("/connection/test", { method: "POST" });
|
|
6054
6091
|
setConnectionNotice(result.connected ? `${t.testSuccess} · ${result.latencyMs} ms` : t.testFailed);
|
|
6055
6092
|
await loadStatus(true);
|
|
6056
6093
|
} catch (err) {
|
|
@@ -6061,7 +6098,7 @@ window.__ModuleLoader__.load({
|
|
|
6061
6098
|
};
|
|
6062
6099
|
const applyEnabled = async (enabledModelIds) => {
|
|
6063
6100
|
try {
|
|
6064
|
-
const updated = await api$
|
|
6101
|
+
const updated = await api$14.request("/models", {
|
|
6065
6102
|
method: "POST",
|
|
6066
6103
|
body: JSON.stringify({ enabledModelIds })
|
|
6067
6104
|
});
|
|
@@ -6084,7 +6121,7 @@ window.__ModuleLoader__.load({
|
|
|
6084
6121
|
};
|
|
6085
6122
|
const handleUpdateEffort = async (effort) => {
|
|
6086
6123
|
try {
|
|
6087
|
-
const updated = await api$
|
|
6124
|
+
const updated = await api$14.request("/settings", {
|
|
6088
6125
|
method: "POST",
|
|
6089
6126
|
body: JSON.stringify({ defaultReasoningEffort: effort })
|
|
6090
6127
|
});
|
|
@@ -6104,7 +6141,7 @@ window.__ModuleLoader__.load({
|
|
|
6104
6141
|
try {
|
|
6105
6142
|
setSavingModel(modelId);
|
|
6106
6143
|
setError(null);
|
|
6107
|
-
const updated = await api$
|
|
6144
|
+
const updated = await api$14.request("/settings", {
|
|
6108
6145
|
method: "POST",
|
|
6109
6146
|
body: JSON.stringify({ contextWindowOverrides: { [modelId]: parsed } })
|
|
6110
6147
|
});
|
|
@@ -6125,7 +6162,7 @@ window.__ModuleLoader__.load({
|
|
|
6125
6162
|
try {
|
|
6126
6163
|
setSavingModel(modelId);
|
|
6127
6164
|
setError(null);
|
|
6128
|
-
const updated = await api$
|
|
6165
|
+
const updated = await api$14.request("/settings", {
|
|
6129
6166
|
method: "POST",
|
|
6130
6167
|
body: JSON.stringify({ contextWindowOverrides: { [modelId]: null } })
|
|
6131
6168
|
});
|
|
@@ -6152,7 +6189,7 @@ window.__ModuleLoader__.load({
|
|
|
6152
6189
|
try {
|
|
6153
6190
|
setBusy("context");
|
|
6154
6191
|
setError(null);
|
|
6155
|
-
const updated = await api$
|
|
6192
|
+
const updated = await api$14.request("/settings", {
|
|
6156
6193
|
method: "POST",
|
|
6157
6194
|
body: JSON.stringify({ contextWindowOverrides: Object.fromEntries(models.map((model) => [model, null])) })
|
|
6158
6195
|
});
|
|
@@ -6633,11 +6670,11 @@ window.__ModuleLoader__.load({
|
|
|
6633
6670
|
* The names stay as they were so the hook that consumes them does not have to
|
|
6634
6671
|
* change with the reader.
|
|
6635
6672
|
*/
|
|
6636
|
-
const api$
|
|
6637
|
-
api$
|
|
6638
|
-
const get$
|
|
6639
|
-
const post$
|
|
6640
|
-
function messageOf$
|
|
6673
|
+
const api$13 = createLineApi(MINIMAX_CODE_ROUTE_PREFIX, "MiniMax Code");
|
|
6674
|
+
api$13.request;
|
|
6675
|
+
const get$4 = api$13.get;
|
|
6676
|
+
const post$6 = api$13.post;
|
|
6677
|
+
function messageOf$4(cause) {
|
|
6641
6678
|
return cause instanceof Error ? cause.message : String(cause);
|
|
6642
6679
|
}
|
|
6643
6680
|
/**
|
|
@@ -6647,7 +6684,7 @@ window.__ModuleLoader__.load({
|
|
|
6647
6684
|
* produces the reader's "restart DSH" sentence rather than a bare parse crash.
|
|
6648
6685
|
*/
|
|
6649
6686
|
function fetchResetCards() {
|
|
6650
|
-
return get$
|
|
6687
|
+
return get$4("/reset-cards");
|
|
6651
6688
|
}
|
|
6652
6689
|
/**
|
|
6653
6690
|
* Spend one card.
|
|
@@ -6658,12 +6695,12 @@ window.__ModuleLoader__.load({
|
|
|
6658
6695
|
* looks the card up and sends the key it found.
|
|
6659
6696
|
*/
|
|
6660
6697
|
function useResetCard(cardId) {
|
|
6661
|
-
return post$
|
|
6698
|
+
return post$6("/reset-cards/use", { cardId });
|
|
6662
6699
|
}
|
|
6663
6700
|
//#endregion
|
|
6664
6701
|
//#region src/client/minimax-code/locales.ts
|
|
6665
6702
|
const NS_MINIMAX_CODE = "dsh-minimax-code";
|
|
6666
|
-
const zh$
|
|
6703
|
+
const zh$13 = {
|
|
6667
6704
|
...accountPoolZh,
|
|
6668
6705
|
title: "MiniMax Code",
|
|
6669
6706
|
pageDesc: "登录 MiniMax Code 编程订阅(设备码 OAuth),复用本机 MiniMax Code 的登录态,管理账号、连接与模型。",
|
|
@@ -6861,7 +6898,7 @@ window.__ModuleLoader__.load({
|
|
|
6861
6898
|
videoHistoryEncrypted: "已由系统凭据后端加密",
|
|
6862
6899
|
videoHistoryPlain: "本机没有可用的凭据后端,记录为明文"
|
|
6863
6900
|
};
|
|
6864
|
-
const en$
|
|
6901
|
+
const en$13 = {
|
|
6865
6902
|
...accountPoolEn,
|
|
6866
6903
|
title: "MiniMax Code",
|
|
6867
6904
|
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.",
|
|
@@ -7059,11 +7096,11 @@ window.__ModuleLoader__.load({
|
|
|
7059
7096
|
videoHistoryEncrypted: "Encrypted by the platform credential backend",
|
|
7060
7097
|
videoHistoryPlain: "No credential backend on this host; stored as plain text"
|
|
7061
7098
|
};
|
|
7062
|
-
const dictionaries$
|
|
7063
|
-
zh: zh$
|
|
7064
|
-
"zh-CN": zh$
|
|
7065
|
-
en: en$
|
|
7066
|
-
"en-US": en$
|
|
7099
|
+
const dictionaries$13 = {
|
|
7100
|
+
zh: zh$13,
|
|
7101
|
+
"zh-CN": zh$13,
|
|
7102
|
+
en: en$13,
|
|
7103
|
+
"en-US": en$13
|
|
7067
7104
|
};
|
|
7068
7105
|
//#endregion
|
|
7069
7106
|
//#region src/client/minimax-code/useMinimaxCodeSection.ts
|
|
@@ -7077,7 +7114,7 @@ window.__ModuleLoader__.load({
|
|
|
7077
7114
|
* rather than inferred from the JSX.
|
|
7078
7115
|
*/
|
|
7079
7116
|
/** The card's own dictionary; stable identity keeps effect dependencies intact. */
|
|
7080
|
-
const fallbackTranslate$7 = (key) => zh$
|
|
7117
|
+
const fallbackTranslate$7 = (key) => zh$13[key];
|
|
7081
7118
|
/**
|
|
7082
7119
|
* The shared pool card's labels, resolved through this card's dictionary.
|
|
7083
7120
|
*
|
|
@@ -7190,7 +7227,7 @@ window.__ModuleLoader__.load({
|
|
|
7190
7227
|
const loadStatus = (0, react.useCallback)(async (quiet = false) => {
|
|
7191
7228
|
if (!quiet) setError(null);
|
|
7192
7229
|
try {
|
|
7193
|
-
const next = await get$
|
|
7230
|
+
const next = await get$4("/status");
|
|
7194
7231
|
setStatus(next);
|
|
7195
7232
|
setContextDrafts(contextDraftsFor(next));
|
|
7196
7233
|
quotaFollowUp.current ??= createQuotaFollowUp();
|
|
@@ -7198,7 +7235,7 @@ window.__ModuleLoader__.load({
|
|
|
7198
7235
|
loadStatus(true);
|
|
7199
7236
|
});
|
|
7200
7237
|
} catch (cause) {
|
|
7201
|
-
if (!quiet) setError(messageOf$
|
|
7238
|
+
if (!quiet) setError(messageOf$4(cause));
|
|
7202
7239
|
} finally {
|
|
7203
7240
|
setLoading(false);
|
|
7204
7241
|
}
|
|
@@ -7227,7 +7264,7 @@ window.__ModuleLoader__.load({
|
|
|
7227
7264
|
const timer = window.setInterval(() => {
|
|
7228
7265
|
(async () => {
|
|
7229
7266
|
try {
|
|
7230
|
-
const poll = await post$
|
|
7267
|
+
const poll = await post$6("/login/poll", { loginId });
|
|
7231
7268
|
if (stopped || poll.status === "pending") return;
|
|
7232
7269
|
stopped = true;
|
|
7233
7270
|
window.clearInterval(timer);
|
|
@@ -7268,7 +7305,7 @@ window.__ModuleLoader__.load({
|
|
|
7268
7305
|
quotaRequested.current = true;
|
|
7269
7306
|
(async () => {
|
|
7270
7307
|
try {
|
|
7271
|
-
setStatus(await post$
|
|
7308
|
+
setStatus(await post$6("/quota"));
|
|
7272
7309
|
} catch {}
|
|
7273
7310
|
})();
|
|
7274
7311
|
}, [authenticated, status?.quota]);
|
|
@@ -7325,7 +7362,7 @@ window.__ModuleLoader__.load({
|
|
|
7325
7362
|
await loadResetCards();
|
|
7326
7363
|
await refreshQuota();
|
|
7327
7364
|
} catch (cause) {
|
|
7328
|
-
setError(messageOf$
|
|
7365
|
+
setError(messageOf$4(cause));
|
|
7329
7366
|
} finally {
|
|
7330
7367
|
setBusy(null);
|
|
7331
7368
|
}
|
|
@@ -7336,7 +7373,7 @@ window.__ModuleLoader__.load({
|
|
|
7336
7373
|
setError(null);
|
|
7337
7374
|
setConnectionNotice(null);
|
|
7338
7375
|
setCopied(false);
|
|
7339
|
-
const started = await post$
|
|
7376
|
+
const started = await post$6("/login/start");
|
|
7340
7377
|
const next = started.login ?? (typeof started.loginId === "string" ? started : void 0);
|
|
7341
7378
|
if (next === void 0) {
|
|
7342
7379
|
setError(t("loginFailed"));
|
|
@@ -7344,7 +7381,7 @@ window.__ModuleLoader__.load({
|
|
|
7344
7381
|
}
|
|
7345
7382
|
setFlow(next);
|
|
7346
7383
|
} catch (cause) {
|
|
7347
|
-
setError(messageOf$
|
|
7384
|
+
setError(messageOf$4(cause));
|
|
7348
7385
|
} finally {
|
|
7349
7386
|
setBusy(null);
|
|
7350
7387
|
}
|
|
@@ -7354,9 +7391,9 @@ window.__ModuleLoader__.load({
|
|
|
7354
7391
|
setFlow(null);
|
|
7355
7392
|
if (pending === null) return;
|
|
7356
7393
|
try {
|
|
7357
|
-
await post$
|
|
7394
|
+
await post$6("/login/cancel", { loginId: pending.loginId });
|
|
7358
7395
|
} catch (cause) {
|
|
7359
|
-
setError(messageOf$
|
|
7396
|
+
setError(messageOf$4(cause));
|
|
7360
7397
|
}
|
|
7361
7398
|
};
|
|
7362
7399
|
const copyCode = async () => {
|
|
@@ -7374,12 +7411,12 @@ window.__ModuleLoader__.load({
|
|
|
7374
7411
|
setError(null);
|
|
7375
7412
|
setConnectionNotice(null);
|
|
7376
7413
|
setFlow(null);
|
|
7377
|
-
const result = await post$
|
|
7414
|
+
const result = await post$6("/logout");
|
|
7378
7415
|
if (result.native === true) setConnectionNotice(result.error ?? t("logoutOwnedByApp"));
|
|
7379
7416
|
await loadStatus(true);
|
|
7380
7417
|
onModelChange?.();
|
|
7381
7418
|
} catch (cause) {
|
|
7382
|
-
setError(messageOf$
|
|
7419
|
+
setError(messageOf$4(cause));
|
|
7383
7420
|
await loadStatus(true);
|
|
7384
7421
|
} finally {
|
|
7385
7422
|
setBusy(null);
|
|
@@ -7394,7 +7431,7 @@ window.__ModuleLoader__.load({
|
|
|
7394
7431
|
/** Re-read the pool slice, which lives beside the status on its own route. */
|
|
7395
7432
|
const loadPool = (0, react.useCallback)(async () => {
|
|
7396
7433
|
try {
|
|
7397
|
-
const next = await get$
|
|
7434
|
+
const next = await get$4("/accounts");
|
|
7398
7435
|
setPool(next);
|
|
7399
7436
|
} catch {
|
|
7400
7437
|
setPool(void 0);
|
|
@@ -7405,7 +7442,7 @@ window.__ModuleLoader__.load({
|
|
|
7405
7442
|
try {
|
|
7406
7443
|
setBusy(action);
|
|
7407
7444
|
setError(null);
|
|
7408
|
-
await post$
|
|
7445
|
+
await post$6("/accounts", {
|
|
7409
7446
|
action,
|
|
7410
7447
|
accountId
|
|
7411
7448
|
});
|
|
@@ -7413,7 +7450,7 @@ window.__ModuleLoader__.load({
|
|
|
7413
7450
|
await loadStatus(true);
|
|
7414
7451
|
onModelChange?.();
|
|
7415
7452
|
} catch (cause) {
|
|
7416
|
-
setError(messageOf$
|
|
7453
|
+
setError(messageOf$4(cause));
|
|
7417
7454
|
} finally {
|
|
7418
7455
|
setBusy(null);
|
|
7419
7456
|
}
|
|
@@ -7422,13 +7459,13 @@ window.__ModuleLoader__.load({
|
|
|
7422
7459
|
try {
|
|
7423
7460
|
setBusy("strategy");
|
|
7424
7461
|
setError(null);
|
|
7425
|
-
await post$
|
|
7462
|
+
await post$6("/accounts", {
|
|
7426
7463
|
action: "strategy",
|
|
7427
7464
|
strategy
|
|
7428
7465
|
});
|
|
7429
7466
|
await loadPool();
|
|
7430
7467
|
} catch (cause) {
|
|
7431
|
-
setError(messageOf$
|
|
7468
|
+
setError(messageOf$4(cause));
|
|
7432
7469
|
} finally {
|
|
7433
7470
|
setBusy(null);
|
|
7434
7471
|
}
|
|
@@ -7436,12 +7473,12 @@ window.__ModuleLoader__.load({
|
|
|
7436
7473
|
const applyEnabled = async (enabledModelIds) => {
|
|
7437
7474
|
try {
|
|
7438
7475
|
setError(null);
|
|
7439
|
-
const updated = await post$
|
|
7476
|
+
const updated = await post$6("/models", { enabledModelIds });
|
|
7440
7477
|
setStatus(updated);
|
|
7441
7478
|
setContextDrafts(contextDraftsFor(updated));
|
|
7442
7479
|
onModelChange?.();
|
|
7443
7480
|
} catch (cause) {
|
|
7444
|
-
setError(messageOf$
|
|
7481
|
+
setError(messageOf$4(cause));
|
|
7445
7482
|
}
|
|
7446
7483
|
};
|
|
7447
7484
|
/** Flip the check-in scheduler's own switch, through the same settings route. */
|
|
@@ -7449,10 +7486,10 @@ window.__ModuleLoader__.load({
|
|
|
7449
7486
|
try {
|
|
7450
7487
|
setBusy("checkin");
|
|
7451
7488
|
setError(null);
|
|
7452
|
-
const updated = await post$
|
|
7489
|
+
const updated = await post$6("/settings", { checkin: { enabled } });
|
|
7453
7490
|
setStatus(updated);
|
|
7454
7491
|
} catch (cause) {
|
|
7455
|
-
setError(messageOf$
|
|
7492
|
+
setError(messageOf$4(cause));
|
|
7456
7493
|
} finally {
|
|
7457
7494
|
setBusy(null);
|
|
7458
7495
|
}
|
|
@@ -7462,10 +7499,10 @@ window.__ModuleLoader__.load({
|
|
|
7462
7499
|
try {
|
|
7463
7500
|
setBusy("checkin");
|
|
7464
7501
|
setError(null);
|
|
7465
|
-
const updated = await post$
|
|
7502
|
+
const updated = await post$6("/checkin/now");
|
|
7466
7503
|
setStatus(updated);
|
|
7467
7504
|
} catch (cause) {
|
|
7468
|
-
setError(messageOf$
|
|
7505
|
+
setError(messageOf$4(cause));
|
|
7469
7506
|
} finally {
|
|
7470
7507
|
setBusy(null);
|
|
7471
7508
|
}
|
|
@@ -7483,11 +7520,11 @@ window.__ModuleLoader__.load({
|
|
|
7483
7520
|
const updateEffort = async (effort) => {
|
|
7484
7521
|
try {
|
|
7485
7522
|
setError(null);
|
|
7486
|
-
const updated = await post$
|
|
7523
|
+
const updated = await post$6("/settings", { defaultReasoningEffort: effort });
|
|
7487
7524
|
setStatus(updated);
|
|
7488
7525
|
onModelChange?.();
|
|
7489
7526
|
} catch (cause) {
|
|
7490
|
-
setError(messageOf$
|
|
7527
|
+
setError(messageOf$4(cause));
|
|
7491
7528
|
}
|
|
7492
7529
|
};
|
|
7493
7530
|
const saveContextWindow = async (modelId) => {
|
|
@@ -7500,7 +7537,7 @@ window.__ModuleLoader__.load({
|
|
|
7500
7537
|
try {
|
|
7501
7538
|
setSavingModel(modelId);
|
|
7502
7539
|
setError(null);
|
|
7503
|
-
const updated = await post$
|
|
7540
|
+
const updated = await post$6("/settings", { contextWindowOverrides: { [modelId]: parsed } });
|
|
7504
7541
|
setStatus(updated);
|
|
7505
7542
|
setContextDrafts((prev) => ({
|
|
7506
7543
|
...prev,
|
|
@@ -7508,7 +7545,7 @@ window.__ModuleLoader__.load({
|
|
|
7508
7545
|
}));
|
|
7509
7546
|
onModelChange?.();
|
|
7510
7547
|
} catch (cause) {
|
|
7511
|
-
setError(messageOf$
|
|
7548
|
+
setError(messageOf$4(cause));
|
|
7512
7549
|
} finally {
|
|
7513
7550
|
setSavingModel(null);
|
|
7514
7551
|
}
|
|
@@ -7517,7 +7554,7 @@ window.__ModuleLoader__.load({
|
|
|
7517
7554
|
try {
|
|
7518
7555
|
setSavingModel(modelId);
|
|
7519
7556
|
setError(null);
|
|
7520
|
-
const updated = await post$
|
|
7557
|
+
const updated = await post$6("/settings", { contextWindowOverrides: { [modelId]: null } });
|
|
7521
7558
|
setStatus(updated);
|
|
7522
7559
|
const model = updated.models.find((entry) => entry.id === modelId);
|
|
7523
7560
|
if (model !== void 0) setContextDrafts((prev) => ({
|
|
@@ -7526,7 +7563,7 @@ window.__ModuleLoader__.load({
|
|
|
7526
7563
|
}));
|
|
7527
7564
|
onModelChange?.();
|
|
7528
7565
|
} catch (cause) {
|
|
7529
|
-
setError(messageOf$
|
|
7566
|
+
setError(messageOf$4(cause));
|
|
7530
7567
|
} finally {
|
|
7531
7568
|
setSavingModel(null);
|
|
7532
7569
|
}
|
|
@@ -7536,12 +7573,12 @@ window.__ModuleLoader__.load({
|
|
|
7536
7573
|
if (ids.length === 0) return;
|
|
7537
7574
|
try {
|
|
7538
7575
|
setError(null);
|
|
7539
|
-
const updated = await post$
|
|
7576
|
+
const updated = await post$6("/settings", { contextWindowOverrides: Object.fromEntries(ids.map((id) => [id, null])) });
|
|
7540
7577
|
setStatus(updated);
|
|
7541
7578
|
setContextDrafts(contextDraftsFor(updated));
|
|
7542
7579
|
onModelChange?.();
|
|
7543
7580
|
} catch (cause) {
|
|
7544
|
-
setError(messageOf$
|
|
7581
|
+
setError(messageOf$4(cause));
|
|
7545
7582
|
}
|
|
7546
7583
|
};
|
|
7547
7584
|
/** Force one usage read through `/quota` and render the fresh status. */
|
|
@@ -7549,9 +7586,9 @@ window.__ModuleLoader__.load({
|
|
|
7549
7586
|
try {
|
|
7550
7587
|
setBusy("quota");
|
|
7551
7588
|
setError(null);
|
|
7552
|
-
setStatus(await post$
|
|
7589
|
+
setStatus(await post$6("/quota"));
|
|
7553
7590
|
} catch (cause) {
|
|
7554
|
-
setError(messageOf$
|
|
7591
|
+
setError(messageOf$4(cause));
|
|
7555
7592
|
} finally {
|
|
7556
7593
|
setBusy(null);
|
|
7557
7594
|
}
|
|
@@ -7561,14 +7598,14 @@ window.__ModuleLoader__.load({
|
|
|
7561
7598
|
setBusy("test");
|
|
7562
7599
|
setError(null);
|
|
7563
7600
|
setConnectionNotice(null);
|
|
7564
|
-
const result = await post$
|
|
7601
|
+
const result = await post$6("/test");
|
|
7565
7602
|
if (result.ok === true) {
|
|
7566
7603
|
setConnectionNotice(result.model === void 0 || result.model === "" ? t("testSuccess") : t("testSuccessModel").replace("{model}", result.model));
|
|
7567
7604
|
return;
|
|
7568
7605
|
}
|
|
7569
7606
|
setConnectionNotice(result.error === void 0 || result.error === "" ? t("testFailed") : `${t("testFailed")}:${result.error}`);
|
|
7570
7607
|
} catch (cause) {
|
|
7571
|
-
setConnectionNotice(`${t("testFailed")}:${messageOf$
|
|
7608
|
+
setConnectionNotice(`${t("testFailed")}:${messageOf$4(cause)}`);
|
|
7572
7609
|
} finally {
|
|
7573
7610
|
setBusy(null);
|
|
7574
7611
|
}
|
|
@@ -8303,13 +8340,13 @@ window.__ModuleLoader__.load({
|
|
|
8303
8340
|
}, []);
|
|
8304
8341
|
const load = (0, react.useCallback)(async () => {
|
|
8305
8342
|
try {
|
|
8306
|
-
const value = await get$
|
|
8343
|
+
const value = await get$4("/video-history");
|
|
8307
8344
|
if (!alive.current) return;
|
|
8308
8345
|
setData(parseVideoHistoryDto(value));
|
|
8309
8346
|
setFailure(null);
|
|
8310
8347
|
} catch (error) {
|
|
8311
8348
|
if (!alive.current) return;
|
|
8312
|
-
setFailure(messageOf$
|
|
8349
|
+
setFailure(messageOf$4(error));
|
|
8313
8350
|
} finally {
|
|
8314
8351
|
if (alive.current) setLoading(false);
|
|
8315
8352
|
}
|
|
@@ -9136,7 +9173,7 @@ window.__ModuleLoader__.load({
|
|
|
9136
9173
|
* 键名重合的会被渲染成 ChatGPT 的措辞,不重合的会把键名本身打印出来)。
|
|
9137
9174
|
*/
|
|
9138
9175
|
const NS_GLM_CODING_PLAN = "dsh-glm-coding-plan";
|
|
9139
|
-
const zh$
|
|
9176
|
+
const zh$12 = {
|
|
9140
9177
|
...accountPoolZh,
|
|
9141
9178
|
title: "GLM(ZCode 账号)",
|
|
9142
9179
|
pageDesc: "用 ZCode 账号授权接入 GLM Coding Plan(国区 bigmodel.cn / 国际区 z.ai),管理账号池、套餐额度与模型勾选。两个区域的凭据各自独立,池内可以同时存在两区账号。",
|
|
@@ -9230,7 +9267,7 @@ window.__ModuleLoader__.load({
|
|
|
9230
9267
|
quotaAllowanceUnknown: "未判定",
|
|
9231
9268
|
quotaAllowanceHint: "登录时探活认定的额度来源。「免费体验额度」指新用户注册后自动获得、首次使用起 5 天内每天 800 万 token 的体验额度。"
|
|
9232
9269
|
};
|
|
9233
|
-
const en$
|
|
9270
|
+
const en$12 = {
|
|
9234
9271
|
...accountPoolEn,
|
|
9235
9272
|
title: "GLM (ZCode account)",
|
|
9236
9273
|
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.",
|
|
@@ -9324,11 +9361,11 @@ window.__ModuleLoader__.load({
|
|
|
9324
9361
|
quotaAllowanceUnknown: "Undetermined",
|
|
9325
9362
|
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."
|
|
9326
9363
|
};
|
|
9327
|
-
const dictionaries$
|
|
9328
|
-
zh: zh$
|
|
9329
|
-
"zh-CN": zh$
|
|
9330
|
-
en: en$
|
|
9331
|
-
"en-US": en$
|
|
9364
|
+
const dictionaries$12 = {
|
|
9365
|
+
zh: zh$12,
|
|
9366
|
+
"zh-CN": zh$12,
|
|
9367
|
+
en: en$12,
|
|
9368
|
+
"en-US": en$12
|
|
9332
9369
|
};
|
|
9333
9370
|
/** 一个配额窗口的键到「窗口长度(分钟)」的映射。 */
|
|
9334
9371
|
const QUOTA_WINDOW_MINUTES$1 = {
|
|
@@ -9387,10 +9424,10 @@ window.__ModuleLoader__.load({
|
|
|
9387
9424
|
* 除 adopt 与 connection/test 外,全部走共享的 { ok, value } 信封,
|
|
9388
9425
|
* 因此答案都是裸 DTO——createLineApi 已经把信封拆掉了。
|
|
9389
9426
|
*/
|
|
9390
|
-
const api$
|
|
9391
|
-
const get$
|
|
9392
|
-
const post$
|
|
9393
|
-
function messageOf$
|
|
9427
|
+
const api$12 = createLineApi(GLM_CODING_PLAN_ROUTE_PREFIX, GLM_CODING_PLAN_PROVIDER_NAME);
|
|
9428
|
+
const get$3 = api$12.get;
|
|
9429
|
+
const post$5 = api$12.post;
|
|
9430
|
+
function messageOf$3(cause) {
|
|
9394
9431
|
return cause instanceof Error ? cause.message : String(cause);
|
|
9395
9432
|
}
|
|
9396
9433
|
//#endregion
|
|
@@ -9409,7 +9446,7 @@ window.__ModuleLoader__.load({
|
|
|
9409
9446
|
/** 登录状态机的轮询节奏。真实超时与间隔由 host 拥有,卡片只是跟随。 */
|
|
9410
9447
|
const LOGIN_POLL_INTERVAL_MS$2 = 2e3;
|
|
9411
9448
|
/** 本卡片的字典;身份稳定,依赖它的 effect 才不会每次渲染重建。 */
|
|
9412
|
-
const fallbackTranslate$6 = (key) => zh$
|
|
9449
|
+
const fallbackTranslate$6 = (key) => zh$12[key];
|
|
9413
9450
|
/**
|
|
9414
9451
|
* 共享账号池卡片需要的标签集,按本卡片的字典逐键查出来。
|
|
9415
9452
|
*
|
|
@@ -9490,7 +9527,7 @@ window.__ModuleLoader__.load({
|
|
|
9490
9527
|
const loadStatus = (0, react.useCallback)(async (quiet = false) => {
|
|
9491
9528
|
if (!quiet) setError(null);
|
|
9492
9529
|
try {
|
|
9493
|
-
const next = await get$
|
|
9530
|
+
const next = await get$3("/status");
|
|
9494
9531
|
setStatus(next);
|
|
9495
9532
|
setContextDrafts(contextDraftsFor(next));
|
|
9496
9533
|
if (!regionTouched.current) setRegionState(next.region);
|
|
@@ -9499,7 +9536,7 @@ window.__ModuleLoader__.load({
|
|
|
9499
9536
|
loadStatus(true);
|
|
9500
9537
|
});
|
|
9501
9538
|
} catch (cause) {
|
|
9502
|
-
if (!quiet) setError(messageOf$
|
|
9539
|
+
if (!quiet) setError(messageOf$3(cause));
|
|
9503
9540
|
} finally {
|
|
9504
9541
|
setLoading(false);
|
|
9505
9542
|
}
|
|
@@ -9524,7 +9561,7 @@ window.__ModuleLoader__.load({
|
|
|
9524
9561
|
const timer = window.setInterval(() => {
|
|
9525
9562
|
(async () => {
|
|
9526
9563
|
try {
|
|
9527
|
-
const poll = await get$
|
|
9564
|
+
const poll = await get$3("/login/status");
|
|
9528
9565
|
if (stopped) return;
|
|
9529
9566
|
if (poll.status === "complete") {
|
|
9530
9567
|
setPasteValue("");
|
|
@@ -9557,13 +9594,13 @@ window.__ModuleLoader__.load({
|
|
|
9557
9594
|
setError(null);
|
|
9558
9595
|
setConnection(null);
|
|
9559
9596
|
setPasteValue("");
|
|
9560
|
-
const flow = await post$
|
|
9597
|
+
const flow = await post$5("/login/start", { region: loginRegion });
|
|
9561
9598
|
await loadStatus(true);
|
|
9562
9599
|
if (flow.authorizeUrl !== void 0 && flow.authorizeUrl !== "") try {
|
|
9563
9600
|
window.open(flow.authorizeUrl, "_blank", "noopener,noreferrer");
|
|
9564
9601
|
} catch {}
|
|
9565
9602
|
} catch (cause) {
|
|
9566
|
-
setError(messageOf$
|
|
9603
|
+
setError(messageOf$3(cause));
|
|
9567
9604
|
} finally {
|
|
9568
9605
|
setBusy(null);
|
|
9569
9606
|
}
|
|
@@ -9572,10 +9609,10 @@ window.__ModuleLoader__.load({
|
|
|
9572
9609
|
try {
|
|
9573
9610
|
setBusy("login:cancel");
|
|
9574
9611
|
setError(null);
|
|
9575
|
-
await post$
|
|
9612
|
+
await post$5("/login/cancel", { region });
|
|
9576
9613
|
await loadStatus(true);
|
|
9577
9614
|
} catch (cause) {
|
|
9578
|
-
setError(messageOf$
|
|
9615
|
+
setError(messageOf$3(cause));
|
|
9579
9616
|
} finally {
|
|
9580
9617
|
setBusy(null);
|
|
9581
9618
|
}
|
|
@@ -9588,14 +9625,14 @@ window.__ModuleLoader__.load({
|
|
|
9588
9625
|
try {
|
|
9589
9626
|
setBusy("login-manual");
|
|
9590
9627
|
setError(null);
|
|
9591
|
-
setStatus(await post$
|
|
9628
|
+
setStatus(await post$5("/login/manual", {
|
|
9592
9629
|
region,
|
|
9593
9630
|
code: pasteValue.trim()
|
|
9594
9631
|
}));
|
|
9595
9632
|
setPasteValue("");
|
|
9596
9633
|
onModelChange?.();
|
|
9597
9634
|
} catch (cause) {
|
|
9598
|
-
setError(messageOf$
|
|
9635
|
+
setError(messageOf$3(cause));
|
|
9599
9636
|
} finally {
|
|
9600
9637
|
setBusy(null);
|
|
9601
9638
|
}
|
|
@@ -9604,12 +9641,12 @@ window.__ModuleLoader__.load({
|
|
|
9604
9641
|
try {
|
|
9605
9642
|
setBusy("adopt");
|
|
9606
9643
|
setError(null);
|
|
9607
|
-
const result = await post$
|
|
9644
|
+
const result = await post$5("/adopt", { region });
|
|
9608
9645
|
setAdoptResult(result);
|
|
9609
9646
|
await loadStatus(true);
|
|
9610
9647
|
if (result.adopted) onModelChange?.();
|
|
9611
9648
|
} catch (cause) {
|
|
9612
|
-
setError(messageOf$
|
|
9649
|
+
setError(messageOf$3(cause));
|
|
9613
9650
|
} finally {
|
|
9614
9651
|
setBusy(null);
|
|
9615
9652
|
}
|
|
@@ -9618,13 +9655,13 @@ window.__ModuleLoader__.load({
|
|
|
9618
9655
|
try {
|
|
9619
9656
|
setBusy(`account:${action}:${accountId}`);
|
|
9620
9657
|
setError(null);
|
|
9621
|
-
setStatus(await post$
|
|
9658
|
+
setStatus(await post$5("/accounts", {
|
|
9622
9659
|
action,
|
|
9623
9660
|
accountId
|
|
9624
9661
|
}));
|
|
9625
9662
|
onModelChange?.();
|
|
9626
9663
|
} catch (cause) {
|
|
9627
|
-
setError(messageOf$
|
|
9664
|
+
setError(messageOf$3(cause));
|
|
9628
9665
|
} finally {
|
|
9629
9666
|
setBusy(null);
|
|
9630
9667
|
}
|
|
@@ -9633,12 +9670,12 @@ window.__ModuleLoader__.load({
|
|
|
9633
9670
|
try {
|
|
9634
9671
|
setBusy("strategy");
|
|
9635
9672
|
setError(null);
|
|
9636
|
-
setStatus(await post$
|
|
9673
|
+
setStatus(await post$5("/accounts", {
|
|
9637
9674
|
action: "strategy",
|
|
9638
9675
|
strategy
|
|
9639
9676
|
}));
|
|
9640
9677
|
} catch (cause) {
|
|
9641
|
-
setError(messageOf$
|
|
9678
|
+
setError(messageOf$3(cause));
|
|
9642
9679
|
} finally {
|
|
9643
9680
|
setBusy(null);
|
|
9644
9681
|
}
|
|
@@ -9647,12 +9684,12 @@ window.__ModuleLoader__.load({
|
|
|
9647
9684
|
const applyEnabledModels = async (enabledModelIds) => {
|
|
9648
9685
|
try {
|
|
9649
9686
|
setError(null);
|
|
9650
|
-
const updated = await post$
|
|
9687
|
+
const updated = await post$5("/settings", { enabledModelIds });
|
|
9651
9688
|
setStatus(updated);
|
|
9652
9689
|
setContextDrafts(contextDraftsFor(updated));
|
|
9653
9690
|
onModelChange?.();
|
|
9654
9691
|
} catch (cause) {
|
|
9655
|
-
setError(messageOf$
|
|
9692
|
+
setError(messageOf$3(cause));
|
|
9656
9693
|
}
|
|
9657
9694
|
};
|
|
9658
9695
|
const toggleModel = (modelId, enabled) => {
|
|
@@ -9675,14 +9712,14 @@ window.__ModuleLoader__.load({
|
|
|
9675
9712
|
try {
|
|
9676
9713
|
setSavingModel(modelId);
|
|
9677
9714
|
setError(null);
|
|
9678
|
-
setStatus(await post$
|
|
9715
|
+
setStatus(await post$5("/settings", { contextWindowOverrides: { [modelId]: parsed } }));
|
|
9679
9716
|
setContextDrafts((previous) => ({
|
|
9680
9717
|
...previous,
|
|
9681
9718
|
[modelId]: formatCapacity$1(parsed)
|
|
9682
9719
|
}));
|
|
9683
9720
|
onModelChange?.();
|
|
9684
9721
|
} catch (cause) {
|
|
9685
|
-
setError(messageOf$
|
|
9722
|
+
setError(messageOf$3(cause));
|
|
9686
9723
|
} finally {
|
|
9687
9724
|
setSavingModel(null);
|
|
9688
9725
|
}
|
|
@@ -9691,7 +9728,7 @@ window.__ModuleLoader__.load({
|
|
|
9691
9728
|
try {
|
|
9692
9729
|
setSavingModel(modelId);
|
|
9693
9730
|
setError(null);
|
|
9694
|
-
const updated = await post$
|
|
9731
|
+
const updated = await post$5("/settings", { contextWindowOverrides: { [modelId]: null } });
|
|
9695
9732
|
setStatus(updated);
|
|
9696
9733
|
const model = updated.models.find((entry) => entry.id === modelId);
|
|
9697
9734
|
if (model !== void 0) setContextDrafts((previous) => ({
|
|
@@ -9700,7 +9737,7 @@ window.__ModuleLoader__.load({
|
|
|
9700
9737
|
}));
|
|
9701
9738
|
onModelChange?.();
|
|
9702
9739
|
} catch (cause) {
|
|
9703
|
-
setError(messageOf$
|
|
9740
|
+
setError(messageOf$3(cause));
|
|
9704
9741
|
} finally {
|
|
9705
9742
|
setSavingModel(null);
|
|
9706
9743
|
}
|
|
@@ -9710,21 +9747,21 @@ window.__ModuleLoader__.load({
|
|
|
9710
9747
|
if (ids.length === 0) return;
|
|
9711
9748
|
try {
|
|
9712
9749
|
setError(null);
|
|
9713
|
-
const updated = await post$
|
|
9750
|
+
const updated = await post$5("/settings", { contextWindowOverrides: Object.fromEntries(ids.map((id) => [id, null])) });
|
|
9714
9751
|
setStatus(updated);
|
|
9715
9752
|
setContextDrafts(contextDraftsFor(updated));
|
|
9716
9753
|
onModelChange?.();
|
|
9717
9754
|
} catch (cause) {
|
|
9718
|
-
setError(messageOf$
|
|
9755
|
+
setError(messageOf$3(cause));
|
|
9719
9756
|
}
|
|
9720
9757
|
};
|
|
9721
9758
|
const refreshQuota = async () => {
|
|
9722
9759
|
try {
|
|
9723
9760
|
setBusy("quota");
|
|
9724
9761
|
setError(null);
|
|
9725
|
-
setStatus(await post$
|
|
9762
|
+
setStatus(await post$5("/quota", {}));
|
|
9726
9763
|
} catch (cause) {
|
|
9727
|
-
setError(messageOf$
|
|
9764
|
+
setError(messageOf$3(cause));
|
|
9728
9765
|
} finally {
|
|
9729
9766
|
setBusy(null);
|
|
9730
9767
|
}
|
|
@@ -9733,9 +9770,9 @@ window.__ModuleLoader__.load({
|
|
|
9733
9770
|
try {
|
|
9734
9771
|
setBusy("catalog");
|
|
9735
9772
|
setError(null);
|
|
9736
|
-
setStatus(await post$
|
|
9773
|
+
setStatus(await post$5("/catalog/refresh", {}));
|
|
9737
9774
|
} catch (cause) {
|
|
9738
|
-
setError(messageOf$
|
|
9775
|
+
setError(messageOf$3(cause));
|
|
9739
9776
|
} finally {
|
|
9740
9777
|
setBusy(null);
|
|
9741
9778
|
}
|
|
@@ -9744,9 +9781,9 @@ window.__ModuleLoader__.load({
|
|
|
9744
9781
|
try {
|
|
9745
9782
|
setBusy("connection");
|
|
9746
9783
|
setError(null);
|
|
9747
|
-
setConnection(await post$
|
|
9784
|
+
setConnection(await post$5("/connection/test", {}));
|
|
9748
9785
|
} catch (cause) {
|
|
9749
|
-
setError(messageOf$
|
|
9786
|
+
setError(messageOf$3(cause));
|
|
9750
9787
|
} finally {
|
|
9751
9788
|
setBusy(null);
|
|
9752
9789
|
}
|
|
@@ -9835,7 +9872,7 @@ window.__ModuleLoader__.load({
|
|
|
9835
9872
|
const { status, loading, busy, error, connection, adoptResult, pasteValue, region, pasteOpen, contextDrafts, savingModel } = state;
|
|
9836
9873
|
const { accounts, models, contextModels, overrideCount, login, quota, authenticated, poolLabels } = derived;
|
|
9837
9874
|
const { setRegion, login: startLogin, cancelLogin, submitPaste, setPasteValue, togglePaste, adopt, clearAdoptResult, accountAction, setStrategy, toggleModel, setAllModels, saveContextWindow, resetContextWindow, resetAllContextWindows, updateContextDraft, refreshQuota, refreshCatalog, testConnection } = actions;
|
|
9838
|
-
const t = useLineDict(NS_GLM_CODING_PLAN, zh$
|
|
9875
|
+
const t = useLineDict(NS_GLM_CODING_PLAN, zh$12);
|
|
9839
9876
|
if (loading) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
9840
9877
|
className: "dsha-page",
|
|
9841
9878
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -10301,7 +10338,7 @@ window.__ModuleLoader__.load({
|
|
|
10301
10338
|
* provider — the same reason every sibling line has one.
|
|
10302
10339
|
*/
|
|
10303
10340
|
const NS_CLAUDE = "dsh-claude";
|
|
10304
|
-
const zh$
|
|
10341
|
+
const zh$11 = {
|
|
10305
10342
|
...accountPoolZh,
|
|
10306
10343
|
title: "Claude(订阅)",
|
|
10307
10344
|
pageDesc: "登录 Claude Pro/Max 订阅,管理模型、思考档位、上下文窗口与额度。",
|
|
@@ -10418,7 +10455,7 @@ window.__ModuleLoader__.load({
|
|
|
10418
10455
|
copy: "复制",
|
|
10419
10456
|
copied: "已复制"
|
|
10420
10457
|
};
|
|
10421
|
-
const en$
|
|
10458
|
+
const en$11 = {
|
|
10422
10459
|
...accountPoolEn,
|
|
10423
10460
|
title: "Claude (subscription)",
|
|
10424
10461
|
pageDesc: "Sign in to a Claude Pro/Max subscription and manage models, thinking levels, context windows and quota.",
|
|
@@ -10535,11 +10572,11 @@ window.__ModuleLoader__.load({
|
|
|
10535
10572
|
copy: "Copy",
|
|
10536
10573
|
copied: "Copied"
|
|
10537
10574
|
};
|
|
10538
|
-
const dictionaries$
|
|
10539
|
-
zh: zh$
|
|
10540
|
-
"zh-CN": zh$
|
|
10541
|
-
en: en$
|
|
10542
|
-
"en-US": en$
|
|
10575
|
+
const dictionaries$11 = {
|
|
10576
|
+
zh: zh$11,
|
|
10577
|
+
"zh-CN": zh$11,
|
|
10578
|
+
en: en$11,
|
|
10579
|
+
"en-US": en$11
|
|
10543
10580
|
};
|
|
10544
10581
|
//#endregion
|
|
10545
10582
|
//#region src/client/claude/useClaudeSection.ts
|
|
@@ -10552,7 +10589,7 @@ window.__ModuleLoader__.load({
|
|
|
10552
10589
|
* `ClaudeSectionView` — so the contract between the two is visible here rather
|
|
10553
10590
|
* than inferred from a thousand lines of JSX.
|
|
10554
10591
|
*/
|
|
10555
|
-
const api$
|
|
10592
|
+
const api$11 = createLineApi("/claude/api", "Claude");
|
|
10556
10593
|
/**
|
|
10557
10594
|
* The poll cadence of a pending sign-in.
|
|
10558
10595
|
*
|
|
@@ -10573,7 +10610,7 @@ window.__ModuleLoader__.load({
|
|
|
10573
10610
|
const [connection, setConnection] = (0, react.useState)(null);
|
|
10574
10611
|
/** Follow-up poll owed while the host refreshes the quota behind an answer. */
|
|
10575
10612
|
const quotaFollowUp = (0, react.useRef)(null);
|
|
10576
|
-
const t = useLineDict(NS_CLAUDE, zh$
|
|
10613
|
+
const t = useLineDict(NS_CLAUDE, zh$11);
|
|
10577
10614
|
const notifyChange = (0, react.useCallback)(() => {
|
|
10578
10615
|
onModelChange?.();
|
|
10579
10616
|
loadModelDirectory?.();
|
|
@@ -10585,7 +10622,7 @@ window.__ModuleLoader__.load({
|
|
|
10585
10622
|
const loadStatus = (0, react.useCallback)(async (quiet = false) => {
|
|
10586
10623
|
if (!quiet) setError(null);
|
|
10587
10624
|
try {
|
|
10588
|
-
const data = await api$
|
|
10625
|
+
const data = await api$11.request("/status");
|
|
10589
10626
|
setStatus(data);
|
|
10590
10627
|
setContextDrafts(contextDraftsFor(data));
|
|
10591
10628
|
quotaFollowUp.current ??= createQuotaFollowUp();
|
|
@@ -10616,7 +10653,7 @@ window.__ModuleLoader__.load({
|
|
|
10616
10653
|
const timer = window.setInterval(() => {
|
|
10617
10654
|
(async () => {
|
|
10618
10655
|
try {
|
|
10619
|
-
const poll = await api$
|
|
10656
|
+
const poll = await api$11.request("/login/status");
|
|
10620
10657
|
setFlow(poll);
|
|
10621
10658
|
if (poll.status === "complete") {
|
|
10622
10659
|
setPasteValue("");
|
|
@@ -10638,7 +10675,7 @@ window.__ModuleLoader__.load({
|
|
|
10638
10675
|
setBusy("login");
|
|
10639
10676
|
setError(null);
|
|
10640
10677
|
setPasteValue("");
|
|
10641
|
-
const next = await api$
|
|
10678
|
+
const next = await api$11.request("/login", {
|
|
10642
10679
|
method: "POST",
|
|
10643
10680
|
body: JSON.stringify({})
|
|
10644
10681
|
});
|
|
@@ -10652,7 +10689,7 @@ window.__ModuleLoader__.load({
|
|
|
10652
10689
|
};
|
|
10653
10690
|
const cancelLogin = async () => {
|
|
10654
10691
|
try {
|
|
10655
|
-
const next = await api$
|
|
10692
|
+
const next = await api$11.request("/login/cancel", { method: "POST" });
|
|
10656
10693
|
setFlow(next);
|
|
10657
10694
|
} catch (err) {
|
|
10658
10695
|
reportError(err);
|
|
@@ -10664,7 +10701,7 @@ window.__ModuleLoader__.load({
|
|
|
10664
10701
|
try {
|
|
10665
10702
|
setBusy("login-input");
|
|
10666
10703
|
setError(null);
|
|
10667
|
-
const updated = await api$
|
|
10704
|
+
const updated = await api$11.request("/login/input", {
|
|
10668
10705
|
method: "POST",
|
|
10669
10706
|
body: JSON.stringify({ input: pasteValue })
|
|
10670
10707
|
});
|
|
@@ -10688,7 +10725,7 @@ window.__ModuleLoader__.load({
|
|
|
10688
10725
|
try {
|
|
10689
10726
|
setBusy("adopt");
|
|
10690
10727
|
setError(null);
|
|
10691
|
-
const updated = await api$
|
|
10728
|
+
const updated = await api$11.request("/adopt", { method: "POST" });
|
|
10692
10729
|
setStatus(updated);
|
|
10693
10730
|
setContextDrafts(contextDraftsFor(updated));
|
|
10694
10731
|
notifyChange();
|
|
@@ -10703,7 +10740,7 @@ window.__ModuleLoader__.load({
|
|
|
10703
10740
|
try {
|
|
10704
10741
|
setBusy(accountId === void 0 ? "adopt-disable" : `adopt-disable-${accountId}`);
|
|
10705
10742
|
setError(null);
|
|
10706
|
-
const updated = await api$
|
|
10743
|
+
const updated = await api$11.request("/adopt/disable", {
|
|
10707
10744
|
method: "POST",
|
|
10708
10745
|
body: JSON.stringify(accountId === void 0 ? {} : { accountId })
|
|
10709
10746
|
});
|
|
@@ -10720,7 +10757,7 @@ window.__ModuleLoader__.load({
|
|
|
10720
10757
|
try {
|
|
10721
10758
|
setBusy(`${action}-${accountId}`);
|
|
10722
10759
|
setError(null);
|
|
10723
|
-
const updated = await api$
|
|
10760
|
+
const updated = await api$11.request("/accounts", {
|
|
10724
10761
|
method: "POST",
|
|
10725
10762
|
body: JSON.stringify({
|
|
10726
10763
|
action,
|
|
@@ -10739,7 +10776,7 @@ window.__ModuleLoader__.load({
|
|
|
10739
10776
|
try {
|
|
10740
10777
|
setBusy("strategy");
|
|
10741
10778
|
setError(null);
|
|
10742
|
-
const updated = await api$
|
|
10779
|
+
const updated = await api$11.request("/accounts", {
|
|
10743
10780
|
method: "POST",
|
|
10744
10781
|
body: JSON.stringify({
|
|
10745
10782
|
action: "strategy",
|
|
@@ -10766,7 +10803,7 @@ window.__ModuleLoader__.load({
|
|
|
10766
10803
|
setBusy(`relogin-${accountId}`);
|
|
10767
10804
|
setError(null);
|
|
10768
10805
|
setPasteValue("");
|
|
10769
|
-
const next = await api$
|
|
10806
|
+
const next = await api$11.request("/login", {
|
|
10770
10807
|
method: "POST",
|
|
10771
10808
|
body: JSON.stringify({ accountId })
|
|
10772
10809
|
});
|
|
@@ -10783,7 +10820,7 @@ window.__ModuleLoader__.load({
|
|
|
10783
10820
|
try {
|
|
10784
10821
|
setBusy("quota");
|
|
10785
10822
|
setError(null);
|
|
10786
|
-
const updated = await api$
|
|
10823
|
+
const updated = await api$11.request("/quota", { method: "POST" });
|
|
10787
10824
|
setStatus(updated);
|
|
10788
10825
|
} catch (err) {
|
|
10789
10826
|
reportError(err);
|
|
@@ -10796,7 +10833,7 @@ window.__ModuleLoader__.load({
|
|
|
10796
10833
|
try {
|
|
10797
10834
|
setBusy("catalog");
|
|
10798
10835
|
setError(null);
|
|
10799
|
-
const updated = await api$
|
|
10836
|
+
const updated = await api$11.request("/catalog/refresh", { method: "POST" });
|
|
10800
10837
|
setStatus(updated);
|
|
10801
10838
|
setContextDrafts(contextDraftsFor(updated));
|
|
10802
10839
|
notifyChange();
|
|
@@ -10811,7 +10848,7 @@ window.__ModuleLoader__.load({
|
|
|
10811
10848
|
setBusy("connection");
|
|
10812
10849
|
setError(null);
|
|
10813
10850
|
setConnection(null);
|
|
10814
|
-
const result = await api$
|
|
10851
|
+
const result = await api$11.request("/connection/test", { method: "POST" });
|
|
10815
10852
|
setConnection(result);
|
|
10816
10853
|
await loadStatus(true);
|
|
10817
10854
|
} catch (err) {
|
|
@@ -10822,7 +10859,7 @@ window.__ModuleLoader__.load({
|
|
|
10822
10859
|
};
|
|
10823
10860
|
const applyEnabled = async (enabledModelIds) => {
|
|
10824
10861
|
try {
|
|
10825
|
-
const updated = await api$
|
|
10862
|
+
const updated = await api$11.request("/models", {
|
|
10826
10863
|
method: "POST",
|
|
10827
10864
|
body: JSON.stringify({ enabledModelIds })
|
|
10828
10865
|
});
|
|
@@ -10845,7 +10882,7 @@ window.__ModuleLoader__.load({
|
|
|
10845
10882
|
};
|
|
10846
10883
|
const updateEffort = async (effort) => {
|
|
10847
10884
|
try {
|
|
10848
|
-
const updated = await api$
|
|
10885
|
+
const updated = await api$11.request("/settings", {
|
|
10849
10886
|
method: "POST",
|
|
10850
10887
|
body: JSON.stringify({ defaultReasoningEffort: effort })
|
|
10851
10888
|
});
|
|
@@ -10857,7 +10894,7 @@ window.__ModuleLoader__.load({
|
|
|
10857
10894
|
};
|
|
10858
10895
|
const updateCacheTtl = async (ttl) => {
|
|
10859
10896
|
try {
|
|
10860
|
-
const updated = await api$
|
|
10897
|
+
const updated = await api$11.request("/settings", {
|
|
10861
10898
|
method: "POST",
|
|
10862
10899
|
body: JSON.stringify({ cacheTtl: ttl })
|
|
10863
10900
|
});
|
|
@@ -10877,7 +10914,7 @@ window.__ModuleLoader__.load({
|
|
|
10877
10914
|
try {
|
|
10878
10915
|
setSavingModel(modelId);
|
|
10879
10916
|
setError(null);
|
|
10880
|
-
const updated = await api$
|
|
10917
|
+
const updated = await api$11.request("/settings", {
|
|
10881
10918
|
method: "POST",
|
|
10882
10919
|
body: JSON.stringify({ contextWindowOverrides: { [modelId]: parsed } })
|
|
10883
10920
|
});
|
|
@@ -10904,7 +10941,7 @@ window.__ModuleLoader__.load({
|
|
|
10904
10941
|
try {
|
|
10905
10942
|
setSavingModel(modelId);
|
|
10906
10943
|
setError(null);
|
|
10907
|
-
const updated = await api$
|
|
10944
|
+
const updated = await api$11.request("/settings", {
|
|
10908
10945
|
method: "POST",
|
|
10909
10946
|
body: JSON.stringify({ contextWindowOverrides: { [modelId]: null } })
|
|
10910
10947
|
});
|
|
@@ -10931,7 +10968,7 @@ window.__ModuleLoader__.load({
|
|
|
10931
10968
|
try {
|
|
10932
10969
|
setBusy("context");
|
|
10933
10970
|
setError(null);
|
|
10934
|
-
const updated = await api$
|
|
10971
|
+
const updated = await api$11.request("/settings", {
|
|
10935
10972
|
method: "POST",
|
|
10936
10973
|
body: JSON.stringify({ contextWindowOverrides: Object.fromEntries(models.map((model) => [model, null])) })
|
|
10937
10974
|
});
|
|
@@ -11020,11 +11057,11 @@ window.__ModuleLoader__.load({
|
|
|
11020
11057
|
* out here would hide a choice the host would accept and a catalog may expose.
|
|
11021
11058
|
*/
|
|
11022
11059
|
const EFFORT_LABELS$2 = {
|
|
11023
|
-
low: zh$
|
|
11024
|
-
medium: zh$
|
|
11025
|
-
high: zh$
|
|
11026
|
-
xhigh: zh$
|
|
11027
|
-
max: zh$
|
|
11060
|
+
low: zh$11.effortLow,
|
|
11061
|
+
medium: zh$11.effortMedium,
|
|
11062
|
+
high: zh$11.effortHigh,
|
|
11063
|
+
xhigh: zh$11.effortXHigh,
|
|
11064
|
+
max: zh$11.effortMax
|
|
11028
11065
|
};
|
|
11029
11066
|
/** One-line capability summary shown as a model pill's hover title. */
|
|
11030
11067
|
function modelFacts(model, t) {
|
|
@@ -11045,7 +11082,7 @@ window.__ModuleLoader__.load({
|
|
|
11045
11082
|
const { status, loading, busy, error, flow, connection, pasteValue, contextDrafts, savingModel } = state;
|
|
11046
11083
|
const { accounts, hasAdopted, contextModels, overrideCount, quota, windows, poolLabels } = derived;
|
|
11047
11084
|
const { login, cancelLogin, submitPaste, adopt, stopImporting, accountAction, setStrategy, relogin, refreshQuota, refreshCatalog, testConnection, toggleModel, setAllModels, updateEffort, updateCacheTtl, saveContextWindow, resetContextWindow, resetAllContextWindows, updateContextDraft, setPasteValue } = actions;
|
|
11048
|
-
const t = useLineDict(NS_CLAUDE, zh$
|
|
11085
|
+
const t = useLineDict(NS_CLAUDE, zh$11);
|
|
11049
11086
|
if (loading) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
11050
11087
|
className: "dsha-page",
|
|
11051
11088
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -11537,7 +11574,7 @@ window.__ModuleLoader__.load({
|
|
|
11537
11574
|
*/
|
|
11538
11575
|
var OllamaApi = class {
|
|
11539
11576
|
status() {
|
|
11540
|
-
return request$
|
|
11577
|
+
return request$2(`${API$9}/status`);
|
|
11541
11578
|
}
|
|
11542
11579
|
/**
|
|
11543
11580
|
* One pool action, returning the refreshed status.
|
|
@@ -11546,13 +11583,13 @@ window.__ModuleLoader__.load({
|
|
|
11546
11583
|
* never has to guess what the pool looks like after a change.
|
|
11547
11584
|
*/
|
|
11548
11585
|
accountAction(action, body = {}) {
|
|
11549
|
-
return post$
|
|
11586
|
+
return post$4(`${API$9}/accounts`, {
|
|
11550
11587
|
action,
|
|
11551
11588
|
...body
|
|
11552
11589
|
});
|
|
11553
11590
|
}
|
|
11554
11591
|
refreshCatalog() {
|
|
11555
|
-
return post$
|
|
11592
|
+
return post$4(`${API$9}/catalog/refresh`, {});
|
|
11556
11593
|
}
|
|
11557
11594
|
/**
|
|
11558
11595
|
* Store the default thinking level, answering with the refreshed status.
|
|
@@ -11567,7 +11604,7 @@ window.__ModuleLoader__.load({
|
|
|
11567
11604
|
* explicitly rather than left out of the body.
|
|
11568
11605
|
*/
|
|
11569
11606
|
setDefaultReasoningEffort(effort) {
|
|
11570
|
-
return post$
|
|
11607
|
+
return post$4(`${API$9}/settings`, { defaultReasoningEffort: effort }).then(() => this.status());
|
|
11571
11608
|
}
|
|
11572
11609
|
/**
|
|
11573
11610
|
* Replace the enabled-model selection.
|
|
@@ -11577,17 +11614,17 @@ window.__ModuleLoader__.load({
|
|
|
11577
11614
|
* selection before it could answer 'turn this one off'.
|
|
11578
11615
|
*/
|
|
11579
11616
|
setEnabledModels(enabledModelIds) {
|
|
11580
|
-
return post$
|
|
11617
|
+
return post$4(`${API$9}/models`, { enabledModelIds });
|
|
11581
11618
|
}
|
|
11582
11619
|
};
|
|
11583
|
-
async function post$
|
|
11584
|
-
return request$
|
|
11620
|
+
async function post$4(url, body) {
|
|
11621
|
+
return request$2(url, {
|
|
11585
11622
|
method: "POST",
|
|
11586
11623
|
headers: { "Content-Type": "application/json" },
|
|
11587
11624
|
body: JSON.stringify(body)
|
|
11588
11625
|
});
|
|
11589
11626
|
}
|
|
11590
|
-
async function request$
|
|
11627
|
+
async function request$2(url, init) {
|
|
11591
11628
|
const response = await fetch(url, {
|
|
11592
11629
|
...init,
|
|
11593
11630
|
credentials: "same-origin"
|
|
@@ -11637,7 +11674,7 @@ window.__ModuleLoader__.load({
|
|
|
11637
11674
|
//#endregion
|
|
11638
11675
|
//#region src/client/ollama/locales.ts
|
|
11639
11676
|
const NS_OLLAMA = "dsh-ollama";
|
|
11640
|
-
const zh$
|
|
11677
|
+
const zh$10 = {
|
|
11641
11678
|
...accountPoolZh,
|
|
11642
11679
|
relogin: "更换 Key",
|
|
11643
11680
|
needsRelogin: "Key 已失效",
|
|
@@ -11689,7 +11726,7 @@ window.__ModuleLoader__.load({
|
|
|
11689
11726
|
usageNone: "尚无请求",
|
|
11690
11727
|
usageHint: "按 Ollama 每次响应自带的 token 计数本地累加。"
|
|
11691
11728
|
};
|
|
11692
|
-
const en$
|
|
11729
|
+
const en$10 = {
|
|
11693
11730
|
...accountPoolEn,
|
|
11694
11731
|
relogin: "Replace Key",
|
|
11695
11732
|
needsRelogin: "Key rejected",
|
|
@@ -11741,11 +11778,11 @@ window.__ModuleLoader__.load({
|
|
|
11741
11778
|
usageNone: "No requests yet",
|
|
11742
11779
|
usageHint: "Summed locally from the token counts Ollama returns on each response."
|
|
11743
11780
|
};
|
|
11744
|
-
const dictionaries$
|
|
11745
|
-
zh: zh$
|
|
11746
|
-
"zh-CN": zh$
|
|
11747
|
-
en: en$
|
|
11748
|
-
"en-US": en$
|
|
11781
|
+
const dictionaries$10 = {
|
|
11782
|
+
zh: zh$10,
|
|
11783
|
+
"zh-CN": zh$10,
|
|
11784
|
+
en: en$10,
|
|
11785
|
+
"en-US": en$10
|
|
11749
11786
|
};
|
|
11750
11787
|
//#endregion
|
|
11751
11788
|
//#region src/client/ollama/OllamaSection.tsx
|
|
@@ -11871,7 +11908,7 @@ window.__ModuleLoader__.load({
|
|
|
11871
11908
|
const setEffort = (0, react.useCallback)((value) => {
|
|
11872
11909
|
run("effort", () => API$8.setDefaultReasoningEffort(value === "" ? null : value));
|
|
11873
11910
|
}, [run]);
|
|
11874
|
-
const t = useLineDict(NS_OLLAMA, zh$
|
|
11911
|
+
const t = useLineDict(NS_OLLAMA, zh$10);
|
|
11875
11912
|
const pool = status?.pool;
|
|
11876
11913
|
const models = status?.models ?? [];
|
|
11877
11914
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [
|
|
@@ -11986,7 +12023,7 @@ window.__ModuleLoader__.load({
|
|
|
11986
12023
|
className: "dsha-btn",
|
|
11987
12024
|
disabled: busy !== null,
|
|
11988
12025
|
onClick: () => setShowKeyForm(false),
|
|
11989
|
-
children: zh$
|
|
12026
|
+
children: zh$10.deleteAccount
|
|
11990
12027
|
})]
|
|
11991
12028
|
})
|
|
11992
12029
|
]
|
|
@@ -12108,19 +12145,19 @@ window.__ModuleLoader__.load({
|
|
|
12108
12145
|
*/
|
|
12109
12146
|
var AntigravityAcpApi = class {
|
|
12110
12147
|
status() {
|
|
12111
|
-
return request(`${API$7}/status`);
|
|
12148
|
+
return request$1(`${API$7}/status`);
|
|
12112
12149
|
}
|
|
12113
12150
|
/** Submit one settings patch and receive the refreshed status. */
|
|
12114
12151
|
update(patch) {
|
|
12115
|
-
return post$
|
|
12152
|
+
return post$3(`${API$7}/settings`, patch);
|
|
12116
12153
|
}
|
|
12117
12154
|
/** Force a live catalogue read. */
|
|
12118
12155
|
refresh() {
|
|
12119
|
-
return post$
|
|
12156
|
+
return post$3(`${API$7}/refresh`, {});
|
|
12120
12157
|
}
|
|
12121
12158
|
/** Run the line's self-check and return its one-line-per-stage report. */
|
|
12122
12159
|
doctor() {
|
|
12123
|
-
return post$
|
|
12160
|
+
return post$3(`${API$7}/doctor`, {});
|
|
12124
12161
|
}
|
|
12125
12162
|
/**
|
|
12126
12163
|
* Start the official sign-in.
|
|
@@ -12130,21 +12167,21 @@ window.__ModuleLoader__.load({
|
|
|
12130
12167
|
* producing two Google pages.
|
|
12131
12168
|
*/
|
|
12132
12169
|
startLogin() {
|
|
12133
|
-
return post$
|
|
12170
|
+
return post$3(`${API$7}/login/start`, {});
|
|
12134
12171
|
}
|
|
12135
12172
|
/** Re-read the auth state after a sign-in attempt. */
|
|
12136
12173
|
loginStatus() {
|
|
12137
|
-
return request(`${API$7}/login/status`);
|
|
12174
|
+
return request$1(`${API$7}/login/status`);
|
|
12138
12175
|
}
|
|
12139
12176
|
};
|
|
12140
|
-
async function post$
|
|
12141
|
-
return request(url, {
|
|
12177
|
+
async function post$3(url, body) {
|
|
12178
|
+
return request$1(url, {
|
|
12142
12179
|
method: "POST",
|
|
12143
12180
|
headers: { "Content-Type": "application/json" },
|
|
12144
12181
|
body: JSON.stringify(body)
|
|
12145
12182
|
});
|
|
12146
12183
|
}
|
|
12147
|
-
async function request(url, init) {
|
|
12184
|
+
async function request$1(url, init) {
|
|
12148
12185
|
const response = await fetch(url, {
|
|
12149
12186
|
...init,
|
|
12150
12187
|
credentials: "same-origin"
|
|
@@ -12185,7 +12222,7 @@ window.__ModuleLoader__.load({
|
|
|
12185
12222
|
//#endregion
|
|
12186
12223
|
//#region src/client/antigravity-acp/locales.ts
|
|
12187
12224
|
const NS_ANTIGRAVITY_ACP = "dsh-antigravity-acp";
|
|
12188
|
-
const zh$
|
|
12225
|
+
const zh$9 = {
|
|
12189
12226
|
title: "Antigravity(ACP)",
|
|
12190
12227
|
pageDesc: "通过 Google 官方 Antigravity CLI 的 Agent Client Protocol(ACP)接入:模型、工具与会话全部由官方进程驱动,登录态由官方进程自己保管。",
|
|
12191
12228
|
routeOwned: "模型路由由本插件提供",
|
|
@@ -12277,7 +12314,7 @@ window.__ModuleLoader__.load({
|
|
|
12277
12314
|
enabledHint: "该线路当前已启用。",
|
|
12278
12315
|
toggleHint: "可在「订阅服务」总览页的该线路卡片上随时停用。"
|
|
12279
12316
|
};
|
|
12280
|
-
const en$
|
|
12317
|
+
const en$9 = {
|
|
12281
12318
|
title: "Antigravity (ACP)",
|
|
12282
12319
|
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.",
|
|
12283
12320
|
routeOwned: "Model route served by this plugin",
|
|
@@ -12369,11 +12406,11 @@ window.__ModuleLoader__.load({
|
|
|
12369
12406
|
enabledHint: "This line is enabled.",
|
|
12370
12407
|
toggleHint: "You can switch it off at any time from its card in the subscription overview."
|
|
12371
12408
|
};
|
|
12372
|
-
const dictionaries$
|
|
12373
|
-
zh: zh$
|
|
12374
|
-
"zh-CN": zh$
|
|
12375
|
-
en: en$
|
|
12376
|
-
"en-US": en$
|
|
12409
|
+
const dictionaries$9 = {
|
|
12410
|
+
zh: zh$9,
|
|
12411
|
+
"zh-CN": zh$9,
|
|
12412
|
+
en: en$9,
|
|
12413
|
+
"en-US": en$9
|
|
12377
12414
|
};
|
|
12378
12415
|
//#endregion
|
|
12379
12416
|
//#region src/client/antigravity-acp/AntigravityAcpSection.tsx
|
|
@@ -12430,7 +12467,7 @@ window.__ModuleLoader__.load({
|
|
|
12430
12467
|
setBusy(null);
|
|
12431
12468
|
}
|
|
12432
12469
|
}, [props]);
|
|
12433
|
-
const t = useLineDict(NS_ANTIGRAVITY_ACP, zh$
|
|
12470
|
+
const t = useLineDict(NS_ANTIGRAVITY_ACP, zh$9);
|
|
12434
12471
|
const models = status?.models ?? [];
|
|
12435
12472
|
const auth = status?.auth;
|
|
12436
12473
|
const usage = status?.usage;
|
|
@@ -12921,7 +12958,7 @@ window.__ModuleLoader__.load({
|
|
|
12921
12958
|
* 键名重合的会被渲染成 ChatGPT 的措辞,不重合的会把键名本身打印出来)。
|
|
12922
12959
|
*/
|
|
12923
12960
|
const NS_STEP_CODE = "dsh-step-code";
|
|
12924
|
-
const zh$
|
|
12961
|
+
const zh$8 = {
|
|
12925
12962
|
...accountPoolZh,
|
|
12926
12963
|
title: "Step Code(Step Plan 订阅)",
|
|
12927
12964
|
pageDesc: "用 StepFun 的 Step Plan 订阅(国区 api.stepfun.com / 国际区 api.stepfun.ai)或开放平台 API Key 接入,管理账号池、套餐额度、缓存用量与模型勾选。区域是凭据的属性,两区凭据互不通用,因此号池里可以同时存在两区账号。",
|
|
@@ -13091,7 +13128,7 @@ window.__ModuleLoader__.load({
|
|
|
13091
13128
|
cacheExpiredHint: "缓存可能已过期:距上次请求约 {minutes} 分钟,下次会重新处理前缀。",
|
|
13092
13129
|
cacheHitRatioUnavailable: "—"
|
|
13093
13130
|
};
|
|
13094
|
-
const en$
|
|
13131
|
+
const en$8 = {
|
|
13095
13132
|
...accountPoolEn,
|
|
13096
13133
|
title: "Step Code (Step Plan subscription)",
|
|
13097
13134
|
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.",
|
|
@@ -13259,11 +13296,11 @@ window.__ModuleLoader__.load({
|
|
|
13259
13296
|
cacheExpiredHint: "The cache has likely expired: about {minutes} minutes since the last request, so the next turn will reprocess the prefix.",
|
|
13260
13297
|
cacheHitRatioUnavailable: "—"
|
|
13261
13298
|
};
|
|
13262
|
-
const dictionaries$
|
|
13263
|
-
zh: zh$
|
|
13264
|
-
"zh-CN": zh$
|
|
13265
|
-
en: en$
|
|
13266
|
-
"en-US": en$
|
|
13299
|
+
const dictionaries$8 = {
|
|
13300
|
+
zh: zh$8,
|
|
13301
|
+
"zh-CN": zh$8,
|
|
13302
|
+
en: en$8,
|
|
13303
|
+
"en-US": en$8
|
|
13267
13304
|
};
|
|
13268
13305
|
/** 一个额度窗口的键到「窗口长度(分钟)」的映射。窗口名由共享组件按长度本地化。 */
|
|
13269
13306
|
const QUOTA_WINDOW_MINUTES = {
|
|
@@ -13355,10 +13392,10 @@ window.__ModuleLoader__.load({
|
|
|
13355
13392
|
* **仅有的两处**带秘密的形状,它们只在这两个函数调用点的字面量里出现,
|
|
13356
13393
|
* 既不进 URL、也不进日志,卡片那边同样没有别的地方可以读到它们。
|
|
13357
13394
|
*/
|
|
13358
|
-
const api$
|
|
13359
|
-
const get$
|
|
13360
|
-
const post$
|
|
13361
|
-
function messageOf$
|
|
13395
|
+
const api$10 = createLineApi(STEP_CODE_ROUTE_PREFIX, STEP_CODE_PROVIDER_NAME);
|
|
13396
|
+
const get$2 = api$10.get;
|
|
13397
|
+
const post$2 = api$10.post;
|
|
13398
|
+
function messageOf$2(cause) {
|
|
13362
13399
|
return cause instanceof Error ? cause.message : String(cause);
|
|
13363
13400
|
}
|
|
13364
13401
|
//#endregion
|
|
@@ -13381,7 +13418,7 @@ window.__ModuleLoader__.load({
|
|
|
13381
13418
|
/** 登录状态机的轮询节奏。真实超时与间隔由 host 拥有,卡片只是跟随。 */
|
|
13382
13419
|
const LOGIN_POLL_INTERVAL_MS$1 = 2e3;
|
|
13383
13420
|
/** 本卡片的字典;身份稳定,依赖它的 effect 才不会每次渲染重建。 */
|
|
13384
|
-
const fallbackTranslate$5 = (key) => zh$
|
|
13421
|
+
const fallbackTranslate$5 = (key) => zh$8[key];
|
|
13385
13422
|
/**
|
|
13386
13423
|
* 共享账号池卡片需要的标签集,按本卡片的字典逐键查出来。
|
|
13387
13424
|
*
|
|
@@ -13530,7 +13567,7 @@ window.__ModuleLoader__.load({
|
|
|
13530
13567
|
const loadStatus = (0, react.useCallback)(async (quiet = false) => {
|
|
13531
13568
|
if (!quiet) setError(null);
|
|
13532
13569
|
try {
|
|
13533
|
-
const next = await get$
|
|
13570
|
+
const next = await get$2("/status");
|
|
13534
13571
|
setStatus(next);
|
|
13535
13572
|
setContextDrafts(contextDraftsFor(next));
|
|
13536
13573
|
if (!profileTouched.current && isStepCodeProfile(next.profile)) setProfileState(next.profile);
|
|
@@ -13539,7 +13576,7 @@ window.__ModuleLoader__.load({
|
|
|
13539
13576
|
loadStatus(true);
|
|
13540
13577
|
});
|
|
13541
13578
|
} catch (cause) {
|
|
13542
|
-
if (!quiet) setError(messageOf$
|
|
13579
|
+
if (!quiet) setError(messageOf$2(cause));
|
|
13543
13580
|
} finally {
|
|
13544
13581
|
setLoading(false);
|
|
13545
13582
|
}
|
|
@@ -13564,7 +13601,7 @@ window.__ModuleLoader__.load({
|
|
|
13564
13601
|
const timer = window.setInterval(() => {
|
|
13565
13602
|
(async () => {
|
|
13566
13603
|
try {
|
|
13567
|
-
const poll = await get$
|
|
13604
|
+
const poll = await get$2("/login/status");
|
|
13568
13605
|
if (stopped) return;
|
|
13569
13606
|
if (poll.status === "complete") {
|
|
13570
13607
|
setPasteValue("");
|
|
@@ -13597,13 +13634,13 @@ window.__ModuleLoader__.load({
|
|
|
13597
13634
|
setError(null);
|
|
13598
13635
|
setConnection(null);
|
|
13599
13636
|
setPasteValue("");
|
|
13600
|
-
const flow = await post$
|
|
13637
|
+
const flow = await post$2("/login/start", { profile: loginProfile });
|
|
13601
13638
|
await loadStatus(true);
|
|
13602
13639
|
if (flow.authorizeUrl !== void 0 && flow.authorizeUrl !== "") try {
|
|
13603
13640
|
window.open(flow.authorizeUrl, "_blank", "noopener,noreferrer");
|
|
13604
13641
|
} catch {}
|
|
13605
13642
|
} catch (cause) {
|
|
13606
|
-
setError(messageOf$
|
|
13643
|
+
setError(messageOf$2(cause));
|
|
13607
13644
|
} finally {
|
|
13608
13645
|
setBusy(null);
|
|
13609
13646
|
}
|
|
@@ -13612,10 +13649,10 @@ window.__ModuleLoader__.load({
|
|
|
13612
13649
|
try {
|
|
13613
13650
|
setBusy("login:cancel");
|
|
13614
13651
|
setError(null);
|
|
13615
|
-
await post$
|
|
13652
|
+
await post$2("/login/cancel", {});
|
|
13616
13653
|
await loadStatus(true);
|
|
13617
13654
|
} catch (cause) {
|
|
13618
|
-
setError(messageOf$
|
|
13655
|
+
setError(messageOf$2(cause));
|
|
13619
13656
|
} finally {
|
|
13620
13657
|
setBusy(null);
|
|
13621
13658
|
}
|
|
@@ -13629,14 +13666,14 @@ window.__ModuleLoader__.load({
|
|
|
13629
13666
|
try {
|
|
13630
13667
|
setBusy("login-manual");
|
|
13631
13668
|
setError(null);
|
|
13632
|
-
setStatus(await post$
|
|
13669
|
+
setStatus(await post$2("/login/manual", {
|
|
13633
13670
|
profile,
|
|
13634
13671
|
apiKey
|
|
13635
13672
|
}));
|
|
13636
13673
|
setPasteValue("");
|
|
13637
13674
|
onModelChange?.();
|
|
13638
13675
|
} catch (cause) {
|
|
13639
|
-
setError(messageOf$
|
|
13676
|
+
setError(messageOf$2(cause));
|
|
13640
13677
|
} finally {
|
|
13641
13678
|
setPasteValue("");
|
|
13642
13679
|
setBusy(null);
|
|
@@ -13646,12 +13683,12 @@ window.__ModuleLoader__.load({
|
|
|
13646
13683
|
try {
|
|
13647
13684
|
setBusy("adopt");
|
|
13648
13685
|
setError(null);
|
|
13649
|
-
const result = await post$
|
|
13686
|
+
const result = await post$2("/adopt", {});
|
|
13650
13687
|
setAdoptResult(result);
|
|
13651
13688
|
await loadStatus(true);
|
|
13652
13689
|
if (result.adopted) onModelChange?.();
|
|
13653
13690
|
} catch (cause) {
|
|
13654
|
-
setError(messageOf$
|
|
13691
|
+
setError(messageOf$2(cause));
|
|
13655
13692
|
} finally {
|
|
13656
13693
|
setBusy(null);
|
|
13657
13694
|
}
|
|
@@ -13660,13 +13697,13 @@ window.__ModuleLoader__.load({
|
|
|
13660
13697
|
try {
|
|
13661
13698
|
setBusy(`account:${action}:${accountId}`);
|
|
13662
13699
|
setError(null);
|
|
13663
|
-
setStatus(await post$
|
|
13700
|
+
setStatus(await post$2("/accounts", {
|
|
13664
13701
|
action,
|
|
13665
13702
|
accountId
|
|
13666
13703
|
}));
|
|
13667
13704
|
onModelChange?.();
|
|
13668
13705
|
} catch (cause) {
|
|
13669
|
-
setError(messageOf$
|
|
13706
|
+
setError(messageOf$2(cause));
|
|
13670
13707
|
} finally {
|
|
13671
13708
|
setBusy(null);
|
|
13672
13709
|
}
|
|
@@ -13675,12 +13712,12 @@ window.__ModuleLoader__.load({
|
|
|
13675
13712
|
try {
|
|
13676
13713
|
setBusy("strategy");
|
|
13677
13714
|
setError(null);
|
|
13678
|
-
setStatus(await post$
|
|
13715
|
+
setStatus(await post$2("/accounts", {
|
|
13679
13716
|
action: "strategy",
|
|
13680
13717
|
strategy
|
|
13681
13718
|
}));
|
|
13682
13719
|
} catch (cause) {
|
|
13683
|
-
setError(messageOf$
|
|
13720
|
+
setError(messageOf$2(cause));
|
|
13684
13721
|
} finally {
|
|
13685
13722
|
setBusy(null);
|
|
13686
13723
|
}
|
|
@@ -13695,12 +13732,12 @@ window.__ModuleLoader__.load({
|
|
|
13695
13732
|
const applyEnabledModels = async (enabledModelIds) => {
|
|
13696
13733
|
try {
|
|
13697
13734
|
setError(null);
|
|
13698
|
-
const updated = await post$
|
|
13735
|
+
const updated = await post$2("/settings", { enabledModelIds });
|
|
13699
13736
|
setStatus(updated);
|
|
13700
13737
|
setContextDrafts(contextDraftsFor(updated));
|
|
13701
13738
|
onModelChange?.();
|
|
13702
13739
|
} catch (cause) {
|
|
13703
|
-
setError(messageOf$
|
|
13740
|
+
setError(messageOf$2(cause));
|
|
13704
13741
|
}
|
|
13705
13742
|
};
|
|
13706
13743
|
const toggleModel = (modelId, enabled) => {
|
|
@@ -13723,14 +13760,14 @@ window.__ModuleLoader__.load({
|
|
|
13723
13760
|
try {
|
|
13724
13761
|
setSavingModel(modelId);
|
|
13725
13762
|
setError(null);
|
|
13726
|
-
setStatus(await post$
|
|
13763
|
+
setStatus(await post$2("/settings", { contextWindowOverrides: { [modelId]: parsed } }));
|
|
13727
13764
|
setContextDrafts((previous) => ({
|
|
13728
13765
|
...previous,
|
|
13729
13766
|
[modelId]: formatCapacity$1(parsed)
|
|
13730
13767
|
}));
|
|
13731
13768
|
onModelChange?.();
|
|
13732
13769
|
} catch (cause) {
|
|
13733
|
-
setError(messageOf$
|
|
13770
|
+
setError(messageOf$2(cause));
|
|
13734
13771
|
} finally {
|
|
13735
13772
|
setSavingModel(null);
|
|
13736
13773
|
}
|
|
@@ -13739,7 +13776,7 @@ window.__ModuleLoader__.load({
|
|
|
13739
13776
|
try {
|
|
13740
13777
|
setSavingModel(modelId);
|
|
13741
13778
|
setError(null);
|
|
13742
|
-
const updated = await post$
|
|
13779
|
+
const updated = await post$2("/settings", { contextWindowOverrides: { [modelId]: null } });
|
|
13743
13780
|
setStatus(updated);
|
|
13744
13781
|
const model = updated.models.find((entry) => entry.id === modelId);
|
|
13745
13782
|
if (model !== void 0) setContextDrafts((previous) => ({
|
|
@@ -13748,7 +13785,7 @@ window.__ModuleLoader__.load({
|
|
|
13748
13785
|
}));
|
|
13749
13786
|
onModelChange?.();
|
|
13750
13787
|
} catch (cause) {
|
|
13751
|
-
setError(messageOf$
|
|
13788
|
+
setError(messageOf$2(cause));
|
|
13752
13789
|
} finally {
|
|
13753
13790
|
setSavingModel(null);
|
|
13754
13791
|
}
|
|
@@ -13758,21 +13795,21 @@ window.__ModuleLoader__.load({
|
|
|
13758
13795
|
if (ids.length === 0) return;
|
|
13759
13796
|
try {
|
|
13760
13797
|
setError(null);
|
|
13761
|
-
const updated = await post$
|
|
13798
|
+
const updated = await post$2("/settings", { contextWindowOverrides: Object.fromEntries(ids.map((id) => [id, null])) });
|
|
13762
13799
|
setStatus(updated);
|
|
13763
13800
|
setContextDrafts(contextDraftsFor(updated));
|
|
13764
13801
|
onModelChange?.();
|
|
13765
13802
|
} catch (cause) {
|
|
13766
|
-
setError(messageOf$
|
|
13803
|
+
setError(messageOf$2(cause));
|
|
13767
13804
|
}
|
|
13768
13805
|
};
|
|
13769
13806
|
const setDefaultReasoningEffort = async (effort) => {
|
|
13770
13807
|
try {
|
|
13771
13808
|
setBusy("effort");
|
|
13772
13809
|
setError(null);
|
|
13773
|
-
setStatus(await post$
|
|
13810
|
+
setStatus(await post$2("/settings", { defaultReasoningEffort: effort }));
|
|
13774
13811
|
} catch (cause) {
|
|
13775
|
-
setError(messageOf$
|
|
13812
|
+
setError(messageOf$2(cause));
|
|
13776
13813
|
} finally {
|
|
13777
13814
|
setBusy(null);
|
|
13778
13815
|
}
|
|
@@ -13781,9 +13818,9 @@ window.__ModuleLoader__.load({
|
|
|
13781
13818
|
try {
|
|
13782
13819
|
setBusy("cache-params");
|
|
13783
13820
|
setError(null);
|
|
13784
|
-
setStatus(await post$
|
|
13821
|
+
setStatus(await post$2("/settings", { cacheRequestParams: enabled }));
|
|
13785
13822
|
} catch (cause) {
|
|
13786
|
-
setError(messageOf$
|
|
13823
|
+
setError(messageOf$2(cause));
|
|
13787
13824
|
} finally {
|
|
13788
13825
|
setBusy(null);
|
|
13789
13826
|
}
|
|
@@ -13792,9 +13829,9 @@ window.__ModuleLoader__.load({
|
|
|
13792
13829
|
try {
|
|
13793
13830
|
setBusy("quota");
|
|
13794
13831
|
setError(null);
|
|
13795
|
-
setStatus(await post$
|
|
13832
|
+
setStatus(await post$2("/quota", {}));
|
|
13796
13833
|
} catch (cause) {
|
|
13797
|
-
setError(messageOf$
|
|
13834
|
+
setError(messageOf$2(cause));
|
|
13798
13835
|
} finally {
|
|
13799
13836
|
setBusy(null);
|
|
13800
13837
|
}
|
|
@@ -13803,9 +13840,9 @@ window.__ModuleLoader__.load({
|
|
|
13803
13840
|
try {
|
|
13804
13841
|
setBusy("catalog");
|
|
13805
13842
|
setError(null);
|
|
13806
|
-
setStatus(await post$
|
|
13843
|
+
setStatus(await post$2("/catalog/refresh", {}));
|
|
13807
13844
|
} catch (cause) {
|
|
13808
|
-
setError(messageOf$
|
|
13845
|
+
setError(messageOf$2(cause));
|
|
13809
13846
|
} finally {
|
|
13810
13847
|
setBusy(null);
|
|
13811
13848
|
}
|
|
@@ -13814,9 +13851,9 @@ window.__ModuleLoader__.load({
|
|
|
13814
13851
|
try {
|
|
13815
13852
|
setBusy("connection");
|
|
13816
13853
|
setError(null);
|
|
13817
|
-
setConnection(await post$
|
|
13854
|
+
setConnection(await post$2("/connection/test", {}));
|
|
13818
13855
|
} catch (cause) {
|
|
13819
|
-
setError(messageOf$
|
|
13856
|
+
setError(messageOf$2(cause));
|
|
13820
13857
|
} finally {
|
|
13821
13858
|
setBusy(null);
|
|
13822
13859
|
}
|
|
@@ -13848,7 +13885,7 @@ window.__ModuleLoader__.load({
|
|
|
13848
13885
|
try {
|
|
13849
13886
|
setBusy(`quota-credential:${mode}`);
|
|
13850
13887
|
setError(null);
|
|
13851
|
-
setStatus(await post$
|
|
13888
|
+
setStatus(await post$2("/quota/credential", mode === "password" ? {
|
|
13852
13889
|
mode,
|
|
13853
13890
|
account,
|
|
13854
13891
|
password
|
|
@@ -13857,7 +13894,7 @@ window.__ModuleLoader__.load({
|
|
|
13857
13894
|
token
|
|
13858
13895
|
} : { mode }));
|
|
13859
13896
|
} catch (cause) {
|
|
13860
|
-
setError(messageOf$
|
|
13897
|
+
setError(messageOf$2(cause));
|
|
13861
13898
|
} finally {
|
|
13862
13899
|
setQuotaPassword("");
|
|
13863
13900
|
setQuotaToken("");
|
|
@@ -14067,7 +14104,7 @@ window.__ModuleLoader__.load({
|
|
|
14067
14104
|
const { status, loading, busy, error, connection, adoptResult, pasteValue, profile, pasteOpen, contextDrafts, savingModel, quotaAccount, quotaPassword, quotaToken } = state;
|
|
14068
14105
|
const { accounts, models, contextModels, overrideCount, login, quota, authenticated, poolLabels, cache, cacheHitRatio: hitRatio, quotaCredential } = derived;
|
|
14069
14106
|
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;
|
|
14070
|
-
const t = useLineDict(NS_STEP_CODE, zh$
|
|
14107
|
+
const t = useLineDict(NS_STEP_CODE, zh$8);
|
|
14071
14108
|
if (loading) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
14072
14109
|
className: "dsha-page",
|
|
14073
14110
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -14857,7 +14894,7 @@ window.__ModuleLoader__.load({
|
|
|
14857
14894
|
}
|
|
14858
14895
|
//#endregion
|
|
14859
14896
|
//#region src/client/cline-pass/api.ts
|
|
14860
|
-
const api$
|
|
14897
|
+
const api$9 = createLineApi(CLINE_PASS_ROUTE_PREFIX, "Cline Pass");
|
|
14861
14898
|
/**
|
|
14862
14899
|
* Whether the host is refreshing the quota behind this answer.
|
|
14863
14900
|
*
|
|
@@ -14888,62 +14925,62 @@ window.__ModuleLoader__.load({
|
|
|
14888
14925
|
* raw quota payload.
|
|
14889
14926
|
*/
|
|
14890
14927
|
status(refresh = false) {
|
|
14891
|
-
if (!refresh) return api$
|
|
14892
|
-
return api$
|
|
14928
|
+
if (!refresh) return api$9.get("/status");
|
|
14929
|
+
return api$9.post("/usage", {}).then((outcome) => outcome.status);
|
|
14893
14930
|
}
|
|
14894
14931
|
updateSettings(patch) {
|
|
14895
|
-
return api$
|
|
14932
|
+
return api$9.post("/settings", patch).then(() => this.status());
|
|
14896
14933
|
}
|
|
14897
14934
|
accountAction(action, body = {}) {
|
|
14898
|
-
return api$
|
|
14935
|
+
return api$9.post("/accounts", {
|
|
14899
14936
|
action,
|
|
14900
14937
|
...body
|
|
14901
14938
|
});
|
|
14902
14939
|
}
|
|
14903
14940
|
/** Verify a key without storing it; the host answers the verdict directly. */
|
|
14904
14941
|
testKey(body) {
|
|
14905
|
-
return api$
|
|
14942
|
+
return api$9.post("/accounts", {
|
|
14906
14943
|
action: "test",
|
|
14907
14944
|
...body
|
|
14908
14945
|
});
|
|
14909
14946
|
}
|
|
14910
14947
|
/** Start the Cline device-code sign-in. */
|
|
14911
14948
|
startLogin() {
|
|
14912
|
-
return api$
|
|
14949
|
+
return api$9.post("/login/start", {});
|
|
14913
14950
|
}
|
|
14914
14951
|
/** One poll of the pending sign-in; the host throttles it to WorkOS's interval. */
|
|
14915
14952
|
loginStatus(id) {
|
|
14916
|
-
return api$
|
|
14953
|
+
return api$9.get(`/login/status?id=${encodeURIComponent(id)}`);
|
|
14917
14954
|
}
|
|
14918
14955
|
cancelLogin(id) {
|
|
14919
|
-
return api$
|
|
14956
|
+
return api$9.post("/login/cancel", { id });
|
|
14920
14957
|
}
|
|
14921
14958
|
setEnabledModels(enabledModelIds) {
|
|
14922
|
-
return api$
|
|
14959
|
+
return api$9.post("/models", { enabledModelIds });
|
|
14923
14960
|
}
|
|
14924
14961
|
setContextWindow(model, contextWindow) {
|
|
14925
|
-
return api$
|
|
14962
|
+
return api$9.post("/models/context-window", {
|
|
14926
14963
|
model,
|
|
14927
14964
|
contextWindow
|
|
14928
14965
|
});
|
|
14929
14966
|
}
|
|
14930
14967
|
test(model) {
|
|
14931
|
-
return api$
|
|
14968
|
+
return api$9.post("/models/test", { model });
|
|
14932
14969
|
}
|
|
14933
14970
|
setVisibility(model, visible) {
|
|
14934
|
-
return api$
|
|
14971
|
+
return api$9.post("/models/visibility", {
|
|
14935
14972
|
model,
|
|
14936
14973
|
visible
|
|
14937
14974
|
});
|
|
14938
14975
|
}
|
|
14939
14976
|
setVisibilityAll(mode) {
|
|
14940
|
-
return api$
|
|
14977
|
+
return api$9.post("/models/visibility-all", { mode });
|
|
14941
14978
|
}
|
|
14942
14979
|
refreshCatalog() {
|
|
14943
|
-
return api$
|
|
14980
|
+
return api$9.post("/catalog/refresh", {});
|
|
14944
14981
|
}
|
|
14945
14982
|
searchCatalog(query) {
|
|
14946
|
-
return api$
|
|
14983
|
+
return api$9.get("/catalog/search?q=" + encodeURIComponent(query));
|
|
14947
14984
|
}
|
|
14948
14985
|
/**
|
|
14949
14986
|
* Add one search hit.
|
|
@@ -14952,26 +14989,26 @@ window.__ModuleLoader__.load({
|
|
|
14952
14989
|
* refuses it until the caller acknowledges that (`acknowledgeBilling`).
|
|
14953
14990
|
*/
|
|
14954
14991
|
addCatalogModel(model, acknowledgeBilling = false) {
|
|
14955
|
-
return api$
|
|
14992
|
+
return api$9.post("/catalog/add", acknowledgeBilling ? {
|
|
14956
14993
|
model,
|
|
14957
14994
|
acknowledgeBilling: true
|
|
14958
14995
|
} : { model });
|
|
14959
14996
|
}
|
|
14960
14997
|
readUsage() {
|
|
14961
|
-
return api$
|
|
14998
|
+
return api$9.post("/usage", {});
|
|
14962
14999
|
}
|
|
14963
15000
|
history(limit = 25, model = "") {
|
|
14964
15001
|
const query = new URLSearchParams({
|
|
14965
15002
|
limit: String(limit),
|
|
14966
15003
|
...model === "" ? {} : { model }
|
|
14967
15004
|
});
|
|
14968
|
-
return api$
|
|
15005
|
+
return api$9.get("/history?" + query.toString());
|
|
14969
15006
|
}
|
|
14970
15007
|
};
|
|
14971
15008
|
//#endregion
|
|
14972
15009
|
//#region src/client/cline-pass/locales.ts
|
|
14973
15010
|
const NS_CLINE_PASS = "dsh-cline-pass";
|
|
14974
|
-
const zh$
|
|
15011
|
+
const zh$7 = {
|
|
14975
15012
|
...accountPoolZh,
|
|
14976
15013
|
relogin: "重新登录",
|
|
14977
15014
|
needsRelogin: "登录已失效",
|
|
@@ -15095,7 +15132,7 @@ window.__ModuleLoader__.load({
|
|
|
15095
15132
|
limitRoute: "模型路由按 provider id 抢占:若已有其他插件占用 cline-pass,本卡仍可配置,但请求由对方服务。",
|
|
15096
15133
|
limitQuota: "额度窗口来自网关的 usage-limits 接口;接口失败时卡片保留上一次读数并显示原因。"
|
|
15097
15134
|
};
|
|
15098
|
-
const en$
|
|
15135
|
+
const en$7 = {
|
|
15099
15136
|
...accountPoolEn,
|
|
15100
15137
|
relogin: "Sign in again",
|
|
15101
15138
|
needsRelogin: "Sign-in expired",
|
|
@@ -15219,11 +15256,11 @@ window.__ModuleLoader__.load({
|
|
|
15219
15256
|
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.",
|
|
15220
15257
|
limitQuota: "Quota windows come from the gateway usage-limits endpoint; when it fails the card keeps the previous reading and says why."
|
|
15221
15258
|
};
|
|
15222
|
-
const dictionaries$
|
|
15223
|
-
zh: zh$
|
|
15224
|
-
"zh-CN": zh$
|
|
15225
|
-
en: en$
|
|
15226
|
-
"en-US": en$
|
|
15259
|
+
const dictionaries$7 = {
|
|
15260
|
+
zh: zh$7,
|
|
15261
|
+
"zh-CN": zh$7,
|
|
15262
|
+
en: en$7,
|
|
15263
|
+
"en-US": en$7
|
|
15227
15264
|
};
|
|
15228
15265
|
//#endregion
|
|
15229
15266
|
//#region src/client/cline-pass/ClinePassSection.tsx
|
|
@@ -15342,10 +15379,10 @@ window.__ModuleLoader__.load({
|
|
|
15342
15379
|
API$5.loginStatus(flow.id).then((next) => {
|
|
15343
15380
|
setLoginFlow(next);
|
|
15344
15381
|
if (next.status === "complete") {
|
|
15345
|
-
setNotice(zh$
|
|
15382
|
+
setNotice(zh$7.loginComplete.replace("{account}", next.accountAlias === "" ? "Cline Pass" : next.accountAlias));
|
|
15346
15383
|
setShowKeyForm(false);
|
|
15347
15384
|
loadStatus();
|
|
15348
|
-
} else if (next.status === "failed") setError(zh$
|
|
15385
|
+
} else if (next.status === "failed") setError(zh$7.loginFailed.replace("{detail}", next.error));
|
|
15349
15386
|
}).catch((cause) => setError(detail$1(cause)));
|
|
15350
15387
|
}, Math.max(2, flow.intervalSeconds) * 1e3);
|
|
15351
15388
|
return () => window.clearInterval(timer);
|
|
@@ -15419,7 +15456,7 @@ window.__ModuleLoader__.load({
|
|
|
15419
15456
|
apiKey: trimmed,
|
|
15420
15457
|
...keyBaseURL.trim() === "" ? {} : { baseURL: keyBaseURL.trim() }
|
|
15421
15458
|
}).then((result) => {
|
|
15422
|
-
setNotice(result.authorized ? zh$
|
|
15459
|
+
setNotice(result.authorized ? zh$7.keyTestOk.replace("{ms}", String(Math.round(result.ms))) : zh$7.keyTestFailed.replace("{detail}", result.error));
|
|
15423
15460
|
}).catch((cause) => setError(detail$1(cause))).finally(() => setBusy(null));
|
|
15424
15461
|
}, [key, keyBaseURL]);
|
|
15425
15462
|
const testStored = (0, react.useCallback)((accountId) => {
|
|
@@ -15427,7 +15464,7 @@ window.__ModuleLoader__.load({
|
|
|
15427
15464
|
setError(null);
|
|
15428
15465
|
setNotice(null);
|
|
15429
15466
|
API$5.testKey({ accountId }).then((result) => {
|
|
15430
|
-
setNotice(result.authorized ? zh$
|
|
15467
|
+
setNotice(result.authorized ? zh$7.keyTestOk.replace("{ms}", String(Math.round(result.ms))) : zh$7.keyTestFailed.replace("{detail}", result.error));
|
|
15431
15468
|
}).catch((cause) => setError(detail$1(cause))).finally(() => setBusy(null));
|
|
15432
15469
|
}, []);
|
|
15433
15470
|
const enabledModels = (0, react.useMemo)(() => (status?.models ?? []).filter((model) => model.enabled), [status]);
|
|
@@ -15453,7 +15490,7 @@ window.__ModuleLoader__.load({
|
|
|
15453
15490
|
if (model === void 0) return;
|
|
15454
15491
|
const parsed = parsePositiveCapacity$1(drafts[id] ?? formatCapacity$1(model.contextWindow));
|
|
15455
15492
|
if (parsed === null) {
|
|
15456
|
-
setError(zh$
|
|
15493
|
+
setError(zh$7.error.replace("{detail}", zh$7.defaultContextWindow));
|
|
15457
15494
|
return;
|
|
15458
15495
|
}
|
|
15459
15496
|
run("ctx:" + id, () => API$5.setContextWindow(id, parsed));
|
|
@@ -15475,7 +15512,7 @@ window.__ModuleLoader__.load({
|
|
|
15475
15512
|
}, [run, status]);
|
|
15476
15513
|
const resetAllContext = (0, react.useCallback)(() => {
|
|
15477
15514
|
if (status === null) return;
|
|
15478
|
-
if (typeof window !== "undefined" && !window.confirm(zh$
|
|
15515
|
+
if (typeof window !== "undefined" && !window.confirm(zh$7.contextResetAll)) return;
|
|
15479
15516
|
const overridden = status.models.filter((model) => model.contextWindowOverride !== void 0);
|
|
15480
15517
|
run("ctx-all", async () => {
|
|
15481
15518
|
let next = status;
|
|
@@ -15516,7 +15553,7 @@ window.__ModuleLoader__.load({
|
|
|
15516
15553
|
const refreshUsage = (0, react.useCallback)(() => {
|
|
15517
15554
|
run("usage", async () => {
|
|
15518
15555
|
const outcome = await API$5.readUsage();
|
|
15519
|
-
setNotice(outcome.usage.accounts.some((account) => account.ok) ? "" : zh$
|
|
15556
|
+
setNotice(outcome.usage.accounts.some((account) => account.ok) ? "" : zh$7.usageEmpty);
|
|
15520
15557
|
return outcome.status;
|
|
15521
15558
|
});
|
|
15522
15559
|
}, [run]);
|
|
@@ -15536,7 +15573,7 @@ window.__ModuleLoader__.load({
|
|
|
15536
15573
|
};
|
|
15537
15574
|
const invalid = Object.entries(numbers).find(([, value]) => !Number.isSafeInteger(value) || value < 0);
|
|
15538
15575
|
if (invalid !== void 0) {
|
|
15539
|
-
setError(zh$
|
|
15576
|
+
setError(zh$7.error.replace("{detail}", invalid[0]));
|
|
15540
15577
|
return;
|
|
15541
15578
|
}
|
|
15542
15579
|
setBusy("settings");
|
|
@@ -15547,7 +15584,7 @@ window.__ModuleLoader__.load({
|
|
|
15547
15584
|
}).then((next) => {
|
|
15548
15585
|
applyStatus(next);
|
|
15549
15586
|
setSettingsForm(settingsFormOf$1(next));
|
|
15550
|
-
setNotice(zh$
|
|
15587
|
+
setNotice(zh$7.saved);
|
|
15551
15588
|
}).catch((cause) => setError(detail$1(cause))).finally(() => setBusy(null));
|
|
15552
15589
|
}, [settingsForm, applyStatus]);
|
|
15553
15590
|
const toggleTools = (0, react.useCallback)(() => {
|
|
@@ -15558,10 +15595,10 @@ window.__ModuleLoader__.load({
|
|
|
15558
15595
|
API$5.updateSettings({ exposeTools: value }).then((next) => {
|
|
15559
15596
|
applyStatus(next);
|
|
15560
15597
|
setSettingsForm(settingsFormOf$1(next));
|
|
15561
|
-
setNotice(zh$
|
|
15598
|
+
setNotice(zh$7.restartRequired);
|
|
15562
15599
|
}).catch((cause) => setError(detail$1(cause))).finally(() => setBusy(null));
|
|
15563
15600
|
}, [status, applyStatus]);
|
|
15564
|
-
const t = useLineDict(NS_CLINE_PASS, zh$
|
|
15601
|
+
const t = useLineDict(NS_CLINE_PASS, zh$7);
|
|
15565
15602
|
const errorPrefix = t.error.split("{detail}")[0] ?? "";
|
|
15566
15603
|
const pool = status?.pool;
|
|
15567
15604
|
const accounts = (0, react.useMemo)(() => {
|
|
@@ -16336,7 +16373,7 @@ window.__ModuleLoader__.load({
|
|
|
16336
16373
|
* 'settings.section' 上的那张座位(那张座绑定的是 ChatGPT 的键集)。
|
|
16337
16374
|
*/
|
|
16338
16375
|
const NS_QODER = "dsh-qoder";
|
|
16339
|
-
const zh$
|
|
16376
|
+
const zh$6 = {
|
|
16340
16377
|
modelRowEfforts: "档位 {list}",
|
|
16341
16378
|
modelRowNoEfforts: "无档位",
|
|
16342
16379
|
modelRowOutput: "输出 {cap}",
|
|
@@ -16460,8 +16497,8 @@ window.__ModuleLoader__.load({
|
|
|
16460
16497
|
quotaWindow: "额度窗口"
|
|
16461
16498
|
};
|
|
16462
16499
|
/** 两套字典。 */
|
|
16463
|
-
const dictionaries$
|
|
16464
|
-
zh: zh$
|
|
16500
|
+
const dictionaries$6 = {
|
|
16501
|
+
zh: zh$6,
|
|
16465
16502
|
en: {
|
|
16466
16503
|
modelRowEfforts: "efforts {list}",
|
|
16467
16504
|
modelRowNoEfforts: "no efforts",
|
|
@@ -16638,10 +16675,10 @@ window.__ModuleLoader__.load({
|
|
|
16638
16675
|
* 凭据边界也写在这里:/login/manual 的请求体是本文件里**唯一**带秘密的形状,
|
|
16639
16676
|
* 它只在这个函数调用点的字面量里出现,既不进 URL、也不进日志。
|
|
16640
16677
|
*/
|
|
16641
|
-
const api$
|
|
16642
|
-
const get = api$
|
|
16643
|
-
const post = api$
|
|
16644
|
-
function messageOf(cause) {
|
|
16678
|
+
const api$8 = createLineApi(QODER_ROUTE_PREFIX, QODER_PROVIDER_NAME);
|
|
16679
|
+
const get$1 = api$8.get;
|
|
16680
|
+
const post$1 = api$8.post;
|
|
16681
|
+
function messageOf$1(cause) {
|
|
16645
16682
|
return cause instanceof Error ? cause.message : String(cause);
|
|
16646
16683
|
}
|
|
16647
16684
|
//#endregion
|
|
@@ -16662,7 +16699,7 @@ window.__ModuleLoader__.load({
|
|
|
16662
16699
|
/** 登录状态机的轮询节奏。真实超时与间隔由 host 拥有,卡片只是跟随。 */
|
|
16663
16700
|
const LOGIN_POLL_INTERVAL_MS = 2e3;
|
|
16664
16701
|
/** 本卡片的字典;身份稳定,依赖它的 effect 才不会每次渲染重建。 */
|
|
16665
|
-
const fallbackTranslate$4 = (key) => zh$
|
|
16702
|
+
const fallbackTranslate$4 = (key) => zh$6[key];
|
|
16666
16703
|
/**
|
|
16667
16704
|
* 共享账号池卡片需要的标签集,按本卡片的字典逐键查出来。
|
|
16668
16705
|
*
|
|
@@ -16801,7 +16838,7 @@ window.__ModuleLoader__.load({
|
|
|
16801
16838
|
if (catalogPullAttempted.current) return;
|
|
16802
16839
|
catalogPullAttempted.current = true;
|
|
16803
16840
|
try {
|
|
16804
|
-
const next = await post("/catalog/refresh", {});
|
|
16841
|
+
const next = await post$1("/catalog/refresh", {});
|
|
16805
16842
|
setStatus(next);
|
|
16806
16843
|
setContextDrafts(contextDraftsFor(next));
|
|
16807
16844
|
} catch {}
|
|
@@ -16809,7 +16846,7 @@ window.__ModuleLoader__.load({
|
|
|
16809
16846
|
const loadStatus = (0, react.useCallback)(async (quiet = false) => {
|
|
16810
16847
|
if (!quiet) setError(null);
|
|
16811
16848
|
try {
|
|
16812
|
-
const next = await get("/status");
|
|
16849
|
+
const next = await get$1("/status");
|
|
16813
16850
|
setStatus(next);
|
|
16814
16851
|
setContextDrafts(contextDraftsFor(next));
|
|
16815
16852
|
if (!regionTouched.current && isQoderRegion(next.region)) setRegionState(next.region);
|
|
@@ -16819,7 +16856,7 @@ window.__ModuleLoader__.load({
|
|
|
16819
16856
|
});
|
|
16820
16857
|
if (next.catalogRefreshing === true) pullCatalogQuietly();
|
|
16821
16858
|
} catch (cause) {
|
|
16822
|
-
if (!quiet) setError(messageOf(cause));
|
|
16859
|
+
if (!quiet) setError(messageOf$1(cause));
|
|
16823
16860
|
} finally {
|
|
16824
16861
|
setLoading(false);
|
|
16825
16862
|
}
|
|
@@ -16844,7 +16881,7 @@ window.__ModuleLoader__.load({
|
|
|
16844
16881
|
const timer = window.setInterval(() => {
|
|
16845
16882
|
(async () => {
|
|
16846
16883
|
try {
|
|
16847
|
-
const poll = await get("/login/status");
|
|
16884
|
+
const poll = await get$1("/login/status");
|
|
16848
16885
|
if (stopped) return;
|
|
16849
16886
|
if (poll.status === "complete") {
|
|
16850
16887
|
setPasteValue("");
|
|
@@ -16877,13 +16914,13 @@ window.__ModuleLoader__.load({
|
|
|
16877
16914
|
setError(null);
|
|
16878
16915
|
setConnection(null);
|
|
16879
16916
|
setPasteValue("");
|
|
16880
|
-
const flow = await post("/login/start", { region: loginRegion });
|
|
16917
|
+
const flow = await post$1("/login/start", { region: loginRegion });
|
|
16881
16918
|
await loadStatus(true);
|
|
16882
16919
|
if (flow.authorizeUrl !== void 0 && flow.authorizeUrl !== "") try {
|
|
16883
16920
|
window.open(flow.authorizeUrl, "_blank", "noopener,noreferrer");
|
|
16884
16921
|
} catch {}
|
|
16885
16922
|
} catch (cause) {
|
|
16886
|
-
setError(messageOf(cause));
|
|
16923
|
+
setError(messageOf$1(cause));
|
|
16887
16924
|
} finally {
|
|
16888
16925
|
setBusy(null);
|
|
16889
16926
|
}
|
|
@@ -16892,10 +16929,10 @@ window.__ModuleLoader__.load({
|
|
|
16892
16929
|
try {
|
|
16893
16930
|
setBusy("login:cancel");
|
|
16894
16931
|
setError(null);
|
|
16895
|
-
await post("/login/cancel", {});
|
|
16932
|
+
await post$1("/login/cancel", {});
|
|
16896
16933
|
await loadStatus(true);
|
|
16897
16934
|
} catch (cause) {
|
|
16898
|
-
setError(messageOf(cause));
|
|
16935
|
+
setError(messageOf$1(cause));
|
|
16899
16936
|
} finally {
|
|
16900
16937
|
setBusy(null);
|
|
16901
16938
|
}
|
|
@@ -16909,13 +16946,13 @@ window.__ModuleLoader__.load({
|
|
|
16909
16946
|
try {
|
|
16910
16947
|
setBusy("login-manual");
|
|
16911
16948
|
setError(null);
|
|
16912
|
-
setStatus(await post("/login/manual", {
|
|
16949
|
+
setStatus(await post$1("/login/manual", {
|
|
16913
16950
|
region,
|
|
16914
16951
|
token
|
|
16915
16952
|
}));
|
|
16916
16953
|
onModelChange?.();
|
|
16917
16954
|
} catch (cause) {
|
|
16918
|
-
setError(messageOf(cause));
|
|
16955
|
+
setError(messageOf$1(cause));
|
|
16919
16956
|
} finally {
|
|
16920
16957
|
setPasteValue("");
|
|
16921
16958
|
setBusy(null);
|
|
@@ -16925,12 +16962,12 @@ window.__ModuleLoader__.load({
|
|
|
16925
16962
|
try {
|
|
16926
16963
|
setBusy("adopt");
|
|
16927
16964
|
setError(null);
|
|
16928
|
-
const result = await post("/adopt", {});
|
|
16965
|
+
const result = await post$1("/adopt", {});
|
|
16929
16966
|
setAdoptResult(result);
|
|
16930
16967
|
await loadStatus(true);
|
|
16931
16968
|
if (result.adopted) onModelChange?.();
|
|
16932
16969
|
} catch (cause) {
|
|
16933
|
-
setError(messageOf(cause));
|
|
16970
|
+
setError(messageOf$1(cause));
|
|
16934
16971
|
} finally {
|
|
16935
16972
|
setBusy(null);
|
|
16936
16973
|
}
|
|
@@ -16939,13 +16976,13 @@ window.__ModuleLoader__.load({
|
|
|
16939
16976
|
try {
|
|
16940
16977
|
setBusy("account:" + action + ":" + accountId);
|
|
16941
16978
|
setError(null);
|
|
16942
|
-
setStatus(await post("/accounts", {
|
|
16979
|
+
setStatus(await post$1("/accounts", {
|
|
16943
16980
|
action,
|
|
16944
16981
|
accountId
|
|
16945
16982
|
}));
|
|
16946
16983
|
onModelChange?.();
|
|
16947
16984
|
} catch (cause) {
|
|
16948
|
-
setError(messageOf(cause));
|
|
16985
|
+
setError(messageOf$1(cause));
|
|
16949
16986
|
} finally {
|
|
16950
16987
|
setBusy(null);
|
|
16951
16988
|
}
|
|
@@ -16954,12 +16991,12 @@ window.__ModuleLoader__.load({
|
|
|
16954
16991
|
try {
|
|
16955
16992
|
setBusy("strategy");
|
|
16956
16993
|
setError(null);
|
|
16957
|
-
setStatus(await post("/accounts", {
|
|
16994
|
+
setStatus(await post$1("/accounts", {
|
|
16958
16995
|
action: "strategy",
|
|
16959
16996
|
strategy
|
|
16960
16997
|
}));
|
|
16961
16998
|
} catch (cause) {
|
|
16962
|
-
setError(messageOf(cause));
|
|
16999
|
+
setError(messageOf$1(cause));
|
|
16963
17000
|
} finally {
|
|
16964
17001
|
setBusy(null);
|
|
16965
17002
|
}
|
|
@@ -16974,12 +17011,12 @@ window.__ModuleLoader__.load({
|
|
|
16974
17011
|
const applyEnabledModels = async (enabledModelIds) => {
|
|
16975
17012
|
try {
|
|
16976
17013
|
setError(null);
|
|
16977
|
-
const updated = await post("/settings", { enabledModelIds });
|
|
17014
|
+
const updated = await post$1("/settings", { enabledModelIds });
|
|
16978
17015
|
setStatus(updated);
|
|
16979
17016
|
setContextDrafts(contextDraftsFor(updated));
|
|
16980
17017
|
onModelChange?.();
|
|
16981
17018
|
} catch (cause) {
|
|
16982
|
-
setError(messageOf(cause));
|
|
17019
|
+
setError(messageOf$1(cause));
|
|
16983
17020
|
}
|
|
16984
17021
|
};
|
|
16985
17022
|
const toggleModel = (modelId, enabled) => {
|
|
@@ -17002,14 +17039,14 @@ window.__ModuleLoader__.load({
|
|
|
17002
17039
|
try {
|
|
17003
17040
|
setSavingModel(modelId);
|
|
17004
17041
|
setError(null);
|
|
17005
|
-
setStatus(await post("/settings", { contextWindowOverrides: { [modelId]: parsed } }));
|
|
17042
|
+
setStatus(await post$1("/settings", { contextWindowOverrides: { [modelId]: parsed } }));
|
|
17006
17043
|
setContextDrafts((previous) => ({
|
|
17007
17044
|
...previous,
|
|
17008
17045
|
[modelId]: formatCapacity$1(parsed)
|
|
17009
17046
|
}));
|
|
17010
17047
|
onModelChange?.();
|
|
17011
17048
|
} catch (cause) {
|
|
17012
|
-
setError(messageOf(cause));
|
|
17049
|
+
setError(messageOf$1(cause));
|
|
17013
17050
|
} finally {
|
|
17014
17051
|
setSavingModel(null);
|
|
17015
17052
|
}
|
|
@@ -17018,7 +17055,7 @@ window.__ModuleLoader__.load({
|
|
|
17018
17055
|
try {
|
|
17019
17056
|
setSavingModel(modelId);
|
|
17020
17057
|
setError(null);
|
|
17021
|
-
const updated = await post("/settings", { contextWindowOverrides: { [modelId]: null } });
|
|
17058
|
+
const updated = await post$1("/settings", { contextWindowOverrides: { [modelId]: null } });
|
|
17022
17059
|
setStatus(updated);
|
|
17023
17060
|
const model = updated.models.find((entry) => entry.id === modelId);
|
|
17024
17061
|
if (model !== void 0) setContextDrafts((previous) => ({
|
|
@@ -17027,7 +17064,7 @@ window.__ModuleLoader__.load({
|
|
|
17027
17064
|
}));
|
|
17028
17065
|
onModelChange?.();
|
|
17029
17066
|
} catch (cause) {
|
|
17030
|
-
setError(messageOf(cause));
|
|
17067
|
+
setError(messageOf$1(cause));
|
|
17031
17068
|
} finally {
|
|
17032
17069
|
setSavingModel(null);
|
|
17033
17070
|
}
|
|
@@ -17037,21 +17074,21 @@ window.__ModuleLoader__.load({
|
|
|
17037
17074
|
if (ids.length === 0) return;
|
|
17038
17075
|
try {
|
|
17039
17076
|
setError(null);
|
|
17040
|
-
const updated = await post("/settings", { contextWindowOverrides: Object.fromEntries(ids.map((id) => [id, null])) });
|
|
17077
|
+
const updated = await post$1("/settings", { contextWindowOverrides: Object.fromEntries(ids.map((id) => [id, null])) });
|
|
17041
17078
|
setStatus(updated);
|
|
17042
17079
|
setContextDrafts(contextDraftsFor(updated));
|
|
17043
17080
|
onModelChange?.();
|
|
17044
17081
|
} catch (cause) {
|
|
17045
|
-
setError(messageOf(cause));
|
|
17082
|
+
setError(messageOf$1(cause));
|
|
17046
17083
|
}
|
|
17047
17084
|
};
|
|
17048
17085
|
const setDefaultReasoningEffort = async (effort) => {
|
|
17049
17086
|
try {
|
|
17050
17087
|
setBusy("effort");
|
|
17051
17088
|
setError(null);
|
|
17052
|
-
setStatus(await post("/settings", { defaultReasoningEffort: effort }));
|
|
17089
|
+
setStatus(await post$1("/settings", { defaultReasoningEffort: effort }));
|
|
17053
17090
|
} catch (cause) {
|
|
17054
|
-
setError(messageOf(cause));
|
|
17091
|
+
setError(messageOf$1(cause));
|
|
17055
17092
|
} finally {
|
|
17056
17093
|
setBusy(null);
|
|
17057
17094
|
}
|
|
@@ -17060,9 +17097,9 @@ window.__ModuleLoader__.load({
|
|
|
17060
17097
|
try {
|
|
17061
17098
|
setBusy("quota");
|
|
17062
17099
|
setError(null);
|
|
17063
|
-
setStatus(await post("/quota", {}));
|
|
17100
|
+
setStatus(await post$1("/quota", {}));
|
|
17064
17101
|
} catch (cause) {
|
|
17065
|
-
setError(messageOf(cause));
|
|
17102
|
+
setError(messageOf$1(cause));
|
|
17066
17103
|
} finally {
|
|
17067
17104
|
setBusy(null);
|
|
17068
17105
|
}
|
|
@@ -17071,9 +17108,9 @@ window.__ModuleLoader__.load({
|
|
|
17071
17108
|
try {
|
|
17072
17109
|
setBusy("catalog");
|
|
17073
17110
|
setError(null);
|
|
17074
|
-
setStatus(await post("/catalog/refresh", {}));
|
|
17111
|
+
setStatus(await post$1("/catalog/refresh", {}));
|
|
17075
17112
|
} catch (cause) {
|
|
17076
|
-
setError(messageOf(cause));
|
|
17113
|
+
setError(messageOf$1(cause));
|
|
17077
17114
|
} finally {
|
|
17078
17115
|
setBusy(null);
|
|
17079
17116
|
}
|
|
@@ -17082,9 +17119,9 @@ window.__ModuleLoader__.load({
|
|
|
17082
17119
|
try {
|
|
17083
17120
|
setBusy("connection");
|
|
17084
17121
|
setError(null);
|
|
17085
|
-
setConnection(await post("/connection/test", {}));
|
|
17122
|
+
setConnection(await post$1("/connection/test", {}));
|
|
17086
17123
|
} catch (cause) {
|
|
17087
|
-
setError(messageOf(cause));
|
|
17124
|
+
setError(messageOf$1(cause));
|
|
17088
17125
|
} finally {
|
|
17089
17126
|
setBusy(null);
|
|
17090
17127
|
}
|
|
@@ -17228,7 +17265,7 @@ window.__ModuleLoader__.load({
|
|
|
17228
17265
|
* `defaultMaxTokens`),客户端不按模型名推断任何一项。与 OpenDesign 卡同一写法:
|
|
17229
17266
|
* 数据一行,散文进折叠区。
|
|
17230
17267
|
*/
|
|
17231
|
-
function qoderModelRowHint(model, t = zh$
|
|
17268
|
+
function qoderModelRowHint(model, t = zh$6) {
|
|
17232
17269
|
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))}`;
|
|
17233
17270
|
}
|
|
17234
17271
|
function QoderSection({ onModelChange } = {}) {
|
|
@@ -17236,7 +17273,7 @@ window.__ModuleLoader__.load({
|
|
|
17236
17273
|
const { status, loading, busy, error, connection, adoptResult, pasteValue, region, pasteOpen, contextDrafts, savingModel } = state;
|
|
17237
17274
|
const { accounts, models, contextModels, overrideCount, login, quota, authenticated, poolLabels, cache, cacheHitRatio: hitRatio } = derived;
|
|
17238
17275
|
const { setRegion, login: startLogin, cancelLogin, submitPaste, setPasteValue, togglePaste, adopt, clearAdoptResult, accountAction, setStrategy, toggleModel, setAllModels, saveContextWindow, resetContextWindow, resetAllContextWindows, updateContextDraft, setDefaultReasoningEffort, refreshQuota, refreshCatalog, testConnection } = actions;
|
|
17239
|
-
const t = useLineDict(NS_QODER, zh$
|
|
17276
|
+
const t = useLineDict(NS_QODER, zh$6);
|
|
17240
17277
|
if (loading) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
17241
17278
|
className: "dsha-page",
|
|
17242
17279
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -17765,7 +17802,7 @@ window.__ModuleLoader__.load({
|
|
|
17765
17802
|
const OPENDESIGN_ROUTE_PREFIX = "/opendesign/api";
|
|
17766
17803
|
//#endregion
|
|
17767
17804
|
//#region src/client/opendesign/api.ts
|
|
17768
|
-
const api$
|
|
17805
|
+
const api$7 = createLineApi(OPENDESIGN_ROUTE_PREFIX, "OpenDesign");
|
|
17769
17806
|
/**
|
|
17770
17807
|
* The OpenDesign settings API, as the card uses it.
|
|
17771
17808
|
*
|
|
@@ -17774,65 +17811,65 @@ window.__ModuleLoader__.load({
|
|
|
17774
17811
|
*/
|
|
17775
17812
|
var OpenDesignApi = class {
|
|
17776
17813
|
status() {
|
|
17777
|
-
return api$
|
|
17814
|
+
return api$7.get("/status");
|
|
17778
17815
|
}
|
|
17779
17816
|
updateSettings(patch) {
|
|
17780
|
-
return api$
|
|
17817
|
+
return api$7.post("/settings", patch).then(() => this.status());
|
|
17781
17818
|
}
|
|
17782
17819
|
accountAction(action, body = {}) {
|
|
17783
|
-
return api$
|
|
17820
|
+
return api$7.post("/accounts", {
|
|
17784
17821
|
action,
|
|
17785
17822
|
...body
|
|
17786
17823
|
});
|
|
17787
17824
|
}
|
|
17788
17825
|
/** Verify a key without storing it; the host answers the verdict directly. */
|
|
17789
17826
|
testKey(body) {
|
|
17790
|
-
return api$
|
|
17827
|
+
return api$7.post("/accounts", {
|
|
17791
17828
|
action: "test",
|
|
17792
17829
|
...body
|
|
17793
17830
|
});
|
|
17794
17831
|
}
|
|
17795
17832
|
/** Start the browser device-authorization sign-in. */
|
|
17796
17833
|
startLogin() {
|
|
17797
|
-
return api$
|
|
17834
|
+
return api$7.post("/login/start", {});
|
|
17798
17835
|
}
|
|
17799
17836
|
/** One poll of the pending sign-in; the host throttles it to the advertised interval. */
|
|
17800
17837
|
loginStatus(id) {
|
|
17801
|
-
return api$
|
|
17838
|
+
return api$7.get(`/login/status?id=${encodeURIComponent(id)}`);
|
|
17802
17839
|
}
|
|
17803
17840
|
cancelLogin(id) {
|
|
17804
|
-
return api$
|
|
17841
|
+
return api$7.post("/login/cancel", { id });
|
|
17805
17842
|
}
|
|
17806
17843
|
/** Read each OAuth account's wallet balance once (one upstream call per account). */
|
|
17807
17844
|
readUsage() {
|
|
17808
|
-
return api$
|
|
17845
|
+
return api$7.post("/usage", {});
|
|
17809
17846
|
}
|
|
17810
17847
|
setEnabledModels(enabledModelIds) {
|
|
17811
|
-
return api$
|
|
17848
|
+
return api$7.post("/models", { enabledModelIds });
|
|
17812
17849
|
}
|
|
17813
17850
|
setContextWindow(model, contextWindow) {
|
|
17814
|
-
return api$
|
|
17851
|
+
return api$7.post("/models/context-window", {
|
|
17815
17852
|
model,
|
|
17816
17853
|
contextWindow
|
|
17817
17854
|
});
|
|
17818
17855
|
}
|
|
17819
17856
|
setVisibility(model, visible) {
|
|
17820
|
-
return api$
|
|
17857
|
+
return api$7.post("/models/visibility", {
|
|
17821
17858
|
model,
|
|
17822
17859
|
visible
|
|
17823
17860
|
});
|
|
17824
17861
|
}
|
|
17825
17862
|
setVisibilityAll(mode) {
|
|
17826
|
-
return api$
|
|
17863
|
+
return api$7.post("/models/visibility-all", { mode });
|
|
17827
17864
|
}
|
|
17828
17865
|
refreshCatalog() {
|
|
17829
|
-
return api$
|
|
17866
|
+
return api$7.post("/catalog/refresh", {});
|
|
17830
17867
|
}
|
|
17831
17868
|
};
|
|
17832
17869
|
//#endregion
|
|
17833
17870
|
//#region src/client/opendesign/locales.ts
|
|
17834
17871
|
const NS_OPENDESIGN = "dsh-opendesign";
|
|
17835
|
-
const zh$
|
|
17872
|
+
const zh$5 = {
|
|
17836
17873
|
...accountPoolZh,
|
|
17837
17874
|
relogin: "重新登录",
|
|
17838
17875
|
needsRelogin: "登录已失效",
|
|
@@ -17940,7 +17977,7 @@ window.__ModuleLoader__.load({
|
|
|
17940
17977
|
limitRoute: "模型路由按 provider id 抢占:若已有其他插件占用 opendesign,本卡仍可配置,但请求由对方服务。",
|
|
17941
17978
|
limitQuota: "套餐与额度读取只覆盖浏览器授权登录的账号;粘贴的 API Key 没有控制 Key,请在 OpenDesign Cloud 控制台查看用量。"
|
|
17942
17979
|
};
|
|
17943
|
-
const en$
|
|
17980
|
+
const en$5 = {
|
|
17944
17981
|
...accountPoolEn,
|
|
17945
17982
|
relogin: "Add again",
|
|
17946
17983
|
needsRelogin: "Key invalid",
|
|
@@ -18048,11 +18085,11 @@ window.__ModuleLoader__.load({
|
|
|
18048
18085
|
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.",
|
|
18049
18086
|
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."
|
|
18050
18087
|
};
|
|
18051
|
-
const dictionaries$
|
|
18052
|
-
zh: zh$
|
|
18053
|
-
"zh-CN": zh$
|
|
18054
|
-
en: en$
|
|
18055
|
-
"en-US": en$
|
|
18088
|
+
const dictionaries$5 = {
|
|
18089
|
+
zh: zh$5,
|
|
18090
|
+
"zh-CN": zh$5,
|
|
18091
|
+
en: en$5,
|
|
18092
|
+
"en-US": en$5
|
|
18056
18093
|
};
|
|
18057
18094
|
//#endregion
|
|
18058
18095
|
//#region src/client/opendesign/OpenDesignSection.tsx
|
|
@@ -18347,7 +18384,7 @@ window.__ModuleLoader__.load({
|
|
|
18347
18384
|
try {
|
|
18348
18385
|
const outcome = await API$4.readUsage();
|
|
18349
18386
|
setStatus(outcome.status);
|
|
18350
|
-
if (!silent) setNotice(outcome.usage.accounts.some((account) => account.ok) ? "" : zh$
|
|
18387
|
+
if (!silent) setNotice(outcome.usage.accounts.some((account) => account.ok) ? "" : zh$5.usageEmpty);
|
|
18351
18388
|
} catch (cause) {
|
|
18352
18389
|
if (!silent) setError(detail(cause));
|
|
18353
18390
|
}
|
|
@@ -18384,10 +18421,10 @@ window.__ModuleLoader__.load({
|
|
|
18384
18421
|
API$4.loginStatus(flow.id).then((next) => {
|
|
18385
18422
|
setLoginFlow(next);
|
|
18386
18423
|
if (next.status === "complete") {
|
|
18387
|
-
setNotice(zh$
|
|
18424
|
+
setNotice(zh$5.loginComplete.replace("{account}", next.accountAlias === "" ? "OpenDesign" : next.accountAlias));
|
|
18388
18425
|
setShowKeyForm(false);
|
|
18389
18426
|
reload();
|
|
18390
|
-
} else if (next.status === "failed") setError(zh$
|
|
18427
|
+
} else if (next.status === "failed") setError(zh$5.loginFailed.replace("{detail}", next.error));
|
|
18391
18428
|
}).catch((cause) => setError(detail(cause)));
|
|
18392
18429
|
}, Math.max(2, flow.intervalSeconds) * 1e3);
|
|
18393
18430
|
return () => window.clearInterval(timer);
|
|
@@ -18453,7 +18490,7 @@ window.__ModuleLoader__.load({
|
|
|
18453
18490
|
const refreshUsage = (0, react.useCallback)(() => {
|
|
18454
18491
|
run("usage", async () => {
|
|
18455
18492
|
const outcome = await API$4.readUsage();
|
|
18456
|
-
setNotice(outcome.usage.accounts.some((account) => account.ok) ? "" : zh$
|
|
18493
|
+
setNotice(outcome.usage.accounts.some((account) => account.ok) ? "" : zh$5.usageEmpty);
|
|
18457
18494
|
return outcome.status;
|
|
18458
18495
|
});
|
|
18459
18496
|
}, [run]);
|
|
@@ -18488,7 +18525,7 @@ window.__ModuleLoader__.load({
|
|
|
18488
18525
|
apiKey: trimmed,
|
|
18489
18526
|
...keyBaseURL.trim() === "" ? {} : { baseURL: keyBaseURL.trim() }
|
|
18490
18527
|
}).then((result) => {
|
|
18491
|
-
setNotice(result.authorized ? zh$
|
|
18528
|
+
setNotice(result.authorized ? zh$5.keyTestOk.replace("{ms}", String(Math.round(result.ms))).replace("{count}", String(result.modelCount)) : zh$5.keyTestFailed.replace("{detail}", result.error));
|
|
18492
18529
|
}).catch((cause) => setError(detail(cause))).finally(() => setBusy(null));
|
|
18493
18530
|
}, [key, keyBaseURL]);
|
|
18494
18531
|
const testStored = (0, react.useCallback)((accountId) => {
|
|
@@ -18496,7 +18533,7 @@ window.__ModuleLoader__.load({
|
|
|
18496
18533
|
setError(null);
|
|
18497
18534
|
setNotice(null);
|
|
18498
18535
|
API$4.testKey({ accountId }).then((result) => {
|
|
18499
|
-
setNotice(result.authorized ? zh$
|
|
18536
|
+
setNotice(result.authorized ? zh$5.keyTestOk.replace("{ms}", String(Math.round(result.ms))).replace("{count}", String(result.modelCount)) : zh$5.keyTestFailed.replace("{detail}", result.error));
|
|
18500
18537
|
}).catch((cause) => setError(detail(cause))).finally(() => setBusy(null));
|
|
18501
18538
|
}, []);
|
|
18502
18539
|
const enabledModels = (0, react.useMemo)(() => (status?.models ?? []).filter((model) => model.enabled), [status]);
|
|
@@ -18522,7 +18559,7 @@ window.__ModuleLoader__.load({
|
|
|
18522
18559
|
if (model === void 0) return;
|
|
18523
18560
|
const parsed = parsePositiveCapacity$1(drafts[id] ?? formatCapacity$1(model.contextWindow));
|
|
18524
18561
|
if (parsed === null) {
|
|
18525
|
-
setError(zh$
|
|
18562
|
+
setError(zh$5.error.replace("{detail}", zh$5.defaultContextWindow));
|
|
18526
18563
|
return;
|
|
18527
18564
|
}
|
|
18528
18565
|
run("ctx:" + id, () => API$4.setContextWindow(id, parsed));
|
|
@@ -18544,7 +18581,7 @@ window.__ModuleLoader__.load({
|
|
|
18544
18581
|
}, [run, status]);
|
|
18545
18582
|
const resetAllContext = (0, react.useCallback)(() => {
|
|
18546
18583
|
if (status === null) return;
|
|
18547
|
-
if (typeof window !== "undefined" && !window.confirm(zh$
|
|
18584
|
+
if (typeof window !== "undefined" && !window.confirm(zh$5.contextResetAll)) return;
|
|
18548
18585
|
const overridden = status.models.filter((model) => model.contextWindowOverride !== void 0);
|
|
18549
18586
|
run("ctx-all", async () => {
|
|
18550
18587
|
let next = status;
|
|
@@ -18560,7 +18597,7 @@ window.__ModuleLoader__.load({
|
|
|
18560
18597
|
const refreshCatalog = (0, react.useCallback)(() => {
|
|
18561
18598
|
run("catalog", async () => {
|
|
18562
18599
|
const outcome = await API$4.refreshCatalog();
|
|
18563
|
-
setNotice(zh$
|
|
18600
|
+
setNotice(zh$5.catalogSyncedNote.replace("{count}", String(outcome.status.catalogCount)));
|
|
18564
18601
|
return outcome.status;
|
|
18565
18602
|
});
|
|
18566
18603
|
}, [run]);
|
|
@@ -18574,7 +18611,7 @@ window.__ModuleLoader__.load({
|
|
|
18574
18611
|
};
|
|
18575
18612
|
const invalid = Object.entries(numbers).find(([, value]) => !Number.isSafeInteger(value) || value < 0);
|
|
18576
18613
|
if (invalid !== void 0) {
|
|
18577
|
-
setError(zh$
|
|
18614
|
+
setError(zh$5.error.replace("{detail}", invalid[0]));
|
|
18578
18615
|
return;
|
|
18579
18616
|
}
|
|
18580
18617
|
setBusy("settings");
|
|
@@ -18585,10 +18622,10 @@ window.__ModuleLoader__.load({
|
|
|
18585
18622
|
}).then((next) => {
|
|
18586
18623
|
applyStatus(next);
|
|
18587
18624
|
setSettingsForm(settingsFormOf(next));
|
|
18588
|
-
setNotice(zh$
|
|
18625
|
+
setNotice(zh$5.saved);
|
|
18589
18626
|
}).catch((cause) => setError(detail(cause))).finally(() => setBusy(null));
|
|
18590
18627
|
}, [settingsForm, applyStatus]);
|
|
18591
|
-
const t = useLineDict(NS_OPENDESIGN, zh$
|
|
18628
|
+
const t = useLineDict(NS_OPENDESIGN, zh$5);
|
|
18592
18629
|
const errorPrefix = t.error.split("{detail}")[0] ?? "";
|
|
18593
18630
|
const pool = status?.pool;
|
|
18594
18631
|
const accounts = pool?.accounts ?? [];
|
|
@@ -19106,7 +19143,7 @@ window.__ModuleLoader__.load({
|
|
|
19106
19143
|
* control that renders it instead.
|
|
19107
19144
|
*/
|
|
19108
19145
|
const NS_WORKBUDDY = "dsh-workbuddy";
|
|
19109
|
-
const zh$
|
|
19146
|
+
const zh$4 = {
|
|
19110
19147
|
title: "WorkBuddy",
|
|
19111
19148
|
pageDesc: "复用本机 CodeBuddy 桌面端登录态,管理 WorkBuddy(CodeBuddy 订阅)模型、上下文窗口与额度。",
|
|
19112
19149
|
account: "账号",
|
|
@@ -19232,7 +19269,7 @@ window.__ModuleLoader__.load({
|
|
|
19232
19269
|
modelCooldownActive: "模型限流中",
|
|
19233
19270
|
notRoutable: "当前不可路由"
|
|
19234
19271
|
};
|
|
19235
|
-
const en$
|
|
19272
|
+
const en$4 = {
|
|
19236
19273
|
title: "WorkBuddy",
|
|
19237
19274
|
pageDesc: "Reuse the local CodeBuddy desktop sign-in to manage WorkBuddy (CodeBuddy subscription) models, context windows, and quota.",
|
|
19238
19275
|
account: "Account",
|
|
@@ -19358,11 +19395,11 @@ window.__ModuleLoader__.load({
|
|
|
19358
19395
|
modelCooldownActive: "Model parked",
|
|
19359
19396
|
notRoutable: "Not routable right now"
|
|
19360
19397
|
};
|
|
19361
|
-
const dictionaries$
|
|
19362
|
-
zh: zh$
|
|
19363
|
-
"zh-CN": zh$
|
|
19364
|
-
en: en$
|
|
19365
|
-
"en-US": en$
|
|
19398
|
+
const dictionaries$4 = {
|
|
19399
|
+
zh: zh$4,
|
|
19400
|
+
"zh-CN": zh$4,
|
|
19401
|
+
en: en$4,
|
|
19402
|
+
"en-US": en$4
|
|
19366
19403
|
};
|
|
19367
19404
|
//#endregion
|
|
19368
19405
|
//#region src/client/workbuddy/useWorkBuddySection.ts
|
|
@@ -19403,7 +19440,7 @@ window.__ModuleLoader__.load({
|
|
|
19403
19440
|
* is exactly what a stale host half produces) be reported as such instead of as
|
|
19404
19441
|
* a bare "Unexpected end of JSON input".
|
|
19405
19442
|
*/
|
|
19406
|
-
const api$
|
|
19443
|
+
const api$6 = createLineApi(API$3, "WorkBuddy");
|
|
19407
19444
|
/**
|
|
19408
19445
|
* Reasoning levels the default-effort control may offer.
|
|
19409
19446
|
*
|
|
@@ -19460,7 +19497,7 @@ window.__ModuleLoader__.load({
|
|
|
19460
19497
|
const quotaFollowUp = (0, react.useRef)(null);
|
|
19461
19498
|
const [contextDrafts, setContextDrafts] = (0, react.useState)({});
|
|
19462
19499
|
const [savingModel, setSavingModel] = (0, react.useState)(null);
|
|
19463
|
-
const t = useLineDict(NS_WORKBUDDY, zh$
|
|
19500
|
+
const t = useLineDict(NS_WORKBUDDY, zh$4);
|
|
19464
19501
|
const notifyChange = (0, react.useCallback)(() => {
|
|
19465
19502
|
onModelChange?.();
|
|
19466
19503
|
loadModelDirectory?.();
|
|
@@ -19472,7 +19509,7 @@ window.__ModuleLoader__.load({
|
|
|
19472
19509
|
const loadStatus = (0, react.useCallback)(async (quiet = false) => {
|
|
19473
19510
|
if (!quiet) setError(null);
|
|
19474
19511
|
try {
|
|
19475
|
-
const data = await api$
|
|
19512
|
+
const data = await api$6.request("/status");
|
|
19476
19513
|
const normalized = normalizeStatus(data);
|
|
19477
19514
|
setStatus(normalized);
|
|
19478
19515
|
setStatusFailed(false);
|
|
@@ -19507,7 +19544,7 @@ window.__ModuleLoader__.load({
|
|
|
19507
19544
|
try {
|
|
19508
19545
|
setBusy("rescan");
|
|
19509
19546
|
setError(null);
|
|
19510
|
-
const updated = await api$
|
|
19547
|
+
const updated = await api$6.request("/rescan", { method: "POST" });
|
|
19511
19548
|
setStatus(normalizeStatus(updated));
|
|
19512
19549
|
notifyChange();
|
|
19513
19550
|
} catch (err) {
|
|
@@ -19521,7 +19558,7 @@ window.__ModuleLoader__.load({
|
|
|
19521
19558
|
setBusy(`login:${region}`);
|
|
19522
19559
|
setError(null);
|
|
19523
19560
|
setLoginProgress(t.loginWaiting);
|
|
19524
|
-
const flow = await api$
|
|
19561
|
+
const flow = await api$6.request("/accounts/login", {
|
|
19525
19562
|
method: "POST",
|
|
19526
19563
|
body: JSON.stringify({ region })
|
|
19527
19564
|
});
|
|
@@ -19531,7 +19568,7 @@ window.__ModuleLoader__.load({
|
|
|
19531
19568
|
const timer = window.setInterval(() => {
|
|
19532
19569
|
(async () => {
|
|
19533
19570
|
try {
|
|
19534
|
-
const poll = await api$
|
|
19571
|
+
const poll = await api$6.request("/accounts/login/status");
|
|
19535
19572
|
if (poll.progress) setLoginProgress(poll.progress);
|
|
19536
19573
|
if (poll.status === "complete") {
|
|
19537
19574
|
window.clearInterval(timer);
|
|
@@ -19540,7 +19577,7 @@ window.__ModuleLoader__.load({
|
|
|
19540
19577
|
loginTimeoutRef.current = null;
|
|
19541
19578
|
setBusy(null);
|
|
19542
19579
|
setLoginProgress(null);
|
|
19543
|
-
if (poll.accountId) await api$
|
|
19580
|
+
if (poll.accountId) await api$6.request("/settings", {
|
|
19544
19581
|
method: "POST",
|
|
19545
19582
|
body: JSON.stringify({ selectedAccountId: poll.accountId })
|
|
19546
19583
|
});
|
|
@@ -19580,7 +19617,7 @@ window.__ModuleLoader__.load({
|
|
|
19580
19617
|
try {
|
|
19581
19618
|
setBusy(`${action}:${accountId}`);
|
|
19582
19619
|
setError(null);
|
|
19583
|
-
const updated = await api$
|
|
19620
|
+
const updated = await api$6.request("/accounts/action", {
|
|
19584
19621
|
method: "POST",
|
|
19585
19622
|
body: JSON.stringify({
|
|
19586
19623
|
action,
|
|
@@ -19603,7 +19640,7 @@ window.__ModuleLoader__.load({
|
|
|
19603
19640
|
try {
|
|
19604
19641
|
setBusy("strategy");
|
|
19605
19642
|
setError(null);
|
|
19606
|
-
const updated = await api$
|
|
19643
|
+
const updated = await api$6.request("/accounts/strategy", {
|
|
19607
19644
|
method: "POST",
|
|
19608
19645
|
body: JSON.stringify({ strategy })
|
|
19609
19646
|
});
|
|
@@ -19618,7 +19655,7 @@ window.__ModuleLoader__.load({
|
|
|
19618
19655
|
try {
|
|
19619
19656
|
setBusy("connection");
|
|
19620
19657
|
setError(null);
|
|
19621
|
-
setConnection(await api$
|
|
19658
|
+
setConnection(await api$6.request("/connection/test", { method: "POST" }));
|
|
19622
19659
|
} catch (err) {
|
|
19623
19660
|
setError(err instanceof Error ? err.message : String(err));
|
|
19624
19661
|
} finally {
|
|
@@ -19629,7 +19666,7 @@ window.__ModuleLoader__.load({
|
|
|
19629
19666
|
try {
|
|
19630
19667
|
setBusy("quota");
|
|
19631
19668
|
setError(null);
|
|
19632
|
-
const updated = await api$
|
|
19669
|
+
const updated = await api$6.request("/quota", { method: "POST" });
|
|
19633
19670
|
setStatus(updated);
|
|
19634
19671
|
} catch (err) {
|
|
19635
19672
|
setError(err instanceof Error ? err.message : String(err));
|
|
@@ -19641,7 +19678,7 @@ window.__ModuleLoader__.load({
|
|
|
19641
19678
|
try {
|
|
19642
19679
|
setBusy("checkin");
|
|
19643
19680
|
setError(null);
|
|
19644
|
-
const updated = await api$
|
|
19681
|
+
const updated = await api$6.request("/checkin/now", { method: "POST" });
|
|
19645
19682
|
setStatus(normalizeStatus(updated));
|
|
19646
19683
|
} catch (err) {
|
|
19647
19684
|
setError(err instanceof Error ? err.message : String(err));
|
|
@@ -19653,7 +19690,7 @@ window.__ModuleLoader__.load({
|
|
|
19653
19690
|
try {
|
|
19654
19691
|
setBusy("checkin");
|
|
19655
19692
|
setError(null);
|
|
19656
|
-
const updated = await api$
|
|
19693
|
+
const updated = await api$6.request("/settings", {
|
|
19657
19694
|
method: "POST",
|
|
19658
19695
|
body: JSON.stringify({ checkin })
|
|
19659
19696
|
});
|
|
@@ -19669,7 +19706,7 @@ window.__ModuleLoader__.load({
|
|
|
19669
19706
|
try {
|
|
19670
19707
|
setBusy("outbound");
|
|
19671
19708
|
setError(null);
|
|
19672
|
-
const updated = await api$
|
|
19709
|
+
const updated = await api$6.request("/settings", {
|
|
19673
19710
|
method: "POST",
|
|
19674
19711
|
body: JSON.stringify({ outboundIdentity })
|
|
19675
19712
|
});
|
|
@@ -19685,7 +19722,7 @@ window.__ModuleLoader__.load({
|
|
|
19685
19722
|
try {
|
|
19686
19723
|
setBusy("guardrails");
|
|
19687
19724
|
setError(null);
|
|
19688
|
-
const updated = await api$
|
|
19725
|
+
const updated = await api$6.request("/settings", {
|
|
19689
19726
|
method: "POST",
|
|
19690
19727
|
body: JSON.stringify({ guardrails })
|
|
19691
19728
|
});
|
|
@@ -19701,7 +19738,7 @@ window.__ModuleLoader__.load({
|
|
|
19701
19738
|
try {
|
|
19702
19739
|
setBusy("atrest");
|
|
19703
19740
|
setError(null);
|
|
19704
|
-
const updated = await api$
|
|
19741
|
+
const updated = await api$6.request("/at-rest-key", {
|
|
19705
19742
|
method: "POST",
|
|
19706
19743
|
body: JSON.stringify({ key })
|
|
19707
19744
|
});
|
|
@@ -19717,7 +19754,7 @@ window.__ModuleLoader__.load({
|
|
|
19717
19754
|
try {
|
|
19718
19755
|
setBusy("atrest");
|
|
19719
19756
|
setError(null);
|
|
19720
|
-
const updated = await api$
|
|
19757
|
+
const updated = await api$6.request("/at-rest-key", { method: "DELETE" });
|
|
19721
19758
|
setStatus(normalizeStatus(updated));
|
|
19722
19759
|
} catch (err) {
|
|
19723
19760
|
setError(err instanceof Error ? err.message : String(err));
|
|
@@ -19732,7 +19769,7 @@ window.__ModuleLoader__.load({
|
|
|
19732
19769
|
try {
|
|
19733
19770
|
setBusy(`model:${modelId}`);
|
|
19734
19771
|
setError(null);
|
|
19735
|
-
const normalized = normalizeStatus(await api$
|
|
19772
|
+
const normalized = normalizeStatus(await api$6.request("/settings", {
|
|
19736
19773
|
method: "POST",
|
|
19737
19774
|
body: JSON.stringify({ enabledModelIds: next })
|
|
19738
19775
|
}));
|
|
@@ -19750,7 +19787,7 @@ window.__ModuleLoader__.load({
|
|
|
19750
19787
|
try {
|
|
19751
19788
|
setBusy("models-all");
|
|
19752
19789
|
setError(null);
|
|
19753
|
-
const normalized = normalizeStatus(await api$
|
|
19790
|
+
const normalized = normalizeStatus(await api$6.request("/settings", {
|
|
19754
19791
|
method: "POST",
|
|
19755
19792
|
body: JSON.stringify({ enabledModelIds: enabled ? status.models.map((model) => model.id) : [] })
|
|
19756
19793
|
}));
|
|
@@ -19767,7 +19804,7 @@ window.__ModuleLoader__.load({
|
|
|
19767
19804
|
try {
|
|
19768
19805
|
setBusy("effort");
|
|
19769
19806
|
setError(null);
|
|
19770
|
-
const updated = await api$
|
|
19807
|
+
const updated = await api$6.request("/settings", {
|
|
19771
19808
|
method: "POST",
|
|
19772
19809
|
body: JSON.stringify({ defaultReasoningEffort: effort })
|
|
19773
19810
|
});
|
|
@@ -19783,7 +19820,7 @@ window.__ModuleLoader__.load({
|
|
|
19783
19820
|
try {
|
|
19784
19821
|
setBusy("catalog");
|
|
19785
19822
|
setError(null);
|
|
19786
|
-
const normalized = normalizeStatus(await api$
|
|
19823
|
+
const normalized = normalizeStatus(await api$6.request("/catalog/refresh", { method: "POST" }));
|
|
19787
19824
|
setStatus(normalized);
|
|
19788
19825
|
setContextDrafts(contextDraftsFor(normalized));
|
|
19789
19826
|
notifyChange();
|
|
@@ -19803,7 +19840,7 @@ window.__ModuleLoader__.load({
|
|
|
19803
19840
|
try {
|
|
19804
19841
|
setSavingModel(modelId);
|
|
19805
19842
|
setError(null);
|
|
19806
|
-
const updated = await api$
|
|
19843
|
+
const updated = await api$6.request("/settings", {
|
|
19807
19844
|
method: "POST",
|
|
19808
19845
|
body: JSON.stringify({ contextWindowOverrides: { [modelId]: parsed } })
|
|
19809
19846
|
});
|
|
@@ -19824,7 +19861,7 @@ window.__ModuleLoader__.load({
|
|
|
19824
19861
|
try {
|
|
19825
19862
|
setSavingModel(modelId);
|
|
19826
19863
|
setError(null);
|
|
19827
|
-
const updated = normalizeStatus(await api$
|
|
19864
|
+
const updated = normalizeStatus(await api$6.request("/settings", {
|
|
19828
19865
|
method: "POST",
|
|
19829
19866
|
body: JSON.stringify({ contextWindowOverrides: { [modelId]: null } })
|
|
19830
19867
|
}));
|
|
@@ -19851,7 +19888,7 @@ window.__ModuleLoader__.load({
|
|
|
19851
19888
|
try {
|
|
19852
19889
|
setBusy("context");
|
|
19853
19890
|
setError(null);
|
|
19854
|
-
const updated = normalizeStatus(await api$
|
|
19891
|
+
const updated = normalizeStatus(await api$6.request("/settings", {
|
|
19855
19892
|
method: "POST",
|
|
19856
19893
|
body: JSON.stringify({ contextWindowOverrides: Object.fromEntries(models.map((model) => [model, null])) })
|
|
19857
19894
|
}));
|
|
@@ -20094,7 +20131,7 @@ window.__ModuleLoader__.load({
|
|
|
20094
20131
|
const timer = window.setInterval(() => setNow(Date.now()), 1e3);
|
|
20095
20132
|
return () => window.clearInterval(timer);
|
|
20096
20133
|
}, [pausedUntil]);
|
|
20097
|
-
const t = useLineDict(NS_WORKBUDDY, zh$
|
|
20134
|
+
const t = useLineDict(NS_WORKBUDDY, zh$4);
|
|
20098
20135
|
const poolState = poolStateLines(pool, t, now);
|
|
20099
20136
|
const storageLine = poolStorageLine(pool?.storage, t);
|
|
20100
20137
|
const storageUnavailable = pool?.storage === void 0 ? null : poolStorageUnavailableLabel(pool.storage, t);
|
|
@@ -20690,6 +20727,722 @@ window.__ModuleLoader__.load({
|
|
|
20690
20727
|
});
|
|
20691
20728
|
}
|
|
20692
20729
|
//#endregion
|
|
20730
|
+
//#region src/shared/qianwen-token-plan-contracts.ts
|
|
20731
|
+
/**
|
|
20732
|
+
* Public host/client contract for the Qwen Token Plan line.
|
|
20733
|
+
*
|
|
20734
|
+
* No API key, encrypted thinking payload, or request body crosses this boundary.
|
|
20735
|
+
* Upstream facts are sourced from the official Qianwen documentation recorded in
|
|
20736
|
+
* docs/qianwen-token-plan-line-plan.md.
|
|
20737
|
+
*/
|
|
20738
|
+
const QIANWEN_TOKEN_PLAN_PROVIDER_ID = "qianwen-token-plan";
|
|
20739
|
+
const QIANWEN_TOKEN_PLAN_PROVIDER_NAME = "Qwen Token Plan(千问)";
|
|
20740
|
+
const QIANWEN_TOKEN_PLAN_ROUTE_PREFIX = "/qianwen-token-plan/api";
|
|
20741
|
+
const QIANWEN_REASONING_EFFORTS = [
|
|
20742
|
+
"none",
|
|
20743
|
+
"minimal",
|
|
20744
|
+
"low",
|
|
20745
|
+
"medium",
|
|
20746
|
+
"high",
|
|
20747
|
+
"xhigh",
|
|
20748
|
+
"max"
|
|
20749
|
+
];
|
|
20750
|
+
function isQianwenReasoningEffort(value) {
|
|
20751
|
+
return typeof value === "string" && QIANWEN_REASONING_EFFORTS.includes(value);
|
|
20752
|
+
}
|
|
20753
|
+
const QIANWEN_CACHE_TTLS = ["5m", "1h"];
|
|
20754
|
+
function isQianwenCacheTtl(value) {
|
|
20755
|
+
return value === "5m" || value === "1h";
|
|
20756
|
+
}
|
|
20757
|
+
const QIANWEN_IMAGE_DETAILS = [
|
|
20758
|
+
"low",
|
|
20759
|
+
"auto",
|
|
20760
|
+
"high"
|
|
20761
|
+
];
|
|
20762
|
+
function isQianwenImageDetail(value) {
|
|
20763
|
+
return value === "low" || value === "auto" || value === "high";
|
|
20764
|
+
}
|
|
20765
|
+
//#endregion
|
|
20766
|
+
//#region src/client/qianwen-token-plan/locales.ts
|
|
20767
|
+
const NS_QIANWEN = "dsh-qianwen-token-plan";
|
|
20768
|
+
const zh$3 = {
|
|
20769
|
+
title: "Qwen Token Plan(千问)",
|
|
20770
|
+
pageDesc: "使用千问 Token Plan 专属 API Key 调用 Qwen4,管理显式缓存、思考回放、推理档位、模型和视觉预算。",
|
|
20771
|
+
loading: "加载中...",
|
|
20772
|
+
moreNotes: "更多说明",
|
|
20773
|
+
enabled: "启用此线路",
|
|
20774
|
+
keySection: "API Key",
|
|
20775
|
+
keyConfigured: "已配置套餐专属 API Key;凭据只保存在主机加密存储中。",
|
|
20776
|
+
keyMissing: "尚未配置 API Key。请在千问 Token Plan 控制台创建套餐专属 Key。",
|
|
20777
|
+
keyPlaceholder: "粘贴 Token Plan API Key(sk-sp-…)",
|
|
20778
|
+
saveKey: "保存 Key",
|
|
20779
|
+
savingKey: "保存中...",
|
|
20780
|
+
removeKey: "删除 Key",
|
|
20781
|
+
removingKey: "删除中...",
|
|
20782
|
+
storagePath: "加密存储",
|
|
20783
|
+
testConnection: "测试连接",
|
|
20784
|
+
testingConnection: "测试中...",
|
|
20785
|
+
connectionOk: "连接正常",
|
|
20786
|
+
connectionFailed: "连接失败",
|
|
20787
|
+
latency: "往返 {ms} 毫秒",
|
|
20788
|
+
routeOwned: "本插件正在服务该模型路由。",
|
|
20789
|
+
routeConflict: "模型路由被其他 Provider 占用:{detail}",
|
|
20790
|
+
cacheSection: "显式缓存",
|
|
20791
|
+
cacheDesc: "Qwen4 自动断点与稳定前缀断点共同复用输入;用量统计见 DSH 自带的使用统计与千问用量控制台。",
|
|
20792
|
+
cacheEnabled: "启用显式缓存",
|
|
20793
|
+
cacheTtl: "缓存 TTL",
|
|
20794
|
+
ttl5m: "5 分钟(5m)",
|
|
20795
|
+
ttl1h: "1 小时(1h)",
|
|
20796
|
+
cacheHitRatio: "缓存命中率",
|
|
20797
|
+
cacheHint: "缓存可能已过期:距最近请求约 {minutes} 分钟。",
|
|
20798
|
+
thinkingSection: "思考",
|
|
20799
|
+
defaultEffort: "默认推理档位",
|
|
20800
|
+
effortDefault: "跟随上游默认(high)",
|
|
20801
|
+
effortNone: "关闭(none)",
|
|
20802
|
+
effortMinimal: "最低(minimal)",
|
|
20803
|
+
effortLow: "低(low)",
|
|
20804
|
+
effortMedium: "中(medium)",
|
|
20805
|
+
effortHigh: "高(high)",
|
|
20806
|
+
effortXhigh: "很高(xhigh)",
|
|
20807
|
+
effortMax: "最高(max)",
|
|
20808
|
+
effortHint: "所选档位原样发给上游;本线路不自动降档,也不同时发送 thinking_budget。会话中的档位选择优先于此默认值。",
|
|
20809
|
+
thinkingSummary: "启用 CoT 摘要与密文回放",
|
|
20810
|
+
thinkingSummaryHint: "Qwen4-Max 显示思考摘要,原样保存并回放 encrypted_content;密文不会进入可见正文或日志。",
|
|
20811
|
+
modelsSection: "模型",
|
|
20812
|
+
modelsHint: "勾选后模型才会出现在对话模型选择器中;preview 是上游限时模型,正式使用建议选择 qwen4-max。",
|
|
20813
|
+
selectAll: "全选",
|
|
20814
|
+
clearAll: "全不选",
|
|
20815
|
+
selectionHint: "清空全部勾选表示明确禁用本线路的所有模型,与首次安装的默认选择不同。",
|
|
20816
|
+
contextSection: "模型上下文窗口",
|
|
20817
|
+
contextHint: "覆盖值用于 DSH 压缩与溢出规划;默认 1M,可输入 256K、512K、1M 等容量。",
|
|
20818
|
+
contextEmpty: "尚未勾选模型。",
|
|
20819
|
+
tokens: "tokens",
|
|
20820
|
+
save: "保存",
|
|
20821
|
+
saving: "保存中...",
|
|
20822
|
+
reset: "恢复默认",
|
|
20823
|
+
resetAll: "全部恢复默认",
|
|
20824
|
+
invalidCapacity: "容量格式无效:{value}",
|
|
20825
|
+
visionSection: "视觉预算",
|
|
20826
|
+
imageDetail: "图片 detail",
|
|
20827
|
+
detailLow: "low(低成本)",
|
|
20828
|
+
detailAuto: "auto(默认上限)",
|
|
20829
|
+
detailHigh: "high(保留细节)",
|
|
20830
|
+
maxPixels: "max_pixels(可选)",
|
|
20831
|
+
maxPixelsPlaceholder: "留空使用线路默认",
|
|
20832
|
+
maxPixelsSave: "保存视觉预算",
|
|
20833
|
+
maxPixelsReset: "恢复默认",
|
|
20834
|
+
invalidPixels: "max_pixels 必须是 65536 至 16777216 的整数。",
|
|
20835
|
+
visionHint: "普通截图建议使用 auto/low;OCR 或细小文字可切换 high。显式 max_pixels 优先。",
|
|
20836
|
+
dashboard: "打开千问用量控制台",
|
|
20837
|
+
composerLabel: "Qwen 缓存",
|
|
20838
|
+
noQuota: "无配额数据",
|
|
20839
|
+
proxy: "代理"
|
|
20840
|
+
};
|
|
20841
|
+
const dictionaries$3 = {
|
|
20842
|
+
zh: zh$3,
|
|
20843
|
+
en: {
|
|
20844
|
+
title: "Qwen Token Plan",
|
|
20845
|
+
pageDesc: "Use a dedicated Qianwen Token Plan API key with Qwen4, explicit caching, thinking replay, all reasoning levels, models and visual budgets.",
|
|
20846
|
+
loading: "Loading...",
|
|
20847
|
+
moreNotes: "More details",
|
|
20848
|
+
enabled: "Enable this line",
|
|
20849
|
+
keySection: "API key",
|
|
20850
|
+
keyConfigured: "A dedicated plan key is configured and stored only in host encrypted storage.",
|
|
20851
|
+
keyMissing: "No API key yet. Create a dedicated key in the Qianwen Token Plan console.",
|
|
20852
|
+
keyPlaceholder: "Paste Token Plan API key (sk-sp-…)",
|
|
20853
|
+
saveKey: "Save key",
|
|
20854
|
+
savingKey: "Saving...",
|
|
20855
|
+
removeKey: "Remove key",
|
|
20856
|
+
removingKey: "Removing...",
|
|
20857
|
+
storagePath: "Encrypted storage",
|
|
20858
|
+
testConnection: "Test connection",
|
|
20859
|
+
testingConnection: "Testing...",
|
|
20860
|
+
connectionOk: "Connection OK",
|
|
20861
|
+
connectionFailed: "Connection failed",
|
|
20862
|
+
latency: "{ms} ms round trip",
|
|
20863
|
+
routeOwned: "This plugin serves the model route.",
|
|
20864
|
+
routeConflict: "Another provider owns the model route: {detail}",
|
|
20865
|
+
cacheSection: "Explicit cache",
|
|
20866
|
+
cacheDesc: "Qwen4 automatic and stable-prefix breakpoints reuse input; usage figures live in DSH built-in usage stats and the Qianwen usage console.",
|
|
20867
|
+
cacheEnabled: "Enable explicit cache",
|
|
20868
|
+
cacheTtl: "Cache TTL",
|
|
20869
|
+
ttl5m: "5 minutes (5m)",
|
|
20870
|
+
ttl1h: "1 hour (1h)",
|
|
20871
|
+
cacheHitRatio: "Cache hit ratio",
|
|
20872
|
+
cacheHint: "The cache may be cold: about {minutes} minutes since the latest request.",
|
|
20873
|
+
thinkingSection: "Thinking",
|
|
20874
|
+
defaultEffort: "Default reasoning effort",
|
|
20875
|
+
effortDefault: "Upstream default (high)",
|
|
20876
|
+
effortNone: "Off (none)",
|
|
20877
|
+
effortMinimal: "Minimal",
|
|
20878
|
+
effortLow: "Low",
|
|
20879
|
+
effortMedium: "Medium",
|
|
20880
|
+
effortHigh: "High",
|
|
20881
|
+
effortXhigh: "Very high (xhigh)",
|
|
20882
|
+
effortMax: "Max",
|
|
20883
|
+
effortHint: "The selected value is sent verbatim. This line never lowers it automatically and never sends thinking_budget alongside it. A per-conversation selection wins.",
|
|
20884
|
+
thinkingSummary: "Enable CoT summary and encrypted replay",
|
|
20885
|
+
thinkingSummaryHint: "Qwen4-Max displays a summary and preserves encrypted_content verbatim for replay; ciphertext never enters visible content or logs.",
|
|
20886
|
+
modelsSection: "Models",
|
|
20887
|
+
modelsHint: "Only checked models appear in the picker. Preview is time-limited upstream; prefer qwen4-max for stable use.",
|
|
20888
|
+
selectAll: "Select all",
|
|
20889
|
+
clearAll: "Clear all",
|
|
20890
|
+
selectionHint: "An explicitly empty selection disables every model on this line; it differs from the first-run default.",
|
|
20891
|
+
contextSection: "Model context windows",
|
|
20892
|
+
contextHint: "Overrides guide DSH compaction and overflow planning. The default is 1M; values such as 256K, 512K and 1M are accepted.",
|
|
20893
|
+
contextEmpty: "No models are checked.",
|
|
20894
|
+
tokens: "tokens",
|
|
20895
|
+
save: "Save",
|
|
20896
|
+
saving: "Saving...",
|
|
20897
|
+
reset: "Restore default",
|
|
20898
|
+
resetAll: "Restore all defaults",
|
|
20899
|
+
invalidCapacity: "Invalid capacity: {value}",
|
|
20900
|
+
visionSection: "Visual budget",
|
|
20901
|
+
imageDetail: "Image detail",
|
|
20902
|
+
detailLow: "low (lower cost)",
|
|
20903
|
+
detailAuto: "auto (default cap)",
|
|
20904
|
+
detailHigh: "high (more detail)",
|
|
20905
|
+
maxPixels: "max_pixels (optional)",
|
|
20906
|
+
maxPixelsPlaceholder: "Blank uses the line default",
|
|
20907
|
+
maxPixelsSave: "Save visual budget",
|
|
20908
|
+
maxPixelsReset: "Restore default",
|
|
20909
|
+
invalidPixels: "max_pixels must be an integer from 65536 through 16777216.",
|
|
20910
|
+
visionHint: "Use auto/low for ordinary screenshots and high for OCR or small text. Explicit max_pixels wins.",
|
|
20911
|
+
dashboard: "Open Qianwen usage console",
|
|
20912
|
+
composerLabel: "Qwen cache",
|
|
20913
|
+
noQuota: "No quota data",
|
|
20914
|
+
proxy: "Proxy"
|
|
20915
|
+
}
|
|
20916
|
+
};
|
|
20917
|
+
//#endregion
|
|
20918
|
+
//#region src/client/qianwen-token-plan/api.ts
|
|
20919
|
+
const api$5 = createLineApi(QIANWEN_TOKEN_PLAN_ROUTE_PREFIX, QIANWEN_TOKEN_PLAN_PROVIDER_NAME);
|
|
20920
|
+
const get = api$5.get;
|
|
20921
|
+
const post = api$5.post;
|
|
20922
|
+
const request = api$5.request;
|
|
20923
|
+
const messageOf = (cause) => cause instanceof Error ? cause.message : String(cause);
|
|
20924
|
+
//#endregion
|
|
20925
|
+
//#region src/client/qianwen-token-plan/useQianwenSection.ts
|
|
20926
|
+
function qianwenCacheHitRatio(stats) {
|
|
20927
|
+
if (stats === null) return null;
|
|
20928
|
+
const denominator = stats.cacheReadTokens + stats.missedInputTokens + stats.cacheWriteTokens;
|
|
20929
|
+
return Number.isFinite(denominator) && denominator > 0 ? stats.cacheReadTokens / denominator : null;
|
|
20930
|
+
}
|
|
20931
|
+
function useQianwenSection({ onModelChange } = {}) {
|
|
20932
|
+
const [status, setStatus] = (0, react.useState)(null);
|
|
20933
|
+
const [loading, setLoading] = (0, react.useState)(true);
|
|
20934
|
+
const [busy, setBusy] = (0, react.useState)(null);
|
|
20935
|
+
const [error, setError] = (0, react.useState)(null);
|
|
20936
|
+
const [connection, setConnection] = (0, react.useState)(null);
|
|
20937
|
+
const [keyValue, setKeyValue] = (0, react.useState)("");
|
|
20938
|
+
const [contextDrafts, setContextDrafts] = (0, react.useState)({});
|
|
20939
|
+
const [savingModel, setSavingModel] = (0, react.useState)(null);
|
|
20940
|
+
const [pixelsDraft, setPixelsDraft] = (0, react.useState)("");
|
|
20941
|
+
const adopt = (0, react.useCallback)((next) => {
|
|
20942
|
+
setStatus(next);
|
|
20943
|
+
setContextDrafts(contextDraftsFor(next));
|
|
20944
|
+
setPixelsDraft(next.maxPixels === null ? "" : String(next.maxPixels));
|
|
20945
|
+
}, []);
|
|
20946
|
+
const loadStatus = (0, react.useCallback)(async (quiet = false) => {
|
|
20947
|
+
if (!quiet) setError(null);
|
|
20948
|
+
try {
|
|
20949
|
+
adopt(await get("/status"));
|
|
20950
|
+
} catch (cause) {
|
|
20951
|
+
if (!quiet) setError(messageOf(cause));
|
|
20952
|
+
} finally {
|
|
20953
|
+
setLoading(false);
|
|
20954
|
+
}
|
|
20955
|
+
}, [adopt]);
|
|
20956
|
+
(0, react.useEffect)(() => {
|
|
20957
|
+
loadStatus();
|
|
20958
|
+
const visible = () => {
|
|
20959
|
+
if (document.visibilityState === "visible") loadStatus(true);
|
|
20960
|
+
};
|
|
20961
|
+
const timer = window.setInterval(visible, 6e4);
|
|
20962
|
+
document.addEventListener("visibilitychange", visible);
|
|
20963
|
+
return () => {
|
|
20964
|
+
window.clearInterval(timer);
|
|
20965
|
+
document.removeEventListener("visibilitychange", visible);
|
|
20966
|
+
};
|
|
20967
|
+
}, [loadStatus]);
|
|
20968
|
+
const update = (0, react.useCallback)(async (patch, label = "settings") => {
|
|
20969
|
+
setBusy(label);
|
|
20970
|
+
setError(null);
|
|
20971
|
+
try {
|
|
20972
|
+
const next = await post("/settings", patch);
|
|
20973
|
+
adopt(next);
|
|
20974
|
+
if (patch.enabled !== void 0 || patch.enabledModelIds !== void 0 || patch.defaultReasoningEffort !== void 0) onModelChange?.();
|
|
20975
|
+
return next;
|
|
20976
|
+
} catch (cause) {
|
|
20977
|
+
setError(messageOf(cause));
|
|
20978
|
+
throw cause;
|
|
20979
|
+
} finally {
|
|
20980
|
+
setBusy(null);
|
|
20981
|
+
}
|
|
20982
|
+
}, [adopt, onModelChange]);
|
|
20983
|
+
return {
|
|
20984
|
+
status,
|
|
20985
|
+
loading,
|
|
20986
|
+
busy,
|
|
20987
|
+
error,
|
|
20988
|
+
connection,
|
|
20989
|
+
keyValue,
|
|
20990
|
+
contextDrafts,
|
|
20991
|
+
savingModel,
|
|
20992
|
+
pixelsDraft,
|
|
20993
|
+
setKeyValue,
|
|
20994
|
+
setPixelsDraft,
|
|
20995
|
+
setContextDraft: (id, draft) => setContextDrafts((current) => ({
|
|
20996
|
+
...current,
|
|
20997
|
+
[id]: draft
|
|
20998
|
+
})),
|
|
20999
|
+
saveKey: (0, react.useCallback)(async () => {
|
|
21000
|
+
const apiKey = keyValue.trim();
|
|
21001
|
+
if (apiKey === "") return;
|
|
21002
|
+
setBusy("key");
|
|
21003
|
+
setError(null);
|
|
21004
|
+
try {
|
|
21005
|
+
adopt(await request("/credentials", {
|
|
21006
|
+
method: "PUT",
|
|
21007
|
+
body: JSON.stringify({ apiKey })
|
|
21008
|
+
}));
|
|
21009
|
+
setKeyValue("");
|
|
21010
|
+
setConnection(null);
|
|
21011
|
+
onModelChange?.();
|
|
21012
|
+
} catch (cause) {
|
|
21013
|
+
setError(messageOf(cause));
|
|
21014
|
+
} finally {
|
|
21015
|
+
setBusy(null);
|
|
21016
|
+
}
|
|
21017
|
+
}, [
|
|
21018
|
+
adopt,
|
|
21019
|
+
keyValue,
|
|
21020
|
+
onModelChange
|
|
21021
|
+
]),
|
|
21022
|
+
removeKey: (0, react.useCallback)(async () => {
|
|
21023
|
+
setBusy("remove-key");
|
|
21024
|
+
setError(null);
|
|
21025
|
+
try {
|
|
21026
|
+
adopt(await request("/credentials", { method: "DELETE" }));
|
|
21027
|
+
setConnection(null);
|
|
21028
|
+
onModelChange?.();
|
|
21029
|
+
} catch (cause) {
|
|
21030
|
+
setError(messageOf(cause));
|
|
21031
|
+
} finally {
|
|
21032
|
+
setBusy(null);
|
|
21033
|
+
}
|
|
21034
|
+
}, [adopt, onModelChange]),
|
|
21035
|
+
testConnection: (0, react.useCallback)(async () => {
|
|
21036
|
+
setBusy("connection");
|
|
21037
|
+
setError(null);
|
|
21038
|
+
try {
|
|
21039
|
+
setConnection(await post("/connection", {}));
|
|
21040
|
+
} catch (cause) {
|
|
21041
|
+
setError(messageOf(cause));
|
|
21042
|
+
} finally {
|
|
21043
|
+
setBusy(null);
|
|
21044
|
+
}
|
|
21045
|
+
}, []),
|
|
21046
|
+
update,
|
|
21047
|
+
toggleModel: (0, react.useCallback)((id, enabled) => {
|
|
21048
|
+
if (status === null) return;
|
|
21049
|
+
const ids = status.models.filter((model) => model.id === id ? enabled : model.enabled).map((model) => model.id);
|
|
21050
|
+
update({ enabledModelIds: ids }, "models").catch(() => void 0);
|
|
21051
|
+
}, [status, update]),
|
|
21052
|
+
setAllModels: (0, react.useCallback)((enabled) => {
|
|
21053
|
+
if (status === null) return;
|
|
21054
|
+
update({ enabledModelIds: enabled ? status.models.map((model) => model.id) : [] }, "models").catch(() => void 0);
|
|
21055
|
+
}, [status, update]),
|
|
21056
|
+
saveContextWindow: (0, react.useCallback)(async (id) => {
|
|
21057
|
+
const raw = contextDrafts[id] ?? "";
|
|
21058
|
+
const parsed = parsePositiveCapacity$1(raw);
|
|
21059
|
+
if (parsed === null) {
|
|
21060
|
+
setError("Invalid capacity: " + raw);
|
|
21061
|
+
return;
|
|
21062
|
+
}
|
|
21063
|
+
setSavingModel(id);
|
|
21064
|
+
try {
|
|
21065
|
+
await update({ contextWindowOverrides: { [id]: parsed } }, "context:" + id);
|
|
21066
|
+
} catch {} finally {
|
|
21067
|
+
setSavingModel(null);
|
|
21068
|
+
}
|
|
21069
|
+
}, [contextDrafts, update]),
|
|
21070
|
+
resetContextWindow: (0, react.useCallback)(async (id) => {
|
|
21071
|
+
setSavingModel(id);
|
|
21072
|
+
try {
|
|
21073
|
+
await update({ contextWindowOverrides: { [id]: null } }, "context:" + id);
|
|
21074
|
+
} catch {} finally {
|
|
21075
|
+
setSavingModel(null);
|
|
21076
|
+
}
|
|
21077
|
+
}, [update]),
|
|
21078
|
+
resetAllContextWindows: (0, react.useCallback)(async () => {
|
|
21079
|
+
const overrides = Object.fromEntries(Object.keys(status?.contextWindowOverrides ?? {}).map((id) => [id, null]));
|
|
21080
|
+
if (Object.keys(overrides).length > 0) await update({ contextWindowOverrides: overrides }, "context");
|
|
21081
|
+
}, [status, update]),
|
|
21082
|
+
savePixels: (0, react.useCallback)(async () => {
|
|
21083
|
+
const raw = pixelsDraft.trim();
|
|
21084
|
+
const value = raw === "" ? null : Number(raw);
|
|
21085
|
+
if (value !== null && (!Number.isSafeInteger(value) || value < 65536 || value > 16777216)) {
|
|
21086
|
+
setError("max_pixels must be an integer from 65536 through 16777216.");
|
|
21087
|
+
return;
|
|
21088
|
+
}
|
|
21089
|
+
try {
|
|
21090
|
+
await update({ maxPixels: value }, "pixels");
|
|
21091
|
+
} catch {}
|
|
21092
|
+
}, [pixelsDraft, update]),
|
|
21093
|
+
setDefaultEffort: (defaultReasoningEffort) => update({ defaultReasoningEffort }, "effort"),
|
|
21094
|
+
setImageDetail: (imageDetail) => update({ imageDetail }, "vision")
|
|
21095
|
+
};
|
|
21096
|
+
}
|
|
21097
|
+
//#endregion
|
|
21098
|
+
//#region src/client/qianwen-token-plan/QianwenTokenPlanSection.tsx
|
|
21099
|
+
const EFFORT_KEYS = {
|
|
21100
|
+
none: "effortNone",
|
|
21101
|
+
minimal: "effortMinimal",
|
|
21102
|
+
low: "effortLow",
|
|
21103
|
+
medium: "effortMedium",
|
|
21104
|
+
high: "effortHigh",
|
|
21105
|
+
xhigh: "effortXhigh",
|
|
21106
|
+
max: "effortMax"
|
|
21107
|
+
};
|
|
21108
|
+
function more(title, lines) {
|
|
21109
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", {
|
|
21110
|
+
className: "dshqw-details",
|
|
21111
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("summary", { children: title }), lines.map((line) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: line }, line))]
|
|
21112
|
+
});
|
|
21113
|
+
}
|
|
21114
|
+
function QianwenTokenPlanSection(props = {}) {
|
|
21115
|
+
const t = useLineDict(NS_QIANWEN, zh$3);
|
|
21116
|
+
const view = useQianwenSection(props);
|
|
21117
|
+
const { status, busy } = view;
|
|
21118
|
+
if (view.loading && status === null) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
21119
|
+
className: "dsha-empty",
|
|
21120
|
+
children: t.loading
|
|
21121
|
+
});
|
|
21122
|
+
const models = status?.models ?? [];
|
|
21123
|
+
const enabledModels = models.filter((model) => model.enabled);
|
|
21124
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
21125
|
+
className: "dsha-page dshqw-page",
|
|
21126
|
+
"data-provider": "qianwen-token-plan",
|
|
21127
|
+
children: [
|
|
21128
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
21129
|
+
className: "dsha-group dshqw-account",
|
|
21130
|
+
children: [
|
|
21131
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
21132
|
+
className: "dsha-grouphead",
|
|
21133
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: t.title }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
21134
|
+
className: "dsha-actions",
|
|
21135
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
21136
|
+
className: "dsha-btn",
|
|
21137
|
+
disabled: busy !== null || !status?.authenticated,
|
|
21138
|
+
onClick: () => void view.testConnection(),
|
|
21139
|
+
children: busy === "connection" ? t.testingConnection : t.testConnection
|
|
21140
|
+
}), status?.authenticated && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
21141
|
+
className: "dsha-btn",
|
|
21142
|
+
disabled: busy !== null,
|
|
21143
|
+
onClick: () => void view.removeKey(),
|
|
21144
|
+
children: busy === "remove-key" ? t.removingKey : t.removeKey
|
|
21145
|
+
})]
|
|
21146
|
+
})]
|
|
21147
|
+
}),
|
|
21148
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
21149
|
+
className: "dsha-muted",
|
|
21150
|
+
children: t.pageDesc
|
|
21151
|
+
}),
|
|
21152
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
21153
|
+
className: "dsha-pref-row",
|
|
21154
|
+
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", {
|
|
21155
|
+
type: "checkbox",
|
|
21156
|
+
"aria-label": t.enabled,
|
|
21157
|
+
checked: status?.enabled !== false,
|
|
21158
|
+
disabled: busy !== null,
|
|
21159
|
+
onChange: (event) => void view.update({ enabled: event.currentTarget.checked }).catch(() => void 0)
|
|
21160
|
+
})]
|
|
21161
|
+
}),
|
|
21162
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
21163
|
+
className: "dsha-empty",
|
|
21164
|
+
children: status?.authenticated ? t.keyConfigured : t.keyMissing
|
|
21165
|
+
}),
|
|
21166
|
+
status?.authenticated && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
21167
|
+
className: "dsha-row",
|
|
21168
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
21169
|
+
className: "dsha-label",
|
|
21170
|
+
children: t.storagePath
|
|
21171
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
21172
|
+
className: "dsha-value",
|
|
21173
|
+
children: status.storagePath
|
|
21174
|
+
})]
|
|
21175
|
+
}),
|
|
21176
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
21177
|
+
className: "dshqw-key-row",
|
|
21178
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
21179
|
+
className: "dsha-select",
|
|
21180
|
+
type: "password",
|
|
21181
|
+
autoComplete: "off",
|
|
21182
|
+
"aria-label": t.keySection,
|
|
21183
|
+
placeholder: t.keyPlaceholder,
|
|
21184
|
+
value: view.keyValue,
|
|
21185
|
+
disabled: busy !== null,
|
|
21186
|
+
onChange: (event) => view.setKeyValue(event.currentTarget.value),
|
|
21187
|
+
onKeyDown: (event) => {
|
|
21188
|
+
if (event.key === "Enter") view.saveKey();
|
|
21189
|
+
}
|
|
21190
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
21191
|
+
className: "dsha-btn dsha-btn-primary",
|
|
21192
|
+
disabled: busy !== null || view.keyValue.trim() === "",
|
|
21193
|
+
onClick: () => void view.saveKey(),
|
|
21194
|
+
children: busy === "key" ? t.savingKey : t.saveKey
|
|
21195
|
+
})]
|
|
21196
|
+
}),
|
|
21197
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
21198
|
+
className: "dsha-muted",
|
|
21199
|
+
children: status?.serving === false && status.conflict ? t.routeConflict.replace("{detail}", status.conflict) : t.routeOwned
|
|
21200
|
+
}),
|
|
21201
|
+
view.connection !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
21202
|
+
className: view.connection.connected ? "dsha-muted" : "dsha-notice",
|
|
21203
|
+
children: view.connection.connected ? t.connectionOk + " · " + t.latency.replace("{ms}", String(view.connection.latencyMs)) : t.connectionFailed + ": " + (view.connection.error ?? "—")
|
|
21204
|
+
})
|
|
21205
|
+
]
|
|
21206
|
+
}),
|
|
21207
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
21208
|
+
className: "dsha-group dshqw-cache",
|
|
21209
|
+
children: [
|
|
21210
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
21211
|
+
className: "dsha-grouphead",
|
|
21212
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: t.cacheSection })
|
|
21213
|
+
}),
|
|
21214
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
21215
|
+
className: "dsha-muted",
|
|
21216
|
+
children: t.cacheDesc
|
|
21217
|
+
}),
|
|
21218
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
21219
|
+
className: "dsha-pref-row",
|
|
21220
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t.cacheEnabled }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
21221
|
+
type: "checkbox",
|
|
21222
|
+
"aria-label": t.cacheEnabled,
|
|
21223
|
+
checked: status?.cacheEnabled === true,
|
|
21224
|
+
disabled: busy !== null,
|
|
21225
|
+
onChange: (event) => void view.update({ cacheEnabled: event.currentTarget.checked }).catch(() => void 0)
|
|
21226
|
+
})]
|
|
21227
|
+
}),
|
|
21228
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
21229
|
+
className: "dsha-pref-row",
|
|
21230
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t.cacheTtl }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
|
|
21231
|
+
className: "dsha-select",
|
|
21232
|
+
"aria-label": t.cacheTtl,
|
|
21233
|
+
value: status?.cacheTtl ?? "5m",
|
|
21234
|
+
disabled: busy !== null || status?.cacheEnabled !== true,
|
|
21235
|
+
onChange: (event) => {
|
|
21236
|
+
const value = event.currentTarget.value;
|
|
21237
|
+
if (isQianwenCacheTtl(value)) view.update({ cacheTtl: value }).catch(() => void 0);
|
|
21238
|
+
},
|
|
21239
|
+
children: QIANWEN_CACHE_TTLS.map((ttl) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
21240
|
+
value: ttl,
|
|
21241
|
+
children: ttl === "5m" ? t.ttl5m : t.ttl1h
|
|
21242
|
+
}, ttl))
|
|
21243
|
+
})]
|
|
21244
|
+
}),
|
|
21245
|
+
status?.cacheHint && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
21246
|
+
className: "dsha-muted",
|
|
21247
|
+
children: t.cacheHint.replace("{minutes}", String(Math.floor(status.cacheHint.idleMs / 6e4)))
|
|
21248
|
+
}),
|
|
21249
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
21250
|
+
className: "dsha-actions",
|
|
21251
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
21252
|
+
href: "https://platform.qianwenai.com/home/analytics/token-plan/individual",
|
|
21253
|
+
target: "_blank",
|
|
21254
|
+
rel: "noreferrer",
|
|
21255
|
+
children: t.dashboard
|
|
21256
|
+
})
|
|
21257
|
+
})
|
|
21258
|
+
]
|
|
21259
|
+
}),
|
|
21260
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
21261
|
+
className: "dsha-group dshqw-thinking",
|
|
21262
|
+
children: [
|
|
21263
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
21264
|
+
className: "dsha-grouphead",
|
|
21265
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: t.thinkingSection })
|
|
21266
|
+
}),
|
|
21267
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
21268
|
+
className: "dsha-pref-row",
|
|
21269
|
+
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", {
|
|
21270
|
+
className: "dsha-muted",
|
|
21271
|
+
children: t.effortHint
|
|
21272
|
+
})] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
|
|
21273
|
+
className: "dsha-select",
|
|
21274
|
+
"aria-label": t.defaultEffort,
|
|
21275
|
+
value: status?.defaultReasoningEffort ?? "",
|
|
21276
|
+
disabled: busy !== null,
|
|
21277
|
+
onChange: (event) => {
|
|
21278
|
+
const value = event.currentTarget.value;
|
|
21279
|
+
view.setDefaultEffort(isQianwenReasoningEffort(value) ? value : null).catch(() => void 0);
|
|
21280
|
+
},
|
|
21281
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
21282
|
+
value: "",
|
|
21283
|
+
children: t.effortDefault
|
|
21284
|
+
}), QIANWEN_REASONING_EFFORTS.map((effort) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
21285
|
+
value: effort,
|
|
21286
|
+
children: t[EFFORT_KEYS[effort]]
|
|
21287
|
+
}, effort))]
|
|
21288
|
+
})]
|
|
21289
|
+
}),
|
|
21290
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
21291
|
+
className: "dsha-pref-row",
|
|
21292
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t.thinkingSummary }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
21293
|
+
className: "dsha-muted",
|
|
21294
|
+
children: t.thinkingSummaryHint
|
|
21295
|
+
})] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
21296
|
+
type: "checkbox",
|
|
21297
|
+
"aria-label": t.thinkingSummary,
|
|
21298
|
+
checked: status?.thinkingSummary === true,
|
|
21299
|
+
disabled: busy !== null,
|
|
21300
|
+
onChange: (event) => void view.update({ thinkingSummary: event.currentTarget.checked }).catch(() => void 0)
|
|
21301
|
+
})]
|
|
21302
|
+
})
|
|
21303
|
+
]
|
|
21304
|
+
}),
|
|
21305
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
21306
|
+
className: "dsha-group dshqw-models",
|
|
21307
|
+
children: [
|
|
21308
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
21309
|
+
className: "dsha-grouphead",
|
|
21310
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: t.modelsSection })
|
|
21311
|
+
}),
|
|
21312
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
21313
|
+
className: "dsha-muted",
|
|
21314
|
+
children: t.modelsHint
|
|
21315
|
+
}),
|
|
21316
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModelChecklist, {
|
|
21317
|
+
items: models.map((model) => ({
|
|
21318
|
+
id: model.id,
|
|
21319
|
+
name: model.name,
|
|
21320
|
+
hint: model.hint,
|
|
21321
|
+
enabled: model.enabled
|
|
21322
|
+
})),
|
|
21323
|
+
busy: busy !== null,
|
|
21324
|
+
onToggle: view.toggleModel,
|
|
21325
|
+
onToggleAll: view.setAllModels,
|
|
21326
|
+
labels: {
|
|
21327
|
+
selectAll: t.selectAll,
|
|
21328
|
+
clearAll: t.clearAll,
|
|
21329
|
+
list: t.modelsSection
|
|
21330
|
+
}
|
|
21331
|
+
}),
|
|
21332
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
21333
|
+
className: "dsha-muted",
|
|
21334
|
+
children: t.selectionHint
|
|
21335
|
+
})
|
|
21336
|
+
]
|
|
21337
|
+
}),
|
|
21338
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
21339
|
+
className: "dsha-group dshqw-context",
|
|
21340
|
+
children: [
|
|
21341
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
21342
|
+
className: "dsha-grouphead",
|
|
21343
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: t.contextSection })
|
|
21344
|
+
}),
|
|
21345
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
21346
|
+
className: "dsha-muted",
|
|
21347
|
+
children: t.contextHint
|
|
21348
|
+
}),
|
|
21349
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContextWindowEditor, {
|
|
21350
|
+
rows: enabledModels.map((model) => ({
|
|
21351
|
+
id: model.id,
|
|
21352
|
+
name: model.name,
|
|
21353
|
+
draft: view.contextDrafts[model.id] ?? "",
|
|
21354
|
+
meta: model.contextWindow !== model.defaultContextWindow ? formatCapacity$1(model.contextWindow) : void 0,
|
|
21355
|
+
inputLabel: model.name + " " + t.contextSection,
|
|
21356
|
+
hasOverride: status?.contextWindowOverrides[model.id] !== void 0,
|
|
21357
|
+
saving: view.savingModel === model.id
|
|
21358
|
+
})),
|
|
21359
|
+
labels: {
|
|
21360
|
+
tokens: t.tokens,
|
|
21361
|
+
save: t.save,
|
|
21362
|
+
saving: t.saving,
|
|
21363
|
+
reset: t.reset,
|
|
21364
|
+
resetAll: t.resetAll,
|
|
21365
|
+
empty: t.contextEmpty
|
|
21366
|
+
},
|
|
21367
|
+
busy: busy !== null,
|
|
21368
|
+
overrideCount: Object.keys(status?.contextWindowOverrides ?? {}).length,
|
|
21369
|
+
metaClassName: "dshqw-model-meta",
|
|
21370
|
+
onDraftChange: view.setContextDraft,
|
|
21371
|
+
onCommit: (id) => void view.saveContextWindow(id),
|
|
21372
|
+
onReset: (id) => void view.resetContextWindow(id),
|
|
21373
|
+
onResetAll: () => void view.resetAllContextWindows().catch(() => void 0)
|
|
21374
|
+
})
|
|
21375
|
+
]
|
|
21376
|
+
}),
|
|
21377
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
21378
|
+
className: "dsha-group dshqw-vision",
|
|
21379
|
+
children: [
|
|
21380
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
21381
|
+
className: "dsha-grouphead",
|
|
21382
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: t.visionSection })
|
|
21383
|
+
}),
|
|
21384
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
21385
|
+
className: "dsha-muted",
|
|
21386
|
+
children: t.visionHint
|
|
21387
|
+
}),
|
|
21388
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
21389
|
+
className: "dsha-pref-row",
|
|
21390
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t.imageDetail }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
|
|
21391
|
+
className: "dsha-select",
|
|
21392
|
+
"aria-label": t.imageDetail,
|
|
21393
|
+
value: status?.imageDetail ?? "auto",
|
|
21394
|
+
disabled: busy !== null,
|
|
21395
|
+
onChange: (event) => {
|
|
21396
|
+
const value = event.currentTarget.value;
|
|
21397
|
+
if (isQianwenImageDetail(value)) view.setImageDetail(value).catch(() => void 0);
|
|
21398
|
+
},
|
|
21399
|
+
children: QIANWEN_IMAGE_DETAILS.map((detail) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
21400
|
+
value: detail,
|
|
21401
|
+
children: detail === "low" ? t.detailLow : detail === "high" ? t.detailHigh : t.detailAuto
|
|
21402
|
+
}, detail))
|
|
21403
|
+
})]
|
|
21404
|
+
}),
|
|
21405
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
21406
|
+
className: "dshqw-key-row dshqw-vision-row",
|
|
21407
|
+
children: [
|
|
21408
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
21409
|
+
className: "dsha-select",
|
|
21410
|
+
inputMode: "numeric",
|
|
21411
|
+
"aria-label": t.maxPixels,
|
|
21412
|
+
placeholder: t.maxPixelsPlaceholder,
|
|
21413
|
+
value: view.pixelsDraft,
|
|
21414
|
+
disabled: busy !== null,
|
|
21415
|
+
onChange: (event) => view.setPixelsDraft(event.currentTarget.value)
|
|
21416
|
+
}),
|
|
21417
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
21418
|
+
className: "dsha-btn",
|
|
21419
|
+
disabled: busy !== null,
|
|
21420
|
+
onClick: () => void view.savePixels(),
|
|
21421
|
+
children: t.maxPixelsSave
|
|
21422
|
+
}),
|
|
21423
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
21424
|
+
className: "dsha-btn",
|
|
21425
|
+
disabled: busy !== null || view.pixelsDraft === "",
|
|
21426
|
+
onClick: () => {
|
|
21427
|
+
view.setPixelsDraft("");
|
|
21428
|
+
view.update({ maxPixels: null }, "pixels").catch(() => void 0);
|
|
21429
|
+
},
|
|
21430
|
+
children: t.maxPixelsReset
|
|
21431
|
+
})
|
|
21432
|
+
]
|
|
21433
|
+
}),
|
|
21434
|
+
more(t.moreNotes, [t.invalidPixels])
|
|
21435
|
+
]
|
|
21436
|
+
}),
|
|
21437
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(LineProxySection, { line: "qianwen-token-plan" }),
|
|
21438
|
+
view.error !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
21439
|
+
className: "dsha-error",
|
|
21440
|
+
children: view.error
|
|
21441
|
+
})
|
|
21442
|
+
]
|
|
21443
|
+
});
|
|
21444
|
+
}
|
|
21445
|
+
//#endregion
|
|
20693
21446
|
//#region src/client/hub/providers.tsx
|
|
20694
21447
|
/** One POST to a line's settings endpoint, answered with that line's refreshed status. */
|
|
20695
21448
|
async function postLineSettings(prefix, body) {
|
|
@@ -20814,6 +21567,12 @@ window.__ModuleLoader__.load({
|
|
|
20814
21567
|
name: "Antigravity (ACP)",
|
|
20815
21568
|
setEnabled: (enabled) => postLineSettings("/antigravity-acp/api", { enabled }),
|
|
20816
21569
|
renderDetail: ({ onModelChange }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AntigravityAcpSection, { onModelChange })
|
|
21570
|
+
},
|
|
21571
|
+
{
|
|
21572
|
+
id: "qianwen-token-plan",
|
|
21573
|
+
name: QIANWEN_TOKEN_PLAN_PROVIDER_NAME,
|
|
21574
|
+
setEnabled: (enabled) => postLineSettings(QIANWEN_TOKEN_PLAN_ROUTE_PREFIX, { enabled }),
|
|
21575
|
+
renderDetail: ({ onModelChange }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(QianwenTokenPlanSection, { onModelChange })
|
|
20817
21576
|
}
|
|
20818
21577
|
];
|
|
20819
21578
|
function hubProviderDescriptor(id) {
|
|
@@ -21651,7 +22410,7 @@ window.__ModuleLoader__.load({
|
|
|
21651
22410
|
* account-pool labels come from `./account-pool.ts`, with the same overrides the
|
|
21652
22411
|
* source applies on top of them.
|
|
21653
22412
|
*/
|
|
21654
|
-
const dictionary$
|
|
22413
|
+
const dictionary$15 = {
|
|
21655
22414
|
...accountPoolRu,
|
|
21656
22415
|
title: "Claude (подписка)",
|
|
21657
22416
|
pageDesc: "Войдите в подписку Claude Pro/Max и управляйте моделями, уровнями рассуждений, контекстными окнами и квотой.",
|
|
@@ -21770,7 +22529,7 @@ window.__ModuleLoader__.load({
|
|
|
21770
22529
|
};
|
|
21771
22530
|
//#endregion
|
|
21772
22531
|
//#region src/client/locales-ru/cline-pass.ts
|
|
21773
|
-
const dictionary$
|
|
22532
|
+
const dictionary$14 = {
|
|
21774
22533
|
...accountPoolRu,
|
|
21775
22534
|
relogin: "Войти заново",
|
|
21776
22535
|
needsRelogin: "Вход истёк",
|
|
@@ -21896,7 +22655,7 @@ window.__ModuleLoader__.load({
|
|
|
21896
22655
|
};
|
|
21897
22656
|
//#endregion
|
|
21898
22657
|
//#region src/client/locales-ru/command-code.ts
|
|
21899
|
-
const dictionary$
|
|
22658
|
+
const dictionary$13 = {
|
|
21900
22659
|
...accountPoolRu,
|
|
21901
22660
|
title: "Command Code",
|
|
21902
22661
|
pageDesc: "Войдите в Command Code и управляйте моделями, контекстными окнами и квотой.",
|
|
@@ -21966,7 +22725,7 @@ window.__ModuleLoader__.load({
|
|
|
21966
22725
|
};
|
|
21967
22726
|
//#endregion
|
|
21968
22727
|
//#region src/client/locales-ru/glm-coding-plan.ts
|
|
21969
|
-
const dictionary$
|
|
22728
|
+
const dictionary$12 = {
|
|
21970
22729
|
...accountPoolRu,
|
|
21971
22730
|
title: "GLM (аккаунт ZCode)",
|
|
21972
22731
|
pageDesc: "Вход аккаунтом ZCode подключает GLM Coding Plan (Китай — bigmodel.cn, международный — z.ai). Здесь же пул аккаунтов, квота тарифа и выбор моделей. Учётные данные двух регионов независимы, поэтому в одном пуле могут быть аккаунты обоих.",
|
|
@@ -22069,7 +22828,7 @@ window.__ModuleLoader__.load({
|
|
|
22069
22828
|
* account-pool labels come from `./account-pool.ts`, with the same overrides the
|
|
22070
22829
|
* source applies on top of them.
|
|
22071
22830
|
*/
|
|
22072
|
-
const dictionary$
|
|
22831
|
+
const dictionary$11 = {
|
|
22073
22832
|
...accountPoolRu,
|
|
22074
22833
|
title: "ChatGPT",
|
|
22075
22834
|
hubTitle: "Подписки",
|
|
@@ -22283,6 +23042,7 @@ window.__ModuleLoader__.load({
|
|
|
22283
23042
|
"cardName.opendesign": "OpenDesign",
|
|
22284
23043
|
"cardName.workbuddy": "WorkBuddy",
|
|
22285
23044
|
"cardName.antigravity-acp": "Antigravity (ACP)",
|
|
23045
|
+
"cardName.qianwen-token-plan": "Qwen Token Plan",
|
|
22286
23046
|
modelChecklistCount: "Включено {count}/{total}",
|
|
22287
23047
|
codeRunTitle: "Код",
|
|
22288
23048
|
codeRunOutput: "Вывод",
|
|
@@ -22298,7 +23058,7 @@ window.__ModuleLoader__.load({
|
|
|
22298
23058
|
};
|
|
22299
23059
|
//#endregion
|
|
22300
23060
|
//#region src/client/locales-ru/kimi-code.ts
|
|
22301
|
-
const dictionary$
|
|
23061
|
+
const dictionary$10 = {
|
|
22302
23062
|
...accountPoolRu,
|
|
22303
23063
|
title: "Kimi Code",
|
|
22304
23064
|
pageDesc: "Вход в подписку Kimi Code: модели, уровень рассуждений, контекстные окна и квота.",
|
|
@@ -22487,7 +23247,7 @@ window.__ModuleLoader__.load({
|
|
|
22487
23247
|
};
|
|
22488
23248
|
//#endregion
|
|
22489
23249
|
//#region src/client/locales-ru/minimax-code.ts
|
|
22490
|
-
const dictionary$
|
|
23250
|
+
const dictionary$9 = {
|
|
22491
23251
|
...accountPoolRu,
|
|
22492
23252
|
title: "MiniMax Code",
|
|
22493
23253
|
pageDesc: "Вход в подписку MiniMax Code для программирования (OAuth по коду устройства) с переиспользованием локального входа MiniMax Code: управление аккаунтом, подключением и моделями.",
|
|
@@ -22687,7 +23447,7 @@ window.__ModuleLoader__.load({
|
|
|
22687
23447
|
};
|
|
22688
23448
|
//#endregion
|
|
22689
23449
|
//#region src/client/locales-ru/ollama.ts
|
|
22690
|
-
const dictionary$
|
|
23450
|
+
const dictionary$8 = {
|
|
22691
23451
|
...accountPoolRu,
|
|
22692
23452
|
relogin: "Заменить ключ",
|
|
22693
23453
|
needsRelogin: "Ключ отклонён",
|
|
@@ -22741,7 +23501,7 @@ window.__ModuleLoader__.load({
|
|
|
22741
23501
|
};
|
|
22742
23502
|
//#endregion
|
|
22743
23503
|
//#region src/client/locales-ru/antigravity-acp.ts
|
|
22744
|
-
const dictionary$
|
|
23504
|
+
const dictionary$7 = {
|
|
22745
23505
|
title: "Antigravity (ACP)",
|
|
22746
23506
|
pageDesc: "Подключение через официальный Antigravity CLI от Google по Agent Client Protocol (ACP): модель, инструменты и сессии приходят от официального процесса, и он же хранит состояние входа.",
|
|
22747
23507
|
routeOwned: "Маршрут моделей обслуживает этот плагин",
|
|
@@ -22835,7 +23595,7 @@ window.__ModuleLoader__.load({
|
|
|
22835
23595
|
};
|
|
22836
23596
|
//#endregion
|
|
22837
23597
|
//#region src/client/locales-ru/opendesign.ts
|
|
22838
|
-
const dictionary$
|
|
23598
|
+
const dictionary$6 = {
|
|
22839
23599
|
...accountPoolRu,
|
|
22840
23600
|
relogin: "Добавить заново",
|
|
22841
23601
|
needsRelogin: "API-ключ недействителен",
|
|
@@ -22945,7 +23705,7 @@ window.__ModuleLoader__.load({
|
|
|
22945
23705
|
};
|
|
22946
23706
|
//#endregion
|
|
22947
23707
|
//#region src/client/locales-ru/dispatch-ledger.ts
|
|
22948
|
-
const dictionary$
|
|
23708
|
+
const dictionary$5 = {
|
|
22949
23709
|
mandateTitle: "Запуск субагента",
|
|
22950
23710
|
mandateTitleFork: "Запуск субагента (с контекстом)",
|
|
22951
23711
|
mandatePreparing: "Сборка задания",
|
|
@@ -22970,7 +23730,7 @@ window.__ModuleLoader__.load({
|
|
|
22970
23730
|
};
|
|
22971
23731
|
//#endregion
|
|
22972
23732
|
//#region src/client/locales-ru/progress-updates.ts
|
|
22973
|
-
const dictionary$
|
|
23733
|
+
const dictionary$4 = {
|
|
22974
23734
|
navTitle: "Ход работы",
|
|
22975
23735
|
progressTitle: "Ход работы",
|
|
22976
23736
|
progressGuideNote: "Каждый шаг, о котором сообщает агент, собирается здесь",
|
|
@@ -23026,7 +23786,7 @@ window.__ModuleLoader__.load({
|
|
|
23026
23786
|
};
|
|
23027
23787
|
//#endregion
|
|
23028
23788
|
//#region src/client/locales-ru/qoder.ts
|
|
23029
|
-
const dictionary$
|
|
23789
|
+
const dictionary$3 = {
|
|
23030
23790
|
modelRowEfforts: "уровни {list}",
|
|
23031
23791
|
modelRowNoEfforts: "без уровней",
|
|
23032
23792
|
modelRowOutput: "вывод {cap}",
|
|
@@ -23148,7 +23908,7 @@ window.__ModuleLoader__.load({
|
|
|
23148
23908
|
};
|
|
23149
23909
|
//#endregion
|
|
23150
23910
|
//#region src/client/locales-ru/step-code.ts
|
|
23151
|
-
const dictionary$
|
|
23911
|
+
const dictionary$2 = {
|
|
23152
23912
|
...accountPoolRu,
|
|
23153
23913
|
title: "Step Code (подписка Step Plan)",
|
|
23154
23914
|
pageDesc: "Подключение к StepFun по подписке Step Plan (Китай api.stepfun.com / международный api.stepfun.ai) или по API-ключу открытой платформы: пул аккаунтов, квота тарифа, расход кеша и выбор моделей. Регион — свойство учётных данных, и два региона несовместимы, поэтому в пуле могут быть аккаунты из обоих.",
|
|
@@ -23325,7 +24085,7 @@ window.__ModuleLoader__.load({
|
|
|
23325
24085
|
* dropped '{placeholder}' would turn a sentence into a bald claim. 'test/
|
|
23326
24086
|
* russian-locale.test.tsx' pins both rules.
|
|
23327
24087
|
*/
|
|
23328
|
-
const dictionary = {
|
|
24088
|
+
const dictionary$1 = {
|
|
23329
24089
|
title: "WorkBuddy",
|
|
23330
24090
|
pageDesc: "Повторно использует локальный вход CodeBuddy, чтобы управлять моделями WorkBuddy (подписка CodeBuddy), контекстными окнами и квотой.",
|
|
23331
24091
|
account: "Аккаунт",
|
|
@@ -23451,6 +24211,81 @@ window.__ModuleLoader__.load({
|
|
|
23451
24211
|
modelCooldownActive: "Модель приостановлена",
|
|
23452
24212
|
notRoutable: "Сейчас не маршрутизируется"
|
|
23453
24213
|
};
|
|
24214
|
+
//#endregion
|
|
24215
|
+
//#region src/client/locales-ru/qianwen-token-plan.ts
|
|
24216
|
+
const dictionary = {
|
|
24217
|
+
title: "Qwen Token Plan",
|
|
24218
|
+
pageDesc: "Подключение Qwen4 по выделенному API-ключу Qianwen Token Plan: явный кеш, воспроизведение размышлений, уровни reasoning, модели и визуальный бюджет.",
|
|
24219
|
+
loading: "Загрузка…",
|
|
24220
|
+
moreNotes: "Подробнее",
|
|
24221
|
+
enabled: "Включить линию",
|
|
24222
|
+
keySection: "API-ключ",
|
|
24223
|
+
keyConfigured: "Выделенный ключ настроен и хранится только в зашифрованном хранилище host.",
|
|
24224
|
+
keyMissing: "API-ключ не настроен. Создайте выделенный ключ в консоли Qianwen Token Plan.",
|
|
24225
|
+
keyPlaceholder: "Вставьте API-ключ Token Plan (sk-sp-…)",
|
|
24226
|
+
saveKey: "Сохранить ключ",
|
|
24227
|
+
savingKey: "Сохранение…",
|
|
24228
|
+
removeKey: "Удалить ключ",
|
|
24229
|
+
removingKey: "Удаление…",
|
|
24230
|
+
storagePath: "Зашифрованное хранилище",
|
|
24231
|
+
testConnection: "Проверить соединение",
|
|
24232
|
+
testingConnection: "Проверка…",
|
|
24233
|
+
connectionOk: "Соединение работает",
|
|
24234
|
+
connectionFailed: "Ошибка соединения",
|
|
24235
|
+
latency: "{ms} мс",
|
|
24236
|
+
routeOwned: "Этот плагин обслуживает маршрут модели.",
|
|
24237
|
+
routeConflict: "Маршрут занят другим провайдером: {detail}",
|
|
24238
|
+
cacheSection: "Явный кеш",
|
|
24239
|
+
cacheDesc: "Автоматические и стабильные точки кеширования Qwen4 повторно используют ввод; статистика использования — во встроенной статистике DSH и консоли Qianwen.",
|
|
24240
|
+
cacheEnabled: "Включить явный кеш",
|
|
24241
|
+
cacheTtl: "TTL кеша",
|
|
24242
|
+
ttl5m: "5 минут (5m)",
|
|
24243
|
+
ttl1h: "1 час (1h)",
|
|
24244
|
+
cacheHitRatio: "Доля попаданий",
|
|
24245
|
+
cacheHint: "Кеш мог остыть: с последнего запроса прошло около {minutes} мин.",
|
|
24246
|
+
thinkingSection: "Размышления",
|
|
24247
|
+
defaultEffort: "Уровень reasoning по умолчанию",
|
|
24248
|
+
effortDefault: "По умолчанию апстрима (high)",
|
|
24249
|
+
effortNone: "Выкл. (none)",
|
|
24250
|
+
effortMinimal: "Минимальный",
|
|
24251
|
+
effortLow: "Низкий",
|
|
24252
|
+
effortMedium: "Средний",
|
|
24253
|
+
effortHigh: "Высокий",
|
|
24254
|
+
effortXhigh: "Очень высокий (xhigh)",
|
|
24255
|
+
effortMax: "Максимальный",
|
|
24256
|
+
effortHint: "Выбранное значение передаётся без изменений. Плагин не понижает его автоматически и не добавляет thinking_budget. Выбор в текущем разговоре имеет приоритет.",
|
|
24257
|
+
thinkingSummary: "Включить сводку CoT и зашифрованный повтор",
|
|
24258
|
+
thinkingSummaryHint: "Qwen4-Max показывает сводку и сохраняет encrypted_content для повтора; шифротекст не попадает в видимый текст или журналы.",
|
|
24259
|
+
modelsSection: "Модели",
|
|
24260
|
+
modelsHint: "В выборе моделей появляются только отмеченные строки. Preview ограничен по времени; для стабильной работы выберите qwen4-max.",
|
|
24261
|
+
selectAll: "Выбрать все",
|
|
24262
|
+
clearAll: "Снять все",
|
|
24263
|
+
selectionHint: "Явно пустой выбор отключает все модели линии; это отличается от первоначальной настройки.",
|
|
24264
|
+
contextSection: "Контекстные окна",
|
|
24265
|
+
contextHint: "Переопределения управляют сжатием и переполнением DSH. По умолчанию 1M; допустимы 256K, 512K, 1M и другие значения.",
|
|
24266
|
+
contextEmpty: "Модели не выбраны.",
|
|
24267
|
+
tokens: "токенов",
|
|
24268
|
+
save: "Сохранить",
|
|
24269
|
+
saving: "Сохранение…",
|
|
24270
|
+
reset: "Сбросить",
|
|
24271
|
+
resetAll: "Сбросить все",
|
|
24272
|
+
invalidCapacity: "Неверная ёмкость: {value}",
|
|
24273
|
+
visionSection: "Визуальный бюджет",
|
|
24274
|
+
imageDetail: "Параметр detail",
|
|
24275
|
+
detailLow: "low (экономно)",
|
|
24276
|
+
detailAuto: "auto (обычный предел)",
|
|
24277
|
+
detailHigh: "high (больше деталей)",
|
|
24278
|
+
maxPixels: "max_pixels (необязательно)",
|
|
24279
|
+
maxPixelsPlaceholder: "Пусто — значение по умолчанию",
|
|
24280
|
+
maxPixelsSave: "Сохранить визуальный бюджет",
|
|
24281
|
+
maxPixelsReset: "Сбросить",
|
|
24282
|
+
invalidPixels: "max_pixels должно быть целым числом от 65536 до 16777216.",
|
|
24283
|
+
visionHint: "Для обычных снимков используйте auto/low, для OCR и мелкого текста — high. Явный max_pixels имеет приоритет.",
|
|
24284
|
+
dashboard: "Открыть консоль использования Qianwen",
|
|
24285
|
+
composerLabel: "Кеш Qwen",
|
|
24286
|
+
noQuota: "Нет данных квоты",
|
|
24287
|
+
proxy: "Прокси"
|
|
24288
|
+
};
|
|
23454
24289
|
/**
|
|
23455
24290
|
* Register the Russian language and every dictionary it covers.
|
|
23456
24291
|
*
|
|
@@ -23473,21 +24308,22 @@ window.__ModuleLoader__.load({
|
|
|
23473
24308
|
}
|
|
23474
24309
|
}, "dsh-chatgpt-subscription: ru language");
|
|
23475
24310
|
const dictionaries = [
|
|
23476
|
-
[NS, dictionary$
|
|
23477
|
-
[NS_CLAUDE, dictionary$
|
|
23478
|
-
[NS_COMMAND_CODE, dictionary$
|
|
23479
|
-
[NS_KIMI_CODE, dictionary$
|
|
23480
|
-
[NS_MINIMAX_CODE, dictionary$
|
|
23481
|
-
[NS_GLM_CODING_PLAN, dictionary$
|
|
23482
|
-
[NS_OLLAMA, dictionary$
|
|
23483
|
-
[NS_STEP_CODE, dictionary$
|
|
23484
|
-
[NS_CLINE_PASS, dictionary$
|
|
23485
|
-
[NS_QODER, dictionary$
|
|
23486
|
-
[NS_OPENDESIGN, dictionary$
|
|
23487
|
-
[NS_PROGRESS_UPDATES, dictionary$
|
|
23488
|
-
[NS_WORKBUDDY, dictionary],
|
|
23489
|
-
[NS_DISPATCH_LEDGER, dictionary$
|
|
23490
|
-
[NS_ANTIGRAVITY_ACP, dictionary$
|
|
24311
|
+
[NS, dictionary$11],
|
|
24312
|
+
[NS_CLAUDE, dictionary$15],
|
|
24313
|
+
[NS_COMMAND_CODE, dictionary$13],
|
|
24314
|
+
[NS_KIMI_CODE, dictionary$10],
|
|
24315
|
+
[NS_MINIMAX_CODE, dictionary$9],
|
|
24316
|
+
[NS_GLM_CODING_PLAN, dictionary$12],
|
|
24317
|
+
[NS_OLLAMA, dictionary$8],
|
|
24318
|
+
[NS_STEP_CODE, dictionary$2],
|
|
24319
|
+
[NS_CLINE_PASS, dictionary$14],
|
|
24320
|
+
[NS_QODER, dictionary$3],
|
|
24321
|
+
[NS_OPENDESIGN, dictionary$6],
|
|
24322
|
+
[NS_PROGRESS_UPDATES, dictionary$4],
|
|
24323
|
+
[NS_WORKBUDDY, dictionary$1],
|
|
24324
|
+
[NS_DISPATCH_LEDGER, dictionary$5],
|
|
24325
|
+
[NS_ANTIGRAVITY_ACP, dictionary$7],
|
|
24326
|
+
[NS_QIANWEN, dictionary]
|
|
23491
24327
|
];
|
|
23492
24328
|
for (const [ns, dictionary] of dictionaries) ctx.effect(() => {
|
|
23493
24329
|
try {
|
|
@@ -24030,7 +24866,7 @@ window.__ModuleLoader__.load({
|
|
|
24030
24866
|
}
|
|
24031
24867
|
//#endregion
|
|
24032
24868
|
//#region src/client/claude/styles.ts
|
|
24033
|
-
const STYLE_ID$
|
|
24869
|
+
const STYLE_ID$8 = "dsh-claude-settings-style";
|
|
24034
24870
|
/**
|
|
24035
24871
|
* Claude-only additions to the shared settings design system.
|
|
24036
24872
|
*
|
|
@@ -24054,7 +24890,7 @@ window.__ModuleLoader__.load({
|
|
|
24054
24890
|
.dshcl-mono{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:11px;overflow-wrap:anywhere}
|
|
24055
24891
|
.dshcl-model-meta{color:var(--dsw-alias-label-tertiary);font-size:11px;margin-left:5px}
|
|
24056
24892
|
.dshcl-empty-inline{color:var(--dsw-alias-label-tertiary);font-size:12px}
|
|
24057
|
-
`, STYLE_ID$
|
|
24893
|
+
`, STYLE_ID$8);
|
|
24058
24894
|
}
|
|
24059
24895
|
//#endregion
|
|
24060
24896
|
//#region src/client/command-code/CommandCodeComposerQuota.tsx
|
|
@@ -24171,7 +25007,7 @@ window.__ModuleLoader__.load({
|
|
|
24171
25007
|
}
|
|
24172
25008
|
//#endregion
|
|
24173
25009
|
//#region src/client/kimi-code/styles.ts
|
|
24174
|
-
const STYLE_ID$
|
|
25010
|
+
const STYLE_ID$7 = "dsh-kimi-code-settings-style";
|
|
24175
25011
|
/**
|
|
24176
25012
|
* Node the base control styles come from.
|
|
24177
25013
|
*
|
|
@@ -24313,7 +25149,7 @@ window.__ModuleLoader__.load({
|
|
|
24313
25149
|
`;
|
|
24314
25150
|
/** Kimi-specific rules layered on top of the shared control styles. */
|
|
24315
25151
|
function installKimiCodeStyles() {
|
|
24316
|
-
installPluginStyle("kimi-code", BASE, STYLE_ID$
|
|
25152
|
+
installPluginStyle("kimi-code", BASE, STYLE_ID$7);
|
|
24317
25153
|
}
|
|
24318
25154
|
//#endregion
|
|
24319
25155
|
//#region src/client/minimax-code/MinimaxCodeComposerQuota.tsx
|
|
@@ -24449,7 +25285,7 @@ window.__ModuleLoader__.load({
|
|
|
24449
25285
|
//#region src/client/minimax-code/MinimaxVideoDocumentBody.tsx
|
|
24450
25286
|
/** 兜底翻译:只在没有 locale 座位时用到。 */
|
|
24451
25287
|
function translate$1(key) {
|
|
24452
|
-
return zh$
|
|
25288
|
+
return zh$13[key] ?? key;
|
|
24453
25289
|
}
|
|
24454
25290
|
/**
|
|
24455
25291
|
* 一个文件地址里的会话与路径。
|
|
@@ -24585,7 +25421,7 @@ window.__ModuleLoader__.load({
|
|
|
24585
25421
|
*/
|
|
24586
25422
|
/** 兜底翻译:只在没有 locale 座位时用到,走同一份 zh 字典。 */
|
|
24587
25423
|
function translate(key) {
|
|
24588
|
-
return zh$
|
|
25424
|
+
return zh$13[key] ?? key;
|
|
24589
25425
|
}
|
|
24590
25426
|
/**
|
|
24591
25427
|
* 一张视频工具卡片。
|
|
@@ -24855,7 +25691,7 @@ window.__ModuleLoader__.load({
|
|
|
24855
25691
|
}
|
|
24856
25692
|
//#endregion
|
|
24857
25693
|
//#region src/client/minimax-code/styles.ts
|
|
24858
|
-
const STYLE_ID$
|
|
25694
|
+
const STYLE_ID$6 = "dsh-minimax-code-settings-style";
|
|
24859
25695
|
/**
|
|
24860
25696
|
* MiniMax Code-only additions to the shared settings design system.
|
|
24861
25697
|
*
|
|
@@ -25024,7 +25860,7 @@ window.__ModuleLoader__.load({
|
|
|
25024
25860
|
.dshm-video-history-meta{color:var(--dsw-alias-label-tertiary);flex:none;font-size:11px;font-variant-numeric:tabular-nums}
|
|
25025
25861
|
@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}}
|
|
25026
25862
|
@media(prefers-reduced-motion:reduce){.dshm-video-skeleton span{animation:none;opacity:.6}}
|
|
25027
|
-
`, STYLE_ID$
|
|
25863
|
+
`, STYLE_ID$6);
|
|
25028
25864
|
}
|
|
25029
25865
|
//#endregion
|
|
25030
25866
|
//#region src/client/glm-coding-plan/GlmCodingPlanComposerQuota.tsx
|
|
@@ -25041,7 +25877,7 @@ window.__ModuleLoader__.load({
|
|
|
25041
25877
|
* 没有快照、没有窗口、或全部窗口都没有百分比时返回 null,即**不渲染胶囊**:
|
|
25042
25878
|
* 契约允许 quota 为 null,装一个占位数字比不显示更像坏了。
|
|
25043
25879
|
*/
|
|
25044
|
-
function selectBadgeFacts$3(status, lookup = (key) => zh$
|
|
25880
|
+
function selectBadgeFacts$3(status, lookup = (key) => zh$12[key]) {
|
|
25045
25881
|
const measured = (status?.quota?.windows ?? []).filter((window) => typeof window.usedPercent === "number" && Number.isFinite(window.usedPercent));
|
|
25046
25882
|
if (measured.length === 0) return null;
|
|
25047
25883
|
const tightest = measured.reduce((best, window) => {
|
|
@@ -25072,14 +25908,14 @@ window.__ModuleLoader__.load({
|
|
|
25072
25908
|
directory,
|
|
25073
25909
|
loadModelDirectory,
|
|
25074
25910
|
providerId: GLM_CODING_PLAN_PROVIDER_ID,
|
|
25075
|
-
readStatus: (refresh) => refresh ? post$
|
|
25911
|
+
readStatus: (refresh) => refresh ? post$5("/quota", {}) : get$3("/status"),
|
|
25076
25912
|
selectFacts: (status) => selectBadgeFacts$3(status, t),
|
|
25077
25913
|
label: t("composerLabel")
|
|
25078
25914
|
});
|
|
25079
25915
|
}
|
|
25080
25916
|
//#endregion
|
|
25081
25917
|
//#region src/client/glm-coding-plan/styles.ts
|
|
25082
|
-
const STYLE_ID$
|
|
25918
|
+
const STYLE_ID$5 = "dsh-glm-coding-plan-settings-style";
|
|
25083
25919
|
/**
|
|
25084
25920
|
* GLM(ZCode 账号)卡片独有的样式。
|
|
25085
25921
|
*
|
|
@@ -25119,7 +25955,7 @@ window.__ModuleLoader__.load({
|
|
|
25119
25955
|
:not(.dsha-btn-primary));通用 hover 修好后它只剩副作用:把 .dsha-btn 的次要
|
|
25120
25956
|
按钮也画成主按钮,故删除。 */
|
|
25121
25957
|
.dsha-account-add-actions{display:flex;flex-wrap:wrap;gap:8px}
|
|
25122
|
-
`, STYLE_ID$
|
|
25958
|
+
`, STYLE_ID$5);
|
|
25123
25959
|
}
|
|
25124
25960
|
//#endregion
|
|
25125
25961
|
//#region src/client/antigravity-acp/route.ts
|
|
@@ -25137,7 +25973,7 @@ window.__ModuleLoader__.load({
|
|
|
25137
25973
|
* single most misleading pixel on the page.
|
|
25138
25974
|
*/
|
|
25139
25975
|
function AntigravityAcpComposerBadge(props) {
|
|
25140
|
-
const t = useLineDict(NS_ANTIGRAVITY_ACP, zh$
|
|
25976
|
+
const t = useLineDict(NS_ANTIGRAVITY_ACP, zh$9);
|
|
25141
25977
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComposerQuotaBadge, {
|
|
25142
25978
|
directory: props.directory,
|
|
25143
25979
|
loadModelDirectory: props.loadModelDirectory,
|
|
@@ -25179,7 +26015,7 @@ window.__ModuleLoader__.load({
|
|
|
25179
26015
|
}
|
|
25180
26016
|
//#endregion
|
|
25181
26017
|
//#region src/client/antigravity-acp/styles.ts
|
|
25182
|
-
const STYLE_ID$
|
|
26018
|
+
const STYLE_ID$4 = "dsh-antigravity-acp-settings-style";
|
|
25183
26019
|
/**
|
|
25184
26020
|
* The Antigravity (ACP) card's own styles.
|
|
25185
26021
|
*
|
|
@@ -25205,7 +26041,7 @@ window.__ModuleLoader__.load({
|
|
|
25205
26041
|
.dshagy-details[open]>summary{color:var(--dsw-alias-label-primary)}
|
|
25206
26042
|
.dshagy-details>p{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:1.55;margin:9px 0 0}
|
|
25207
26043
|
.dshagy-boundary{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:1.55;margin:9px 0 0;padding-left:18px}
|
|
25208
|
-
`, STYLE_ID$
|
|
26044
|
+
`, STYLE_ID$4);
|
|
25209
26045
|
}
|
|
25210
26046
|
//#endregion
|
|
25211
26047
|
//#region src/client/step-code/StepCodeComposerQuota.tsx
|
|
@@ -25221,7 +26057,7 @@ window.__ModuleLoader__.load({
|
|
|
25221
26057
|
*
|
|
25222
26058
|
* 没有快照、没有窗口、或全部窗口都没有百分比时返回 null(见文件头)。
|
|
25223
26059
|
*/
|
|
25224
|
-
function selectBadgeFacts$2(status, lookup = (key) => zh$
|
|
26060
|
+
function selectBadgeFacts$2(status, lookup = (key) => zh$8[key]) {
|
|
25225
26061
|
const quota = status?.quota;
|
|
25226
26062
|
if (quota === null || quota === void 0) return null;
|
|
25227
26063
|
if (quota.kind !== "windowed") return null;
|
|
@@ -25262,14 +26098,14 @@ window.__ModuleLoader__.load({
|
|
|
25262
26098
|
directory,
|
|
25263
26099
|
loadModelDirectory,
|
|
25264
26100
|
providerId: STEP_CODE_PROVIDER_ID,
|
|
25265
|
-
readStatus: (refresh) => refresh ? post$
|
|
26101
|
+
readStatus: (refresh) => refresh ? post$2("/quota", {}) : get$2("/status"),
|
|
25266
26102
|
selectFacts: (status) => selectBadgeFacts$2(status, t),
|
|
25267
26103
|
label: t("composerLabel")
|
|
25268
26104
|
});
|
|
25269
26105
|
}
|
|
25270
26106
|
//#endregion
|
|
25271
26107
|
//#region src/client/step-code/styles.ts
|
|
25272
|
-
const STYLE_ID$
|
|
26108
|
+
const STYLE_ID$3 = "dsh-step-code-settings-style";
|
|
25273
26109
|
/**
|
|
25274
26110
|
* Step Code(Step Plan 订阅)卡片独有的样式。
|
|
25275
26111
|
*
|
|
@@ -25347,7 +26183,7 @@ window.__ModuleLoader__.load({
|
|
|
25347
26183
|
@media(max-width:560px){.dshsc-cred-grid,.dshsc-cred-grid-narrow{grid-template-columns:minmax(0,1fr)}}
|
|
25348
26184
|
|
|
25349
26185
|
.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)}
|
|
25350
|
-
`, STYLE_ID$
|
|
26186
|
+
`, STYLE_ID$3);
|
|
25351
26187
|
}
|
|
25352
26188
|
//#endregion
|
|
25353
26189
|
//#region src/client/cline-pass/ClinePassComposerQuota.tsx
|
|
@@ -25368,7 +26204,7 @@ window.__ModuleLoader__.load({
|
|
|
25368
26204
|
directory: props.directory,
|
|
25369
26205
|
loadModelDirectory: props.loadModelDirectory,
|
|
25370
26206
|
providerId: "cline-pass",
|
|
25371
|
-
label: zh$
|
|
26207
|
+
label: zh$7.composerLabel,
|
|
25372
26208
|
readStatus: (refresh) => API$1.status(refresh),
|
|
25373
26209
|
selectFacts: selectClinePassFacts
|
|
25374
26210
|
});
|
|
@@ -25454,7 +26290,7 @@ window.__ModuleLoader__.load({
|
|
|
25454
26290
|
* 另外那只可能还剩一大半。所以这里不平均、不取最小剩余,而是取最大已用比例。
|
|
25455
26291
|
* 没有快照、没有桶、或全部桶都没有总额时返回 null(见文件头)。
|
|
25456
26292
|
*/
|
|
25457
|
-
function selectBadgeFacts$1(status, lookup = (key) => zh$
|
|
26293
|
+
function selectBadgeFacts$1(status, lookup = (key) => zh$6[key]) {
|
|
25458
26294
|
const quota = status?.quota;
|
|
25459
26295
|
if (quota === null || quota === void 0) return null;
|
|
25460
26296
|
const measurable = quota.buckets.filter((bucket) => bucket.total !== null && bucket.total > 0 && bucket.used !== null);
|
|
@@ -25464,7 +26300,7 @@ window.__ModuleLoader__.load({
|
|
|
25464
26300
|
const remaining = Math.round((1 - used) * 100);
|
|
25465
26301
|
const unit = tightest.unit !== null && tightest.unit !== "" ? " " + tightest.unit : "";
|
|
25466
26302
|
const bucketLabel = quotaBucketText(tightest.kind, {
|
|
25467
|
-
...zh$
|
|
26303
|
+
...zh$6,
|
|
25468
26304
|
quotaBucketPersonal: lookup("quotaBucketPersonal"),
|
|
25469
26305
|
quotaBucketAddOn: lookup("quotaBucketAddOn"),
|
|
25470
26306
|
quotaBucketOrg: lookup("quotaBucketOrg")
|
|
@@ -25489,14 +26325,14 @@ window.__ModuleLoader__.load({
|
|
|
25489
26325
|
directory,
|
|
25490
26326
|
loadModelDirectory,
|
|
25491
26327
|
providerId: QODER_PROVIDER_ID,
|
|
25492
|
-
readStatus: (refresh) => refresh ? post("/quota", {}) : get("/status"),
|
|
26328
|
+
readStatus: (refresh) => refresh ? post$1("/quota", {}) : get$1("/status"),
|
|
25493
26329
|
selectFacts: (status) => selectBadgeFacts$1(status, t),
|
|
25494
26330
|
label: t("composerLabel")
|
|
25495
26331
|
});
|
|
25496
26332
|
}
|
|
25497
26333
|
//#endregion
|
|
25498
26334
|
//#region src/client/qoder/styles.ts
|
|
25499
|
-
const STYLE_ID$
|
|
26335
|
+
const STYLE_ID$2 = "dsh-qoder-settings-style";
|
|
25500
26336
|
/**
|
|
25501
26337
|
* Qoder(订阅)卡片独有的样式。
|
|
25502
26338
|
*
|
|
@@ -25551,7 +26387,7 @@ window.__ModuleLoader__.load({
|
|
|
25551
26387
|
.dshq-details>p{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:1.55;margin:9px 0 0}
|
|
25552
26388
|
|
|
25553
26389
|
.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)}
|
|
25554
|
-
`, STYLE_ID$
|
|
26390
|
+
`, STYLE_ID$2);
|
|
25555
26391
|
}
|
|
25556
26392
|
//#endregion
|
|
25557
26393
|
//#region src/client/opendesign/OpenDesignComposerQuota.tsx
|
|
@@ -25575,7 +26411,7 @@ window.__ModuleLoader__.load({
|
|
|
25575
26411
|
directory: props.directory,
|
|
25576
26412
|
loadModelDirectory: props.loadModelDirectory,
|
|
25577
26413
|
providerId: "opendesign",
|
|
25578
|
-
label: zh$
|
|
26414
|
+
label: zh$5.composerLabel,
|
|
25579
26415
|
readStatus: () => API.status(),
|
|
25580
26416
|
selectFacts: selectOpenDesignFacts
|
|
25581
26417
|
});
|
|
@@ -25596,9 +26432,9 @@ window.__ModuleLoader__.load({
|
|
|
25596
26432
|
* is not), and one decimal is what keeps "1.5 小时" from reading as "2 小时".
|
|
25597
26433
|
*/
|
|
25598
26434
|
function planWindowName(seconds) {
|
|
25599
|
-
if (seconds >= 86400 && seconds % 86400 === 0) return zh$
|
|
25600
|
-
if (seconds >= 3600) return zh$
|
|
25601
|
-
return zh$
|
|
26435
|
+
if (seconds >= 86400 && seconds % 86400 === 0) return zh$5.usageWindowDays.replace("{count}", String(seconds / 86400));
|
|
26436
|
+
if (seconds >= 3600) return zh$5.usageWindowHours.replace("{count}", formatDecimal(seconds / 3600));
|
|
26437
|
+
return zh$5.usageWindowMinutes.replace("{count}", formatDecimal(seconds / 60));
|
|
25602
26438
|
}
|
|
25603
26439
|
/** What a window still has, from the grant and the remainder it states. */
|
|
25604
26440
|
function windowRemaining(limitCredits, remainingCredits) {
|
|
@@ -25631,7 +26467,7 @@ window.__ModuleLoader__.load({
|
|
|
25631
26467
|
const primaryId = status.pool.activeAccountId ?? status.pool.accounts.find((account) => account.isPrimary)?.id;
|
|
25632
26468
|
const reading = readings.find((account) => account.accountId === primaryId) ?? readings[0];
|
|
25633
26469
|
const amount = reading.balanceUsd;
|
|
25634
|
-
const readAt = zh$
|
|
26470
|
+
const readAt = zh$5.usageReadAt.replace("{time}", new Date(reading.fetchedAt).toLocaleTimeString());
|
|
25635
26471
|
const windows = planWindows(reading.codingPlan);
|
|
25636
26472
|
if (windows.length === 0) return {
|
|
25637
26473
|
text: `$${amount}`,
|
|
@@ -25640,8 +26476,8 @@ window.__ModuleLoader__.load({
|
|
|
25640
26476
|
};
|
|
25641
26477
|
const narrowest = windows[0];
|
|
25642
26478
|
return {
|
|
25643
|
-
text: zh$
|
|
25644
|
-
tooltip: `${reading.alias} · ${windows.map((window) => `${window.name} ${zh$
|
|
26479
|
+
text: zh$5.usageWindowRemaining.replace("{remaining}", formatDecimal(narrowest.remaining)),
|
|
26480
|
+
tooltip: `${reading.alias} · ${windows.map((window) => `${window.name} ${zh$5.usageWindowRemaining.replace("{remaining}", formatDecimal(window.remaining))}`).join(" · ")} · ${readAt}`,
|
|
25645
26481
|
level: quotaLevel(narrowest.remaining),
|
|
25646
26482
|
percent: narrowest.remaining
|
|
25647
26483
|
};
|
|
@@ -27470,7 +28306,7 @@ window.__ModuleLoader__.load({
|
|
|
27470
28306
|
}
|
|
27471
28307
|
/** 兜底翻译:只在没有 locale 服务时用到(测试、以及菜单渲染早于字典注册)。 */
|
|
27472
28308
|
function fallbackTranslate$3(key, params) {
|
|
27473
|
-
const template = zh$
|
|
28309
|
+
const template = zh$13[key] ?? key;
|
|
27474
28310
|
if (params === void 0) return template;
|
|
27475
28311
|
return template.replace(/\{(\w+)\}/g, (_match, name) => String(params[name] ?? ""));
|
|
27476
28312
|
}
|
|
@@ -56768,12 +57604,12 @@ window.__ModuleLoader__.load({
|
|
|
56768
57604
|
providerId: "workbuddy-subscription",
|
|
56769
57605
|
readStatus: (refresh) => refresh ? api.post("/quota") : api.get("/status"),
|
|
56770
57606
|
selectFacts: selectBadgeFacts,
|
|
56771
|
-
label: useLineDict(NS_WORKBUDDY, zh$
|
|
57607
|
+
label: useLineDict(NS_WORKBUDDY, zh$4).composerLabel
|
|
56772
57608
|
});
|
|
56773
57609
|
}
|
|
56774
57610
|
//#endregion
|
|
56775
57611
|
//#region src/client/workbuddy/styles.ts
|
|
56776
|
-
const STYLE_ID = "dsh-workbuddy-settings-style";
|
|
57612
|
+
const STYLE_ID$1 = "dsh-workbuddy-settings-style";
|
|
56777
57613
|
/**
|
|
56778
57614
|
* WorkBuddy-only additions to the shared settings design system.
|
|
56779
57615
|
*
|
|
@@ -56827,6 +57663,50 @@ window.__ModuleLoader__.load({
|
|
|
56827
57663
|
.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}
|
|
56828
57664
|
.dsh-wb-inputrow>input:disabled{opacity:.5}
|
|
56829
57665
|
|
|
57666
|
+
`, STYLE_ID$1);
|
|
57667
|
+
}
|
|
57668
|
+
//#endregion
|
|
57669
|
+
//#region src/client/qianwen-token-plan/QianwenComposerQuota.tsx
|
|
57670
|
+
function selectQianwenBadgeFacts(status, lookup = (key) => zh$3[key]) {
|
|
57671
|
+
const cache = status?.cacheStats;
|
|
57672
|
+
if (cache === void 0 || cache === null) return null;
|
|
57673
|
+
const ratio = qianwenCacheHitRatio(cache);
|
|
57674
|
+
if (ratio === null) return null;
|
|
57675
|
+
const percent = Math.round(ratio * 100);
|
|
57676
|
+
return {
|
|
57677
|
+
text: percent + "%",
|
|
57678
|
+
tooltip: "[" + lookup("title") + "] " + lookup("cacheHitRatio") + ": " + percent + "% · " + cache.cacheReadTokens + " tokens",
|
|
57679
|
+
level: quotaLevel(percent)
|
|
57680
|
+
};
|
|
57681
|
+
}
|
|
57682
|
+
function QianwenComposerQuota({ directory, loadModelDirectory, t }) {
|
|
57683
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComposerQuotaBadge, {
|
|
57684
|
+
directory,
|
|
57685
|
+
loadModelDirectory,
|
|
57686
|
+
providerId: QIANWEN_TOKEN_PLAN_PROVIDER_ID,
|
|
57687
|
+
readStatus: () => get("/status"),
|
|
57688
|
+
selectFacts: (status) => selectQianwenBadgeFacts(status, t),
|
|
57689
|
+
label: t("composerLabel")
|
|
57690
|
+
});
|
|
57691
|
+
}
|
|
57692
|
+
//#endregion
|
|
57693
|
+
//#region src/client/qianwen-token-plan/styles.ts
|
|
57694
|
+
const STYLE_ID = "dsh-qianwen-token-plan-settings-style";
|
|
57695
|
+
function installQianwenStyles() {
|
|
57696
|
+
installPluginStyle("qianwen-token-plan", `
|
|
57697
|
+
/* 输入行与上方 .dsha-row / .dsha-pref-row 的底部分界线保持间距,避免框线重合 */
|
|
57698
|
+
.dshqw-key-row{align-items:stretch;display:grid;gap:8px;grid-template-columns:minmax(0,1fr) auto;margin-top:10px;width:100%}
|
|
57699
|
+
.dshqw-vision-row{grid-template-columns:minmax(0,1fr) auto auto}
|
|
57700
|
+
.dshqw-key-row input{box-sizing:border-box;display:block;height:32px;max-width:none;min-width:0;width:100%}
|
|
57701
|
+
.dshqw-key-row .dsha-btn{align-items:center;display:inline-flex;height:32px;justify-content:center;min-width:80px;white-space:nowrap}
|
|
57702
|
+
@media(max-width:640px){
|
|
57703
|
+
.dshqw-key-row,.dshqw-vision-row{grid-template-columns:minmax(0,1fr)}
|
|
57704
|
+
.dshqw-key-row .dsha-btn{width:100%}
|
|
57705
|
+
}
|
|
57706
|
+
.dshqw-details{border-top:0.5px solid var(--dsw-alias-border-l2);padding:10px 0 2px}
|
|
57707
|
+
.dshqw-details>summary{color:var(--dsw-alias-label-secondary);cursor:pointer;font-size:12px;list-style:none}
|
|
57708
|
+
.dshqw-details>p{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:1.55;margin:9px 0 0}
|
|
57709
|
+
.dshqw-model-meta{color:var(--dsw-alias-label-tertiary);font-size:11px;margin-left:5px}
|
|
56830
57710
|
`, STYLE_ID);
|
|
56831
57711
|
}
|
|
56832
57712
|
//#endregion
|
|
@@ -60098,7 +60978,7 @@ window.__ModuleLoader__.load({
|
|
|
60098
60978
|
* @module @eddyskywalker/dsh-chatgpt-subscription/client/codemode/CodeRunToolView
|
|
60099
60979
|
*/
|
|
60100
60980
|
function fallbackTranslate(key) {
|
|
60101
|
-
return zh$
|
|
60981
|
+
return zh$16[key] ?? key;
|
|
60102
60982
|
}
|
|
60103
60983
|
function firstLine(text) {
|
|
60104
60984
|
const nl = text.indexOf("\n");
|
|
@@ -60856,36 +61736,36 @@ window.__ModuleLoader__.load({
|
|
|
60856
61736
|
installLineLocale(ctx.locale);
|
|
60857
61737
|
ctx.effect(() => installHostLocaleMirror(ctx.locale), "dsh-chatgpt-subscription: host locale mirror");
|
|
60858
61738
|
installRussianLocale(ctx);
|
|
60859
|
-
ctx.effect(() => ctx.locale.register(NS, dictionaries$
|
|
61739
|
+
ctx.effect(() => ctx.locale.register(NS, dictionaries$16), "dsh-chatgpt-subscription: dictionaries");
|
|
60860
61740
|
ctx.effect(() => installStyles(), "dsh-chatgpt-subscription: styles");
|
|
60861
61741
|
ctx.effect(() => {
|
|
60862
61742
|
installHubStyles();
|
|
60863
61743
|
installModelChecklistStyles();
|
|
60864
61744
|
return () => {};
|
|
60865
61745
|
}, "dsh-chatgpt-subscription: hub styles");
|
|
60866
|
-
ctx.effect(() => ctx.locale.register(NS_CLAUDE, dictionaries$
|
|
61746
|
+
ctx.effect(() => ctx.locale.register(NS_CLAUDE, dictionaries$11), "dsh-claude: dictionaries");
|
|
60867
61747
|
ctx.effect(() => {
|
|
60868
61748
|
installClaudeStyles();
|
|
60869
61749
|
return () => {};
|
|
60870
61750
|
}, "dsh-claude: styles");
|
|
60871
|
-
ctx.effect(() => ctx.locale.register(NS_COMMAND_CODE, dictionaries$
|
|
60872
|
-
ctx.effect(() => ctx.locale.register(NS_KIMI_CODE, dictionaries$
|
|
61751
|
+
ctx.effect(() => ctx.locale.register(NS_COMMAND_CODE, dictionaries$15), "dsh-command-code: dictionaries");
|
|
61752
|
+
ctx.effect(() => ctx.locale.register(NS_KIMI_CODE, dictionaries$14), "dsh-kimi-code: dictionaries");
|
|
60873
61753
|
ctx.effect(() => {
|
|
60874
61754
|
installKimiCodeStyles();
|
|
60875
61755
|
return () => {};
|
|
60876
61756
|
}, "dsh-kimi-code: styles");
|
|
60877
|
-
ctx.effect(() => ctx.locale.register(NS_MINIMAX_CODE, dictionaries$
|
|
61757
|
+
ctx.effect(() => ctx.locale.register(NS_MINIMAX_CODE, dictionaries$13), "dsh-minimax-code: dictionaries");
|
|
60878
61758
|
ctx.effect(() => {
|
|
60879
61759
|
installMinimaxCodeStyles();
|
|
60880
61760
|
return () => {};
|
|
60881
61761
|
}, "dsh-minimax-code: styles");
|
|
60882
|
-
ctx.effect(() => ctx.locale.register(NS_GLM_CODING_PLAN, dictionaries$
|
|
61762
|
+
ctx.effect(() => ctx.locale.register(NS_GLM_CODING_PLAN, dictionaries$12), "dsh-glm-coding-plan: dictionaries");
|
|
60883
61763
|
ctx.effect(() => {
|
|
60884
61764
|
installGlmCodingPlanStyles();
|
|
60885
61765
|
return () => {};
|
|
60886
61766
|
}, "dsh-glm-coding-plan: styles");
|
|
60887
|
-
ctx.effect(() => ctx.locale.register(NS_OLLAMA, dictionaries$
|
|
60888
|
-
ctx.effect(() => ctx.locale.register(NS_ANTIGRAVITY_ACP, dictionaries$
|
|
61767
|
+
ctx.effect(() => ctx.locale.register(NS_OLLAMA, dictionaries$10), "dsh-ollama: dictionaries");
|
|
61768
|
+
ctx.effect(() => ctx.locale.register(NS_ANTIGRAVITY_ACP, dictionaries$9), "dsh-antigravity-acp: dictionaries");
|
|
60889
61769
|
ctx.effect(() => {
|
|
60890
61770
|
installAntigravityAcpStyles();
|
|
60891
61771
|
return () => {};
|
|
@@ -60895,31 +61775,36 @@ window.__ModuleLoader__.load({
|
|
|
60895
61775
|
installProgressUpdatesStyles();
|
|
60896
61776
|
return () => {};
|
|
60897
61777
|
}, "dsh-progress-updates: styles");
|
|
60898
|
-
ctx.effect(() => ctx.locale.register(NS_STEP_CODE, dictionaries$
|
|
61778
|
+
ctx.effect(() => ctx.locale.register(NS_STEP_CODE, dictionaries$8), "dsh-step-code: dictionaries");
|
|
60899
61779
|
ctx.effect(() => {
|
|
60900
61780
|
installStepCodeStyles();
|
|
60901
61781
|
return () => {};
|
|
60902
61782
|
}, "dsh-step-code: styles");
|
|
60903
|
-
ctx.effect(() => ctx.locale.register(NS_CLINE_PASS, dictionaries$
|
|
61783
|
+
ctx.effect(() => ctx.locale.register(NS_CLINE_PASS, dictionaries$7), "dsh-cline-pass: dictionaries");
|
|
60904
61784
|
ctx.effect(() => {
|
|
60905
61785
|
installClinePassStyles();
|
|
60906
61786
|
return () => {};
|
|
60907
61787
|
}, "dsh-cline-pass: styles");
|
|
60908
|
-
ctx.effect(() => ctx.locale.register(NS_QODER, dictionaries$
|
|
61788
|
+
ctx.effect(() => ctx.locale.register(NS_QODER, dictionaries$6), "dsh-qoder: dictionaries");
|
|
60909
61789
|
ctx.effect(() => {
|
|
60910
61790
|
installQoderStyles();
|
|
60911
61791
|
return () => {};
|
|
60912
61792
|
}, "dsh-qoder: styles");
|
|
60913
|
-
ctx.effect(() => ctx.locale.register(NS_OPENDESIGN, dictionaries$
|
|
61793
|
+
ctx.effect(() => ctx.locale.register(NS_OPENDESIGN, dictionaries$5), "dsh-opendesign: dictionaries");
|
|
60914
61794
|
ctx.effect(() => {
|
|
60915
61795
|
installOpenDesignStyles();
|
|
60916
61796
|
return () => {};
|
|
60917
61797
|
}, "dsh-opendesign: styles");
|
|
60918
|
-
ctx.effect(() => ctx.locale.register(NS_WORKBUDDY, dictionaries$
|
|
61798
|
+
ctx.effect(() => ctx.locale.register(NS_WORKBUDDY, dictionaries$4), "dsh-workbuddy: dictionaries");
|
|
60919
61799
|
ctx.effect(() => {
|
|
60920
61800
|
installWorkBuddyStyles();
|
|
60921
61801
|
return () => {};
|
|
60922
61802
|
}, "dsh-workbuddy: styles");
|
|
61803
|
+
ctx.effect(() => ctx.locale.register(NS_QIANWEN, dictionaries$3), "dsh-qianwen-token-plan: dictionaries");
|
|
61804
|
+
ctx.effect(() => {
|
|
61805
|
+
installQianwenStyles();
|
|
61806
|
+
return () => {};
|
|
61807
|
+
}, "dsh-qianwen-token-plan: styles");
|
|
60923
61808
|
ctx.effect(() => ctx.locale.register(NS_SUBAGENT, dictionaries), "dsh-subagent-settings: dictionaries");
|
|
60924
61809
|
ctx.effect(() => ctx.locale.register(NS_DISPATCH_LEDGER, dictionaries$2), "dsh-dispatch-ledger: dictionaries");
|
|
60925
61810
|
ctx.effect(() => {
|
|
@@ -61038,6 +61923,13 @@ window.__ModuleLoader__.load({
|
|
|
61038
61923
|
locale: NS_ANTIGRAVITY_ACP,
|
|
61039
61924
|
inject: (sessionId) => composerBadgeInject(ctx, sessionId)
|
|
61040
61925
|
}, AntigravityAcpComposerBadge));
|
|
61926
|
+
ctx.slots.inject("conversation.input.right", () => ctx.slots.register({
|
|
61927
|
+
name: "conversation.input.right",
|
|
61928
|
+
id: "qianwen-token-plan-quota",
|
|
61929
|
+
order: 49,
|
|
61930
|
+
locale: NS_QIANWEN,
|
|
61931
|
+
inject: (sessionId) => composerBadgeInject(ctx, sessionId)
|
|
61932
|
+
}, QianwenComposerQuota));
|
|
61041
61933
|
ctx.slots.inject("tool.call.toolview", () => ctx.slots.register({
|
|
61042
61934
|
name: "tool.call.toolview",
|
|
61043
61935
|
key: CODEX_IMAGE_TOOL_NAME,
|