@jayyuen66/dsh-zvec-grep 0.1.13 → 0.1.15
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 +17 -0
- package/README.md +27 -26
- package/README.zh-CN.md +5 -5
- package/client.js +616 -28
- package/cordis.patch.yml +0 -3
- package/host.js +227 -163
- package/package.json +46 -48
package/client.js
CHANGED
|
@@ -8,7 +8,6 @@ window.__ModuleLoader__.load({
|
|
|
8
8
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
9
9
|
let react = require("react");
|
|
10
10
|
let zod = require("zod");
|
|
11
|
-
let _jayyuen66_dsh_plugin_shared_client = require("@jayyuen66/dsh-plugin-shared/client");
|
|
12
11
|
// lib/embedding-catalog.ts
|
|
13
12
|
/** 默认模型:本地最强(1024 维 / 8192 上下文 / 中英通用),约 640MB 一次性下载。 */
|
|
14
13
|
const DEFAULT_EMBEDDING = "local/qwen3-embedding-0.6b";
|
|
@@ -89,6 +88,595 @@ const REMOTE_EMBEDDING_CATALOG = Object.freeze([
|
|
|
89
88
|
dimension: 1024
|
|
90
89
|
}
|
|
91
90
|
].map((entry) => Object.freeze(entry)));
|
|
91
|
+
// node_modules/@jayyuen66/dsh-plugin-shared/dist/card-ui-D2cuQvLS.js
|
|
92
|
+
const c = `
|
|
93
|
+
.dsu-form{display:flex;flex-direction:column}
|
|
94
|
+
.dsu-section{margin-top:24px;padding-top:24px;border-top:.5px solid var(--dsw-alias-border-l1)}
|
|
95
|
+
.dsu-form>.dsu-section:first-child{margin-top:0;padding-top:0;border-top:0}
|
|
96
|
+
.dsu-sectionTitle{margin:0;font-size:15px;font-weight:600;line-height:1.4;color:var(--dsw-alias-label-primary)}
|
|
97
|
+
.dsu-sectionHint{margin:4px 0 0;font-size:12px;line-height:1.5;color:var(--dsw-alias-label-tertiary)}
|
|
98
|
+
.dsu-statusbar{display:flex;flex-wrap:wrap;gap:4px 8px;margin-top:8px;font-size:12px;line-height:1.5;color:var(--dsw-alias-label-tertiary)}
|
|
99
|
+
.dsu-field{display:grid;grid-template-columns:minmax(0,1fr) minmax(240px,360px);column-gap:32px;align-items:center;padding:12px 0;border-top:.5px solid var(--dsw-alias-border-l2)}
|
|
100
|
+
.dsu-fieldMeta{display:flex;flex-direction:column;gap:4px;min-width:0}
|
|
101
|
+
.dsu-labelRow{display:flex;align-items:center;gap:6px;min-width:0}
|
|
102
|
+
.dsu-label{font-size:13px;font-weight:500;line-height:1.5;color:var(--dsw-alias-label-primary)}
|
|
103
|
+
.dsu-labelMono{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px}
|
|
104
|
+
.dsu-hint{margin:0;font-size:12px;line-height:1.5;color:var(--dsw-alias-label-tertiary)}
|
|
105
|
+
.dsu-control{min-width:0;display:flex;align-items:center;gap:8px}
|
|
106
|
+
.dsu-fieldWide{grid-template-columns:minmax(0,1fr);align-items:start}
|
|
107
|
+
.dsu-fieldWide .dsu-control{width:100%;max-width:720px;margin-top:2px}
|
|
108
|
+
.dsu-help{display:inline-flex;align-items:center;gap:6px;min-width:0}
|
|
109
|
+
.dsu-helpBtn{appearance:none;border:0;background:transparent;padding:0;width:16px;height:16px;display:inline-flex;align-items:center;justify-content:center;color:var(--dsw-alias-label-tertiary);cursor:help;border-radius:50%;flex:none}
|
|
110
|
+
.dsu-help:hover .dsu-helpBtn,.dsu-helpBtn:focus-visible{color:var(--dsw-alias-label-primary)}
|
|
111
|
+
.dsu-helpBtn:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:1px}
|
|
112
|
+
.dsu-tip{position:fixed;z-index:60;box-sizing:border-box;max-width:min(340px,calc(100vw - 16px));max-height:calc(100vh - 16px);overflow:auto;overflow-wrap:anywhere;padding:10px 12px;border-radius:10px;background:var(--dsw-alias-bg-layer-2);border:.5px solid var(--dsw-alias-border-l3);box-shadow:0 12px 32px rgb(0 0 0 / 45%);font-size:12px;line-height:1.6;font-weight:400;color:var(--dsw-alias-label-secondary)}
|
|
113
|
+
.dsu-input{width:100%;height:34px;padding:0 12px;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-primary);font:inherit;font-size:13px}
|
|
114
|
+
.dsu-input:focus-visible{outline:none;border-color:var(--dsw-alias-state-business-primary)}
|
|
115
|
+
.dsu-input[aria-invalid="true"]{border-color:var(--dsw-alias-state-error-primary)}
|
|
116
|
+
.dsu-input:disabled{color:var(--dsw-alias-label-tertiary);cursor:default}
|
|
117
|
+
.dsu-input::placeholder{color:var(--dsw-alias-label-tertiary)}
|
|
118
|
+
.dsu-textarea{height:auto;min-height:96px;padding:8px 12px;line-height:1.6;resize:vertical}
|
|
119
|
+
.dsu-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}
|
|
120
|
+
.dsu-numberWrap{display:flex;flex-direction:column;gap:4px;width:100%;min-width:0}
|
|
121
|
+
.dsu-number{display:flex;align-items:center;gap:8px;min-width:0}
|
|
122
|
+
.dsu-number .dsu-input{min-width:0}
|
|
123
|
+
.dsu-unit{flex:none;font-size:12px;color:var(--dsw-alias-label-tertiary)}
|
|
124
|
+
.dsu-error{margin:0;font-size:12px;line-height:1.5;color:var(--dsw-alias-state-error-primary)}
|
|
125
|
+
.dsu-switch{appearance:none;width:36px;height:20px;border-radius:999px;border:0;padding:2px;background:var(--dsw-alias-border-l3);display:flex;align-items:center;cursor:pointer;flex:none;transition:background-color .16s}
|
|
126
|
+
.dsu-knob{width:16px;height:16px;border-radius:50%;background:var(--dsw-alias-label-primary);transition:transform .16s,background-color .16s}
|
|
127
|
+
.dsu-switch[aria-checked="true"]{background:var(--dsw-alias-label-primary)}
|
|
128
|
+
.dsu-switch[aria-checked="true"] .dsu-knob{transform:translateX(16px);background:var(--dsw-alias-label-primary-foreground)}
|
|
129
|
+
.dsu-switch:disabled{opacity:.4;cursor:not-allowed}
|
|
130
|
+
.dsu-switch:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}
|
|
131
|
+
.dsu-selectWrap{position:relative;width:100%;min-width:0}
|
|
132
|
+
.dsu-select{display:flex;align-items:center;justify-content:space-between;gap:8px;text-align:left;cursor:pointer}
|
|
133
|
+
.dsu-select[aria-expanded="true"]{border-color:var(--dsw-alias-state-business-primary)}
|
|
134
|
+
.dsu-selectValue{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
135
|
+
.dsu-chevron{flex:none;color:var(--dsw-alias-label-tertiary);transition:transform .16s}
|
|
136
|
+
.dsu-select[aria-expanded="true"] .dsu-chevron{transform:rotate(180deg)}
|
|
137
|
+
.dsu-menu{position:fixed;position-area:block-end span-inline-start;justify-self:start;margin-top:6px;z-index:70;padding:4px;background:var(--dsw-alias-bg-layer-2);border:.5px solid var(--dsw-alias-border-l3);border-radius:12px;box-shadow:0 12px 32px rgb(0 0 0 / 50%);max-height:280px;overflow:auto}
|
|
138
|
+
.dsu-option{appearance:none;border:0;background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:13px;line-height:1.4;width:100%;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:8px 10px;border-radius:8px;cursor:pointer;text-align:left}
|
|
139
|
+
.dsu-option:hover,.dsu-option[data-active="true"]{background:var(--dsw-alias-bg-layer-3)}
|
|
140
|
+
.dsu-option:disabled{color:var(--dsw-alias-label-tertiary);cursor:not-allowed}
|
|
141
|
+
.dsu-option:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:-2px}
|
|
142
|
+
.dsu-optionGroup{padding:6px 10px 2px;font-size:11px;font-weight:600;color:var(--dsw-alias-label-tertiary)}
|
|
143
|
+
.dsu-check{opacity:0;flex:none}
|
|
144
|
+
.dsu-option[aria-selected="true"] .dsu-check{opacity:1}
|
|
145
|
+
.dsu-savebar{display:flex;align-items:center;gap:8px;padding:12px 0;margin-top:24px;border-top:.5px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base)}
|
|
146
|
+
.dsu-savebar[data-dirty="true"]{position:sticky;bottom:0;z-index:2;box-shadow:0 -12px 24px rgb(0 0 0 / 35%)}
|
|
147
|
+
.dsu-btn{appearance:none;border:.5px solid var(--dsw-alias-border-l2);background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:13px;line-height:1.5;border-radius:var(--dsw-radius-md);padding:5px 14px;cursor:pointer;transition:background-color .12s,border-color .12s,color .12s,filter .12s}
|
|
148
|
+
.dsu-btn:hover:not(:disabled){background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-border-l3)}
|
|
149
|
+
.dsu-btn:active:not(:disabled){background:var(--dsw-alias-bg-layer-1)}
|
|
150
|
+
.dsu-btn:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:1px}
|
|
151
|
+
.dsu-btn:disabled{opacity:.4;cursor:not-allowed}
|
|
152
|
+
.dsu-btnPrimary{background:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3)}
|
|
153
|
+
.dsu-btnPrimary:hover:not(:disabled){background:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-primary);filter:brightness(.9)}
|
|
154
|
+
.dsu-btnPrimary:active:not(:disabled){background:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-primary);filter:brightness(.84)}
|
|
155
|
+
.dsu-btnDanger{color:var(--dsw-alias-state-error-primary)}
|
|
156
|
+
.dsu-btnDanger:hover:not(:disabled){color:var(--dsw-alias-state-error-primary);border-color:var(--dsw-alias-state-error-primary);background:var(--dsw-alias-bg-layer-2)}
|
|
157
|
+
.dsu-status{margin-left:auto;font-size:12px;color:var(--dsw-alias-label-tertiary)}
|
|
158
|
+
.dsu-statusError{color:var(--dsw-alias-state-error-primary)}
|
|
159
|
+
.dsu-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(200px,100%),1fr));gap:0 24px}
|
|
160
|
+
.dsu-grid>.dsu-field{display:flex;flex-direction:column;align-items:stretch;gap:6px;padding:10px 0;border-top:.5px solid var(--dsw-alias-border-l1)}
|
|
161
|
+
.dsu-grid>.dsu-field .dsu-control{width:100%}
|
|
162
|
+
@media (max-width:640px){
|
|
163
|
+
.dsu-field{grid-template-columns:minmax(0,1fr);align-items:start}
|
|
164
|
+
.dsu-control{width:100%;max-width:720px}
|
|
165
|
+
.dsu-section{margin-top:20px;padding-top:20px}
|
|
166
|
+
}
|
|
167
|
+
@media (prefers-reduced-motion:reduce){
|
|
168
|
+
.dsu-switch,.dsu-knob,.dsu-chevron,.dsu-btn{transition:none}
|
|
169
|
+
}
|
|
170
|
+
`;
|
|
171
|
+
function l(e, t = 30) {
|
|
172
|
+
return e.length <= t ? { hint: e } : { detail: e };
|
|
173
|
+
}
|
|
174
|
+
function u(t) {
|
|
175
|
+
return (0, react.createElement)(`div`, { className: `dsu-form` }, t.children);
|
|
176
|
+
}
|
|
177
|
+
function d(t) {
|
|
178
|
+
return (0, react.createElement)(`section`, { className: `dsu-section` }, (0, react.createElement)(`h2`, { className: `dsu-sectionTitle` }, t.title), t.hint === void 0 ? null : (0, react.createElement)(`p`, { className: `dsu-sectionHint` }, t.hint), t.children);
|
|
179
|
+
}
|
|
180
|
+
function m(a) {
|
|
181
|
+
let c = (0, react.useId)(), [l, u] = (0, react.useState)(!1), [d, f] = (0, react.useState)(!1), p = (0, react.useRef)(!1), m = (0, react.useRef)(!1), h = (0, react.useRef)(!1), g = (0, react.useRef)(null), _ = (0, react.useRef)(null), v = (0, react.useRef)(null), y = (0, react.useCallback)(() => {
|
|
182
|
+
v.current !== null && (clearTimeout(v.current), v.current = null);
|
|
183
|
+
}, []), b = (0, react.useCallback)(() => {
|
|
184
|
+
let e = g.current, t = _.current;
|
|
185
|
+
/* v8 ignore next 3 -- place 只在 open 的 layout effect 与挂载期监听器里调用;refs 为空只可能是卸载竞态 */
|
|
186
|
+
if (e === null || t === null) return;
|
|
187
|
+
let n = e.getBoundingClientRect(), r = t.offsetWidth, i = t.offsetHeight, { left: a } = n, o = n.bottom + 8;
|
|
188
|
+
o + i > window.innerHeight - 8 && (o = n.top - i - 8), a + r > window.innerWidth - 8 && (a = window.innerWidth - r - 8);
|
|
189
|
+
let s = Math.max(8, window.innerWidth - r - 8), c = Math.max(8, window.innerHeight - i - 8);
|
|
190
|
+
t.style.left = `${Math.min(Math.max(8, a), s)}px`, t.style.top = `${Math.min(Math.max(8, o), c)}px`;
|
|
191
|
+
}, []), x = (0, react.useCallback)(() => {
|
|
192
|
+
y(), h.current = !1, f(!1), u(!1);
|
|
193
|
+
}, [y]), S = (0, react.useCallback)(() => {
|
|
194
|
+
y(), u(!0);
|
|
195
|
+
}, [y]), C = (0, react.useCallback)(() => {
|
|
196
|
+
y(), p.current || m.current || h.current || (v.current = setTimeout(() => {
|
|
197
|
+
/* v8 ignore next 3 -- 任何重新进入/钉住都会 cancelHide;这次复查只防未来的异步路径 */
|
|
198
|
+
v.current = null, p.current || m.current || h.current || u(!1);
|
|
199
|
+
}, 120));
|
|
200
|
+
}, [y]), w = (0, react.useCallback)((e) => {
|
|
201
|
+
h.current = e, f(e);
|
|
202
|
+
}, []);
|
|
203
|
+
(0, react.useLayoutEffect)(() => {
|
|
204
|
+
if (!l) return () => {};
|
|
205
|
+
b();
|
|
206
|
+
let e = (e) => {
|
|
207
|
+
let { target: t } = e;
|
|
208
|
+
t instanceof Node && _.current?.contains(t) === !0 || (h.current ? b() : x());
|
|
209
|
+
}, t = () => {
|
|
210
|
+
b();
|
|
211
|
+
};
|
|
212
|
+
return window.addEventListener(`scroll`, e, !0), window.addEventListener(`resize`, t), () => {
|
|
213
|
+
window.removeEventListener(`scroll`, e, !0), window.removeEventListener(`resize`, t);
|
|
214
|
+
};
|
|
215
|
+
}, [
|
|
216
|
+
l,
|
|
217
|
+
a.detail,
|
|
218
|
+
b,
|
|
219
|
+
x
|
|
220
|
+
]), (0, react.useEffect)(() => {
|
|
221
|
+
if (!l) return () => {};
|
|
222
|
+
let e = (e) => {
|
|
223
|
+
e.key === `Escape` && x();
|
|
224
|
+
};
|
|
225
|
+
return document.addEventListener(`keydown`, e), () => {
|
|
226
|
+
document.removeEventListener(`keydown`, e);
|
|
227
|
+
};
|
|
228
|
+
}, [l, x]), (0, react.useEffect)(() => y, [y]);
|
|
229
|
+
let T = (0, react.createElement)(`button`, {
|
|
230
|
+
ref: g,
|
|
231
|
+
type: `button`,
|
|
232
|
+
className: `dsu-helpBtn`,
|
|
233
|
+
"aria-label": `${a.label} 说明`,
|
|
234
|
+
"aria-describedby": c,
|
|
235
|
+
"aria-pressed": d,
|
|
236
|
+
onClick: () => {
|
|
237
|
+
h.current ? x() : (w(!0), S());
|
|
238
|
+
}
|
|
239
|
+
}, (0, react.createElement)(`svg`, {
|
|
240
|
+
width: 12,
|
|
241
|
+
height: 12,
|
|
242
|
+
viewBox: `0 0 14 14`,
|
|
243
|
+
"aria-hidden": !0
|
|
244
|
+
}, (0, react.createElement)(`circle`, {
|
|
245
|
+
cx: 7,
|
|
246
|
+
cy: 7,
|
|
247
|
+
r: 6,
|
|
248
|
+
fill: `none`,
|
|
249
|
+
stroke: `currentColor`,
|
|
250
|
+
strokeWidth: 1.2
|
|
251
|
+
}), (0, react.createElement)(`path`, {
|
|
252
|
+
d: `M7 6.2v4`,
|
|
253
|
+
stroke: `currentColor`,
|
|
254
|
+
strokeWidth: 1.3,
|
|
255
|
+
strokeLinecap: `round`
|
|
256
|
+
}), (0, react.createElement)(`circle`, {
|
|
257
|
+
cx: 7,
|
|
258
|
+
cy: 4.3,
|
|
259
|
+
r: .8,
|
|
260
|
+
fill: `currentColor`
|
|
261
|
+
}))), E = (0, react.createElement)(`div`, {
|
|
262
|
+
ref: _,
|
|
263
|
+
id: c,
|
|
264
|
+
role: `tooltip`,
|
|
265
|
+
className: `dsu-tip`,
|
|
266
|
+
hidden: !l
|
|
267
|
+
}, a.detail), D = a.showLabel === !1 ? null : (0, react.createElement)(`span`, { className: `dsu-label${a.compact === !0 ? ` dsu-labelMono` : ``}` }, a.label);
|
|
268
|
+
return (0, react.createElement)(`span`, {
|
|
269
|
+
className: `dsu-help`,
|
|
270
|
+
onMouseEnter: () => {
|
|
271
|
+
p.current = !0, S();
|
|
272
|
+
},
|
|
273
|
+
onMouseLeave: () => {
|
|
274
|
+
p.current = !1, C();
|
|
275
|
+
},
|
|
276
|
+
onFocus: () => {
|
|
277
|
+
m.current = !0, S();
|
|
278
|
+
},
|
|
279
|
+
onBlur: (e) => {
|
|
280
|
+
let t = e.relatedTarget;
|
|
281
|
+
t instanceof Node && e.currentTarget.contains(t) || (m.current = !1, C());
|
|
282
|
+
}
|
|
283
|
+
}, D, T, E);
|
|
284
|
+
}
|
|
285
|
+
function h(t) {
|
|
286
|
+
let n = `dsu-label${t.compact === !0 ? ` dsu-labelMono` : ``}`, r = t.controlId === void 0 ? (0, react.createElement)(`span`, { className: n }, t.label) : (0, react.createElement)(`label`, {
|
|
287
|
+
className: n,
|
|
288
|
+
htmlFor: t.controlId
|
|
289
|
+
}, t.label);
|
|
290
|
+
return (0, react.createElement)(`div`, { className: `dsu-labelRow` }, r, t.detail === void 0 ? null : (0, react.createElement)(m, {
|
|
291
|
+
label: t.label,
|
|
292
|
+
detail: t.detail,
|
|
293
|
+
showLabel: !1
|
|
294
|
+
}));
|
|
295
|
+
}
|
|
296
|
+
function g(t) {
|
|
297
|
+
let n = t.controlId === void 0 ? void 0 : `${t.controlId}-hint`;
|
|
298
|
+
return (0, react.createElement)(`div`, { className: `dsu-field${t.wide === !0 ? ` dsu-fieldWide` : ``}` }, (0, react.createElement)(`div`, { className: `dsu-fieldMeta` }, (0, react.createElement)(h, {
|
|
299
|
+
label: t.label,
|
|
300
|
+
detail: t.detail,
|
|
301
|
+
compact: t.compact,
|
|
302
|
+
controlId: t.controlId
|
|
303
|
+
}), t.hint === void 0 ? null : (0, react.createElement)(`p`, {
|
|
304
|
+
className: `dsu-hint`,
|
|
305
|
+
id: n
|
|
306
|
+
}, t.hint)), (0, react.createElement)(`div`, { className: `dsu-control` }, t.children));
|
|
307
|
+
}
|
|
308
|
+
function _(t) {
|
|
309
|
+
let n = (0, react.useId)(), i = t.hint === void 0 ? void 0 : `${n}-hint`;
|
|
310
|
+
return (0, react.createElement)(g, {
|
|
311
|
+
...t,
|
|
312
|
+
controlId: n
|
|
313
|
+
}, (0, react.createElement)(`button`, {
|
|
314
|
+
type: `button`,
|
|
315
|
+
role: `switch`,
|
|
316
|
+
id: n,
|
|
317
|
+
className: `dsu-switch`,
|
|
318
|
+
"aria-checked": t.checked,
|
|
319
|
+
"aria-describedby": i,
|
|
320
|
+
"data-field": t.field,
|
|
321
|
+
disabled: t.disabled === !0,
|
|
322
|
+
onClick: () => {
|
|
323
|
+
t.onChange(!t.checked);
|
|
324
|
+
}
|
|
325
|
+
}, (0, react.createElement)(`span`, { className: `dsu-knob` })));
|
|
326
|
+
}
|
|
327
|
+
function v(t) {
|
|
328
|
+
let i = typeof t.value == `number` && Number.isFinite(t.value) ? String(t.value) : ``, [a, c] = (0, react.useState)(i), [l, u] = (0, react.useState)(!1), d = (0, react.useRef)(void 0), f = (0, react.useId)(), p = (0, react.useId)(), m = [t.hint === void 0 ? void 0 : `${f}-hint`, l ? p : void 0].filter((e) => e !== void 0), h = m.length === 0 ? void 0 : m.join(` `);
|
|
329
|
+
(0, react.useEffect)(() => {
|
|
330
|
+
t.value !== d.current && (d.current = t.value, c(i), u(!1));
|
|
331
|
+
}, [t.value, i]);
|
|
332
|
+
let _ = (e) => {
|
|
333
|
+
let n = t.min ?? -1 / 0, r = t.max ?? 1 / 0;
|
|
334
|
+
if (!Number.isFinite(e) || e < n || e > r) return !1;
|
|
335
|
+
let { step: i } = t;
|
|
336
|
+
if (i === void 0 || i <= 0) return !0;
|
|
337
|
+
let a = (e - (t.min ?? 0)) / i;
|
|
338
|
+
return Math.abs(a - Math.round(a)) < 1e-9;
|
|
339
|
+
}, v = (e) => {
|
|
340
|
+
if (c(e), e === ``) {
|
|
341
|
+
u(!1), d.current = void 0, t.onChange(void 0);
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
let n = Number(e);
|
|
345
|
+
_(n) ? (u(!1), d.current = n, t.onChange(n)) : u(!0);
|
|
346
|
+
}, y = () => {
|
|
347
|
+
a === `` || l || c(String(Number(a)));
|
|
348
|
+
};
|
|
349
|
+
return (0, react.createElement)(g, {
|
|
350
|
+
...t,
|
|
351
|
+
controlId: f
|
|
352
|
+
}, (0, react.createElement)(`div`, { className: `dsu-numberWrap` }, (0, react.createElement)(`div`, { className: `dsu-number` }, (0, react.createElement)(`input`, {
|
|
353
|
+
className: `dsu-input`,
|
|
354
|
+
type: `number`,
|
|
355
|
+
inputMode: `numeric`,
|
|
356
|
+
id: f,
|
|
357
|
+
value: a,
|
|
358
|
+
min: t.min,
|
|
359
|
+
max: t.max,
|
|
360
|
+
step: t.step,
|
|
361
|
+
placeholder: t.placeholder,
|
|
362
|
+
"aria-invalid": l || void 0,
|
|
363
|
+
"aria-describedby": h,
|
|
364
|
+
"data-field": t.field,
|
|
365
|
+
disabled: t.disabled === !0,
|
|
366
|
+
onChange: (e) => {
|
|
367
|
+
v(e.target.value);
|
|
368
|
+
},
|
|
369
|
+
onBlur: y
|
|
370
|
+
}), t.unit === void 0 ? null : (0, react.createElement)(`span`, { className: `dsu-unit` }, t.unit)), l ? (0, react.createElement)(`p`, {
|
|
371
|
+
className: `dsu-error`,
|
|
372
|
+
id: p
|
|
373
|
+
}, t.invalidHint) : null));
|
|
374
|
+
}
|
|
375
|
+
function y(t) {
|
|
376
|
+
let [i, a] = (0, react.useState)(t.value), [o, c] = (0, react.useState)(!1), l = (0, react.useId)(), u = t.hint === void 0 ? void 0 : `${l}-hint`;
|
|
377
|
+
(0, react.useEffect)(() => {
|
|
378
|
+
o || a(t.value);
|
|
379
|
+
}, [t.value, o]);
|
|
380
|
+
let d = {
|
|
381
|
+
id: l,
|
|
382
|
+
className: `dsu-input${t.multiline === !0 ? ` dsu-textarea` : ``}${t.monospace === !0 ? ` dsu-mono` : ``}`,
|
|
383
|
+
value: i,
|
|
384
|
+
placeholder: t.placeholder,
|
|
385
|
+
"aria-describedby": u,
|
|
386
|
+
"data-field": t.field,
|
|
387
|
+
disabled: t.disabled === !0,
|
|
388
|
+
onFocus: () => {
|
|
389
|
+
c(!0);
|
|
390
|
+
},
|
|
391
|
+
onBlur: () => {
|
|
392
|
+
c(!1);
|
|
393
|
+
},
|
|
394
|
+
onChange: (e) => {
|
|
395
|
+
a(e.target.value), t.onChange(e.target.value);
|
|
396
|
+
}
|
|
397
|
+
};
|
|
398
|
+
return (0, react.createElement)(g, {
|
|
399
|
+
...t,
|
|
400
|
+
controlId: l
|
|
401
|
+
}, t.multiline === !0 ? (0, react.createElement)(`textarea`, d) : (0, react.createElement)(`input`, d));
|
|
402
|
+
}
|
|
403
|
+
function x() {
|
|
404
|
+
return `happyDOM` in globalThis ? !1 : typeof CSS < `u` && typeof CSS.supports == `function` && CSS.supports(`position-area: block-end`);
|
|
405
|
+
}
|
|
406
|
+
function S(c) {
|
|
407
|
+
let [l, u] = (0, react.useState)(!1), [d, f] = (0, react.useState)(0), p = (0, react.useRef)(null), m = (0, react.useRef)(null), h = (0, react.useId)(), _ = (0, react.useId)(), v = `--dsu-${_.replaceAll(/[^a-zA-Z0-9]/gu, ``)}`, y = c.hint === void 0 ? void 0 : `${_}-hint`, { disabled: b, value: S, options: C, onChange: w } = c, T = (0, react.useMemo)(() => C.map((e, t) => ({
|
|
408
|
+
option: e,
|
|
409
|
+
index: t
|
|
410
|
+
})).filter((e) => e.option.disabled !== !0), [C]), E = C.find((e) => e.value === S)?.label ?? S, D = C[d], O = D !== void 0 && D.disabled !== !0, k = (0, react.useCallback)(() => {
|
|
411
|
+
let e = p.current, t = m.current;
|
|
412
|
+
/* v8 ignore next 3 -- place 只在 open 的 layout effect 里调用;refs 为空只可能是卸载竞态 */
|
|
413
|
+
if (e === null || t === null) return;
|
|
414
|
+
let n = e.getBoundingClientRect(), r = Math.min(n.width, window.innerWidth - 16);
|
|
415
|
+
if (t.style.width = `${r}px`, x()) return;
|
|
416
|
+
t.style.marginTop = `0px`;
|
|
417
|
+
let { left: i } = n;
|
|
418
|
+
i + r > window.innerWidth - 8 && (i = window.innerWidth - r - 8);
|
|
419
|
+
let a = t.offsetHeight, o = n.bottom + 6;
|
|
420
|
+
o + a > window.innerHeight - 8 && (o = n.top - a - 6);
|
|
421
|
+
let s = Math.max(8, window.innerWidth - r - 8), c = Math.max(8, window.innerHeight - a - 8);
|
|
422
|
+
t.style.left = `${Math.min(Math.max(8, i), s)}px`, t.style.top = `${Math.min(Math.max(8, o), c)}px`;
|
|
423
|
+
}, []), A = (0, react.useCallback)(() => {
|
|
424
|
+
u(!1);
|
|
425
|
+
}, []), j = (0, react.useCallback)(() => {
|
|
426
|
+
if (b === !0) return;
|
|
427
|
+
let e = T.find((e) => e.option.value === S) ?? T.at(0);
|
|
428
|
+
e !== void 0 && (f(e.index), u(!0));
|
|
429
|
+
}, [
|
|
430
|
+
b,
|
|
431
|
+
S,
|
|
432
|
+
T
|
|
433
|
+
]), M = (0, react.useCallback)((e) => {
|
|
434
|
+
/* v8 ignore next 3 -- 浮层只能经由 openMenu 打开;组件禁用时打不开 */
|
|
435
|
+
if (b === !0) return;
|
|
436
|
+
let t = C[e];
|
|
437
|
+
/* v8 ignore next 3 -- disabled 选项在浏览器里不派发 click;越界下标由调用方保证 */
|
|
438
|
+
t !== void 0 && t.disabled !== !0 && (w(t.value), A(), p.current?.focus());
|
|
439
|
+
}, [
|
|
440
|
+
b,
|
|
441
|
+
C,
|
|
442
|
+
w,
|
|
443
|
+
A
|
|
444
|
+
]), N = (0, react.useCallback)((e) => {
|
|
445
|
+
let t = T.findIndex((e) => e.index === d);
|
|
446
|
+
/* v8 ignore next 5 -- open 时归一 effect 已保证 enabled 非空且 active 落在可用项上 */
|
|
447
|
+
if (t === -1 || T.length === 0) return;
|
|
448
|
+
let n = (t + e + T.length) % T.length, r = T[n];
|
|
449
|
+
/* v8 ignore next 3 -- next 由取模保证在界内 */
|
|
450
|
+
r !== void 0 && f(r.index);
|
|
451
|
+
}, [d, T]);
|
|
452
|
+
(0, react.useLayoutEffect)(() => {
|
|
453
|
+
if (!l) return () => {};
|
|
454
|
+
k();
|
|
455
|
+
let e = (e) => {
|
|
456
|
+
let t = e.target;
|
|
457
|
+
m.current?.contains(t) !== !0 && p.current?.contains(t) !== !0 && A();
|
|
458
|
+
}, t = (e) => {
|
|
459
|
+
let { target: t } = e;
|
|
460
|
+
t instanceof Node && m.current?.contains(t) === !0 || A();
|
|
461
|
+
}, n = () => {
|
|
462
|
+
k();
|
|
463
|
+
};
|
|
464
|
+
return document.addEventListener(`pointerdown`, e, !0), window.addEventListener(`scroll`, t, !0), window.addEventListener(`resize`, n), () => {
|
|
465
|
+
document.removeEventListener(`pointerdown`, e, !0), window.removeEventListener(`scroll`, t, !0), window.removeEventListener(`resize`, n);
|
|
466
|
+
};
|
|
467
|
+
}, [
|
|
468
|
+
l,
|
|
469
|
+
c.options,
|
|
470
|
+
k,
|
|
471
|
+
A
|
|
472
|
+
]), (0, react.useEffect)(() => {
|
|
473
|
+
if (!l) return;
|
|
474
|
+
if (b === !0 || T.length === 0) {
|
|
475
|
+
A();
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
if (T.some((e) => e.index === d)) return;
|
|
479
|
+
let e = T.find((e) => e.option.value === S) ?? T.at(0);
|
|
480
|
+
/* v8 ignore next 3 -- enabled 非空在上一分支已保证 */
|
|
481
|
+
e !== void 0 && f(e.index);
|
|
482
|
+
}, [
|
|
483
|
+
l,
|
|
484
|
+
b,
|
|
485
|
+
S,
|
|
486
|
+
C,
|
|
487
|
+
d,
|
|
488
|
+
A,
|
|
489
|
+
T
|
|
490
|
+
]), (0, react.useLayoutEffect)(() => {
|
|
491
|
+
if (!l) return;
|
|
492
|
+
let e = m.current;
|
|
493
|
+
/* v8 ignore next 2 -- 同上,menu 在 open 的 commit 之后必然已挂上 */
|
|
494
|
+
if (e === null) return;
|
|
495
|
+
let t = e.querySelector(`[data-active="true"]`);
|
|
496
|
+
/* v8 ignore next 2 -- active 已由归一 effect 保证落在可用项上 */
|
|
497
|
+
t !== null && (t.offsetTop < e.scrollTop ? e.scrollTop = t.offsetTop : t.offsetTop + t.offsetHeight > e.scrollTop + e.clientHeight && (e.scrollTop = t.offsetTop + t.offsetHeight - e.clientHeight));
|
|
498
|
+
}, [
|
|
499
|
+
l,
|
|
500
|
+
d,
|
|
501
|
+
C
|
|
502
|
+
]);
|
|
503
|
+
let P = (e) => {
|
|
504
|
+
if (e.key === `ArrowDown` || e.key === `ArrowUp`) {
|
|
505
|
+
if (e.preventDefault(), !l) {
|
|
506
|
+
j();
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
N(e.key === `ArrowDown` ? 1 : -1);
|
|
510
|
+
} else if (e.key === `Home` || e.key === `End`) {
|
|
511
|
+
if (e.preventDefault(), l || j(), T.length === 0) return;
|
|
512
|
+
let t = e.key === `Home` ? T.at(0) : T.at(-1);
|
|
513
|
+
/* v8 ignore next 3 -- enabled 为空已在上一条返回 */
|
|
514
|
+
if (t === void 0) return;
|
|
515
|
+
f(t.index);
|
|
516
|
+
} else if (e.key === `Enter` || e.key === ` `) {
|
|
517
|
+
if (e.preventDefault(), !l) {
|
|
518
|
+
j();
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
M(d);
|
|
522
|
+
} else (e.key === `Tab` || e.key === `Escape`) && A();
|
|
523
|
+
}, F = [], I;
|
|
524
|
+
for (let [t, n] of C.entries()) n.group !== I && (n.group !== void 0 && F.push((0, react.createElement)(`div`, {
|
|
525
|
+
key: `group-${t}-${n.group}`,
|
|
526
|
+
className: `dsu-optionGroup`,
|
|
527
|
+
role: `presentation`
|
|
528
|
+
}, n.group)), I = n.group), F.push((0, react.createElement)(`button`, {
|
|
529
|
+
key: `option-${n.value}`,
|
|
530
|
+
type: `button`,
|
|
531
|
+
role: `option`,
|
|
532
|
+
id: `${h}-${t}`,
|
|
533
|
+
className: `dsu-option`,
|
|
534
|
+
tabIndex: -1,
|
|
535
|
+
"aria-selected": n.value === c.value,
|
|
536
|
+
"data-active": t === d,
|
|
537
|
+
disabled: n.disabled === !0,
|
|
538
|
+
onMouseDown: (e) => {
|
|
539
|
+
e.preventDefault();
|
|
540
|
+
},
|
|
541
|
+
onClick: () => {
|
|
542
|
+
M(t);
|
|
543
|
+
},
|
|
544
|
+
onMouseEnter: () => {
|
|
545
|
+
/* v8 ignore next -- happy-dom 对 disabled 元素不派发 mouse 事件;浏览器实现各有差异,保留禁用检查 */
|
|
546
|
+
n.disabled !== !0 && f(t);
|
|
547
|
+
}
|
|
548
|
+
}, (0, react.createElement)(`span`, null, n.label), (0, react.createElement)(`svg`, {
|
|
549
|
+
className: `dsu-check`,
|
|
550
|
+
width: 14,
|
|
551
|
+
height: 14,
|
|
552
|
+
viewBox: `0 0 14 14`,
|
|
553
|
+
"aria-hidden": !0
|
|
554
|
+
}, (0, react.createElement)(`path`, {
|
|
555
|
+
d: `M2.5 7.5l3 3 6-7`,
|
|
556
|
+
fill: `none`,
|
|
557
|
+
stroke: `currentColor`,
|
|
558
|
+
strokeWidth: 1.5,
|
|
559
|
+
strokeLinecap: `round`,
|
|
560
|
+
strokeLinejoin: `round`
|
|
561
|
+
}))));
|
|
562
|
+
return (0, react.createElement)(g, {
|
|
563
|
+
...c,
|
|
564
|
+
controlId: _
|
|
565
|
+
}, (0, react.createElement)(`div`, {
|
|
566
|
+
className: `dsu-selectWrap`,
|
|
567
|
+
onBlur: (e) => {
|
|
568
|
+
let t = e.relatedTarget;
|
|
569
|
+
t instanceof Node && e.currentTarget.contains(t) || A();
|
|
570
|
+
}
|
|
571
|
+
}, (0, react.createElement)(`button`, {
|
|
572
|
+
ref: p,
|
|
573
|
+
type: `button`,
|
|
574
|
+
id: _,
|
|
575
|
+
style: { anchorName: v },
|
|
576
|
+
className: `dsu-select dsu-input`,
|
|
577
|
+
role: `combobox`,
|
|
578
|
+
"aria-haspopup": `listbox`,
|
|
579
|
+
"aria-expanded": l,
|
|
580
|
+
"aria-controls": `${h}-list`,
|
|
581
|
+
"aria-activedescendant": l && O ? `${h}-${d}` : void 0,
|
|
582
|
+
"aria-describedby": y,
|
|
583
|
+
"data-field": c.field,
|
|
584
|
+
disabled: b === !0 || C.length === 0,
|
|
585
|
+
onClick: () => {
|
|
586
|
+
l ? A() : j();
|
|
587
|
+
},
|
|
588
|
+
onKeyDown: P
|
|
589
|
+
}, (0, react.createElement)(`span`, { className: `dsu-selectValue` }, E), (0, react.createElement)(`svg`, {
|
|
590
|
+
className: `dsu-chevron`,
|
|
591
|
+
width: 14,
|
|
592
|
+
height: 14,
|
|
593
|
+
viewBox: `0 0 14 14`,
|
|
594
|
+
"aria-hidden": !0
|
|
595
|
+
}, (0, react.createElement)(`path`, {
|
|
596
|
+
d: `M3 5l4 4 4-4`,
|
|
597
|
+
fill: `none`,
|
|
598
|
+
stroke: `currentColor`,
|
|
599
|
+
strokeWidth: 1.5,
|
|
600
|
+
strokeLinecap: `round`,
|
|
601
|
+
strokeLinejoin: `round`
|
|
602
|
+
}))), (0, react.createElement)(`div`, {
|
|
603
|
+
ref: m,
|
|
604
|
+
id: `${h}-list`,
|
|
605
|
+
role: `listbox`,
|
|
606
|
+
className: `dsu-menu`,
|
|
607
|
+
style: {
|
|
608
|
+
positionAnchor: v,
|
|
609
|
+
positionTryFallbacks: `flip-block, flip-inline`
|
|
610
|
+
},
|
|
611
|
+
"aria-label": c.label,
|
|
612
|
+
hidden: !l
|
|
613
|
+
}, ...F)));
|
|
614
|
+
}
|
|
615
|
+
function C(t) {
|
|
616
|
+
let n = !t.writable || t.busy || !t.dirty, r;
|
|
617
|
+
return r = t.error === null ? t.writable ? t.dirty ? t.dirtyLabel : t.cleanLabel : t.readOnlyLabel : t.error, (0, react.createElement)(`div`, {
|
|
618
|
+
className: `dsu-savebar`,
|
|
619
|
+
"data-dirty": t.dirty
|
|
620
|
+
}, (0, react.createElement)(`button`, {
|
|
621
|
+
type: `button`,
|
|
622
|
+
className: `dsu-btn dsu-btnPrimary`,
|
|
623
|
+
"data-field": `save`,
|
|
624
|
+
disabled: n,
|
|
625
|
+
onClick: t.onSave
|
|
626
|
+
}, t.busy ? t.savingLabel : t.saveLabel), (0, react.createElement)(`button`, {
|
|
627
|
+
type: `button`,
|
|
628
|
+
className: `dsu-btn`,
|
|
629
|
+
"data-field": `discard`,
|
|
630
|
+
disabled: n,
|
|
631
|
+
onClick: t.onDiscard
|
|
632
|
+
}, t.revertLabel), (0, react.createElement)(`span`, { className: t.error === null ? `dsu-status` : `dsu-status dsu-statusError` }, r));
|
|
633
|
+
}
|
|
634
|
+
// node_modules/@jayyuen66/dsh-plugin-shared/dist/card-diff.js
|
|
635
|
+
function e$1(t, n, r) {
|
|
636
|
+
if (t == null || n == null) return (t ?? null) === (n ?? null);
|
|
637
|
+
if (Object.is(t, n)) return !0;
|
|
638
|
+
if (typeof t != `object` || typeof n != `object`) return !1;
|
|
639
|
+
if (r.get(t) === n) return !0;
|
|
640
|
+
if (r.set(t, n), Array.isArray(t) || Array.isArray(n)) return !Array.isArray(t) || !Array.isArray(n) || t.length !== n.length ? !1 : t.every((t, i) => e$1(t, n[i], r));
|
|
641
|
+
let i = Object.keys(t), a = Object.keys(n);
|
|
642
|
+
return i.length === a.length && i.every((i) => Object.hasOwn(n, i) && e$1(Reflect.get(t, i), Reflect.get(n, i), r));
|
|
643
|
+
}
|
|
644
|
+
function t$1(t, n) {
|
|
645
|
+
let r = [];
|
|
646
|
+
for (let i of Object.keys(t)) e$1(t[i], n[i], /* @__PURE__ */ new WeakMap()) || r.push(i);
|
|
647
|
+
return r;
|
|
648
|
+
}
|
|
649
|
+
// node_modules/@jayyuen66/dsh-plugin-shared/dist/record.js
|
|
650
|
+
function e(e) {
|
|
651
|
+
return typeof e == `object` && !!e && !Array.isArray(e);
|
|
652
|
+
}
|
|
653
|
+
// node_modules/@jayyuen66/dsh-plugin-shared/dist/errors.js
|
|
654
|
+
function t(e) {
|
|
655
|
+
let t = Object.getOwnPropertyDescriptor(e, `message`);
|
|
656
|
+
return t !== void 0 && `value` in t && typeof t.value == `string` ? t.value : void 0;
|
|
657
|
+
}
|
|
658
|
+
function n(e, r) {
|
|
659
|
+
if (r.has(e)) return `<circular cause>`;
|
|
660
|
+
r.add(e);
|
|
661
|
+
try {
|
|
662
|
+
if (!(e instanceof Error)) {
|
|
663
|
+
if (typeof e == `object` && e) {
|
|
664
|
+
let n = t(e);
|
|
665
|
+
if (n !== void 0 && n !== ``) return n;
|
|
666
|
+
}
|
|
667
|
+
return String(e);
|
|
668
|
+
}
|
|
669
|
+
let i = e.message === `` ? e.name : e.message, a = typeof globalThis.AggregateError == `function` && e instanceof AggregateError && e.errors.length > 0 ? ` [${e.errors.map((e) => n(e, r)).join(`; `)}]` : ``, o = e.cause === void 0 || e.cause === null ? `` : n(e.cause, r);
|
|
670
|
+
return `${i}${a}${o === `` || o === i ? `` : `: ${o}`}`;
|
|
671
|
+
} catch {
|
|
672
|
+
return `<unrenderable value>`;
|
|
673
|
+
} finally {
|
|
674
|
+
r.delete(e);
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
function r(e) {
|
|
678
|
+
return n(e, /* @__PURE__ */ new Set());
|
|
679
|
+
}
|
|
92
680
|
// lib/card-draft.ts
|
|
93
681
|
/** 草稿优先取值:touched 有该键(哪怕值是 undefined=待清空)即用草稿。
|
|
94
682
|
* 两层都只判**自有**属性:本函数收任意字段名,`in`/裸下标会沿原型链命中 `toString` /
|
|
@@ -317,9 +905,9 @@ const REBUILD_DESCRIPTORS = [
|
|
|
317
905
|
}
|
|
318
906
|
];
|
|
319
907
|
/** 这个值能当远程通道用吗(只核我们要调的那一位;服务来自别的实现或版本时保守当作没有)。 */
|
|
320
|
-
const isRemoteMounter = (value) => (
|
|
908
|
+
const isRemoteMounter = (value) => e(value) && typeof value["$mount"] === "function";
|
|
321
909
|
/** 同上:命名空间服务(挂载之后才有,缺它说明网关没认这枚贡献)。 */
|
|
322
|
-
const isRebuildNamespace = (value) => (
|
|
910
|
+
const isRebuildNamespace = (value) => e(value) && typeof value["roots"] === "function" && typeof value["rebuild"] === "function" && typeof value["status"] === "function";
|
|
323
911
|
/**
|
|
324
912
|
* 线上拒绝(result.ok=false)翻成异常:code 与 message 都来自网关的错误对象。
|
|
325
913
|
* 三个方法同构,收成一个入口——同一份判据,不抄三份。
|
|
@@ -612,9 +1200,9 @@ function numberDisplay(display, schema) {
|
|
|
612
1200
|
/** 检索模型小节:embedding 下拉(按本地后端分组)+ 每组结果数。 */
|
|
613
1201
|
function buildModelSection(deps) {
|
|
614
1202
|
const { editable, fields, setField, t } = deps;
|
|
615
|
-
const embedding = (0, react.createElement)(
|
|
1203
|
+
const embedding = (0, react.createElement)(S, {
|
|
616
1204
|
label: t("embeddingLabel"),
|
|
617
|
-
...(
|
|
1205
|
+
...l(t("embeddingHint")),
|
|
618
1206
|
field: "defaultEmbedding",
|
|
619
1207
|
value: fields.embedding,
|
|
620
1208
|
options: embeddingOptions(t),
|
|
@@ -623,7 +1211,7 @@ function buildModelSection(deps) {
|
|
|
623
1211
|
setField("defaultEmbedding", next);
|
|
624
1212
|
}
|
|
625
1213
|
});
|
|
626
|
-
const limit = (0, react.createElement)(
|
|
1214
|
+
const limit = (0, react.createElement)(v, {
|
|
627
1215
|
label: t("limitLabel"),
|
|
628
1216
|
hint: t("limitInvalid", {
|
|
629
1217
|
min: 1,
|
|
@@ -641,7 +1229,7 @@ function buildModelSection(deps) {
|
|
|
641
1229
|
setField("defaultLimit", next);
|
|
642
1230
|
}
|
|
643
1231
|
});
|
|
644
|
-
return (0, react.createElement)(
|
|
1232
|
+
return (0, react.createElement)(d, { title: t("modelSection") }, embedding, limit);
|
|
645
1233
|
}
|
|
646
1234
|
/** 重建行:root 输入(白名单候选进 <datalist>)+ 触发按钮(在跑时禁用)。 */
|
|
647
1235
|
function buildRebuildField(deps) {
|
|
@@ -667,9 +1255,9 @@ function buildRebuildField(deps) {
|
|
|
667
1255
|
disabled: rebuild.phase === "running",
|
|
668
1256
|
onClick: deps.onRebuild
|
|
669
1257
|
}, rebuild.phase === "running" ? t("rebuildRunning") : t("rebuildButton"));
|
|
670
|
-
return (0, react.createElement)(
|
|
1258
|
+
return (0, react.createElement)(g, {
|
|
671
1259
|
label: t("rebuildLabel"),
|
|
672
|
-
...(
|
|
1260
|
+
...l(rebuildHintText(t, fields.embedding, roots.length > 0)),
|
|
673
1261
|
wide: true
|
|
674
1262
|
}, rootDatalist, rebuildInput, rebuildButton);
|
|
675
1263
|
}
|
|
@@ -700,9 +1288,9 @@ function buildRebuildStatusRow(deps) {
|
|
|
700
1288
|
/** 网络与索引小节:传输三档、镜像地址、search-first 开关、配额与时效、工作区重建与守护进程状态。 */
|
|
701
1289
|
function buildIndexSection(deps) {
|
|
702
1290
|
const { editable, fields, setField, t } = deps;
|
|
703
|
-
const transport = (0, react.createElement)(
|
|
1291
|
+
const transport = (0, react.createElement)(S, {
|
|
704
1292
|
label: t("transportLabel"),
|
|
705
|
-
...(
|
|
1293
|
+
...l(t("transportHint")),
|
|
706
1294
|
field: "transport",
|
|
707
1295
|
value: fields.transport,
|
|
708
1296
|
options: transportOptions(t),
|
|
@@ -711,9 +1299,9 @@ function buildIndexSection(deps) {
|
|
|
711
1299
|
setField("transport", next);
|
|
712
1300
|
}
|
|
713
1301
|
});
|
|
714
|
-
const endpoint = (0, react.createElement)(
|
|
1302
|
+
const endpoint = (0, react.createElement)(y, {
|
|
715
1303
|
label: t("endpointLabel"),
|
|
716
|
-
...(
|
|
1304
|
+
...l(t("endpointHint")),
|
|
717
1305
|
field: "hfEndpoint",
|
|
718
1306
|
value: fields.hfEndpoint,
|
|
719
1307
|
placeholder: EMBEDDING_MIRROR_URL,
|
|
@@ -723,9 +1311,9 @@ function buildIndexSection(deps) {
|
|
|
723
1311
|
setField("hfEndpoint", next.trim() === "" ? void 0 : next.trim());
|
|
724
1312
|
}
|
|
725
1313
|
});
|
|
726
|
-
const enforce = (0, react.createElement)(
|
|
1314
|
+
const enforce = (0, react.createElement)(_, {
|
|
727
1315
|
label: t("enforceLabel"),
|
|
728
|
-
...(
|
|
1316
|
+
...l(t("enforceHint")),
|
|
729
1317
|
field: "enforceSearchFirst",
|
|
730
1318
|
checked: fields.enforceSearchFirst,
|
|
731
1319
|
disabled: !editable,
|
|
@@ -733,9 +1321,9 @@ function buildIndexSection(deps) {
|
|
|
733
1321
|
setField("enforceSearchFirst", next);
|
|
734
1322
|
}
|
|
735
1323
|
});
|
|
736
|
-
const budget = (0, react.createElement)(
|
|
1324
|
+
const budget = (0, react.createElement)(v, {
|
|
737
1325
|
label: t("budgetLabel"),
|
|
738
|
-
...(
|
|
1326
|
+
...l(t("budgetHint", { default: 3 })),
|
|
739
1327
|
field: "grepBudgetPerSearch",
|
|
740
1328
|
value: numberDisplay(fields.grepBudget, BUDGET_SCHEMA),
|
|
741
1329
|
min: BUDGET_SCHEMA.minValue ?? 1,
|
|
@@ -748,9 +1336,9 @@ function buildIndexSection(deps) {
|
|
|
748
1336
|
setField("grepBudgetPerSearch", next);
|
|
749
1337
|
}
|
|
750
1338
|
});
|
|
751
|
-
const window = (0, react.createElement)(
|
|
1339
|
+
const window = (0, react.createElement)(v, {
|
|
752
1340
|
label: t("windowLabel"),
|
|
753
|
-
...(
|
|
1341
|
+
...l(t("windowHint", { default: 10 })),
|
|
754
1342
|
field: "unlockWindowMin",
|
|
755
1343
|
value: numberDisplay(fields.unlockWindow, WINDOW_SCHEMA),
|
|
756
1344
|
min: WINDOW_SCHEMA.minValue ?? 1,
|
|
@@ -763,12 +1351,12 @@ function buildIndexSection(deps) {
|
|
|
763
1351
|
setField("unlockWindowMin", next);
|
|
764
1352
|
}
|
|
765
1353
|
});
|
|
766
|
-
return (0, react.createElement)(
|
|
1354
|
+
return (0, react.createElement)(d, { title: t("indexSection") }, transport, endpoint, enforce, budget, window, buildDaemonNote(deps), buildRebuildField(deps), buildRebuildStatusRow(deps));
|
|
767
1355
|
}
|
|
768
1356
|
/** 卡片主体:检索模型 / 网络与索引两节 + 保存条。 */
|
|
769
1357
|
function buildCardBody(deps) {
|
|
770
1358
|
const { t } = deps;
|
|
771
|
-
const saveBar = (0, react.createElement)(
|
|
1359
|
+
const saveBar = (0, react.createElement)(C, {
|
|
772
1360
|
dirty: deps.dirty,
|
|
773
1361
|
busy: deps.busy,
|
|
774
1362
|
writable: deps.writable,
|
|
@@ -782,7 +1370,7 @@ function buildCardBody(deps) {
|
|
|
782
1370
|
onSave: deps.onSave,
|
|
783
1371
|
onDiscard: deps.onDiscard
|
|
784
1372
|
});
|
|
785
|
-
return (0, react.createElement)(
|
|
1373
|
+
return (0, react.createElement)(u, null, buildModelSection(deps), buildIndexSection(deps), saveBar);
|
|
786
1374
|
}
|
|
787
1375
|
/** 显式字段写入(schema-coverage 门禁按 set('字段名') 字面量识别绑定)。 */
|
|
788
1376
|
function pushFieldWrite(ops, key, draft, set) {
|
|
@@ -872,7 +1460,7 @@ function useRebuild(t, reader) {
|
|
|
872
1460
|
stopPolling();
|
|
873
1461
|
setRebuild({
|
|
874
1462
|
phase: "error",
|
|
875
|
-
output: (
|
|
1463
|
+
output: r(error)
|
|
876
1464
|
});
|
|
877
1465
|
} finally {
|
|
878
1466
|
pollingRef.current = false;
|
|
@@ -909,7 +1497,7 @@ function useRebuild(t, reader) {
|
|
|
909
1497
|
stopPolling();
|
|
910
1498
|
setRebuild({
|
|
911
1499
|
phase: "error",
|
|
912
|
-
output: (
|
|
1500
|
+
output: r(error)
|
|
913
1501
|
});
|
|
914
1502
|
}
|
|
915
1503
|
}
|
|
@@ -933,7 +1521,7 @@ function ZgCard(props) {
|
|
|
933
1521
|
const [saveError, setSaveError] = (0, react.useState)(null);
|
|
934
1522
|
const rebuildView = useRebuild(t, props.rebuildRemote);
|
|
935
1523
|
const fields = draftFields(touched, value);
|
|
936
|
-
const dirtyCount = (
|
|
1524
|
+
const dirtyCount = t$1(touched, value).length;
|
|
937
1525
|
const dirty = dirtyCount > 0;
|
|
938
1526
|
const setField = (field, draft) => {
|
|
939
1527
|
setTouched((prev) => ({
|
|
@@ -942,7 +1530,7 @@ function ZgCard(props) {
|
|
|
942
1530
|
}));
|
|
943
1531
|
};
|
|
944
1532
|
const save = async () => {
|
|
945
|
-
const keys = (
|
|
1533
|
+
const keys = t$1(touched, value);
|
|
946
1534
|
if (keys.length === 0) return;
|
|
947
1535
|
setBusy(true);
|
|
948
1536
|
setSaveError(null);
|
|
@@ -960,7 +1548,7 @@ function ZgCard(props) {
|
|
|
960
1548
|
}
|
|
961
1549
|
} catch (error) {
|
|
962
1550
|
setBusy(false);
|
|
963
|
-
setSaveError(t("saveFailed", { reason: (
|
|
1551
|
+
setSaveError(t("saveFailed", { reason: r(error) }));
|
|
964
1552
|
return;
|
|
965
1553
|
}
|
|
966
1554
|
const savedKeys = new Set(keys);
|
|
@@ -1005,7 +1593,7 @@ function apply(ctx) {
|
|
|
1005
1593
|
ctx.effect(() => {
|
|
1006
1594
|
const tag = document.createElement("style");
|
|
1007
1595
|
tag.id = "zvec-grep-card-css";
|
|
1008
|
-
tag.textContent = `${CARD_CSS}\n${
|
|
1596
|
+
tag.textContent = `${CARD_CSS}\n${c}`;
|
|
1009
1597
|
document.head.append(tag);
|
|
1010
1598
|
return () => {
|
|
1011
1599
|
tag.remove();
|