@jxgame2020/dsh-token-quota 0.1.11 → 0.1.13
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/lib/client.js +343 -89
- package/lib/index.js +62 -3
- package/lib/types/client/TokenQuotaPanel.d.ts +3 -1
- package/lib/types/client/TokenQuotaPanel.js +36 -2
- package/lib/types/client/index.js +36 -1
- package/lib/types/client/locales.d.ts +24 -0
- package/lib/types/client/locales.js +24 -0
- package/lib/types/client/store.d.ts +24 -0
- package/lib/types/client/store.js +16 -0
- package/lib/types/index.d.ts +10 -0
- package/lib/types/index.js +69 -3
- package/lib/types/types.d.ts +2 -0
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -39,11 +39,19 @@ window.__ModuleLoader__.load({
|
|
|
39
39
|
upgrade: null,
|
|
40
40
|
upgradeDismissed: false,
|
|
41
41
|
checkingUpdates: false,
|
|
42
|
+
lastCheckResult: "idle",
|
|
43
|
+
upgradeError: null,
|
|
42
44
|
dialogOpen: false,
|
|
43
45
|
fullNotice: null,
|
|
44
46
|
reset: null,
|
|
45
47
|
logOpen: false,
|
|
46
|
-
log: null
|
|
48
|
+
log: null,
|
|
49
|
+
logSearch: "",
|
|
50
|
+
logPage: 0,
|
|
51
|
+
logPageSize: 15,
|
|
52
|
+
logClearOpen: false,
|
|
53
|
+
logClearBefore: "",
|
|
54
|
+
logClearing: false
|
|
47
55
|
}),
|
|
48
56
|
actions: {
|
|
49
57
|
setSnapshot: (d, snapshot) => {
|
|
@@ -76,6 +84,12 @@ window.__ModuleLoader__.load({
|
|
|
76
84
|
setCheckingUpdates: (d, checking) => {
|
|
77
85
|
d.checkingUpdates = checking;
|
|
78
86
|
},
|
|
87
|
+
setLastCheckResult: (d, result) => {
|
|
88
|
+
d.lastCheckResult = result;
|
|
89
|
+
},
|
|
90
|
+
setUpgradeError: (d, error) => {
|
|
91
|
+
d.upgradeError = error;
|
|
92
|
+
},
|
|
79
93
|
setDialogOpen: (d, open) => {
|
|
80
94
|
d.dialogOpen = open;
|
|
81
95
|
},
|
|
@@ -90,6 +104,26 @@ window.__ModuleLoader__.load({
|
|
|
90
104
|
},
|
|
91
105
|
setLog: (d, log) => {
|
|
92
106
|
d.log = log;
|
|
107
|
+
},
|
|
108
|
+
setLogSearch: (d, search) => {
|
|
109
|
+
d.logSearch = search;
|
|
110
|
+
d.logPage = 0;
|
|
111
|
+
},
|
|
112
|
+
setLogPage: (d, page) => {
|
|
113
|
+
d.logPage = page;
|
|
114
|
+
},
|
|
115
|
+
setLogPageSize: (d, size) => {
|
|
116
|
+
d.logPageSize = size;
|
|
117
|
+
d.logPage = 0;
|
|
118
|
+
},
|
|
119
|
+
setLogClearOpen: (d, open) => {
|
|
120
|
+
d.logClearOpen = open;
|
|
121
|
+
},
|
|
122
|
+
setLogClearBefore: (d, before) => {
|
|
123
|
+
d.logClearBefore = before;
|
|
124
|
+
},
|
|
125
|
+
setLogClearing: (d, clearing) => {
|
|
126
|
+
d.logClearing = clearing;
|
|
93
127
|
}
|
|
94
128
|
}
|
|
95
129
|
});
|
|
@@ -136,7 +170,7 @@ window.__ModuleLoader__.load({
|
|
|
136
170
|
}
|
|
137
171
|
//#endregion
|
|
138
172
|
//#region \0dsh-css:/Users/jxgame/Desktop/works/deepseek-harness-package/dsh-token-quota/packages/token-quota/src/client/TokenQuotaPanel.module.css.mjs
|
|
139
|
-
const css = ".NPLLIq_panel{box-sizing:border-box;background:var(--dsw-alias-bg-overlay);border:1px solid var(--dsw-alias-border-l1);pointer-events:auto;z-index:40;border-radius:12px;flex-direction:column;width:320px;max-height:min(72vh,560px);display:flex;position:fixed;top:56px;right:12px;overflow:hidden;box-shadow:0 8px 28px #0000002e}.NPLLIq_header{border-bottom:1px solid var(--dsw-alias-border-l1);cursor:grab;user-select:none;touch-action:none;justify-content:space-between;align-items:flex-start;gap:8px;padding:10px 12px;display:flex}.NPLLIq_header:active{cursor:grabbing}.NPLLIq_headerText{flex-direction:column;gap:2px;min-width:0;display:flex}.NPLLIq_title{color:var(--dsw-alias-label-primary);align-items:baseline;gap:6px;font-size:13px;font-weight:600;display:flex}.NPLLIq_version{color:var(--dsw-alias-label-secondary);white-space:nowrap;font-size:10px;font-weight:500}.NPLLIq_versionNew{color:var(--dsw-alias-status-warning-foreground,#b56900);background:var(--dsw-alias-status-warning-background,#fff6d7);cursor:default;border-radius:4px;padding:1px 6px}.NPLLIq_subtitle{color:var(--dsw-alias-label-secondary);font-size:11px}.NPLLIq_collapse{color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:6px;flex:none;padding:2px 6px;font-size:11px}.NPLLIq_collapse:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-1)}.NPLLIq_body{padding:4px 0;overflow-y:auto}.NPLLIq_row{border-bottom:1px solid var(--dsw-alias-border-l1);flex-direction:column;gap:6px;padding:8px 12px;display:flex}.NPLLIq_rowHeader{justify-content:space-between;align-items:center;gap:8px;display:flex}.NPLLIq_rowName{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;align-items:center;gap:6px;font-size:12px;font-weight:500;display:inline-flex;overflow:hidden}.NPLLIq_currentBadge{color:var(--dsw-alias-state-success-primary);border:1px solid var(--dsw-alias-state-success-primary);border-radius:8px;flex:none;padding:1px 6px;font-size:10px}.NPLLIq_rowMeta{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;flex:none;font-size:11px}.NPLLIq_bar{background:var(--dsw-alias-bg-layer-1);border-radius:3px;height:6px;overflow:hidden}.NPLLIq_fillIdle{background:var(--dsw-alias-brand-primary);height:100%;transition:width .2s}.NPLLIq_fillWarn{background:var(--dsw-alias-state-warn-primary);height:100%;transition:width .2s}.NPLLIq_fillOver{background:var(--dsw-alias-state-error-primary);height:100%;transition:width .2s}.NPLLIq_controls{align-items:center;gap:6px;display:flex}.NPLLIq_input{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);min-width:0;color:var(--dsw-alias-label-primary);border-radius:6px;flex:1;padding:4px 8px;font-size:11px}.NPLLIq_input::placeholder{color:var(--dsw-alias-label-secondary)}.NPLLIq_save,.NPLLIq_switch{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);cursor:pointer;border-radius:6px;flex:none;padding:4px 10px;font-size:11px}.NPLLIq_save:hover,.NPLLIq_switch:hover:not(:disabled){background:var(--dsw-alias-bg-layer-2)}.NPLLIq_switch:disabled{opacity:.5;cursor:default}.NPLLIq_notice,.NPLLIq_noticeError{color:var(--dsw-alias-label-secondary);padding:10px 12px;font-size:12px}.NPLLIq_noticeError{color:var(--dsw-alias-state-error-primary)}.NPLLIq_tab{background:var(--dsw-alias-brand-primary);border:1px solid var(--dsw-alias-brand-primary);color:var(--dsw-alias-bg-overlay);pointer-events:auto;cursor:pointer;z-index:90;border-radius:10px;align-items:center;gap:6px;padding:9px 14px;font-size:12px;font-weight:600;display:inline-flex;position:fixed;top:56px;right:12px;box-shadow:0 6px 20px #00000040}.NPLLIq_tab:hover{filter:brightness(1.08)}.NPLLIq_tabIcon{font-size:12px;line-height:1}.NPLLIq_tabLabel{white-space:nowrap}.NPLLIq_headerActions{flex:none;align-items:center;gap:4px;display:flex}.NPLLIq_settingsBtn{color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:6px;flex:none;padding:2px 6px;font-size:11px}.NPLLIq_settingsBtn:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-1)}.NPLLIq_selectBtn{border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-brand-primary);cursor:pointer;background:0 0;border-radius:6px;flex:none;padding:1px 6px;font-size:10px}.NPLLIq_selectBtn:hover{background:var(--dsw-alias-bg-layer-1)}.NPLLIq_gearBtn{color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;flex:none;margin-left:6px;padding:0 2px;font-size:12px;line-height:1}.NPLLIq_gearBtn:hover{color:var(--dsw-alias-label-primary)}.NPLLIq_fullNotice{color:var(--dsw-alias-state-error-primary);background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-state-error-primary);border-radius:8px;margin:6px 12px;padding:8px 10px;font-size:12px}.NPLLIq_upgradeBanner{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-divider-1,#0000001a);border-radius:8px;margin:6px 12px;padding:10px 30px 10px 10px;font-size:12px;position:relative}.NPLLIq_upgradeBannerText{margin-bottom:6px;font-weight:600}.NPLLIq_upgradeCommands{flex-direction:column;gap:4px;display:flex}.NPLLIq_upgradeCommandRow{align-items:center;gap:6px;display:flex}.NPLLIq_upgradeCommand{background:var(--dsw-alias-bg-layer-2,#0000000a);white-space:nowrap;border-radius:4px;flex:1;min-width:0;padding:4px 6px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11px;overflow-x:auto}.NPLLIq_copyBtn{border:1px solid var(--dsw-alias-divider-1,#00000026);background:var(--dsw-alias-bg-layer-2,#0000000a);color:var(--dsw-alias-label-primary);cursor:pointer;border-radius:4px;flex:none;padding:3px 8px;font-size:11px}.NPLLIq_copyBtn:hover{background:var(--dsw-alias-bg-layer-3,#00000014)}.NPLLIq_upgradeHint{color:var(--dsw-alias-label-secondary);margin-top:6px;font-size:11px}.NPLLIq_upgradeClose{width:20px;height:20px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:4px;font-size:16px;line-height:1;position:absolute;top:4px;right:6px}.NPLLIq_upgradeClose:hover{background:var(--dsw-alias-bg-layer-2,#0000000a);color:var(--dsw-alias-label-primary)}.NPLLIq_checkUpdatesRow{align-items:center;gap:8px;margin-top:8px;display:flex}.NPLLIq_checkBtn{border:1px solid var(--dsw-alias-divider-1,#00000026);background:var(--dsw-alias-bg-layer-2,#0000000a);color:var(--dsw-alias-label-primary);cursor:pointer;border-radius:4px;padding:4px 10px;font-size:12px}.NPLLIq_checkBtn:hover:not(:disabled){background:var(--dsw-alias-bg-layer-3,#00000014)}.NPLLIq_checkBtn:disabled{opacity:.6;cursor:default}.NPLLIq_dialog{z-index:100;box-sizing:border-box;background:var(--dsw-alias-bg-overlay);border:1px solid var(--dsw-alias-border-l1);border-radius:12px;flex-direction:column;gap:12px;width:280px;max-height:80vh;padding:14px;display:flex;position:fixed;top:50%;left:50%;overflow-y:auto;transform:translate(-50%,-50%);box-shadow:0 8px 28px #00000040}.NPLLIq_dialogTitle{color:var(--dsw-alias-label-primary);font-size:13px;font-weight:600}.NPLLIq_dialogSection{flex-direction:column;gap:6px;display:flex}.NPLLIq_dialogLabel{color:var(--dsw-alias-label-primary);font-size:12px;font-weight:500}.NPLLIq_monitorHint{color:var(--dsw-alias-label-secondary);font-size:11px}.NPLLIq_monitorList{flex-direction:column;gap:2px;max-height:180px;display:flex;overflow-y:auto}.NPLLIq_monitorRow{color:var(--dsw-alias-label-primary);cursor:pointer;border-radius:6px;align-items:center;gap:6px;padding:2px 4px;font-size:12px;display:flex}.NPLLIq_monitorRow:hover{background:var(--dsw-alias-bg-layer-1)}.NPLLIq_monitorName{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.NPLLIq_radioRow{color:var(--dsw-alias-label-primary);cursor:pointer;border-radius:6px;align-items:center;gap:6px;padding:3px 4px;font-size:12px;display:flex}.NPLLIq_radioRow:hover{background:var(--dsw-alias-bg-layer-1)}.NPLLIq_dialogActions{justify-content:flex-end;gap:6px;display:flex}.NPLLIq_dialogBtn,.NPLLIq_dialogBtnPrimary{border:1px solid var(--dsw-alias-border-l1);cursor:pointer;border-radius:6px;padding:4px 12px;font-size:11px}.NPLLIq_dialogBtn{background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary)}.NPLLIq_dialogBtnPrimary{background:var(--dsw-alias-brand-primary);border-color:var(--dsw-alias-brand-primary);color:var(--dsw-alias-bg-overlay)}.NPLLIq_dialogHeader{z-index:2;background:var(--dsw-alias-bg-overlay);cursor:grab;user-select:none;touch-action:none;justify-content:space-between;align-items:center;gap:8px;margin:-14px -14px 0;padding:14px 14px 8px;display:flex;position:sticky;top:-14px}.NPLLIq_dialogHeader:active{cursor:grabbing}.NPLLIq_dialogClose{width:28px;height:28px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:8px;flex:none;justify-content:center;align-items:center;font-size:18px;line-height:1;display:flex}.NPLLIq_dialogClose:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-1)}.NPLLIq_resetRow{flex-wrap:wrap;align-items:center;gap:6px;display:flex}.NPLLIq_resetSelect{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);border-radius:6px;padding:3px 6px;font-size:12px}.NPLLIq_logTable{border-collapse:collapse;width:100%;font-size:11px}.NPLLIq_logTable th{text-align:left;color:var(--dsw-alias-label-secondary);border-bottom:1px solid var(--dsw-alias-border-l1);padding:4px 6px;font-weight:500}.NPLLIq_logTable td{color:var(--dsw-alias-label-primary);border-bottom:1px solid var(--dsw-alias-border-l1);font-variant-numeric:tabular-nums;padding:4px 6px}.NPLLIq_logDayCol{white-space:nowrap;color:var(--dsw-alias-label-secondary)}.NPLLIq_logModelCol{text-overflow:ellipsis;white-space:nowrap;max-width:160px;overflow:hidden}.NPLLIq_logUsedCol{text-align:right}.NPLLIq_logDialog{gap:0;width:380px;max-height:min(72vh,480px);padding:0}.NPLLIq_logHeader{background:var(--dsw-alias-bg-overlay);cursor:grab;user-select:none;touch-action:none;flex:none;justify-content:space-between;align-items:center;gap:8px;padding:14px 14px 8px;display:flex}.NPLLIq_logHeader:active{cursor:grabbing}.NPLLIq_logScroll{flex:1;min-height:0;padding:0 14px 14px;overflow:auto}";
|
|
173
|
+
const css = ".NPLLIq_panel{box-sizing:border-box;background:var(--dsw-alias-bg-overlay);border:1px solid var(--dsw-alias-border-l1);pointer-events:auto;z-index:40;border-radius:12px;flex-direction:column;width:320px;max-height:min(72vh,560px);display:flex;position:fixed;top:56px;right:12px;overflow:hidden;box-shadow:0 8px 28px #0000002e}.NPLLIq_header{border-bottom:1px solid var(--dsw-alias-border-l1);cursor:grab;user-select:none;touch-action:none;justify-content:space-between;align-items:flex-start;gap:8px;padding:10px 12px;display:flex}.NPLLIq_header:active{cursor:grabbing}.NPLLIq_headerText{flex-direction:column;gap:2px;min-width:0;display:flex}.NPLLIq_title{color:var(--dsw-alias-label-primary);align-items:baseline;gap:6px;font-size:13px;font-weight:600;display:flex}.NPLLIq_version{color:var(--dsw-alias-label-secondary);white-space:nowrap;font-size:10px;font-weight:500}.NPLLIq_versionNew{color:var(--dsw-alias-status-warning-foreground,#b56900);background:var(--dsw-alias-status-warning-background,#fff6d7);cursor:default;border-radius:4px;padding:1px 6px}.NPLLIq_subtitle{color:var(--dsw-alias-label-secondary);font-size:11px}.NPLLIq_collapse{color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:6px;flex:none;padding:2px 6px;font-size:11px}.NPLLIq_collapse:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-1)}.NPLLIq_body{padding:4px 0;overflow-y:auto}.NPLLIq_row{border-bottom:1px solid var(--dsw-alias-border-l1);flex-direction:column;gap:6px;padding:8px 12px;display:flex}.NPLLIq_rowHeader{justify-content:space-between;align-items:center;gap:8px;display:flex}.NPLLIq_rowName{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;align-items:center;gap:6px;font-size:12px;font-weight:500;display:inline-flex;overflow:hidden}.NPLLIq_currentBadge{color:var(--dsw-alias-state-success-primary);border:1px solid var(--dsw-alias-state-success-primary);border-radius:8px;flex:none;padding:1px 6px;font-size:10px}.NPLLIq_rowMeta{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;flex:none;font-size:11px}.NPLLIq_bar{background:var(--dsw-alias-bg-layer-1);border-radius:3px;height:6px;overflow:hidden}.NPLLIq_fillIdle{background:var(--dsw-alias-brand-primary);height:100%;transition:width .2s}.NPLLIq_fillWarn{background:var(--dsw-alias-state-warn-primary);height:100%;transition:width .2s}.NPLLIq_fillOver{background:var(--dsw-alias-state-error-primary);height:100%;transition:width .2s}.NPLLIq_controls{align-items:center;gap:6px;display:flex}.NPLLIq_input{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);min-width:0;color:var(--dsw-alias-label-primary);border-radius:6px;flex:1;padding:4px 8px;font-size:11px}.NPLLIq_input::placeholder{color:var(--dsw-alias-label-secondary)}.NPLLIq_save,.NPLLIq_switch{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);cursor:pointer;border-radius:6px;flex:none;padding:4px 10px;font-size:11px}.NPLLIq_save:hover,.NPLLIq_switch:hover:not(:disabled){background:var(--dsw-alias-bg-layer-2)}.NPLLIq_switch:disabled{opacity:.5;cursor:default}.NPLLIq_notice,.NPLLIq_noticeError{color:var(--dsw-alias-label-secondary);padding:10px 12px;font-size:12px}.NPLLIq_noticeError{color:var(--dsw-alias-state-error-primary)}.NPLLIq_tab{background:var(--dsw-alias-brand-primary);border:1px solid var(--dsw-alias-brand-primary);color:var(--dsw-alias-bg-overlay);pointer-events:auto;cursor:pointer;z-index:90;border-radius:10px;align-items:center;gap:6px;padding:9px 14px;font-size:12px;font-weight:600;display:inline-flex;position:fixed;top:56px;right:12px;box-shadow:0 6px 20px #00000040}.NPLLIq_tab:hover{filter:brightness(1.08)}.NPLLIq_tabIcon{font-size:12px;line-height:1}.NPLLIq_tabLabel{white-space:nowrap}.NPLLIq_headerActions{flex:none;align-items:center;gap:4px;display:flex}.NPLLIq_settingsBtn{color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:6px;flex:none;padding:2px 6px;font-size:11px}.NPLLIq_settingsBtn:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-1)}.NPLLIq_selectBtn{border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-brand-primary);cursor:pointer;background:0 0;border-radius:6px;flex:none;padding:1px 6px;font-size:10px}.NPLLIq_selectBtn:hover{background:var(--dsw-alias-bg-layer-1)}.NPLLIq_gearBtn{color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;flex:none;margin-left:6px;padding:0 2px;font-size:12px;line-height:1}.NPLLIq_gearBtn:hover{color:var(--dsw-alias-label-primary)}.NPLLIq_fullNotice{color:var(--dsw-alias-state-error-primary);background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-state-error-primary);border-radius:8px;margin:6px 12px;padding:8px 10px;font-size:12px}.NPLLIq_upgradeBanner{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-divider-1,#0000001a);border-radius:8px;margin:6px 12px;padding:10px 30px 10px 10px;font-size:12px;position:relative}.NPLLIq_upgradeBannerText{margin-bottom:6px;font-weight:600}.NPLLIq_upgradeCommands{flex-direction:column;gap:4px;display:flex}.NPLLIq_upgradeCommandRow{align-items:center;gap:6px;display:flex}.NPLLIq_upgradeCommand{background:var(--dsw-alias-bg-layer-2,#0000000a);white-space:nowrap;border-radius:4px;flex:1;min-width:0;padding:4px 6px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11px;overflow-x:auto}.NPLLIq_copyBtn{border:1px solid var(--dsw-alias-divider-1,#00000026);background:var(--dsw-alias-bg-layer-2,#0000000a);color:var(--dsw-alias-label-primary);cursor:pointer;border-radius:4px;flex:none;padding:3px 8px;font-size:11px}.NPLLIq_copyBtn:hover{background:var(--dsw-alias-bg-layer-3,#00000014)}.NPLLIq_upgradeHint{color:var(--dsw-alias-label-secondary);margin-top:6px;font-size:11px}.NPLLIq_upgradeClose{width:20px;height:20px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:4px;font-size:16px;line-height:1;position:absolute;top:4px;right:6px}.NPLLIq_upgradeClose:hover{background:var(--dsw-alias-bg-layer-2,#0000000a);color:var(--dsw-alias-label-primary)}.NPLLIq_checkUpdatesRow{justify-content:space-between;align-items:center;gap:12px;display:flex}.NPLLIq_checkUpdatesLabel{color:var(--dsw-alias-label-primary);cursor:pointer;align-items:center;gap:6px;font-size:12px;display:flex}.NPLLIq_checkUpdatesLabel input{margin:0}.NPLLIq_checkBtn{border:1px solid var(--dsw-alias-divider-1,#00000026);background:var(--dsw-alias-bg-layer-2,#0000000a);color:var(--dsw-alias-label-primary);cursor:pointer;white-space:nowrap;text-align:center;border-radius:4px;flex:none;min-width:72px;padding:4px 10px;font-size:12px}.NPLLIq_checkBtn:hover:not(:disabled){background:var(--dsw-alias-bg-layer-3,#00000014)}.NPLLIq_checkBtn:disabled{opacity:.6;cursor:default}.NPLLIq_checkErrorHint{color:var(--dsw-alias-state-error-primary,#c00);background:var(--dsw-alias-state-error-background,#ff00000f);border:1px solid var(--dsw-alias-state-error-border,#b4000040);word-break:break-all;border-radius:6px;margin-top:8px;padding:6px 8px;font-size:11px;line-height:1.4}.NPLLIq_dialog{z-index:100;box-sizing:border-box;background:var(--dsw-alias-bg-overlay);border:1px solid var(--dsw-alias-border-l1);border-radius:12px;flex-direction:column;gap:12px;width:280px;max-height:80vh;padding:14px;display:flex;position:fixed;top:50%;left:50%;overflow-y:auto;transform:translate(-50%,-50%);box-shadow:0 8px 28px #00000040}.NPLLIq_dialogTitle{color:var(--dsw-alias-label-primary);font-size:13px;font-weight:600}.NPLLIq_dialogSection{flex-direction:column;gap:6px;display:flex}.NPLLIq_dialogLabel{color:var(--dsw-alias-label-primary);font-size:12px;font-weight:500}.NPLLIq_monitorHint{color:var(--dsw-alias-label-secondary);font-size:11px}.NPLLIq_monitorList{flex-direction:column;gap:2px;max-height:180px;display:flex;overflow-y:auto}.NPLLIq_monitorRow{color:var(--dsw-alias-label-primary);cursor:pointer;border-radius:6px;align-items:center;gap:6px;padding:2px 4px;font-size:12px;display:flex}.NPLLIq_monitorRow:hover{background:var(--dsw-alias-bg-layer-1)}.NPLLIq_monitorName{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.NPLLIq_radioRow{color:var(--dsw-alias-label-primary);cursor:pointer;border-radius:6px;align-items:center;gap:6px;padding:3px 4px;font-size:12px;display:flex}.NPLLIq_radioRow:hover{background:var(--dsw-alias-bg-layer-1)}.NPLLIq_dialogActions{justify-content:flex-end;gap:6px;display:flex}.NPLLIq_dialogBtn,.NPLLIq_dialogBtnPrimary{border:1px solid var(--dsw-alias-border-l1);cursor:pointer;border-radius:6px;padding:4px 12px;font-size:11px}.NPLLIq_dialogBtn{background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary)}.NPLLIq_dialogBtnPrimary{background:var(--dsw-alias-brand-primary);border-color:var(--dsw-alias-brand-primary);color:var(--dsw-alias-bg-overlay)}.NPLLIq_dialogHeader{z-index:2;background:var(--dsw-alias-bg-overlay);cursor:grab;user-select:none;touch-action:none;justify-content:space-between;align-items:center;gap:8px;margin:-14px -14px 0;padding:14px 14px 8px;display:flex;position:sticky;top:-14px}.NPLLIq_dialogHeader:active{cursor:grabbing}.NPLLIq_dialogClose{width:28px;height:28px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:8px;flex:none;justify-content:center;align-items:center;font-size:18px;line-height:1;display:flex}.NPLLIq_dialogClose:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-1)}.NPLLIq_resetRow{flex-wrap:wrap;align-items:center;gap:6px;display:flex}.NPLLIq_resetSelect{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);border-radius:6px;padding:3px 6px;font-size:12px}.NPLLIq_logTable{border-collapse:collapse;width:100%;font-size:11px}.NPLLIq_logTable th{text-align:left;color:var(--dsw-alias-label-secondary);border-bottom:1px solid var(--dsw-alias-border-l1);padding:4px 6px;font-weight:500}.NPLLIq_logTable td{color:var(--dsw-alias-label-primary);border-bottom:1px solid var(--dsw-alias-border-l1);font-variant-numeric:tabular-nums;padding:4px 6px}.NPLLIq_logDayCol{white-space:nowrap;color:var(--dsw-alias-label-secondary)}.NPLLIq_logModelCol{text-overflow:ellipsis;white-space:nowrap;max-width:160px;overflow:hidden}.NPLLIq_logUsedCol{text-align:right}.NPLLIq_logDialog{gap:0;width:380px;max-height:min(72vh,480px);padding:0}.NPLLIq_logHeader{background:var(--dsw-alias-bg-overlay);cursor:grab;user-select:none;touch-action:none;flex:none;justify-content:space-between;align-items:center;gap:8px;padding:14px 14px 8px;display:flex}.NPLLIq_logHeader:active{cursor:grabbing}.NPLLIq_logScroll{flex:1;min-height:0;padding:0 14px 14px;overflow:auto}.NPLLIq_logToolbar{flex:1;align-items:center;gap:6px;display:flex}.NPLLIq_logSearch{border:1px solid var(--dsw-alias-divider-1,#00000026);background:var(--dsw-alias-bg-layer-1,#0000000a);min-width:0;color:var(--dsw-alias-label-primary);border-radius:4px;flex:1;padding:3px 6px;font-size:11px}.NPLLIq_logSearch:focus{border-color:var(--dsw-alias-accent-1,#4a9eff);outline:none}.NPLLIq_logClearBtn{border:1px solid var(--dsw-alias-state-error-border,#b400004d);color:var(--dsw-alias-state-error-primary,#c00);cursor:pointer;white-space:nowrap;background:0 0;border-radius:4px;flex:none;padding:3px 8px;font-size:11px}.NPLLIq_logClearBtn:hover{background:var(--dsw-alias-state-error-background,#ff00000f)}.NPLLIq_logPager{border-top:1px solid var(--dsw-alias-divider-1,#00000014);background:var(--dsw-alias-bg-overlay);color:var(--dsw-alias-label-secondary);flex:none;justify-content:space-between;align-items:center;gap:8px;padding:6px 14px;font-size:11px;display:flex}.NPLLIq_logPagerInfo{white-space:nowrap}.NPLLIq_logPagerControls{align-items:center;gap:4px;display:flex}.NPLLIq_logPagerBtn{border:1px solid var(--dsw-alias-divider-1,#00000026);background:var(--dsw-alias-bg-layer-1,#0000000a);width:24px;height:24px;color:var(--dsw-alias-label-primary);cursor:pointer;border-radius:4px;font-size:13px;line-height:1}.NPLLIq_logPagerBtn:disabled{opacity:.4;cursor:default}.NPLLIq_logPagerPages{text-align:center;min-width:50px;color:var(--dsw-alias-label-secondary)}.NPLLIq_logPageSizeSelect{border:1px solid var(--dsw-alias-divider-1,#00000026);background:var(--dsw-alias-bg-layer-1,#0000000a);color:var(--dsw-alias-label-primary);cursor:pointer;border-radius:4px;padding:2px 4px;font-size:11px}.NPLLIq_dialogOverlay{z-index:100001;background:#0000004d;justify-content:center;align-items:center;display:flex;position:fixed;inset:0}.NPLLIq_logClearDialog{gap:0;width:320px;padding:16px}.NPLLIq_dialogBody{color:var(--dsw-alias-label-secondary);margin:6px 0 10px;font-size:12px;line-height:1.5}.NPLLIq_logClearDate{border:1px solid var(--dsw-alias-divider-1,#00000026);background:var(--dsw-alias-bg-layer-1,#0000000a);width:100%;color:var(--dsw-alias-label-primary);border-radius:6px;margin-bottom:12px;padding:6px 8px;font-size:13px}.NPLLIq_logClearDate:focus{border-color:var(--dsw-alias-accent-1,#4a9eff);outline:none}";
|
|
140
174
|
const tagId = "@jxgame2020/dsh-token-quota/TokenQuotaPanel.module.css";
|
|
141
175
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
142
176
|
const tag = document.createElement("style");
|
|
@@ -146,71 +180,86 @@ window.__ModuleLoader__.load({
|
|
|
146
180
|
document.head.appendChild(tag);
|
|
147
181
|
}
|
|
148
182
|
var TokenQuotaPanel_module_css_default = {
|
|
149
|
-
"
|
|
150
|
-
"
|
|
151
|
-
"
|
|
152
|
-
"
|
|
153
|
-
"
|
|
154
|
-
"
|
|
155
|
-
"
|
|
156
|
-
"
|
|
157
|
-
"
|
|
158
|
-
"
|
|
159
|
-
"
|
|
160
|
-
"dialogBtn": "NPLLIq_dialogBtn",
|
|
161
|
-
"checkUpdatesRow": "NPLLIq_checkUpdatesRow",
|
|
183
|
+
"logPager": "NPLLIq_logPager",
|
|
184
|
+
"checkUpdatesLabel": "NPLLIq_checkUpdatesLabel",
|
|
185
|
+
"dialogHeader": "NPLLIq_dialogHeader",
|
|
186
|
+
"resetRow": "NPLLIq_resetRow",
|
|
187
|
+
"logSearch": "NPLLIq_logSearch",
|
|
188
|
+
"upgradeHint": "NPLLIq_upgradeHint",
|
|
189
|
+
"settingsBtn": "NPLLIq_settingsBtn",
|
|
190
|
+
"monitorRow": "NPLLIq_monitorRow",
|
|
191
|
+
"dialogBody": "NPLLIq_dialogBody",
|
|
192
|
+
"logHeader": "NPLLIq_logHeader",
|
|
193
|
+
"save": "NPLLIq_save",
|
|
162
194
|
"currentBadge": "NPLLIq_currentBadge",
|
|
195
|
+
"upgradeCommands": "NPLLIq_upgradeCommands",
|
|
196
|
+
"switch": "NPLLIq_switch",
|
|
197
|
+
"collapse": "NPLLIq_collapse",
|
|
198
|
+
"checkErrorHint": "NPLLIq_checkErrorHint",
|
|
163
199
|
"header": "NPLLIq_header",
|
|
164
|
-
"
|
|
165
|
-
"
|
|
166
|
-
"
|
|
167
|
-
"
|
|
200
|
+
"input": "NPLLIq_input",
|
|
201
|
+
"upgradeBannerText": "NPLLIq_upgradeBannerText",
|
|
202
|
+
"fillOver": "NPLLIq_fillOver",
|
|
203
|
+
"title": "NPLLIq_title",
|
|
204
|
+
"row": "NPLLIq_row",
|
|
168
205
|
"selectBtn": "NPLLIq_selectBtn",
|
|
169
|
-
"
|
|
170
|
-
"
|
|
171
|
-
"
|
|
172
|
-
"
|
|
173
|
-
"settingsBtn": "NPLLIq_settingsBtn",
|
|
206
|
+
"copyBtn": "NPLLIq_copyBtn",
|
|
207
|
+
"checkBtn": "NPLLIq_checkBtn",
|
|
208
|
+
"dialogClose": "NPLLIq_dialogClose",
|
|
209
|
+
"logDayCol": "NPLLIq_logDayCol",
|
|
174
210
|
"upgradeBanner": "NPLLIq_upgradeBanner",
|
|
175
|
-
"rowName": "NPLLIq_rowName",
|
|
176
|
-
"dialogLabel": "NPLLIq_dialogLabel",
|
|
177
|
-
"fillIdle": "NPLLIq_fillIdle",
|
|
178
211
|
"dialogActions": "NPLLIq_dialogActions",
|
|
179
|
-
"collapse": "NPLLIq_collapse",
|
|
180
|
-
"panel": "NPLLIq_panel",
|
|
181
|
-
"resetSelect": "NPLLIq_resetSelect",
|
|
182
|
-
"fillWarn": "NPLLIq_fillWarn",
|
|
183
|
-
"fullNotice": "NPLLIq_fullNotice",
|
|
184
|
-
"monitorName": "NPLLIq_monitorName",
|
|
185
|
-
"switch": "NPLLIq_switch",
|
|
186
|
-
"dialogBtnPrimary": "NPLLIq_dialogBtnPrimary",
|
|
187
212
|
"versionNew": "NPLLIq_versionNew",
|
|
188
|
-
"
|
|
189
|
-
"
|
|
213
|
+
"checkUpdatesRow": "NPLLIq_checkUpdatesRow",
|
|
214
|
+
"dialogLabel": "NPLLIq_dialogLabel",
|
|
215
|
+
"monitorHint": "NPLLIq_monitorHint",
|
|
190
216
|
"bar": "NPLLIq_bar",
|
|
191
|
-
"noticeError": "NPLLIq_noticeError",
|
|
192
|
-
"tabLabel": "NPLLIq_tabLabel",
|
|
193
|
-
"dialogTitle": "NPLLIq_dialogTitle",
|
|
194
|
-
"headerActions": "NPLLIq_headerActions",
|
|
195
|
-
"upgradeCommands": "NPLLIq_upgradeCommands",
|
|
196
|
-
"upgradeBannerText": "NPLLIq_upgradeBannerText",
|
|
197
|
-
"upgradeHint": "NPLLIq_upgradeHint",
|
|
198
|
-
"save": "NPLLIq_save",
|
|
199
217
|
"version": "NPLLIq_version",
|
|
218
|
+
"notice": "NPLLIq_notice",
|
|
219
|
+
"logToolbar": "NPLLIq_logToolbar",
|
|
220
|
+
"logUsedCol": "NPLLIq_logUsedCol",
|
|
221
|
+
"logPagerControls": "NPLLIq_logPagerControls",
|
|
222
|
+
"dialog": "NPLLIq_dialog",
|
|
223
|
+
"logClearDialog": "NPLLIq_logClearDialog",
|
|
200
224
|
"rowHeader": "NPLLIq_rowHeader",
|
|
201
|
-
"
|
|
202
|
-
"
|
|
225
|
+
"fillWarn": "NPLLIq_fillWarn",
|
|
226
|
+
"noticeError": "NPLLIq_noticeError",
|
|
227
|
+
"logModelCol": "NPLLIq_logModelCol",
|
|
203
228
|
"logDialog": "NPLLIq_logDialog",
|
|
204
|
-
"
|
|
205
|
-
"
|
|
206
|
-
"
|
|
229
|
+
"rowMeta": "NPLLIq_rowMeta",
|
|
230
|
+
"logClearBtn": "NPLLIq_logClearBtn",
|
|
231
|
+
"monitorName": "NPLLIq_monitorName",
|
|
232
|
+
"logPagerBtn": "NPLLIq_logPagerBtn",
|
|
233
|
+
"dialogSection": "NPLLIq_dialogSection",
|
|
234
|
+
"radioRow": "NPLLIq_radioRow",
|
|
235
|
+
"monitorList": "NPLLIq_monitorList",
|
|
236
|
+
"logPagerInfo": "NPLLIq_logPagerInfo",
|
|
237
|
+
"panel": "NPLLIq_panel",
|
|
238
|
+
"logTable": "NPLLIq_logTable",
|
|
239
|
+
"logPagerPages": "NPLLIq_logPagerPages",
|
|
207
240
|
"gearBtn": "NPLLIq_gearBtn",
|
|
208
|
-
"
|
|
241
|
+
"dialogBtn": "NPLLIq_dialogBtn",
|
|
242
|
+
"controls": "NPLLIq_controls",
|
|
209
243
|
"logScroll": "NPLLIq_logScroll",
|
|
210
|
-
"
|
|
211
|
-
"
|
|
212
|
-
"
|
|
213
|
-
"
|
|
244
|
+
"upgradeClose": "NPLLIq_upgradeClose",
|
|
245
|
+
"resetSelect": "NPLLIq_resetSelect",
|
|
246
|
+
"logPageSizeSelect": "NPLLIq_logPageSizeSelect",
|
|
247
|
+
"rowName": "NPLLIq_rowName",
|
|
248
|
+
"tabLabel": "NPLLIq_tabLabel",
|
|
249
|
+
"tab": "NPLLIq_tab",
|
|
250
|
+
"fillIdle": "NPLLIq_fillIdle",
|
|
251
|
+
"headerText": "NPLLIq_headerText",
|
|
252
|
+
"tabIcon": "NPLLIq_tabIcon",
|
|
253
|
+
"dialogTitle": "NPLLIq_dialogTitle",
|
|
254
|
+
"body": "NPLLIq_body",
|
|
255
|
+
"upgradeCommandRow": "NPLLIq_upgradeCommandRow",
|
|
256
|
+
"dialogOverlay": "NPLLIq_dialogOverlay",
|
|
257
|
+
"subtitle": "NPLLIq_subtitle",
|
|
258
|
+
"headerActions": "NPLLIq_headerActions",
|
|
259
|
+
"upgradeCommand": "NPLLIq_upgradeCommand",
|
|
260
|
+
"dialogBtnPrimary": "NPLLIq_dialogBtnPrimary",
|
|
261
|
+
"logClearDate": "NPLLIq_logClearDate",
|
|
262
|
+
"fullNotice": "NPLLIq_fullNotice"
|
|
214
263
|
};
|
|
215
264
|
//#endregion
|
|
216
265
|
//#region lib/types/client/TokenQuotaPanel.js
|
|
@@ -297,7 +346,7 @@ window.__ModuleLoader__.load({
|
|
|
297
346
|
* @param props - composed slot props.
|
|
298
347
|
* @returns the panel element tree.
|
|
299
348
|
*/
|
|
300
|
-
function TokenQuotaPanel({ t, load, setLimit, selectModel, setMonitored, setOnFull, setReset, setCheckUpdates, checkUpdatesNow, useStore, actions, useSessions }) {
|
|
349
|
+
function TokenQuotaPanel({ t, load, setLimit, selectModel, setMonitored, setOnFull, setReset, setCheckUpdates, checkUpdatesNow, clearLogBefore, useStore, actions, useSessions }) {
|
|
301
350
|
const [collapsed, setCollapsed] = (0, react.useState)(false);
|
|
302
351
|
const [drafts, setDrafts] = (0, react.useState)({});
|
|
303
352
|
const [editingKey, setEditingKey] = (0, react.useState)(null);
|
|
@@ -323,10 +372,18 @@ window.__ModuleLoader__.load({
|
|
|
323
372
|
const upgrade = useStore((s) => s.upgrade);
|
|
324
373
|
const upgradeDismissed = useStore((s) => s.upgradeDismissed);
|
|
325
374
|
const checkingUpdates = useStore((s) => s.checkingUpdates);
|
|
375
|
+
const lastCheckResult = useStore((s) => s.lastCheckResult);
|
|
376
|
+
const upgradeError = useStore((s) => s.upgradeError);
|
|
326
377
|
const reset = useStore((s) => s.reset);
|
|
327
378
|
const dialogOpen = useStore((s) => s.dialogOpen);
|
|
328
379
|
const logOpen = useStore((s) => s.logOpen);
|
|
329
380
|
const log = useStore((s) => s.log);
|
|
381
|
+
const logSearch = useStore((s) => s.logSearch);
|
|
382
|
+
const logPage = useStore((s) => s.logPage);
|
|
383
|
+
const logPageSize = useStore((s) => s.logPageSize);
|
|
384
|
+
const logClearOpen = useStore((s) => s.logClearOpen);
|
|
385
|
+
const logClearBefore = useStore((s) => s.logClearBefore);
|
|
386
|
+
const logClearing = useStore((s) => s.logClearing);
|
|
330
387
|
const fullNotice = useStore((s) => s.fullNotice);
|
|
331
388
|
const loading = useStore((s) => s.loading);
|
|
332
389
|
const error = useStore((s) => s.error);
|
|
@@ -343,6 +400,22 @@ window.__ModuleLoader__.load({
|
|
|
343
400
|
name: model.name
|
|
344
401
|
}))).sort((a, b) => a.key.localeCompare(b.key)), [groups]);
|
|
345
402
|
const isMonitoredKey = (key) => monitored === null || monitored.includes(key);
|
|
403
|
+
const filteredLogEntries = (0, react.useMemo)(() => {
|
|
404
|
+
if (log === null) return [];
|
|
405
|
+
const q = logSearch.trim().toLowerCase();
|
|
406
|
+
if (q === "") return log.entries;
|
|
407
|
+
return log.entries.filter((e) => e.key.toLowerCase().includes(q) || e.provider.toLowerCase().includes(q) || e.model.toLowerCase().includes(q));
|
|
408
|
+
}, [log, logSearch]);
|
|
409
|
+
const logTotalPages = Math.max(1, Math.ceil(filteredLogEntries.length / logPageSize));
|
|
410
|
+
const logCurrentPage = Math.min(logPage, logTotalPages - 1);
|
|
411
|
+
const logPageEntries = (0, react.useMemo)(() => {
|
|
412
|
+
const start = logCurrentPage * logPageSize;
|
|
413
|
+
return filteredLogEntries.slice(start, start + logPageSize);
|
|
414
|
+
}, [
|
|
415
|
+
filteredLogEntries,
|
|
416
|
+
logCurrentPage,
|
|
417
|
+
logPageSize
|
|
418
|
+
]);
|
|
346
419
|
/** Copy text to the clipboard (clipboard API with execCommand fallback). */
|
|
347
420
|
const copyToClipboard = async (text) => {
|
|
348
421
|
try {
|
|
@@ -433,13 +506,13 @@ window.__ModuleLoader__.load({
|
|
|
433
506
|
title: t("upgradeAvailableHint"),
|
|
434
507
|
children: [
|
|
435
508
|
"v",
|
|
436
|
-
"0.1.
|
|
509
|
+
"0.1.13",
|
|
437
510
|
" → v",
|
|
438
511
|
upgrade.latestVersion
|
|
439
512
|
]
|
|
440
513
|
}) : (0, react_jsx_runtime.jsxs)("span", {
|
|
441
514
|
className: TokenQuotaPanel_module_css_default.version,
|
|
442
|
-
children: ["v", "0.1.
|
|
515
|
+
children: ["v", "0.1.13"]
|
|
443
516
|
})]
|
|
444
517
|
}), (0, react_jsx_runtime.jsx)("div", {
|
|
445
518
|
className: TokenQuotaPanel_module_css_default.subtitle,
|
|
@@ -762,24 +835,28 @@ window.__ModuleLoader__.load({
|
|
|
762
835
|
}),
|
|
763
836
|
(0, react_jsx_runtime.jsxs)("div", {
|
|
764
837
|
className: TokenQuotaPanel_module_css_default.dialogSection,
|
|
765
|
-
children: [(0, react_jsx_runtime.jsxs)("
|
|
766
|
-
className: TokenQuotaPanel_module_css_default.radioRow,
|
|
767
|
-
children: [(0, react_jsx_runtime.jsx)("input", {
|
|
768
|
-
type: "checkbox",
|
|
769
|
-
checked: checkUpdates,
|
|
770
|
-
onChange: (event) => {
|
|
771
|
-
setCheckUpdates(event.target.checked);
|
|
772
|
-
}
|
|
773
|
-
}), (0, react_jsx_runtime.jsx)("span", { children: t("checkUpdatesLabel") })]
|
|
774
|
-
}), (0, react_jsx_runtime.jsx)("div", {
|
|
838
|
+
children: [(0, react_jsx_runtime.jsxs)("div", {
|
|
775
839
|
className: TokenQuotaPanel_module_css_default.checkUpdatesRow,
|
|
776
|
-
children: (0, react_jsx_runtime.
|
|
840
|
+
children: [(0, react_jsx_runtime.jsxs)("label", {
|
|
841
|
+
className: TokenQuotaPanel_module_css_default.checkUpdatesLabel,
|
|
842
|
+
children: [(0, react_jsx_runtime.jsx)("input", {
|
|
843
|
+
type: "checkbox",
|
|
844
|
+
checked: checkUpdates,
|
|
845
|
+
onChange: (event) => {
|
|
846
|
+
setCheckUpdates(event.target.checked);
|
|
847
|
+
}
|
|
848
|
+
}), (0, react_jsx_runtime.jsx)("span", { children: t("checkUpdatesLabel") })]
|
|
849
|
+
}), (0, react_jsx_runtime.jsx)("button", {
|
|
777
850
|
type: "button",
|
|
778
851
|
className: TokenQuotaPanel_module_css_default.checkBtn,
|
|
779
852
|
disabled: checkingUpdates,
|
|
780
853
|
onClick: checkUpdatesNow,
|
|
781
|
-
children: checkingUpdates ? t("checkingUpdates") : t("checkUpdatesNow")
|
|
782
|
-
})
|
|
854
|
+
children: checkingUpdates ? t("checkingUpdates") : lastCheckResult === "up-to-date" ? t("checkUpToDate") : lastCheckResult === "error" ? t("checkFailed") : t("checkUpdatesNow")
|
|
855
|
+
})]
|
|
856
|
+
}), lastCheckResult === "error" && upgradeError !== null && (0, react_jsx_runtime.jsx)("div", {
|
|
857
|
+
className: TokenQuotaPanel_module_css_default.checkErrorHint,
|
|
858
|
+
role: "alert",
|
|
859
|
+
children: upgradeError
|
|
783
860
|
})]
|
|
784
861
|
})
|
|
785
862
|
]
|
|
@@ -798,22 +875,47 @@ window.__ModuleLoader__.load({
|
|
|
798
875
|
onPointerDown: (event) => {
|
|
799
876
|
beginDrag(event, logRef.current, setLogPos);
|
|
800
877
|
},
|
|
801
|
-
children: [
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
878
|
+
children: [
|
|
879
|
+
(0, react_jsx_runtime.jsx)("div", {
|
|
880
|
+
className: TokenQuotaPanel_module_css_default.dialogTitle,
|
|
881
|
+
children: t("logsTitle")
|
|
882
|
+
}),
|
|
883
|
+
(0, react_jsx_runtime.jsxs)("div", {
|
|
884
|
+
className: TokenQuotaPanel_module_css_default.logToolbar,
|
|
885
|
+
onPointerDown: (event) => {
|
|
886
|
+
event.stopPropagation();
|
|
887
|
+
},
|
|
888
|
+
children: [(0, react_jsx_runtime.jsx)("input", {
|
|
889
|
+
type: "search",
|
|
890
|
+
className: TokenQuotaPanel_module_css_default.logSearch,
|
|
891
|
+
placeholder: t("logSearchPlaceholder"),
|
|
892
|
+
value: logSearch,
|
|
893
|
+
onChange: (event) => {
|
|
894
|
+
actions.setLogSearch(event.target.value);
|
|
895
|
+
}
|
|
896
|
+
}), (0, react_jsx_runtime.jsx)("button", {
|
|
897
|
+
type: "button",
|
|
898
|
+
className: TokenQuotaPanel_module_css_default.logClearBtn,
|
|
899
|
+
onClick: () => {
|
|
900
|
+
actions.setLogClearOpen(true);
|
|
901
|
+
},
|
|
902
|
+
children: t("logClear")
|
|
903
|
+
})]
|
|
904
|
+
}),
|
|
905
|
+
(0, react_jsx_runtime.jsx)("button", {
|
|
906
|
+
type: "button",
|
|
907
|
+
className: TokenQuotaPanel_module_css_default.dialogClose,
|
|
908
|
+
title: t("close"),
|
|
909
|
+
onClick: () => {
|
|
910
|
+
actions.setLogOpen(false);
|
|
911
|
+
},
|
|
912
|
+
children: "×"
|
|
913
|
+
})
|
|
914
|
+
]
|
|
813
915
|
}),
|
|
814
|
-
log !== null &&
|
|
916
|
+
log !== null && filteredLogEntries.length === 0 && (0, react_jsx_runtime.jsx)("div", {
|
|
815
917
|
className: TokenQuotaPanel_module_css_default.notice,
|
|
816
|
-
children: t("logEmpty")
|
|
918
|
+
children: logSearch.trim() !== "" ? t("logNoMatch") : t("logEmpty")
|
|
817
919
|
}),
|
|
818
920
|
(0, react_jsx_runtime.jsx)("div", {
|
|
819
921
|
className: TokenQuotaPanel_module_css_default.logScroll,
|
|
@@ -826,7 +928,7 @@ window.__ModuleLoader__.load({
|
|
|
826
928
|
className: TokenQuotaPanel_module_css_default.logUsedCol,
|
|
827
929
|
children: t("logUsed")
|
|
828
930
|
})
|
|
829
|
-
] }) }), (0, react_jsx_runtime.jsx)("tbody", { children:
|
|
931
|
+
] }) }), (0, react_jsx_runtime.jsx)("tbody", { children: logPageEntries.map((entry) => (0, react_jsx_runtime.jsxs)("tr", { children: [
|
|
830
932
|
(0, react_jsx_runtime.jsx)("td", {
|
|
831
933
|
className: TokenQuotaPanel_module_css_default.logDayCol,
|
|
832
934
|
children: entry.day
|
|
@@ -842,8 +944,105 @@ window.__ModuleLoader__.load({
|
|
|
842
944
|
})
|
|
843
945
|
] }, `${entry.day}/${entry.key}`)) })]
|
|
844
946
|
})
|
|
947
|
+
}),
|
|
948
|
+
(0, react_jsx_runtime.jsxs)("div", {
|
|
949
|
+
className: TokenQuotaPanel_module_css_default.logPager,
|
|
950
|
+
children: [(0, react_jsx_runtime.jsx)("span", {
|
|
951
|
+
className: TokenQuotaPanel_module_css_default.logPagerInfo,
|
|
952
|
+
children: t("logPagerInfo").replace("{from}", String(logCurrentPage * logPageSize + 1)).replace("{to}", String(Math.min((logCurrentPage + 1) * logPageSize, filteredLogEntries.length))).replace("{total}", String(filteredLogEntries.length))
|
|
953
|
+
}), (0, react_jsx_runtime.jsxs)("div", {
|
|
954
|
+
className: TokenQuotaPanel_module_css_default.logPagerControls,
|
|
955
|
+
children: [
|
|
956
|
+
(0, react_jsx_runtime.jsx)("button", {
|
|
957
|
+
type: "button",
|
|
958
|
+
className: TokenQuotaPanel_module_css_default.logPagerBtn,
|
|
959
|
+
disabled: logCurrentPage <= 0,
|
|
960
|
+
onClick: () => {
|
|
961
|
+
actions.setLogPage(logCurrentPage - 1);
|
|
962
|
+
},
|
|
963
|
+
children: "‹"
|
|
964
|
+
}),
|
|
965
|
+
(0, react_jsx_runtime.jsxs)("span", {
|
|
966
|
+
className: TokenQuotaPanel_module_css_default.logPagerPages,
|
|
967
|
+
children: [
|
|
968
|
+
logCurrentPage + 1,
|
|
969
|
+
" / ",
|
|
970
|
+
logTotalPages
|
|
971
|
+
]
|
|
972
|
+
}),
|
|
973
|
+
(0, react_jsx_runtime.jsx)("button", {
|
|
974
|
+
type: "button",
|
|
975
|
+
className: TokenQuotaPanel_module_css_default.logPagerBtn,
|
|
976
|
+
disabled: logCurrentPage >= logTotalPages - 1,
|
|
977
|
+
onClick: () => {
|
|
978
|
+
actions.setLogPage(logCurrentPage + 1);
|
|
979
|
+
},
|
|
980
|
+
children: "›"
|
|
981
|
+
}),
|
|
982
|
+
(0, react_jsx_runtime.jsx)("select", {
|
|
983
|
+
className: TokenQuotaPanel_module_css_default.logPageSizeSelect,
|
|
984
|
+
value: logPageSize,
|
|
985
|
+
onChange: (event) => {
|
|
986
|
+
actions.setLogPageSize(Number(event.target.value));
|
|
987
|
+
},
|
|
988
|
+
children: [
|
|
989
|
+
10,
|
|
990
|
+
15,
|
|
991
|
+
20,
|
|
992
|
+
50,
|
|
993
|
+
100
|
|
994
|
+
].map((size) => (0, react_jsx_runtime.jsxs)("option", {
|
|
995
|
+
value: size,
|
|
996
|
+
children: [size, t("logPerPage")]
|
|
997
|
+
}, size))
|
|
998
|
+
})
|
|
999
|
+
]
|
|
1000
|
+
})]
|
|
845
1001
|
})
|
|
846
1002
|
]
|
|
1003
|
+
}),
|
|
1004
|
+
logClearOpen && (0, react_jsx_runtime.jsx)("div", {
|
|
1005
|
+
className: TokenQuotaPanel_module_css_default.dialogOverlay,
|
|
1006
|
+
children: (0, react_jsx_runtime.jsxs)("div", {
|
|
1007
|
+
className: `${TokenQuotaPanel_module_css_default.dialog} ${TokenQuotaPanel_module_css_default.logClearDialog}`,
|
|
1008
|
+
children: [
|
|
1009
|
+
(0, react_jsx_runtime.jsx)("div", {
|
|
1010
|
+
className: TokenQuotaPanel_module_css_default.dialogTitle,
|
|
1011
|
+
children: t("logClearTitle")
|
|
1012
|
+
}),
|
|
1013
|
+
(0, react_jsx_runtime.jsx)("div", {
|
|
1014
|
+
className: TokenQuotaPanel_module_css_default.dialogBody,
|
|
1015
|
+
children: t("logClearHint")
|
|
1016
|
+
}),
|
|
1017
|
+
(0, react_jsx_runtime.jsx)("input", {
|
|
1018
|
+
type: "date",
|
|
1019
|
+
className: TokenQuotaPanel_module_css_default.logClearDate,
|
|
1020
|
+
value: logClearBefore,
|
|
1021
|
+
onChange: (event) => {
|
|
1022
|
+
actions.setLogClearBefore(event.target.value);
|
|
1023
|
+
}
|
|
1024
|
+
}),
|
|
1025
|
+
(0, react_jsx_runtime.jsxs)("div", {
|
|
1026
|
+
className: TokenQuotaPanel_module_css_default.dialogActions,
|
|
1027
|
+
children: [(0, react_jsx_runtime.jsx)("button", {
|
|
1028
|
+
type: "button",
|
|
1029
|
+
className: TokenQuotaPanel_module_css_default.checkBtn,
|
|
1030
|
+
disabled: logClearBefore === "" || logClearing,
|
|
1031
|
+
onClick: () => {
|
|
1032
|
+
clearLogBefore(logClearBefore);
|
|
1033
|
+
},
|
|
1034
|
+
children: logClearing ? t("logClearing") : t("logClearConfirm")
|
|
1035
|
+
}), (0, react_jsx_runtime.jsx)("button", {
|
|
1036
|
+
type: "button",
|
|
1037
|
+
className: TokenQuotaPanel_module_css_default.checkBtn,
|
|
1038
|
+
onClick: () => {
|
|
1039
|
+
actions.setLogClearOpen(false);
|
|
1040
|
+
},
|
|
1041
|
+
children: t("logClearCancel")
|
|
1042
|
+
})]
|
|
1043
|
+
})
|
|
1044
|
+
]
|
|
1045
|
+
})
|
|
847
1046
|
})
|
|
848
1047
|
]
|
|
849
1048
|
});
|
|
@@ -893,6 +1092,16 @@ window.__ModuleLoader__.load({
|
|
|
893
1092
|
logs: "日志",
|
|
894
1093
|
logsTitle: "用量日志",
|
|
895
1094
|
logEmpty: "暂无记录",
|
|
1095
|
+
logNoMatch: "无匹配记录",
|
|
1096
|
+
logSearchPlaceholder: "搜索模型…",
|
|
1097
|
+
logClear: "清除",
|
|
1098
|
+
logClearTitle: "清除历史日志",
|
|
1099
|
+
logClearHint: "将删除所选日期之前的所有记录(不含当日)",
|
|
1100
|
+
logClearConfirm: "确认清除",
|
|
1101
|
+
logClearCancel: "取消",
|
|
1102
|
+
logClearing: "清除中…",
|
|
1103
|
+
logPagerInfo: "第 {from}-{to} 条 / 共 {total} 条",
|
|
1104
|
+
logPerPage: "条/页",
|
|
896
1105
|
logDay: "日期",
|
|
897
1106
|
logModel: "模型",
|
|
898
1107
|
logUsed: "用量",
|
|
@@ -906,7 +1115,9 @@ window.__ModuleLoader__.load({
|
|
|
906
1115
|
upgradeHint: "升级后请重启 dsh web 并刷新浏览器页面",
|
|
907
1116
|
checkUpdatesLabel: "自动检查更新",
|
|
908
1117
|
checkUpdatesNow: "立即检查",
|
|
909
|
-
checkingUpdates: "检查中…"
|
|
1118
|
+
checkingUpdates: "检查中…",
|
|
1119
|
+
checkUpToDate: "已是最新",
|
|
1120
|
+
checkFailed: "检查失败"
|
|
910
1121
|
};
|
|
911
1122
|
/** English copy. */
|
|
912
1123
|
const en = {
|
|
@@ -945,6 +1156,16 @@ window.__ModuleLoader__.load({
|
|
|
945
1156
|
logs: "Logs",
|
|
946
1157
|
logsTitle: "Usage Log",
|
|
947
1158
|
logEmpty: "No records",
|
|
1159
|
+
logNoMatch: "No matching records",
|
|
1160
|
+
logSearchPlaceholder: "Search model…",
|
|
1161
|
+
logClear: "Clear",
|
|
1162
|
+
logClearTitle: "Clear historical log",
|
|
1163
|
+
logClearHint: "This deletes all records before the selected date (the date itself is kept).",
|
|
1164
|
+
logClearConfirm: "Confirm",
|
|
1165
|
+
logClearCancel: "Cancel",
|
|
1166
|
+
logClearing: "Clearing…",
|
|
1167
|
+
logPagerInfo: "{from}-{to} of {total}",
|
|
1168
|
+
logPerPage: "/page",
|
|
948
1169
|
logDay: "Day",
|
|
949
1170
|
logModel: "Model",
|
|
950
1171
|
logUsed: "Used",
|
|
@@ -958,7 +1179,9 @@ window.__ModuleLoader__.load({
|
|
|
958
1179
|
upgradeHint: "After upgrading, restart dsh web and refresh the browser",
|
|
959
1180
|
checkUpdatesLabel: "Check for updates automatically",
|
|
960
1181
|
checkUpdatesNow: "Check now",
|
|
961
|
-
checkingUpdates: "Checking…"
|
|
1182
|
+
checkingUpdates: "Checking…",
|
|
1183
|
+
checkUpToDate: "Up to date",
|
|
1184
|
+
checkFailed: "Check failed"
|
|
962
1185
|
};
|
|
963
1186
|
//#endregion
|
|
964
1187
|
//#region lib/types/client/index.js
|
|
@@ -1109,6 +1332,7 @@ window.__ModuleLoader__.load({
|
|
|
1109
1332
|
if (snapshot === void 0) return;
|
|
1110
1333
|
bound?.setSnapshot(snapshot);
|
|
1111
1334
|
bound?.setUpgrade(snapshot.upgrade ?? null);
|
|
1335
|
+
bound?.setUpgradeError(snapshot.upgradeError ?? null);
|
|
1112
1336
|
actOnFull(snapshot);
|
|
1113
1337
|
});
|
|
1114
1338
|
if (pullCount % 2 === 0) refreshCurrent();
|
|
@@ -1163,21 +1387,29 @@ window.__ModuleLoader__.load({
|
|
|
1163
1387
|
/** Ask the Host to check the registry right now, then refresh the snapshot. */
|
|
1164
1388
|
const checkUpdatesNow = () => {
|
|
1165
1389
|
bound?.setCheckingUpdates(true);
|
|
1390
|
+
bound?.setLastCheckResult("idle");
|
|
1166
1391
|
fetch("/token-quota/check-updates", { method: "POST" }).then((response) => {
|
|
1167
1392
|
if (!response.ok) {
|
|
1168
1393
|
bound?.setError(`check-updates route: ${String(response.status)}`);
|
|
1394
|
+
bound?.setLastCheckResult("error");
|
|
1169
1395
|
return;
|
|
1170
1396
|
}
|
|
1171
1397
|
return response.json();
|
|
1172
1398
|
}, () => {
|
|
1173
1399
|
bound?.setError("update check failed");
|
|
1400
|
+
bound?.setLastCheckResult("error");
|
|
1174
1401
|
}).then((snapshot) => {
|
|
1175
1402
|
if (snapshot !== void 0) {
|
|
1176
1403
|
bound?.setSnapshot(snapshot);
|
|
1177
1404
|
bound?.setUpgrade(snapshot.upgrade ?? null);
|
|
1405
|
+
bound?.setUpgradeError(snapshot.upgradeError ?? null);
|
|
1178
1406
|
actOnFull(snapshot);
|
|
1407
|
+
if (snapshot.upgrade === null) bound?.setLastCheckResult(snapshot.upgradeError !== null ? "error" : "up-to-date");
|
|
1179
1408
|
}
|
|
1180
1409
|
bound?.setCheckingUpdates(false);
|
|
1410
|
+
setTimeout(() => {
|
|
1411
|
+
bound?.setLastCheckResult("idle");
|
|
1412
|
+
}, 4e3);
|
|
1181
1413
|
});
|
|
1182
1414
|
};
|
|
1183
1415
|
const setReset = (reset) => {
|
|
@@ -1201,6 +1433,27 @@ window.__ModuleLoader__.load({
|
|
|
1201
1433
|
bound?.setError("model switch failed");
|
|
1202
1434
|
});
|
|
1203
1435
|
};
|
|
1436
|
+
/** Ask the Host to clear log entries before a given date, then refresh. */
|
|
1437
|
+
const clearLogBefore = (before) => {
|
|
1438
|
+
bound?.setLogClearing(true);
|
|
1439
|
+
fetch("/token-quota/clear-log", {
|
|
1440
|
+
method: "POST",
|
|
1441
|
+
headers: { "content-type": "application/json" },
|
|
1442
|
+
body: JSON.stringify({ before })
|
|
1443
|
+
}).then((response) => {
|
|
1444
|
+
if (!response.ok) {
|
|
1445
|
+
bound?.setError(`clear-log route: ${String(response.status)}`);
|
|
1446
|
+
return;
|
|
1447
|
+
}
|
|
1448
|
+
return response.json();
|
|
1449
|
+
}, () => {
|
|
1450
|
+
bound?.setError("clear log failed");
|
|
1451
|
+
}).then((log) => {
|
|
1452
|
+
if (log !== void 0) bound?.setLog(log);
|
|
1453
|
+
bound?.setLogClearing(false);
|
|
1454
|
+
bound?.setLogClearOpen(false);
|
|
1455
|
+
});
|
|
1456
|
+
};
|
|
1204
1457
|
const injected = (actions) => {
|
|
1205
1458
|
bound = actions;
|
|
1206
1459
|
return {
|
|
@@ -1211,7 +1464,8 @@ window.__ModuleLoader__.load({
|
|
|
1211
1464
|
setOnFull,
|
|
1212
1465
|
setReset,
|
|
1213
1466
|
setCheckUpdates,
|
|
1214
|
-
checkUpdatesNow
|
|
1467
|
+
checkUpdatesNow,
|
|
1468
|
+
clearLogBefore
|
|
1215
1469
|
};
|
|
1216
1470
|
};
|
|
1217
1471
|
ctx.slots.inject("shell.overlay", () => ctx.slots.register({
|