dsh-multi-router 0.5.7 → 0.5.9
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 +16 -0
- package/README.md +26 -10
- package/cordis.patch.yml +2 -2
- package/lib/accounts.js +3 -1
- package/lib/{chunk-JDZCWBA4.js → chunk-I4EW5TI7.js} +250 -66
- package/lib/chunk-I4EW5TI7.js.map +7 -0
- package/lib/{chunk-OFFVP6YN.js → chunk-S6ZQ45SS.js} +20 -3
- package/lib/chunk-S6ZQ45SS.js.map +7 -0
- package/lib/cli.js +1 -1
- package/lib/client.js +405 -310
- package/lib/client.js.map +2 -2
- package/lib/{host-v0.5.7.js → host-v0.5.9.js} +7 -108
- package/lib/host.js +7 -108
- package/lib/index.js +7 -108
- package/lib/index.js.map +4 -4
- package/lib/manager.js +2 -2
- package/package.json +1 -1
- package/lib/chunk-JDZCWBA4.js.map +0 -7
- package/lib/chunk-OFFVP6YN.js.map +0 -7
package/lib/client.js
CHANGED
|
@@ -23,9 +23,11 @@ __export(client_exports, {
|
|
|
23
23
|
AccountPool: () => AccountPool,
|
|
24
24
|
CheckinPanel: () => CheckinPanel,
|
|
25
25
|
InitialSetup: () => InitialSetup,
|
|
26
|
+
ModelsPanel: () => ModelsPanel,
|
|
26
27
|
PluginUpdatesPanel: () => PluginUpdatesPanel,
|
|
27
28
|
RestartGuidance: () => RestartGuidance,
|
|
28
29
|
RouterPage: () => RouterPage,
|
|
30
|
+
RoutesTable: () => RoutesTable,
|
|
29
31
|
UpdateReminder: () => UpdateReminder,
|
|
30
32
|
UsageDetails: () => UsageDetails,
|
|
31
33
|
apply: () => apply,
|
|
@@ -42,7 +44,7 @@ module.exports = __toCommonJS(client_exports);
|
|
|
42
44
|
var import_react = require("react");
|
|
43
45
|
|
|
44
46
|
// package.json
|
|
45
|
-
var version = "0.5.
|
|
47
|
+
var version = "0.5.9";
|
|
46
48
|
|
|
47
49
|
// src/client.jsx
|
|
48
50
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -113,12 +115,18 @@ var styles = `
|
|
|
113
115
|
.mr .table-shell{padding:0;overflow:hidden}.mr .scroll>.table{min-width:760px}.mr .table{font-size:14px}.mr .table th{background:var(--mr-soft);font-size:12px;letter-spacing:.02em;font-weight:500;white-space:nowrap}.mr .table th,.mr .table td{padding:16px 20px;vertical-align:middle}.mr .table td:last-child{white-space:nowrap}.mr .table tbody tr:last-child td{border-bottom:0}.mr .table td small{display:block;font-size:12px;margin-top:3px}.mr .table td>strong{font-weight:600}.mr .table tr.selected{background:var(--mr-selected)}.mr .table tbody tr:hover{background:var(--mr-soft)}.mr .table .account-name{max-width:230px;overflow-wrap:anywhere}.mr .table .amount{font-size:20px;line-height:1.35;font-variant-numeric:tabular-nums;font-weight:600;white-space:nowrap}.mr .table .cell-actions{white-space:nowrap;text-align:right}.mr .table .account-check{min-width:44px;min-height:44px;justify-content:center;flex-shrink:0}.mr .table .account-cell{display:flex;gap:10px;align-items:center}.mr .table .account-cell .check{margin-left:-12px}.mr .table .account-cell input{accent-color:var(--mr-text)}.mr .table .row{flex-wrap:nowrap}.mr .section-title{margin-bottom:4px}.mr .toolbar{align-items:flex-end;gap:16px}.mr .search{max-width:280px;flex:1;min-width:160px}.mr .table-footer{padding:14px 20px;background:var(--mr-soft)}.mr .hint{font-size:13px;color:var(--mr-muted)}.mr details.help{border:0;padding:0}.mr details.help>div{padding:12px 0;max-width:76ch}.mr .plan-form{align-items:flex-end;padding:16px 0 0;border-top:1px solid var(--mr-border)}.mr .plan-form .filter{min-width:180px}.mr .steps{border:1px solid var(--mr-border);border-radius:10px;background:var(--mr-soft);padding:14px 16px}.mr .route-path span{background:var(--mr-soft);border-color:transparent;font-size:12px}.mr .route-card details{padding-top:10px}.mr .feedback{margin-bottom:16px}.mr .box .feedback{margin-bottom:0}.mr .scroll{max-width:100%}.mr .scroll:focus-visible{outline:2px solid var(--mr-accent);outline-offset:-3px}
|
|
114
116
|
@media(max-width:850px){.mr .metrics{gap:10px}.mr nav{gap:0}.mr nav button{padding:12px 10px}}@media(max-width:600px){.mr h2{font-size:22px}.mr nav{display:grid;grid-template-columns:repeat(4,minmax(0,1fr))}.mr nav button{padding:10px 4px;font-size:12px;white-space:nowrap}.mr .toolbar>.row{width:100%}.mr .toolbar .search{max-width:none}.mr .metric strong{font-size:24px}.mr .table th,.mr .table td{padding:14px 16px}.mr .filter{max-width:none}.mr .plan-form label{flex:1}.mr .box.table-shell{padding:0}}
|
|
115
117
|
|
|
118
|
+
|
|
119
|
+
.mr .metrics{gap:0;border:1px solid var(--mr-border);border-radius:12px;overflow:hidden;background:var(--mr-card)}
|
|
120
|
+
.mr .metrics .metric{border:0;border-radius:0;background:transparent;border-right:1px solid var(--mr-border);padding:16px 20px}.mr .metrics .metric:last-child{border-right:0}.mr .metric strong{font-size:25px;margin:6px 0}.mr .performance{gap:10px}.mr .performance .metrics{background:var(--mr-soft);border-color:transparent}.mr .performance .metric strong{font-size:21px}.mr .performance .metric{padding:12px 20px}.mr .performance h3{font-size:14px}.mr .refresh-control{font-size:12px;color:var(--mr-muted)}
|
|
121
|
+
.mr .section-pad{padding:16px 20px}.mr .table-shell>.section-pad+.section-pad{padding-top:0}.mr .route-table td{max-width:300px}.mr .route-table .route-targets{max-width:300px;white-space:normal;overflow-wrap:anywhere}.mr .route-table small{max-width:320px}.mr .model-table td:first-child{width:38%}.mr .table .cell-actions{width:1%}.mr .install-plugin>div{padding-top:16px}.mr details.help.box{padding:18px 20px}.mr .sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
|
|
122
|
+
@media(max-width:600px){.mr .metrics .metric{padding:12px 14px}.mr .metrics .metric:nth-child(2){border-right:0}.mr .metrics .metric:nth-child(-n+2){border-bottom:1px solid var(--mr-border)}.mr .section-pad{padding:14px 16px}}
|
|
123
|
+
|
|
116
124
|
@media(prefers-reduced-motion:reduce){.mr *{transition:none!important}}
|
|
117
125
|
`;
|
|
118
126
|
function apply(ctx) {
|
|
119
127
|
reloadFromHost = () => requestPluginReload(ctx.get?.("remote"));
|
|
120
128
|
ctx.slots.inject("plugins.bundle.config", () => ctx.slots.register({ name: "plugins.bundle.config", key: "dsh-multi-router" }, RouterPage));
|
|
121
|
-
ctx.slots.inject("shell.overlay", () => ctx.slots.register({ name: "shell.overlay",
|
|
129
|
+
ctx.slots.inject("shell.overlay", () => ctx.slots.register({ name: "shell.overlay", id: "dsh-multi-router-updates" }, UpdateReminder));
|
|
122
130
|
}
|
|
123
131
|
function Modal({ title, close, children, busy }) {
|
|
124
132
|
const ref = (0, import_react.useRef)(null);
|
|
@@ -270,7 +278,7 @@ function RouterPage({ view = "page" }) {
|
|
|
270
278
|
}).finally(() => {
|
|
271
279
|
polling.current = false;
|
|
272
280
|
});
|
|
273
|
-
},
|
|
281
|
+
}, 6e4);
|
|
274
282
|
return () => {
|
|
275
283
|
stopped = true;
|
|
276
284
|
abort.abort();
|
|
@@ -281,7 +289,7 @@ function RouterPage({ view = "page" }) {
|
|
|
281
289
|
(0, import_react.useEffect)(() => {
|
|
282
290
|
if (data?.startup?.phase !== "discovering" && !["waiting", "reloading"].includes(data?.runtime?.phase) && data?.pluginUpdates?.job?.state !== "running" && !data?.checkins?.running) return;
|
|
283
291
|
const timer = setInterval(() => {
|
|
284
|
-
if (polling.current) return;
|
|
292
|
+
if (document.hidden || polling.current) return;
|
|
285
293
|
polling.current = true;
|
|
286
294
|
void load().catch((e) => setError(e.message)).finally(() => {
|
|
287
295
|
polling.current = false;
|
|
@@ -364,6 +372,10 @@ function RouterPage({ view = "page" }) {
|
|
|
364
372
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { className: busy || !data ? "warn" : "good", "aria-hidden": "true" }),
|
|
365
373
|
busy ? "\u6B63\u5728\u5904\u7406\u2026" : !data ? "\u6B63\u5728\u8FDE\u63A5\u2026" : "\u672C\u673A\u8FD0\u884C"
|
|
366
374
|
] }),
|
|
375
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "check refresh-control", children: [
|
|
376
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "checkbox", checked: live, onChange: (e) => setLive(e.target.checked) }),
|
|
377
|
+
"\u6BCF\u5206\u949F\u5237\u65B0"
|
|
378
|
+
] }),
|
|
367
379
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { disabled: busy, onClick: () => {
|
|
368
380
|
void load().catch((e) => setError(e.message));
|
|
369
381
|
}, children: "\u5237\u65B0\u9762\u677F" })
|
|
@@ -400,83 +412,27 @@ function RouterPage({ view = "page" }) {
|
|
|
400
412
|
}, children: "\u91CD\u65B0\u52A0\u8F7D\u63D2\u4EF6" })
|
|
401
413
|
] }),
|
|
402
414
|
["overview", "accounts"].includes(tab) && data.setup?.dismissed !== true && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InitialSetup, { data, busy, act, go: (key) => setTab(key) }),
|
|
403
|
-
tab === "overview" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Overview, { data,
|
|
415
|
+
tab === "overview" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Overview, { data, busy, act, go: (key) => setTab(key) }),
|
|
404
416
|
tab === "plugins" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PluginUpdatesPanel, { data: data.pluginUpdates, busy, act }),
|
|
405
417
|
tab === "checkins" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckinPanel, { data, busy, act }),
|
|
406
418
|
tab === "usage" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UsageDetails, { data, busy, act }),
|
|
407
419
|
tab === "accounts" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccountPool, { data, provider: accountProvider, providerSelect: accountProviderSelect, busy, act, manage: (a) => openAccount("edit", a), add: () => openAccount("add") }, accountProvider),
|
|
408
|
-
tab === "models" && /* @__PURE__ */ (0, import_jsx_runtime.
|
|
409
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "box stack", children: [
|
|
410
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "bar", children: [
|
|
411
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
412
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: "\u539F\u59CB\u6A21\u578B\u5C55\u793A" }),
|
|
413
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "notice", children: [
|
|
414
|
-
"\u5168\u90E8\u6E20\u9053\u5DF2\u5C55\u793A ",
|
|
415
|
-
data.providers.reduce((n, p2) => n + p2.models.filter((m) => m.visible).length, 0),
|
|
416
|
-
" / ",
|
|
417
|
-
data.providers.reduce((n, p2) => n + p2.models.length, 0),
|
|
418
|
-
" \u4E2A\u6A21\u578B"
|
|
419
|
-
] })
|
|
420
|
-
] }),
|
|
421
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "row", children: [
|
|
422
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { disabled: busy, onClick: () => {
|
|
423
|
-
void act({ action: "models.visibility", visible: true });
|
|
424
|
-
}, children: "\u5168\u90E8\u5C55\u793A" }),
|
|
425
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { disabled: busy, onClick: () => {
|
|
426
|
-
void act({ action: "models.visibility", visible: false });
|
|
427
|
-
}, children: "\u5168\u90E8\u9690\u85CF\uFF08\u4EC5\u8DEF\u7531\uFF09" })
|
|
428
|
-
] })
|
|
429
|
-
] }),
|
|
430
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "notice", children: "\u4E09\u5BB6\u6240\u6709\u533A\u57DF\u7684\u539F\u59CB\u6A21\u578B\u9ED8\u8BA4\u9690\u85CF\uFF0C\u53EA\u5C55\u793A\u7EDF\u4E00\u8DEF\u7531\u3002\u6279\u91CF\u64CD\u4F5C\u4F5C\u7528\u4E8E\u5168\u90E8\u6E20\u9053\uFF0C\u5E76\u9002\u7528\u4E8E\u540E\u7EED\u53D1\u73B0\u7684\u65B0\u6A21\u578B\uFF1B\u5355\u4E2A\u6A21\u578B\u4ECD\u53EF\u5355\u72EC\u8C03\u6574\u3002\u9690\u85CF\u4E0D\u5F71\u54CD\u8DEF\u7531\u76EE\u6807\u6216\u5DF2\u6709\u4F1A\u8BDD\u3002" })
|
|
431
|
-
] }),
|
|
432
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "bar", children: [
|
|
433
|
-
providerSelect,
|
|
434
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { disabled: busy, onClick: () => {
|
|
435
|
-
void act({ action: "refresh", provider });
|
|
436
|
-
}, children: "\u83B7\u53D6\u6A21\u578B\u76EE\u5F55" })
|
|
437
|
-
] }),
|
|
438
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [
|
|
439
|
-
"\u641C\u7D22\u6A21\u578B",
|
|
440
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "search", placeholder: "\u8F93\u5165\u540D\u79F0\u6216\u6A21\u578B ID", value: search, onChange: (e) => setSearch(e.target.value) })
|
|
441
|
-
] }),
|
|
442
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "notice", children: "\u5C55\u793A\u5F00\u5173\u51B3\u5B9A\u539F\u59CB\u6A21\u578B\u662F\u5426\u51FA\u73B0\u5728 DSH \u9009\u62E9\u5668\uFF1B\u8DEF\u7531\u5C55\u793A\u5728\u300C\u8DEF\u7531\u89C4\u5219\u300D\u4E2D\u72EC\u7ACB\u8BBE\u7F6E\u3002" }),
|
|
443
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "box", children: [
|
|
444
|
-
!p?.models.length && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "empty", children: "\u5148\u6DFB\u52A0\u5E76\u542F\u7528\u8D26\u53F7\uFF0C\u518D\u83B7\u53D6\u6A21\u578B\u76EE\u5F55\u3002" }),
|
|
445
|
-
p?.models.filter((m) => `${m.id} ${m.name}`.toLowerCase().includes(search.toLowerCase())).map((m) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", { className: "item grid", onSubmit: (e) => {
|
|
446
|
-
e.preventDefault();
|
|
447
|
-
void act({ action: "model.update", provider, id: m.id, name: new FormData(e.currentTarget).get("name") });
|
|
448
|
-
}, children: [
|
|
449
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [
|
|
450
|
-
"\u6A21\u578B\u540D\u79F0",
|
|
451
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { name: "name", defaultValue: m.name, required: true, maxLength: 200, disabled: busy }, m.name),
|
|
452
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "mono muted", children: m.id })
|
|
453
|
-
] }),
|
|
454
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "bar", children: [
|
|
455
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "check", children: [
|
|
456
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "checkbox", disabled: busy, checked: m.visible, onChange: (e) => {
|
|
457
|
-
void act({ action: "model.update", provider, id: m.id, visible: e.target.checked });
|
|
458
|
-
} }),
|
|
459
|
-
"\u5C55\u793A"
|
|
460
|
-
] }),
|
|
461
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { disabled: busy, type: "submit", children: "\u4FDD\u5B58\u540D\u79F0" }),
|
|
462
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "notice", children: [
|
|
463
|
-
"\u4E0A\u4E0B\u6587 ",
|
|
464
|
-
fmt(m.contextWindow / 1e3),
|
|
465
|
-
"K"
|
|
466
|
-
] })
|
|
467
|
-
] })
|
|
468
|
-
] }, `${provider}:${m.id}`))
|
|
469
|
-
] })
|
|
470
|
-
] }),
|
|
420
|
+
tab === "models" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ModelsPanel, { data, provider, providerSelect, search, setSearch, busy, act }),
|
|
471
421
|
tab === "routes" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "stack", children: [
|
|
472
422
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "bar", children: [
|
|
473
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
423
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
424
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: "\u6A21\u578B\u8DEF\u7531" }),
|
|
425
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "notice", children: [
|
|
426
|
+
data.routes.length,
|
|
427
|
+
" \u6761\u8DEF\u7531 \xB7 \u89C4\u5219\u4E0E\u8D26\u53F7\u5728\u7F16\u8F91\u4E2D\u8C03\u6574"
|
|
428
|
+
] })
|
|
429
|
+
] }),
|
|
474
430
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "row", children: [
|
|
475
431
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { disabled: busy, onClick: () => {
|
|
476
432
|
setError("");
|
|
477
433
|
setNotice("");
|
|
478
434
|
setPresetModal(true);
|
|
479
|
-
}, children: "\u6DFB\u52A0\
|
|
435
|
+
}, children: "\u6DFB\u52A0\u9884\u914D\u7F6E" }),
|
|
480
436
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "primary", disabled: busy, onClick: () => {
|
|
481
437
|
setError("");
|
|
482
438
|
setNotice("");
|
|
@@ -484,50 +440,7 @@ function RouterPage({ view = "page" }) {
|
|
|
484
440
|
}, children: "\u65B0\u5EFA\u8DEF\u7531" })
|
|
485
441
|
] })
|
|
486
442
|
] }),
|
|
487
|
-
|
|
488
|
-
data.routes.map((r) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "box stack route-card", children: [
|
|
489
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "bar", children: [
|
|
490
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: r.name }) }),
|
|
491
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "row", children: [
|
|
492
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "badge", children: [
|
|
493
|
-
r.freeOnly ? "\u4EC5\u514D\u8D39 \xB7 \u81EA\u52A8\u53D1\u73B0" : strategies[r.strategy || "failover"],
|
|
494
|
-
r.preferExpiringCredits ? " \xB7 \u4E34\u671F\u4F18\u5148" : ""
|
|
495
|
-
] }),
|
|
496
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { disabled: busy, onClick: () => editRoute(r), children: "\u7F16\u8F91\u8DEF\u7531" })
|
|
497
|
-
] })
|
|
498
|
-
] }),
|
|
499
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "route-path", children: r.targets.map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
500
|
-
data.providers.find((p2) => p2.id === t.provider)?.name,
|
|
501
|
-
" \xB7 ",
|
|
502
|
-
t.account ? data.accounts.find((a) => a.id === t.account)?.name : "\u5168\u90E8\u542F\u7528\u8D26\u53F7",
|
|
503
|
-
r.strategy === "weighted" ? ` \xB7 \u6743\u91CD ${t.weight || 1}` : r.strategy === "tokens" ? ` \xB7 ${fmt(t.tokenBudget)} Token` : r.strategy === "credits" ? ` \xB7 ${fmt(t.creditBudget)} \u79EF\u5206` : ""
|
|
504
|
-
] }, i)) }),
|
|
505
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "bar", children: [
|
|
506
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "notice", children: [
|
|
507
|
-
r.targets.length,
|
|
508
|
-
" \u4E2A\u76EE\u6807 \xB7 ",
|
|
509
|
-
data.telemetry?.rounds[r.id] ? `\u7B2C ${data.telemetry.rounds[r.id].number} \u8F6E \xB7 ` : "",
|
|
510
|
-
"4xx \u81EA\u52A8\u5207\u6362"
|
|
511
|
-
] }),
|
|
512
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "check", children: [
|
|
513
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "checkbox", disabled: busy, checked: r.visible !== false, onChange: (e) => {
|
|
514
|
-
const { id, reasoning, supportsImages, expiringStatus, freeStatus, ...route } = r;
|
|
515
|
-
void act({ action: "route.save", id, previousId: id, route: { ...route, visible: e.target.checked } });
|
|
516
|
-
} }),
|
|
517
|
-
r.freeOnly ? "\u5C55\u793A\u52FE\u9009\u7684\u514D\u8D39\u6A21\u578B" : "\u5728\u6A21\u578B\u9009\u62E9\u5668\u5C55\u793A"
|
|
518
|
-
] })
|
|
519
|
-
] }),
|
|
520
|
-
r.freeOnly && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FreeStatus, { route: r, busy, act }),
|
|
521
|
-
!r.freeOnly && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", { children: [
|
|
522
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("summary", { children: "\u63A8\u7406\u6A21\u5F0F\u4E0E\u517C\u5BB9\u6027" }),
|
|
523
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "notice", children: [
|
|
524
|
-
"\u63A8\u7406\u6A21\u5F0F\uFF1A\u5E73\u53F0\u9ED8\u8BA4",
|
|
525
|
-
r.reasoning?.supportedEfforts?.length ? `\u3001${r.reasoning.supportedEfforts.map((e) => effortNames[e] || e).join("\u3001")}` : "\uFF08\u5E73\u53F0\u672A\u58F0\u660E\u53EF\u8C03\u6863\u4F4D\uFF09",
|
|
526
|
-
"\u3002\u9009\u62E9\u6863\u4F4D\u540E\uFF0C\u53EA\u5728\u652F\u6301\u8BE5\u6863\u4F4D\u7684\u76EE\u6807\u95F4\u5207\u6362\u3002"
|
|
527
|
-
] })
|
|
528
|
-
] }),
|
|
529
|
-
r.preferExpiringCredits && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ExpiryStatus, { route: r, act, busy, revision: data.revision })
|
|
530
|
-
] }, r.id)),
|
|
443
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(RoutesTable, { data, busy, act, edit: editRoute }),
|
|
531
444
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", { children: [
|
|
532
445
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("summary", { children: "\u5168\u5C40\u5207\u6362\u8BBE\u7F6E" }),
|
|
533
446
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", { className: "box stack", style: { marginTop: 16 }, onSubmit: (e) => {
|
|
@@ -581,6 +494,135 @@ function RouterPage({ view = "page" }) {
|
|
|
581
494
|
}, error, notice }) })
|
|
582
495
|
] });
|
|
583
496
|
}
|
|
497
|
+
function ModelsPanel({ data, provider, providerSelect, search, setSearch, busy, act }) {
|
|
498
|
+
const [editing, setEditing] = (0, import_react.useState)(null);
|
|
499
|
+
const models = data.providers.find((p) => p.id === provider)?.models ?? [];
|
|
500
|
+
const all = data.providers.flatMap((p) => p.models), shown = models.filter((m) => `${m.id} ${m.name}`.toLowerCase().includes(search.toLowerCase()));
|
|
501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "stack", children: [
|
|
502
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "bar", children: [
|
|
503
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
504
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: "\u539F\u59CB\u6A21\u578B\u5C55\u793A" }),
|
|
505
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "notice", children: [
|
|
506
|
+
"\u5DF2\u5C55\u793A ",
|
|
507
|
+
all.filter((m) => m.visible).length,
|
|
508
|
+
" / ",
|
|
509
|
+
all.length,
|
|
510
|
+
" \u4E2A \xB7 \u9ED8\u8BA4\u4EC5\u5C55\u793A\u7EDF\u4E00\u8DEF\u7531"
|
|
511
|
+
] })
|
|
512
|
+
] }),
|
|
513
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "row", children: [
|
|
514
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { disabled: busy, onClick: () => {
|
|
515
|
+
void act({ action: "models.visibility", visible: true });
|
|
516
|
+
}, children: "\u5168\u90E8\u5C55\u793A" }),
|
|
517
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { disabled: busy, onClick: () => {
|
|
518
|
+
void act({ action: "models.visibility", visible: false });
|
|
519
|
+
}, children: "\u5168\u90E8\u9690\u85CF\uFF08\u4EC5\u8DEF\u7531\uFF09" })
|
|
520
|
+
] })
|
|
521
|
+
] }),
|
|
522
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "bar toolbar", children: [
|
|
523
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "row", children: [
|
|
524
|
+
providerSelect,
|
|
525
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "search", children: [
|
|
526
|
+
"\u641C\u7D22\u6A21\u578B",
|
|
527
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "search", placeholder: "\u540D\u79F0\u6216\u6A21\u578B ID", value: search, onChange: (e) => setSearch(e.target.value) })
|
|
528
|
+
] })
|
|
529
|
+
] }),
|
|
530
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { disabled: busy, onClick: () => {
|
|
531
|
+
void act({ action: "refresh", provider });
|
|
532
|
+
}, children: "\u83B7\u53D6\u6A21\u578B\u76EE\u5F55" })
|
|
533
|
+
] }),
|
|
534
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "box table-shell", children: [
|
|
535
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "scroll", role: "region", "aria-label": "\u6A21\u578B\u5C55\u793A\u7BA1\u7406", tabIndex: "0", children: [
|
|
536
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", { className: "table model-table", children: [
|
|
537
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
538
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { scope: "col", children: "\u6A21\u578B" }),
|
|
539
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { scope: "col", children: "\u4E0A\u4E0B\u6587 / \u63A8\u7406" }),
|
|
540
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { scope: "col", children: "\u9009\u62E9\u5668\u5C55\u793A" }),
|
|
541
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { scope: "col", className: "cell-actions", children: "\u7BA1\u7406" })
|
|
542
|
+
] }) }),
|
|
543
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: shown.map((m) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { className: m.visible ? "selected" : "", children: [
|
|
544
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("td", { children: [
|
|
545
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: m.name }),
|
|
546
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { className: "mono muted", children: m.id })
|
|
547
|
+
] }),
|
|
548
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("td", { children: [
|
|
549
|
+
fmt(m.contextWindow / 1e3),
|
|
550
|
+
"K",
|
|
551
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { className: "muted", children: m.reasoning?.supportedEfforts?.length ? m.reasoning.supportedEfforts.map((e) => effortNames[e] || e).join(" / ") : "\u5E73\u53F0\u9ED8\u8BA4" })
|
|
552
|
+
] }),
|
|
553
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "check", children: [
|
|
554
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "checkbox", "aria-label": `\u5C55\u793A ${m.name}`, disabled: busy, checked: m.visible, onChange: (e) => {
|
|
555
|
+
void act({ action: "model.update", provider, id: m.id, visible: e.target.checked });
|
|
556
|
+
} }),
|
|
557
|
+
m.visible ? "\u5DF2\u5C55\u793A" : "\u5DF2\u9690\u85CF"
|
|
558
|
+
] }) }),
|
|
559
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { className: "cell-actions", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { disabled: busy, onClick: () => setEditing({ id: m.id, name: m.name, provider }), children: "\u4FEE\u6539\u540D\u79F0" }) })
|
|
560
|
+
] }, m.id)) })
|
|
561
|
+
] }),
|
|
562
|
+
!shown.length && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "empty", children: models.length ? "\u6CA1\u6709\u5339\u914D\u7684\u6A21\u578B\u3002" : "\u6DFB\u52A0\u5E76\u542F\u7528\u8D26\u53F7\u540E\uFF0C\u83B7\u53D6\u6A21\u578B\u76EE\u5F55\u3002" })
|
|
563
|
+
] }),
|
|
564
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "table-footer", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "notice", children: "\u9690\u85CF\u4E0D\u5F71\u54CD\u8DEF\u7531\u6216\u5DF2\u6709\u4F1A\u8BDD\u3002\u6279\u91CF\u8BBE\u7F6E\u4F5C\u7528\u4E8E\u5168\u90E8\u4F9B\u5E94\u5546\u53CA\u540E\u7EED\u53D1\u73B0\u7684\u6A21\u578B\u3002" }) })
|
|
565
|
+
] }),
|
|
566
|
+
editing && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Modal, { title: "\u4FEE\u6539\u6A21\u578B\u540D\u79F0", busy, close: () => setEditing(null), children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", { onSubmit: async (e) => {
|
|
567
|
+
e.preventDefault();
|
|
568
|
+
if (await act({ action: "model.update", ...editing })) setEditing(null);
|
|
569
|
+
}, children: [
|
|
570
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "modal-body stack", children: [
|
|
571
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [
|
|
572
|
+
"\u6A21\u578B\u540D\u79F0",
|
|
573
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { autoFocus: true, required: true, maxLength: 200, disabled: busy, value: editing.name, onChange: (e) => setEditing({ ...editing, name: e.target.value }) })
|
|
574
|
+
] }),
|
|
575
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "mono muted", children: editing.id })
|
|
576
|
+
] }),
|
|
577
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "modal-foot row", children: [
|
|
578
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", disabled: busy, onClick: () => setEditing(null), children: "\u53D6\u6D88" }),
|
|
579
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "primary", disabled: busy, children: "\u4FDD\u5B58\u540D\u79F0" })
|
|
580
|
+
] })
|
|
581
|
+
] }) })
|
|
582
|
+
] });
|
|
583
|
+
}
|
|
584
|
+
function RoutesTable({ data, busy, act, edit }) {
|
|
585
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("section", { className: "box table-shell", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "scroll", role: "region", "aria-label": "\u6A21\u578B\u8DEF\u7531\u89C4\u5219", tabIndex: "0", children: [
|
|
586
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", { className: "table route-table", children: [
|
|
587
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
588
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { scope: "col", children: "\u8DEF\u7531 / \u6A21\u578B" }),
|
|
589
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { scope: "col", children: "\u8D26\u53F7\u4E0E\u6E20\u9053" }),
|
|
590
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { scope: "col", children: "\u5207\u6362\u89C4\u5219" }),
|
|
591
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { scope: "col", children: "\u5C55\u793A" }),
|
|
592
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { scope: "col", className: "cell-actions", children: "\u7BA1\u7406" })
|
|
593
|
+
] }) }),
|
|
594
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: data.routes.map((r) => {
|
|
595
|
+
const accounts = data.accounts.filter((a) => a.enabled !== false && r.targets.some((t) => t.provider === a.provider && (!t.account || t.account === a.id)));
|
|
596
|
+
const providers = [...new Set(r.targets.map((t) => data.providers.find((p) => p.id === t.provider)?.name || t.provider))];
|
|
597
|
+
const cooling = r.expiringStatus?.cooldownUntil > Date.now(), modes = r.reasoning?.supportedEfforts ?? [];
|
|
598
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { className: r.visible !== false ? "selected" : "", children: [
|
|
599
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("td", { children: [
|
|
600
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: r.name }),
|
|
601
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { className: "muted", children: r.freeOnly ? `${r.freeStatus?.modelRoutes?.filter((m) => m.selected).length || 0} \u4E2A\u514D\u8D39\u6A21\u578B\u5DF2\u5C55\u793A` : modes.length ? `\u63A8\u7406\uFF1A${modes.map((e) => effortNames[e] || e).join(" / ")}` : "\u63A8\u7406\uFF1A\u5E73\u53F0\u9ED8\u8BA4" })
|
|
602
|
+
] }),
|
|
603
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("td", { className: "route-targets", children: [
|
|
604
|
+
accounts.length,
|
|
605
|
+
" \u4E2A\u53C2\u4E0E\u8D26\u53F7",
|
|
606
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { className: "muted", children: providers.join("\u3001") })
|
|
607
|
+
] }),
|
|
608
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("td", { children: [
|
|
609
|
+
r.freeOnly ? "\u4EC5\u514D\u8D39 \xB7 \u81EA\u52A8\u53D1\u73B0" : strategies[r.strategy || "failover"],
|
|
610
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { className: cooling ? "warn" : "muted", children: cooling ? "\u4E34\u671F\u4F18\u5148\u51B7\u5374\u4E2D" : r.preferExpiringCredits ? "\u4E34\u671F\u79EF\u5206\u4F18\u5148" : `${r.targets.length} \u4E2A\u76EE\u6807 \xB7 4xx \u5207\u6362` })
|
|
611
|
+
] }),
|
|
612
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "check", children: [
|
|
613
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "checkbox", "aria-label": `\u5C55\u793A\u8DEF\u7531 ${r.name}`, disabled: busy, checked: r.visible !== false, onChange: (e) => {
|
|
614
|
+
const { id, reasoning, supportsImages, expiringStatus, freeStatus, ...route } = r;
|
|
615
|
+
void act({ action: "route.save", id, previousId: id, route: { ...route, visible: e.target.checked } });
|
|
616
|
+
} }),
|
|
617
|
+
r.visible !== false ? "\u5F00\u542F" : "\u5173\u95ED"
|
|
618
|
+
] }) }),
|
|
619
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { className: "cell-actions", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { disabled: busy, onClick: () => edit(r), children: r.freeOnly ? "\u7BA1\u7406\u514D\u8D39\u6A21\u578B" : "\u7F16\u8F91\u8DEF\u7531" }) })
|
|
620
|
+
] }, r.id);
|
|
621
|
+
}) })
|
|
622
|
+
] }),
|
|
623
|
+
!data.routes.length && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "empty", children: "\u6DFB\u52A0\u6A21\u578B\u9884\u914D\u7F6E\uFF0C\u6216\u521B\u5EFA\u81EA\u5B9A\u4E49\u8DEF\u7531\u3002" })
|
|
624
|
+
] }) });
|
|
625
|
+
}
|
|
584
626
|
var displayName = (a) => (a?.name || a?.id || "\u672A\u77E5\u8D26\u53F7").replace(/(?<!\d)(\+?\d{2,3})\d{3,8}(\d{4})(?!\d)/g, "$1****$2");
|
|
585
627
|
var resultLabels = { claimed: "\u7B7E\u5230\u6210\u529F", "already-claimed": "\u5DF2\u9886\u53D6", "no-campaign": "\u65E0\u6D3B\u52A8", retryable: "\u67E5\u8BE2\u5931\u8D25", "before-window": "\u7A97\u53E3\u672A\u5F00", "auth-invalid": "\u4EE4\u724C\u5931\u6548", paused: "\u5E73\u53F0\u6682\u505C", uncertain: "\u5F85\u6838\u5BF9", "device-used": "\u8BBE\u5907\u5DF2\u53C2\u4E0E" };
|
|
586
628
|
function Balance({ account }) {
|
|
@@ -853,7 +895,7 @@ function CheckinPanel({ data, busy, act }) {
|
|
|
853
895
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "notice", children: "\u591A\u53F0\u8BBE\u5907\u7684\u672C\u5730\u8BB0\u5F55\u4E0D\u4F1A\u4E92\u76F8\u540C\u6B65\uFF0C\u6BCF\u6B21\u90FD\u4F1A\u67E5\u8BE2\u5E73\u53F0\u9886\u53D6\u72B6\u6001\uFF1B\u5EFA\u8BAE\u4EC5\u5728\u4E00\u53F0\u5E38\u7528\u8BBE\u5907\u5F00\u542F\u81EA\u52A8\u7B7E\u5230\u3002\u540C\u4E00 Trae \u8BBE\u5907\u6BCF\u5929\u6700\u591A\u5904\u7406\u4E00\u4E2A\u9886\u53D6\u8BF7\u6C42\uFF0C\u91CD\u590D\u8D26\u53F7\u526F\u672C\u4F1A\u53BB\u91CD\uFF1B\u4E0D\u4FDD\u8BC1\u5E73\u53F0\u4E00\u5B9A\u53D1\u653E\u5956\u52B1\u3002" })
|
|
854
896
|
] });
|
|
855
897
|
}
|
|
856
|
-
function Overview({ data,
|
|
898
|
+
function Overview({ data, busy, act, go }) {
|
|
857
899
|
const t = data.telemetry || {}, today = t.days?.[t.today] || {}, totals = data.accounts.reduce((s, a) => ({ requests: s.requests + (a.usage?.requests || 0), tokens: s.tokens + (a.usage?.tokens || 0) }), { requests: 0, tokens: 0 });
|
|
858
900
|
const dates = Array.from({ length: 7 }, (_, i) => {
|
|
859
901
|
const d = /* @__PURE__ */ new Date();
|
|
@@ -873,10 +915,7 @@ function Overview({ data, live, setLive, busy, act, go }) {
|
|
|
873
915
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "bar", children: [
|
|
874
916
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: "\u5E73\u53F0\u989D\u5EA6" }),
|
|
875
917
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "row", children: [
|
|
876
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
877
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "checkbox", checked: live, onChange: (e) => setLive(e.target.checked) }),
|
|
878
|
-
"15 \u79D2\u5237\u65B0\u9762\u677F"
|
|
879
|
-
] }),
|
|
918
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "notice", children: "\u5E73\u53F0\u7528\u91CF \xB7 \u6BCF 5 \u5206\u949F\u66F4\u65B0" }),
|
|
880
919
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { disabled: busy, onClick: () => {
|
|
881
920
|
void act({ action: "monitor.refresh" });
|
|
882
921
|
}, children: "\u5237\u65B0\u5E73\u53F0\u7528\u91CF" })
|
|
@@ -913,7 +952,7 @@ function Overview({ data, live, setLive, busy, act, go }) {
|
|
|
913
952
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { disabled: busy, onClick: () => go("accounts"), children: "\u7BA1\u7406\u8D26\u53F7\u6C60" })
|
|
914
953
|
] })
|
|
915
954
|
] }),
|
|
916
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "notice", children: "\
|
|
955
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "notice", children: "\u9762\u677F\u8BFB\u53D6\u672C\u673A\u7F13\u5B58\uFF0C\u4E0D\u4F1A\u89E6\u53D1\u5E73\u53F0\u67E5\u8BE2\u3002\u5E73\u53F0\u4F59\u989D\u6BCF 5 \u5206\u949F\u66F4\u65B0\uFF0C\u624B\u52A8\u5237\u65B0\u7ACB\u5373\u67E5\u8BE2\uFF1B\u79EF\u5206\u8F6E\u6362\u4E0E\u4E34\u671F\u4F18\u5148\u6309\u9700\u590D\u6838\u3002Token \u4EC5\u7EDF\u8BA1\u672C\u63D2\u4EF6\u8BF7\u6C42\u3002" }),
|
|
917
956
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "grid", children: [
|
|
918
957
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "box", children: [
|
|
919
958
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: "\u8FD1 7 \u65E5 Token" }),
|
|
@@ -928,14 +967,8 @@ function Overview({ data, live, setLive, busy, act, go }) {
|
|
|
928
967
|
] })
|
|
929
968
|
] }),
|
|
930
969
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "box stack", children: [
|
|
931
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: "\
|
|
932
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
933
|
-
"1. \u786E\u8BA4\u81EA\u52A8\u83B7\u53D6\u7684\u8D26\u53F7\uFF0C\u6216\u624B\u52A8\u6DFB\u52A0\u51ED\u8BC1",
|
|
934
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {}),
|
|
935
|
-
"2. \u4F7F\u7528\u9884\u5236\u8DEF\u7531\uFF0C\u6309\u9700\u7F16\u8F91\u8D26\u53F7\u5207\u6362\u89C4\u5219",
|
|
936
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {}),
|
|
937
|
-
"3. \u5230 DSH \u6A21\u578B\u9009\u62E9\u5668\u9009\u62E9\u300C\u7EDF\u4E00\u8DEF\u7531\u300D\u4E2D\u7684\u6A21\u578B"
|
|
938
|
-
] }),
|
|
970
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: "\u5E38\u7528\u5165\u53E3" }),
|
|
971
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "notice", children: "\u8FDE\u63A5\u8D26\u53F7\u540E\uFF0C\u5728 DSH \u6A21\u578B\u9009\u62E9\u5668\u4E2D\u4F7F\u7528\u300C\u7EDF\u4E00\u8DEF\u7531\u300D\u3002" }),
|
|
939
972
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "row", children: [
|
|
940
973
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { onClick: () => go("accounts"), children: "\u67E5\u770B\u8D26\u53F7" }),
|
|
941
974
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { onClick: () => go("routes"), children: "\u914D\u7F6E\u8DEF\u7531" }),
|
|
@@ -999,7 +1032,7 @@ function performanceSummary(events) {
|
|
|
999
1032
|
}
|
|
1000
1033
|
function PerformanceMetrics({ events }) {
|
|
1001
1034
|
const stats = performanceSummary(events);
|
|
1002
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "stack", "aria-label": "\u8C03\u7528\u6027\u80FD\u7EDF\u8BA1", children: [
|
|
1035
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "stack performance", "aria-label": "\u8C03\u7528\u6027\u80FD\u7EDF\u8BA1", children: [
|
|
1003
1036
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "bar", children: [
|
|
1004
1037
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: "\u8C03\u7528\u6027\u80FD" }),
|
|
1005
1038
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "notice", children: [
|
|
@@ -1137,7 +1170,7 @@ function UsageDetails({ data, busy, act }) {
|
|
|
1137
1170
|
"\u7F13\u5B58\u8F93\u5165\u5305\u542B\u5728\u8F93\u5165\u4E2D\uFF0C\u63A8\u7406\u8F93\u51FA\u5305\u542B\u5728\u8F93\u51FA\u4E2D\uFF0C\u5747\u4E0D\u91CD\u590D\u76F8\u52A0\u3002\u672A\u8FD4\u56DE\u7684\u6570\u636E\u4EE5\u300C\u2014\u300D\u663E\u793A\u3002"
|
|
1138
1171
|
] }),
|
|
1139
1172
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(PerformanceMetrics, { events }),
|
|
1140
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "box", children: [
|
|
1173
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "box table-shell", children: [
|
|
1141
1174
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "scroll", role: "region", "aria-label": "\u8BF7\u6C42\u7528\u91CF\u4E0E\u6027\u80FD\u660E\u7EC6", tabIndex: "0", children: [
|
|
1142
1175
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", { className: "table", children: [
|
|
1143
1176
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
@@ -1193,7 +1226,7 @@ function UsageDetails({ data, busy, act }) {
|
|
|
1193
1226
|
] }),
|
|
1194
1227
|
!events.length && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "empty", children: "\u5F53\u524D\u7B5B\u9009\u548C\u4FDD\u7559\u671F\u9650\u5185\u6CA1\u6709\u8BF7\u6C42\u660E\u7EC6\u3002" })
|
|
1195
1228
|
] }),
|
|
1196
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "bar", children: [
|
|
1229
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "bar table-footer", children: [
|
|
1197
1230
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "notice", children: [
|
|
1198
1231
|
"\u7B2C ",
|
|
1199
1232
|
current + 1,
|
|
@@ -1603,129 +1636,161 @@ function CredentialForm({ modal, provider, data, busy, act, close, error, notice
|
|
|
1603
1636
|
] });
|
|
1604
1637
|
}
|
|
1605
1638
|
function MigrationForm({ data, act, busy }) {
|
|
1639
|
+
const [panel, setPanel] = (0, import_react.useState)(null);
|
|
1606
1640
|
const [include, setInclude] = (0, import_react.useState)(false), [exportPassword, setExportPassword] = (0, import_react.useState)(""), [confirmPassword, setConfirmPassword] = (0, import_react.useState)(""), [exportError, setExportError] = (0, import_react.useState)("");
|
|
1607
1641
|
const [document2, setDocument] = (0, import_react.useState)(""), [fileName, setFileName] = (0, import_react.useState)(""), [password, setPassword] = (0, import_react.useState)(""), [mode, setMode] = (0, import_react.useState)("merge"), [preview, setPreview] = (0, import_react.useState)(null), [error, setError] = (0, import_react.useState)("");
|
|
1608
1642
|
const resetPreview = () => {
|
|
1609
1643
|
setPreview(null);
|
|
1610
1644
|
setError("");
|
|
1611
1645
|
};
|
|
1612
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "
|
|
1613
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1646
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "stack", children: [
|
|
1647
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
1648
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: "\u914D\u7F6E\u8FC1\u79FB" }),
|
|
1649
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "notice", children: "\u5728\u8BBE\u5907\u95F4\u8FC1\u79FB\u8D26\u53F7\u3001\u6A21\u578B\u548C\u8DEF\u7531\u8BBE\u7F6E\u3002" })
|
|
1650
|
+
] }),
|
|
1651
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("section", { className: "box table-shell", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", { className: "table", children: [
|
|
1652
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
1653
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { scope: "col", children: "\u64CD\u4F5C" }),
|
|
1654
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { scope: "col", children: "\u5185\u5BB9" }),
|
|
1655
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { scope: "col", className: "cell-actions", children: "\u5F00\u59CB" })
|
|
1656
|
+
] }) }),
|
|
1657
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tbody", { children: [
|
|
1658
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
1659
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: "\u5BFC\u51FA\u5230\u5176\u4ED6\u8BBE\u5907" }) }),
|
|
1660
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("td", { children: [
|
|
1661
|
+
"\u8D26\u53F7\u4E0E\u8DEF\u7531\u8BBE\u7F6E",
|
|
1662
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { className: "muted", children: "\u53EF\u9009\u5BC6\u7801\u52A0\u5BC6\u643A\u5E26\u767B\u5F55\u51ED\u8BC1" })
|
|
1663
|
+
] }),
|
|
1664
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { className: "cell-actions", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { disabled: busy, onClick: () => setPanel("export"), children: "\u5BFC\u51FA\u914D\u7F6E" }) })
|
|
1665
|
+
] }),
|
|
1666
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
1667
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: "\u5BFC\u5165\u5DF2\u6709\u914D\u7F6E" }) }),
|
|
1668
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("td", { children: [
|
|
1669
|
+
"\u5148\u9884\u89C8\uFF0C\u518D\u786E\u8BA4\u5408\u5E76\u6216\u66FF\u6362",
|
|
1670
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { className: "muted", children: "\u5BFC\u5165\u524D\u81EA\u52A8\u5907\u4EFD\u672C\u673A\u914D\u7F6E" })
|
|
1671
|
+
] }),
|
|
1672
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { className: "cell-actions", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { disabled: busy, onClick: () => setPanel("import"), children: "\u5BFC\u5165\u914D\u7F6E" }) })
|
|
1673
|
+
] })
|
|
1674
|
+
] })
|
|
1675
|
+
] }) }),
|
|
1676
|
+
panel && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Modal, { title: panel === "export" ? "\u5BFC\u51FA\u914D\u7F6E" : "\u5BFC\u5165\u914D\u7F6E", busy, close: () => setPanel(null), children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "modal-body stack", children: [
|
|
1677
|
+
panel === "export" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", { className: "box stack", onSubmit: async (e) => {
|
|
1678
|
+
e.preventDefault();
|
|
1679
|
+
setExportError("");
|
|
1680
|
+
if (include && exportPassword !== confirmPassword) {
|
|
1681
|
+
setExportError("\u4E24\u6B21\u8FC1\u79FB\u5BC6\u7801\u4E0D\u4E00\u81F4");
|
|
1682
|
+
return;
|
|
1683
|
+
}
|
|
1684
|
+
const result = await act({ action: "config.export", includeCredentials: include, password: include ? exportPassword : void 0 });
|
|
1685
|
+
if (!result) return;
|
|
1686
|
+
downloadJson(result.exported);
|
|
1687
|
+
setExportPassword("");
|
|
1688
|
+
setConfirmPassword("");
|
|
1689
|
+
}, children: [
|
|
1690
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: "\u5BFC\u51FA\u5230\u5176\u4ED6\u8BBE\u5907" }),
|
|
1691
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "notice", children: "\u5305\u542B\u8D26\u53F7\u540D\u79F0\u548C\u987A\u5E8F\u3001\u6A21\u578B\u5C55\u793A\u8BBE\u7F6E\u3001\u8DEF\u7531\u4E0E\u5207\u6362\u89C4\u5219\u3002\u4E0D\u4F1A\u5BFC\u51FA\u4F1A\u8BDD\u3001\u7EDF\u8BA1\u3001\u6587\u4EF6\u8DEF\u5F84\u6216\u7BA1\u7406\u5BC6\u94A5\u3002" }),
|
|
1692
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "check", children: [
|
|
1693
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "checkbox", checked: include, disabled: busy, onChange: (e) => {
|
|
1694
|
+
setInclude(e.target.checked);
|
|
1695
|
+
setExportPassword("");
|
|
1696
|
+
setConfirmPassword("");
|
|
1697
|
+
} }),
|
|
1698
|
+
"\u540C\u65F6\u8FC1\u79FB\u8D26\u53F7\u767B\u5F55\u51ED\u8BC1\uFF08\u5BC6\u7801\u52A0\u5BC6\uFF09"
|
|
1699
|
+
] }),
|
|
1700
|
+
include ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
1701
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "steps", children: "\u52A0\u5BC6\u6587\u4EF6\u5305\u542B\u767B\u5F55 Token / PAT \u548C\u5FC5\u8981\u8BBE\u5907\u8EAB\u4EFD\uFF0C\u8BF7\u81EA\u884C\u4FDD\u7BA1\u3002\u65B0\u8BBE\u5907\u9700\u8981\u540C\u4E00\u5BC6\u7801\uFF1B\u51ED\u8BC1\u53EF\u80FD\u56E0\u5E73\u53F0\u8BBE\u5907\u9650\u5236\u800C\u9700\u8981\u91CD\u65B0\u767B\u5F55\u3002" }),
|
|
1702
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [
|
|
1703
|
+
"\u8BBE\u7F6E\u8FC1\u79FB\u5BC6\u7801",
|
|
1704
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "password", autoComplete: "new-password", required: true, minLength: "10", maxLength: "1024", value: exportPassword, disabled: busy, onChange: (e) => setExportPassword(e.target.value) })
|
|
1705
|
+
] }),
|
|
1706
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [
|
|
1707
|
+
"\u518D\u6B21\u8F93\u5165\u5BC6\u7801",
|
|
1708
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "password", autoComplete: "new-password", required: true, value: confirmPassword, disabled: busy, onChange: (e) => setConfirmPassword(e.target.value) })
|
|
1709
|
+
] })
|
|
1710
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "steps", children: "\u4EC5\u914D\u7F6E\u6587\u4EF6\u4E0D\u542B\u767B\u5F55\u51ED\u8BC1\u3002\u65B0\u8BBE\u5907\u4E0A\u7684\u8D26\u53F7\u4F1A\u5148\u505C\u7528\uFF0C\u8865\u5145\u51ED\u8BC1\u540E\u5373\u53EF\u542F\u7528\uFF1B\u5408\u5E76\u5BFC\u5165\u4F1A\u4FDD\u7559\u672C\u673A\u5DF2\u6709\u8D26\u53F7\u51ED\u8BC1\u3002" }),
|
|
1711
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Feedback, { error: exportError }),
|
|
1712
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "primary", type: "submit", disabled: busy, children: include ? "\u5BFC\u51FA\u52A0\u5BC6\u8FC1\u79FB\u6587\u4EF6" : "\u5BFC\u51FA\u914D\u7F6E JSON" })
|
|
1635
1713
|
] }),
|
|
1636
|
-
|
|
1637
|
-
|
|
1714
|
+
panel === "import" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", { className: "box stack", onSubmit: async (e) => {
|
|
1715
|
+
e.preventDefault();
|
|
1716
|
+
setError("");
|
|
1717
|
+
const result = await act({ action: "config.preview", document: document2, password, mode });
|
|
1718
|
+
if (result) setPreview({ ...result.importPreview, revision: result.revision });
|
|
1719
|
+
}, children: [
|
|
1720
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: "\u5BFC\u5165\u63D2\u4EF6\u914D\u7F6E" }),
|
|
1638
1721
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [
|
|
1639
|
-
"\
|
|
1640
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "
|
|
1722
|
+
"\u9009\u62E9\u8FC1\u79FB JSON \u6587\u4EF6",
|
|
1723
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "file", accept: ".json,application/json", required: true, disabled: busy, onChange: async (e) => {
|
|
1724
|
+
resetPreview();
|
|
1725
|
+
setPassword("");
|
|
1726
|
+
setDocument("");
|
|
1727
|
+
const file = e.target.files?.[0];
|
|
1728
|
+
if (!file) return;
|
|
1729
|
+
if (file.size > 900 * 1024) {
|
|
1730
|
+
setError("\u8FC1\u79FB\u6587\u4EF6\u4E0D\u80FD\u8D85\u8FC7 900 KB");
|
|
1731
|
+
return;
|
|
1732
|
+
}
|
|
1733
|
+
try {
|
|
1734
|
+
setDocument(await file.text());
|
|
1735
|
+
setFileName(file.name);
|
|
1736
|
+
} catch {
|
|
1737
|
+
setError("\u65E0\u6CD5\u8BFB\u53D6\u6587\u4EF6");
|
|
1738
|
+
}
|
|
1739
|
+
} })
|
|
1641
1740
|
] }),
|
|
1741
|
+
fileName && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "mono muted", children: fileName }),
|
|
1642
1742
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [
|
|
1643
|
-
"\
|
|
1644
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "password", autoComplete: "
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "primary", type: "submit", disabled: busy, children: include ? "\u5BFC\u51FA\u52A0\u5BC6\u8FC1\u79FB\u6587\u4EF6" : "\u5BFC\u51FA\u914D\u7F6E JSON" })
|
|
1649
|
-
] }),
|
|
1650
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", { className: "box stack", onSubmit: async (e) => {
|
|
1651
|
-
e.preventDefault();
|
|
1652
|
-
setError("");
|
|
1653
|
-
const result = await act({ action: "config.preview", document: document2, password, mode });
|
|
1654
|
-
if (result) setPreview({ ...result.importPreview, revision: result.revision });
|
|
1655
|
-
}, children: [
|
|
1656
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: "\u5BFC\u5165\u63D2\u4EF6\u914D\u7F6E" }),
|
|
1657
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [
|
|
1658
|
-
"\u9009\u62E9\u8FC1\u79FB JSON \u6587\u4EF6",
|
|
1659
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "file", accept: ".json,application/json", required: true, disabled: busy, onChange: async (e) => {
|
|
1660
|
-
resetPreview();
|
|
1661
|
-
setPassword("");
|
|
1662
|
-
setDocument("");
|
|
1663
|
-
const file = e.target.files?.[0];
|
|
1664
|
-
if (!file) return;
|
|
1665
|
-
if (file.size > 900 * 1024) {
|
|
1666
|
-
setError("\u8FC1\u79FB\u6587\u4EF6\u4E0D\u80FD\u8D85\u8FC7 900 KB");
|
|
1667
|
-
return;
|
|
1668
|
-
}
|
|
1669
|
-
try {
|
|
1670
|
-
setDocument(await file.text());
|
|
1671
|
-
setFileName(file.name);
|
|
1672
|
-
} catch {
|
|
1673
|
-
setError("\u65E0\u6CD5\u8BFB\u53D6\u6587\u4EF6");
|
|
1674
|
-
}
|
|
1675
|
-
} })
|
|
1676
|
-
] }),
|
|
1677
|
-
fileName && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "mono muted", children: fileName }),
|
|
1678
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [
|
|
1679
|
-
"\u8FC1\u79FB\u5BC6\u7801\uFF08\u4EC5\u52A0\u5BC6\u6587\u4EF6\u9700\u8981\uFF09",
|
|
1680
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "password", autoComplete: "off", maxLength: "1024", disabled: busy, value: password, onChange: (e) => {
|
|
1681
|
-
setPassword(e.target.value);
|
|
1682
|
-
resetPreview();
|
|
1683
|
-
} })
|
|
1684
|
-
] }),
|
|
1685
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [
|
|
1686
|
-
"\u5BFC\u5165\u65B9\u5F0F",
|
|
1687
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { disabled: busy, value: mode, onChange: (e) => {
|
|
1688
|
-
setMode(e.target.value);
|
|
1689
|
-
resetPreview();
|
|
1690
|
-
}, children: [
|
|
1691
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "merge", children: "\u5408\u5E76\uFF1A\u4FDD\u7559\u672C\u673A\u989D\u5916\u8D26\u53F7\u548C\u8DEF\u7531" }),
|
|
1692
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "replace", children: "\u66FF\u6362\uFF1A\u4F7F\u7528\u5BFC\u5165\u6587\u4EF6\u7684\u5B8C\u6574\u914D\u7F6E" })
|
|
1693
|
-
] })
|
|
1694
|
-
] }),
|
|
1695
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "notice", children: "\u5408\u5E76\u65F6\u540C ID \u7684\u914D\u7F6E\u4F1A\u66F4\u65B0\uFF1B\u5E26\u51ED\u8BC1\u7684\u8D26\u53F7\u4F1A\u66F4\u65B0\u767B\u5F55\u526F\u672C\u3002\u66FF\u6362\u4F1A\u79FB\u51FA\u73B0\u6709\u914D\u7F6E\u4E2D\u7684\u989D\u5916\u8D26\u53F7 / \u8DEF\u7531\uFF0C\u4F46\u4FDD\u7559\u539F\u51ED\u8BC1\u6587\u4EF6\u3002\u4E24\u79CD\u65B9\u5F0F\u90FD\u4F1A\u5148\u5907\u4EFD\u672C\u673A\u914D\u7F6E\u3002" }),
|
|
1696
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Feedback, { error }),
|
|
1697
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "submit", disabled: busy || !document2, children: "\u68C0\u67E5\u6587\u4EF6\u5E76\u9884\u89C8\u53D8\u66F4" }),
|
|
1698
|
-
preview && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "steps stack", children: [
|
|
1699
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: "\u5BFC\u5165\u9884\u89C8" }),
|
|
1700
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { children: [
|
|
1701
|
-
preview.accounts,
|
|
1702
|
-
" \u4E2A\u8D26\u53F7\uFF08\u65B0\u589E ",
|
|
1703
|
-
preview.newAccounts,
|
|
1704
|
-
"\uFF09 \xB7 ",
|
|
1705
|
-
preview.credentials,
|
|
1706
|
-
" \u4EFD\u51ED\u8BC1",
|
|
1707
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {}),
|
|
1708
|
-
preview.routes,
|
|
1709
|
-
" \u6761\u8DEF\u7531 \xB7 \u66F4\u65B0\u540C\u540D\u8DEF\u7531 ",
|
|
1710
|
-
preview.overwrittenRoutes,
|
|
1711
|
-
" \u6761",
|
|
1712
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {}),
|
|
1713
|
-
preview.needsLogin,
|
|
1714
|
-
" \u4E2A\u65B0\u8D26\u53F7\u9700\u8865\u5145\u767B\u5F55\uFF0C\u5C06\u5148\u505C\u7528"
|
|
1743
|
+
"\u8FC1\u79FB\u5BC6\u7801\uFF08\u4EC5\u52A0\u5BC6\u6587\u4EF6\u9700\u8981\uFF09",
|
|
1744
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "password", autoComplete: "off", maxLength: "1024", disabled: busy, value: password, onChange: (e) => {
|
|
1745
|
+
setPassword(e.target.value);
|
|
1746
|
+
resetPreview();
|
|
1747
|
+
} })
|
|
1715
1748
|
] }),
|
|
1716
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
}
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1749
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [
|
|
1750
|
+
"\u5BFC\u5165\u65B9\u5F0F",
|
|
1751
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { disabled: busy, value: mode, onChange: (e) => {
|
|
1752
|
+
setMode(e.target.value);
|
|
1753
|
+
resetPreview();
|
|
1754
|
+
}, children: [
|
|
1755
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "merge", children: "\u5408\u5E76\uFF1A\u4FDD\u7559\u672C\u673A\u989D\u5916\u8D26\u53F7\u548C\u8DEF\u7531" }),
|
|
1756
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "replace", children: "\u66FF\u6362\uFF1A\u4F7F\u7528\u5BFC\u5165\u6587\u4EF6\u7684\u5B8C\u6574\u914D\u7F6E" })
|
|
1757
|
+
] })
|
|
1758
|
+
] }),
|
|
1759
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "notice", children: "\u5408\u5E76\u65F6\u540C ID \u7684\u914D\u7F6E\u4F1A\u66F4\u65B0\uFF1B\u5E26\u51ED\u8BC1\u7684\u8D26\u53F7\u4F1A\u66F4\u65B0\u767B\u5F55\u526F\u672C\u3002\u66FF\u6362\u4F1A\u79FB\u51FA\u73B0\u6709\u914D\u7F6E\u4E2D\u7684\u989D\u5916\u8D26\u53F7 / \u8DEF\u7531\uFF0C\u4F46\u4FDD\u7559\u539F\u51ED\u8BC1\u6587\u4EF6\u3002\u4E24\u79CD\u65B9\u5F0F\u90FD\u4F1A\u5148\u5907\u4EFD\u672C\u673A\u914D\u7F6E\u3002" }),
|
|
1760
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Feedback, { error }),
|
|
1761
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "submit", disabled: busy || !document2, children: "\u68C0\u67E5\u6587\u4EF6\u5E76\u9884\u89C8\u53D8\u66F4" }),
|
|
1762
|
+
preview && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "steps stack", children: [
|
|
1763
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: "\u5BFC\u5165\u9884\u89C8" }),
|
|
1764
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { children: [
|
|
1765
|
+
preview.accounts,
|
|
1766
|
+
" \u4E2A\u8D26\u53F7\uFF08\u65B0\u589E ",
|
|
1767
|
+
preview.newAccounts,
|
|
1768
|
+
"\uFF09 \xB7 ",
|
|
1769
|
+
preview.credentials,
|
|
1770
|
+
" \u4EFD\u51ED\u8BC1",
|
|
1771
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {}),
|
|
1772
|
+
preview.routes,
|
|
1773
|
+
" \u6761\u8DEF\u7531 \xB7 \u66F4\u65B0\u540C\u540D\u8DEF\u7531 ",
|
|
1774
|
+
preview.overwrittenRoutes,
|
|
1775
|
+
" \u6761",
|
|
1776
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {}),
|
|
1777
|
+
preview.needsLogin,
|
|
1778
|
+
" \u4E2A\u65B0\u8D26\u53F7\u9700\u8865\u5145\u767B\u5F55\uFF0C\u5C06\u5148\u505C\u7528"
|
|
1779
|
+
] }),
|
|
1780
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { className: "primary", type: "button", disabled: busy, onClick: async () => {
|
|
1781
|
+
if (await act({ action: "config.import", revision: preview.revision, document: document2, password, mode })) {
|
|
1782
|
+
setDocument("");
|
|
1783
|
+
setPassword("");
|
|
1784
|
+
setPreview(null);
|
|
1785
|
+
}
|
|
1786
|
+
}, children: [
|
|
1787
|
+
"\u786E\u8BA4",
|
|
1788
|
+
mode === "merge" ? "\u5408\u5E76" : "\u66FF\u6362",
|
|
1789
|
+
"\u5E76\u5BFC\u5165"
|
|
1790
|
+
] })
|
|
1726
1791
|
] })
|
|
1727
1792
|
] })
|
|
1728
|
-
] })
|
|
1793
|
+
] }) })
|
|
1729
1794
|
] });
|
|
1730
1795
|
}
|
|
1731
1796
|
function ExpiryStatus({ route, act, busy, revision, onForce }) {
|
|
@@ -1761,40 +1826,45 @@ function FreeStatus({ route, busy, act, onUpdate }) {
|
|
|
1761
1826
|
}, children: status?.checking ? "\u6B63\u5728\u68C0\u67E5\u2026" : "\u7ACB\u5373\u68C0\u67E5\u514D\u8D39\u6A21\u578B" })
|
|
1762
1827
|
] }),
|
|
1763
1828
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "notice", children: "\u6309\u6A21\u578B\u81EA\u52A8\u521B\u5EFA\u8DEF\u7531\uFF0C\u52FE\u9009\u540E\u5206\u522B\u51FA\u73B0\u5728 DSH \u6A21\u578B\u5217\u8868\u4E2D\u3002\u540C\u4E00\u6A21\u578B\u53EA\u5728\u6709\u514D\u8D39\u8D44\u683C\u4E14\u652F\u6301\u6240\u9009\u63A8\u7406\u7B49\u7EA7\u7684\u8D26\u53F7\u95F4\u5207\u6362\uFF0C\u4E0D\u6DF7\u7528\u5176\u4ED6\u6A21\u578B\u3002\u6BCF\u5929\u68C0\u67E5\uFF0C\u8C03\u7528\u524D\u590D\u6838\uFF1B\u6062\u590D\u6536\u8D39\u6216\u68C0\u67E5\u5931\u8D25\u65F6\u81EA\u52A8\u79FB\u51FA\uFF0C\u514D\u8D39\u6062\u590D\u540E\u4FDD\u7559\u4F60\u7684\u52FE\u9009\u548C\u6863\u4F4D\u8BBE\u7F6E\u3002" }),
|
|
1764
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "
|
|
1765
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
1766
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("
|
|
1767
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1829
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "box table-shell", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "scroll", role: "region", "aria-label": "\u514D\u8D39\u6A21\u578B\u5C55\u793A\u4E0E\u63A8\u7406\u7B49\u7EA7", tabIndex: "0", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", { className: "table", children: [
|
|
1830
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
1831
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { scope: "col", children: "\u6A21\u578B / \u5C55\u793A" }),
|
|
1832
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { scope: "col", children: "\u53EF\u7528\u8D26\u53F7" }),
|
|
1833
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { scope: "col", children: "\u63A8\u7406\u7B49\u7EA7" })
|
|
1834
|
+
] }) }),
|
|
1835
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: models.map((m) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { className: m.selected ? "selected" : "", children: [
|
|
1836
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("td", { children: [
|
|
1837
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "check", children: [
|
|
1838
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "checkbox", "aria-label": `\u5C55\u793A ${m.modelName}`, disabled: busy, checked: m.selected, onChange: (e) => {
|
|
1839
|
+
void update(m, { visible: e.target.checked });
|
|
1840
|
+
} }),
|
|
1841
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: m.modelName })
|
|
1842
|
+
] }),
|
|
1843
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("small", { className: "muted", children: [
|
|
1844
|
+
m.name.split(" \xB7 ").at(-1),
|
|
1845
|
+
" \xB7 ",
|
|
1846
|
+
fmt(m.contextWindow / 1e3),
|
|
1847
|
+
"K \u4E0A\u4E0B\u6587"
|
|
1848
|
+
] })
|
|
1849
|
+
] }),
|
|
1850
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: m.accountNames.join("\u3001") || "\u6682\u65E0\u8D26\u53F7" }),
|
|
1851
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("td", { children: [
|
|
1852
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [
|
|
1853
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "sr-only", children: [
|
|
1854
|
+
m.modelName,
|
|
1855
|
+
" \u63A8\u7406\u7B49\u7EA7"
|
|
1856
|
+
] }),
|
|
1857
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { "aria-label": `${m.modelName} \u63A8\u7406\u7B49\u7EA7`, disabled: busy, value: m.reasoningEffort || "", onChange: (e) => {
|
|
1858
|
+
void update(m, { reasoningEffort: e.target.value || null });
|
|
1859
|
+
}, children: [
|
|
1860
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "", children: "\u5E73\u53F0\u9ED8\u8BA4" }),
|
|
1861
|
+
m.reasoning?.supportedEfforts?.map((e) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: e, children: effortNames[e] || e }, e))
|
|
1862
|
+
] })
|
|
1863
|
+
] }),
|
|
1864
|
+
m.effortUnavailable && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { className: "warn", children: "\u539F\u6863\u4F4D\u6682\u4E0D\u53EF\u7528\uFF0C\u4F7F\u7528\u5E73\u53F0\u9ED8\u8BA4" })
|
|
1793
1865
|
] })
|
|
1794
|
-
] })
|
|
1795
|
-
|
|
1796
|
-
m.effortUnavailable && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "notice", children: "\u4E4B\u524D\u9009\u62E9\u7684\u6863\u4F4D\u6682\u4E0D\u53EF\u7528\uFF0C\u5F53\u524D\u4F7F\u7528\u5E73\u53F0\u9ED8\u8BA4\u3002" })
|
|
1797
|
-
] }, m.id)) }),
|
|
1866
|
+
] }, m.id)) })
|
|
1867
|
+
] }) }) }),
|
|
1798
1868
|
!models.length && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "notice", children: "\u6682\u65E0\u786E\u8BA4\u514D\u8D39\u7684\u6A21\u578B\u3002\u6DFB\u52A0\u5E76\u542F\u7528\u8D26\u53F7\uFF0C\u6216\u7ACB\u5373\u68C0\u67E5\u76EE\u5F55\u3002" }),
|
|
1799
1869
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", { children: [
|
|
1800
1870
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("summary", { children: "\u5404\u8D26\u53F7\u68C0\u67E5\u72B6\u6001" }),
|
|
@@ -2014,6 +2084,7 @@ function InitialSetup({ data, busy, act, go }) {
|
|
|
2014
2084
|
var updateNames = { unchecked: "\u5F85\u68C0\u67E5", available: "\u53EF\u66F4\u65B0", current: "\u5DF2\u540C\u6B65", pinned: "\u56FA\u5B9A\u63D0\u4EA4", unsupported: "\u672C\u5730\u6765\u6E90", failed: "\u68C0\u67E5 / \u5B89\u88C5\u5931\u8D25", installed: "\u5DF2\u5B89\u88C5" };
|
|
2015
2085
|
function PluginUpdatesPanel({ data, busy, act }) {
|
|
2016
2086
|
const [query, setQuery] = (0, import_react.useState)(""), [selected, setSelected] = (0, import_react.useState)([]), [plan, setPlan] = (0, import_react.useState)(null), [registry, setRegistry] = (0, import_react.useState)(""), [filter, setFilter] = (0, import_react.useState)("all"), [pluginSearch, setPluginSearch] = (0, import_react.useState)("");
|
|
2087
|
+
const [diagnostic, setDiagnostic] = (0, import_react.useState)(null), [copied, setCopied] = (0, import_react.useState)(false);
|
|
2017
2088
|
const running = data?.job?.state === "running", blocked = busy || running;
|
|
2018
2089
|
const rows = (data?.rows ?? []).filter((r) => r.source.kind !== "builtin"), available = rows.filter((r) => r.status === "available" || r.status === "failed" && r.target);
|
|
2019
2090
|
(0, import_react.useEffect)(() => {
|
|
@@ -2036,34 +2107,40 @@ function PluginUpdatesPanel({ data, busy, act }) {
|
|
|
2036
2107
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "bar", children: [
|
|
2037
2108
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
2038
2109
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: "\u7528\u6237\u5B89\u88C5\u7684\u63D2\u4EF6\u4E0E\u66F4\u65B0" }),
|
|
2039
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
2110
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "notice", children: [
|
|
2111
|
+
rows.length,
|
|
2112
|
+
" \u4E2A\u7528\u6237\u5B89\u88C5\u63D2\u4EF6 \xB7 ",
|
|
2113
|
+
available.length,
|
|
2114
|
+
" \u4E2A\u53EF\u66F4\u65B0"
|
|
2115
|
+
] })
|
|
2040
2116
|
] }),
|
|
2041
2117
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "primary", disabled: blocked, onClick: () => {
|
|
2042
2118
|
void act({ action: "plugins.check" });
|
|
2043
2119
|
}, children: "\u68C0\u67E5\u5168\u90E8\u66F4\u65B0" })
|
|
2044
2120
|
] }),
|
|
2045
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
available.length,
|
|
2050
|
-
" \u4E2A\u53EF\u66F4\u65B0 \xB7 \u4E0A\u6B21\u68C0\u67E5 ",
|
|
2051
|
-
when(data.checkedAt)
|
|
2052
|
-
] }),
|
|
2053
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "filter", children: [
|
|
2054
|
-
"npm \u5B89\u88C5\u6E90",
|
|
2055
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { value: registry, disabled: blocked, onChange: (e) => setRegistry(e.target.value), children: [
|
|
2056
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "", children: "DSH \u8BBE\u7F6E\uFF08\u542B\u56DE\u9000\u6765\u6E90\uFF09" }),
|
|
2057
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "https://registry.npmjs.org/", children: "npm \u5B98\u65B9" }),
|
|
2058
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "https://registry.npmmirror.com/", children: "npmmirror" })
|
|
2059
|
-
] })
|
|
2060
|
-
] })
|
|
2121
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "notice", children: [
|
|
2122
|
+
"\u4E0A\u6B21\u68C0\u67E5 ",
|
|
2123
|
+
when(data.checkedAt),
|
|
2124
|
+
" \xB7 \u6BCF\u5929\u81EA\u52A8\u68C0\u67E5\u5E76\u63D0\u9192"
|
|
2061
2125
|
] }),
|
|
2062
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
2126
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", { className: "help", children: [
|
|
2127
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("summary", { children: "\u5B89\u88C5\u6E90\u4E0E\u68C0\u67E5\u89C4\u5219" }),
|
|
2128
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "stack", children: [
|
|
2129
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "filter", children: [
|
|
2130
|
+
"npm \u5B89\u88C5\u6E90",
|
|
2131
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { value: registry, disabled: blocked, onChange: (e) => setRegistry(e.target.value), children: [
|
|
2132
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "", children: "DSH \u8BBE\u7F6E\uFF08\u542B\u56DE\u9000\u6765\u6E90\uFF09" }),
|
|
2133
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "https://registry.npmjs.org/", children: "npm \u5B98\u65B9" }),
|
|
2134
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "https://registry.npmmirror.com/", children: "npmmirror" })
|
|
2135
|
+
] })
|
|
2136
|
+
] }),
|
|
2137
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "notice", children: "npm \u6309\u7248\u672C / \u53D1\u5E03\u9891\u9053\u68C0\u67E5\uFF0CGitHub \u6309\u5206\u652F\u63D0\u4EA4\u68C0\u67E5\uFF1B\u4FDD\u7559\u542F\u7528\u72B6\u6001\uFF0C\u56FA\u5B9A Git \u63D0\u4EA4\u4FDD\u6301\u4E0D\u52A8\u3002" })
|
|
2138
|
+
] })
|
|
2139
|
+
] })
|
|
2063
2140
|
] }),
|
|
2064
2141
|
data.job && !(data.job.kind === "check" && data.job.state === "done") && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "box stack", "aria-live": "polite", children: [
|
|
2065
2142
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "bar", children: [
|
|
2066
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: running ? data.job.kind === "check" ? "\u6B63\u5728\u68C0\u67E5\u66F4\u65B0\u2026" : "\u6B63\u5728\u5B89\u88C5\u63D2\u4EF6\u2026" : data.job.state === "cancelled" ? "\u64CD\u4F5C\u5DF2\u53D6\u6D88" : data.job.state === "failed" ? "\
|
|
2143
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: running ? data.job.kind === "check" ? "\u6B63\u5728\u68C0\u67E5\u66F4\u65B0\u2026" : "\u6B63\u5728\u5B89\u88C5\u63D2\u4EF6\u2026" : data.job.state === "cancelled" ? "\u64CD\u4F5C\u5DF2\u53D6\u6D88" : data.job.state === "failed" || data.job.results.some((r) => r.status === "failed") ? "\u6709\u63D2\u4EF6\u672A\u5B8C\u6210\u5B89\u88C5" : "\u64CD\u4F5C\u5DF2\u5B8C\u6210" }),
|
|
2067
2144
|
running && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { disabled: busy, onClick: () => {
|
|
2068
2145
|
void act({ action: "plugins.cancel" });
|
|
2069
2146
|
}, children: "\u53D6\u6D88" })
|
|
@@ -2079,6 +2156,10 @@ function PluginUpdatesPanel({ data, busy, act }) {
|
|
|
2079
2156
|
data.job.results.map((r, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "item", children: [
|
|
2080
2157
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: r.name }),
|
|
2081
2158
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: r.status === "failed" ? "error" : "notice", children: r.message || updateNames[r.status] || r.status }),
|
|
2159
|
+
r.diagnostic && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: () => {
|
|
2160
|
+
setCopied(false);
|
|
2161
|
+
setDiagnostic(JSON.stringify({ plugin: r.name, targetVersion: r.expectedVersion, ...r.diagnostic }, null, 2));
|
|
2162
|
+
}, children: "\u67E5\u770B\u8131\u654F\u8BCA\u65AD" }),
|
|
2082
2163
|
r.pendingBuilds?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "notice", children: [
|
|
2083
2164
|
"\u5F85\u6388\u6743\u811A\u672C\uFF1A",
|
|
2084
2165
|
r.pendingBuilds.join("\u3001"),
|
|
@@ -2087,8 +2168,8 @@ function PluginUpdatesPanel({ data, busy, act }) {
|
|
|
2087
2168
|
] }, r.name + i)),
|
|
2088
2169
|
data.job.results.some((r) => r.restartRequired) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "steps", children: "\u66F4\u65B0\u6587\u4EF6\u5DF2\u5B89\u88C5\u3002macOS \u4F7F\u7528 \u2318Q \u5B8C\u5168\u9000\u51FA DSH \u540E\u91CD\u5F00\uFF1BWindows \u9000\u51FA\u6258\u76D8\u5E94\u7528\u540E\u91CD\u5F00\uFF1B\u7F51\u9875\u7248\u91CD\u542F\u670D\u52A1\u3002\u5173\u95ED\u7A97\u53E3\u548C\u300C\u5237\u65B0\u9762\u677F\u300D\u4E0D\u4F1A\u91CD\u8F7D\u540E\u53F0\u3002" })
|
|
2089
2170
|
] }),
|
|
2090
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "box
|
|
2091
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "bar", children: [
|
|
2171
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "box table-shell", children: [
|
|
2172
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "bar section-pad", children: [
|
|
2092
2173
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "row", children: [
|
|
2093
2174
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { disabled: blocked || !available.length, onClick: () => setSelected(available.map((r) => r.name)), children: "\u9009\u62E9\u5168\u90E8\u53EF\u66F4\u65B0" }),
|
|
2094
2175
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { disabled: blocked || !selected.length, onClick: () => setSelected([]), children: "\u6E05\u7A7A\u9009\u62E9" })
|
|
@@ -2099,7 +2180,7 @@ function PluginUpdatesPanel({ data, busy, act }) {
|
|
|
2099
2180
|
"\uFF09"
|
|
2100
2181
|
] })
|
|
2101
2182
|
] }),
|
|
2102
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "row", children: [
|
|
2183
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "row section-pad", children: [
|
|
2103
2184
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { style: { flex: 1 }, children: [
|
|
2104
2185
|
"\u641C\u7D22\u5DF2\u5B89\u88C5\u63D2\u4EF6",
|
|
2105
2186
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { value: pluginSearch, onChange: (e) => setPluginSearch(e.target.value), placeholder: "\u6309\u63D2\u4EF6\u540D\u79F0\u7B5B\u9009" })
|
|
@@ -2132,7 +2213,7 @@ function PluginUpdatesPanel({ data, busy, act }) {
|
|
|
2132
2213
|
] }),
|
|
2133
2214
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("td", { children: [
|
|
2134
2215
|
r.source.kind === "npm" ? `npm \xB7 ${r.version || "\u672A\u77E5"}${r.latestVersion ? " \u2192 " + r.latestVersion : ""}` : r.source.kind === "github" ? `GitHub \xB7 ${r.version || "\u672A\u77E5\u7248\u672C"}` : "\u672C\u5730\u6587\u4EF6 / \u5F00\u53D1\u94FE\u63A5",
|
|
2135
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { className: "muted mono", children: r.source.kind === "npm" ? r.source.tag : r.source.kind === "github" ? `${r.commit?.slice(0, 8) || "\u672A\u77E5\u63D0\u4EA4"}${r.latestCommit ? " \u2192 " + r.latestCommit.slice(0, 8) : ""}` : "" })
|
|
2216
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { className: "muted mono", children: r.source.kind === "npm" ? `\u5B89\u88C5\u58F0\u660E ${r.source.source} \xB7 \u68C0\u67E5 ${r.source.tag}` : r.source.kind === "github" ? `${r.commit?.slice(0, 8) || "\u672A\u77E5\u63D0\u4EA4"}${r.latestCommit ? " \u2192 " + r.latestCommit.slice(0, 8) : ""}` : "" })
|
|
2136
2217
|
] }),
|
|
2137
2218
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("td", { children: [
|
|
2138
2219
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: r.status === "failed" ? "error" : r.status === "available" ? "good" : "muted", children: updateNames[r.status] }),
|
|
@@ -2144,21 +2225,35 @@ function PluginUpdatesPanel({ data, busy, act }) {
|
|
|
2144
2225
|
!visibleRows.length && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "empty", children: running ? "\u6B63\u5728\u8BFB\u53D6\u63D2\u4EF6\u6E05\u5355\u2026" : rows.length ? "\u6CA1\u6709\u5339\u914D\u7684\u5DF2\u5B89\u88C5\u63D2\u4EF6\uFF0C\u8BF7\u8C03\u6574\u7B5B\u9009\u3002" : "\u5F53\u524D\u914D\u7F6E\u5C1A\u672A\u8BFB\u53D6\u63D2\u4EF6\uFF0C\u8BF7\u68C0\u67E5\u66F4\u65B0\u3002" })
|
|
2145
2226
|
] })
|
|
2146
2227
|
] }),
|
|
2147
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("
|
|
2148
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("
|
|
2149
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
"
|
|
2156
|
-
|
|
2228
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", { className: "box help install-plugin", children: [
|
|
2229
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("summary", { children: "\u5B89\u88C5 npm / GitHub \u63D2\u4EF6" }),
|
|
2230
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "stack", children: [
|
|
2231
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", { className: "row", onSubmit: (e) => {
|
|
2232
|
+
e.preventDefault();
|
|
2233
|
+
const spec = new FormData(e.currentTarget).get("spec").trim();
|
|
2234
|
+
if (spec) setPlan({ kind: "install", spec });
|
|
2235
|
+
}, children: [
|
|
2236
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { style: { flex: 1 }, children: [
|
|
2237
|
+
"\u5B89\u88C5\u5730\u5740",
|
|
2238
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { name: "spec", value: query, onChange: (e) => setQuery(e.target.value), disabled: blocked, required: true, placeholder: "\u5305\u540D\u3001\u5305\u540D@\u7248\u672C \u6216 github:\u7528\u6237/\u4ED3\u5E93", autoComplete: "off" })
|
|
2239
|
+
] }),
|
|
2240
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { disabled: blocked || !query.trim(), children: "\u67E5\u770B\u5E76\u5B89\u88C5" })
|
|
2157
2241
|
] }),
|
|
2158
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("
|
|
2159
|
-
] })
|
|
2160
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "notice", children: "\u4F7F\u7528 DSH \u81EA\u5E26\u5B89\u88C5\u5668\u6267\u884C\u517C\u5BB9\u68C0\u67E5\u3001\u955C\u50CF\u91CD\u8BD5\u548C\u5931\u8D25\u56DE\u6EDA\u3002npm \u955C\u50CF\u53EA\u4F5C\u7528\u4E8E npm \u5305\uFF0CGitHub \u4E0B\u8F7D\u5931\u8D25\u9700\u68C0\u67E5 GitHub \u7F51\u7EDC\u3002\u7F51\u7EDC\u5931\u8D25\u540E\u53EF\u91CD\u65B0\u68C0\u67E5\u6216\u66F4\u6362 npm \u5B89\u88C5\u6E90\u518D\u91CD\u8BD5\u3002" })
|
|
2242
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "notice", children: "\u4F7F\u7528 DSH \u81EA\u5E26\u5B89\u88C5\u5668\u6267\u884C\u517C\u5BB9\u68C0\u67E5\u3001\u955C\u50CF\u91CD\u8BD5\u548C\u5931\u8D25\u56DE\u6EDA\u3002npm \u955C\u50CF\u53EA\u4F5C\u7528\u4E8E npm \u5305\uFF0CGitHub \u4E0B\u8F7D\u5931\u8D25\u9700\u68C0\u67E5 GitHub \u7F51\u7EDC\u3002\u7F51\u7EDC\u5931\u8D25\u540E\u53EF\u91CD\u65B0\u68C0\u67E5\u6216\u66F4\u6362 npm \u5B89\u88C5\u6E90\u518D\u91CD\u8BD5\u3002" })
|
|
2243
|
+
] })
|
|
2161
2244
|
] }),
|
|
2245
|
+
diagnostic && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Modal, { title: "\u63D2\u4EF6\u5B89\u88C5\u8BCA\u65AD", close: () => setDiagnostic(null), children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "modal-body stack", children: [
|
|
2246
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "notice", children: "\u4EE5\u4E0B\u4FE1\u606F\u53EA\u542B\u63D2\u4EF6\u540D\u3001\u7248\u672C\u3001\u7CFB\u7EDF\u548C\u9519\u8BEF\u5206\u7C7B\uFF0C\u53EF\u590D\u5236\u7528\u4E8E\u6392\u67E5\uFF1B\u672A\u5305\u542B\u539F\u59CB\u65E5\u5FD7\u3001\u7528\u6237\u540D\u8DEF\u5F84\u6216\u51ED\u8BC1\u3002\u82E5\u539F\u56E0\u672A\u77E5\uFF0C\u8BF7\u5728 DSH \u539F\u751F\u63D2\u4EF6\u9875\u83B7\u53D6\u5B89\u88C5\u65E5\u5FD7\u3002" }),
|
|
2247
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("textarea", { "aria-label": "\u8131\u654F\u5B89\u88C5\u8BCA\u65AD", readOnly: true, rows: "9", value: diagnostic, onFocus: (e) => e.currentTarget.select() }),
|
|
2248
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { onClick: async () => {
|
|
2249
|
+
try {
|
|
2250
|
+
await navigator.clipboard.writeText(diagnostic);
|
|
2251
|
+
setCopied(true);
|
|
2252
|
+
} catch {
|
|
2253
|
+
setCopied(false);
|
|
2254
|
+
}
|
|
2255
|
+
}, children: copied ? "\u5DF2\u590D\u5236" : "\u590D\u5236\u8BCA\u65AD" })
|
|
2256
|
+
] }) }),
|
|
2162
2257
|
plan && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Modal, { title: plan.kind === "install" ? "\u786E\u8BA4\u5B89\u88C5\u63D2\u4EF6" : "\u786E\u8BA4\u66F4\u65B0\u63D2\u4EF6", close: () => setPlan(null), busy: blocked, children: [
|
|
2163
2258
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "modal-body stack", children: [
|
|
2164
2259
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "\u8FD9\u4E9B\u64CD\u4F5C\u4F5C\u7528\u4E8E\u5F53\u524D DSH \u914D\u7F6E\u7684\u6240\u6709\u4F1A\u8BDD\u3002\u5B89\u88C5\u540E\u662F\u5426\u9700\u8981\u91CD\u542F\uFF0C\u4F1A\u5728\u7ED3\u679C\u4E2D\u8BF4\u660E\u3002" }),
|