dsh-knowledge-library 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -0
- package/README.md +123 -18
- package/dist/client.js +1699 -374
- package/dist/core/extract.d.ts +1 -0
- package/dist/core/extract.js +62 -5
- package/dist/core/fetch.js +82 -11
- package/dist/core/grouping.d.ts +6 -0
- package/dist/core/grouping.js +71 -0
- package/dist/core/incremental.d.ts +14 -0
- package/dist/core/incremental.js +52 -0
- package/dist/core/jobs.d.ts +1 -0
- package/dist/core/jobs.js +4 -0
- package/dist/core/knowledge.d.ts +37 -0
- package/dist/core/knowledge.js +617 -0
- package/dist/core/library.d.ts +20 -2
- package/dist/core/library.js +271 -12
- package/dist/core/page-access.d.ts +6 -0
- package/dist/core/page-access.js +38 -0
- package/dist/core/purge.d.ts +20 -0
- package/dist/core/purge.js +106 -0
- package/dist/directory-settings.d.ts +18 -0
- package/dist/directory-settings.js +92 -0
- package/dist/http.d.ts +3 -1
- package/dist/http.js +121 -4
- package/dist/index.js +17 -5
- package/dist/knowledge-model.d.ts +18 -0
- package/dist/knowledge-model.js +116 -0
- package/dist/preview-settings.d.ts +6 -0
- package/dist/preview-settings.js +42 -0
- package/dist/public/app.css +385 -182
- package/dist/public/app.js +11 -7
- package/dist/public/index.html +1 -1
- package/dist/standalone.js +8 -3
- package/dist/tools.d.ts +2 -1
- package/dist/tools.js +10 -1
- package/dist/types.d.ts +143 -1
- package/dist/ui/App.js +244 -47
- package/dist/ui/Dialog.d.ts +7 -0
- package/dist/ui/Dialog.js +32 -0
- package/dist/ui/Grouping.d.ts +12 -0
- package/dist/ui/Grouping.js +93 -0
- package/dist/ui/Knowledge.d.ts +26 -0
- package/dist/ui/Knowledge.js +106 -0
- package/dist/ui/api.d.ts +7 -0
- package/dist/ui/api.js +16 -0
- package/dist/ui/icons.js +2 -0
- package/package.json +4 -1
package/dist/client.js
CHANGED
|
@@ -27,7 +27,7 @@ __export(client_exports, {
|
|
|
27
27
|
module.exports = __toCommonJS(client_exports);
|
|
28
28
|
|
|
29
29
|
// src/ui/App.tsx
|
|
30
|
-
var
|
|
30
|
+
var import_react4 = require("react");
|
|
31
31
|
|
|
32
32
|
// src/ui/icons.tsx
|
|
33
33
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -72,15 +72,632 @@ function Icon({ name, size = 20 }) {
|
|
|
72
72
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M4 7h16M4 17h16" }),
|
|
73
73
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "9", cy: "7", r: "3" }),
|
|
74
74
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "15", cy: "17", r: "3" })
|
|
75
|
-
] })
|
|
75
|
+
] }),
|
|
76
|
+
trash: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M3 6h18M9 6V3h6v3M5 6l1 15h12l1-15M10 10v7M14 10v7" }) }),
|
|
77
|
+
restore: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M3 10a9 9 0 1 1 2 9M3 4v6h6M12 7v5l3 2" }) })
|
|
76
78
|
};
|
|
77
79
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: paths[name] || paths.file });
|
|
78
80
|
}
|
|
79
81
|
var LibraryIcon = ({ size }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { name: "library", size });
|
|
80
82
|
|
|
81
|
-
// src/ui/
|
|
82
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
83
|
+
// src/ui/api.ts
|
|
83
84
|
var API = "/knowledge-library/api";
|
|
85
|
+
var ApiError = class extends Error {
|
|
86
|
+
constructor(message, status) {
|
|
87
|
+
super(message);
|
|
88
|
+
this.status = status;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
async function api(path, options = {}) {
|
|
92
|
+
const response = await fetch(API + path, { ...options, headers: { "Content-Type": "application/json", "X-Knowledge-Library": "1", ...options.headers } });
|
|
93
|
+
const data = await response.json();
|
|
94
|
+
if (!response.ok) throw new ApiError(data.error || `\u8BF7\u6C42\u5931\u8D25\uFF1A${response.status}`, response.status);
|
|
95
|
+
return data;
|
|
96
|
+
}
|
|
97
|
+
var post = (path, value, method = "POST", signal) => api(path, { method, body: JSON.stringify(value), signal });
|
|
98
|
+
|
|
99
|
+
// src/ui/Dialog.tsx
|
|
100
|
+
var import_react = require("react");
|
|
101
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
102
|
+
function Dialog({ title, description, onClose, children }) {
|
|
103
|
+
const ref = (0, import_react.useRef)(null);
|
|
104
|
+
const closeRef = (0, import_react.useRef)(onClose);
|
|
105
|
+
closeRef.current = onClose;
|
|
106
|
+
(0, import_react.useEffect)(() => {
|
|
107
|
+
const previous = document.activeElement;
|
|
108
|
+
const timer = setTimeout(() => ref.current?.querySelector("input,textarea,button")?.focus(), 0);
|
|
109
|
+
const key = (event) => {
|
|
110
|
+
if (event.key === "Escape") closeRef.current();
|
|
111
|
+
if (event.key === "Tab") {
|
|
112
|
+
const elements = Array.from(ref.current?.querySelectorAll("button:not(:disabled),input:not(:disabled),textarea:not(:disabled),select,a[href]") || []);
|
|
113
|
+
const first = elements[0], last = elements[elements.length - 1];
|
|
114
|
+
if (event.shiftKey && document.activeElement === first) {
|
|
115
|
+
event.preventDefault();
|
|
116
|
+
last?.focus();
|
|
117
|
+
}
|
|
118
|
+
if (!event.shiftKey && document.activeElement === last) {
|
|
119
|
+
event.preventDefault();
|
|
120
|
+
first?.focus();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
document.addEventListener("keydown", key);
|
|
125
|
+
return () => {
|
|
126
|
+
clearTimeout(timer);
|
|
127
|
+
document.removeEventListener("keydown", key);
|
|
128
|
+
previous?.focus();
|
|
129
|
+
};
|
|
130
|
+
}, []);
|
|
131
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "kl-modal-backdrop", onMouseDown: (event) => {
|
|
132
|
+
if (event.target === event.currentTarget) onClose();
|
|
133
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "kl-dialog", role: "dialog", "aria-modal": "true", "aria-label": title, ref, children: [
|
|
134
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("header", { children: [
|
|
135
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
|
|
136
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { children: title }),
|
|
137
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: description })
|
|
138
|
+
] }),
|
|
139
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { "aria-label": "\u5173\u95ED\u5F39\u7A97", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { name: "close" }) })
|
|
140
|
+
] }),
|
|
141
|
+
children
|
|
142
|
+
] }) });
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// src/ui/Knowledge.tsx
|
|
146
|
+
var import_react3 = require("react");
|
|
147
|
+
|
|
148
|
+
// src/ui/Grouping.tsx
|
|
149
|
+
var import_react2 = require("react");
|
|
150
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
151
|
+
var splitTags = (value) => value.split(/[,,]/).map((t) => t.trim()).filter(Boolean);
|
|
152
|
+
function GroupingEditor({ root, job, model, onRefresh, onNotify, onOpenSource }) {
|
|
153
|
+
const [plan, setPlan] = (0, import_react2.useState)(job.plan);
|
|
154
|
+
const [version, setVersion] = (0, import_react2.useState)(job.planVersion);
|
|
155
|
+
const [tagText, setTagText] = (0, import_react2.useState)(Object.fromEntries(plan.groups.map((g) => [g.id, g.tags.join("\uFF0C")])));
|
|
156
|
+
const [apply2, setApply] = (0, import_react2.useState)(job.classification?.apply ?? plan.applyClassification ?? true);
|
|
157
|
+
const [busy, setBusy] = (0, import_react2.useState)(false);
|
|
158
|
+
const [error, setError] = (0, import_react2.useState)("");
|
|
159
|
+
const locked = !!job.classification;
|
|
160
|
+
const groups = plan.groups.filter((g) => g.sourceIds.length);
|
|
161
|
+
function groupValue(id, change) {
|
|
162
|
+
setPlan((p) => ({ ...p, groups: p.groups.map((g) => g.id === id ? { ...g, ...change } : g) }));
|
|
163
|
+
}
|
|
164
|
+
function newGroup(sourceId) {
|
|
165
|
+
const source = job.sources.find((s) => s.id === sourceId);
|
|
166
|
+
const analysis = job.analyses?.find((a) => a.sourceId === sourceId);
|
|
167
|
+
const id = `group_${crypto.randomUUID()}`;
|
|
168
|
+
const item = { id, title: analysis?.theme || source?.title || "\u65B0\u5206\u7EC4", reason: source ? "\u72EC\u7ACB\u6574\u7406\u8FD9\u4EFD\u8D44\u6599" : "\u8BF7\u586B\u5199\u8D44\u6599\u4E4B\u95F4\u7684\u5177\u4F53\u5173\u8054", sourceIds: sourceId ? [sourceId] : [], category: analysis?.category || "\u6536\u4EF6\u7BB1", tags: analysis?.tags || [] };
|
|
169
|
+
setTagText((values) => ({ ...values, [id]: item.tags.join("\uFF0C") }));
|
|
170
|
+
setPlan((p) => ({ ...p, groups: [...p.groups.map((g) => ({ ...g, sourceIds: g.sourceIds.filter((s) => s !== sourceId) })), item], unassigned: p.unassigned.filter((s) => s.sourceId !== sourceId) }));
|
|
171
|
+
}
|
|
172
|
+
function assign(sourceId, target) {
|
|
173
|
+
if (target === "__new__") {
|
|
174
|
+
newGroup(sourceId);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
const analysis = job.analyses?.find((a) => a.sourceId === sourceId);
|
|
178
|
+
setPlan((p) => ({
|
|
179
|
+
...p,
|
|
180
|
+
groups: p.groups.map((g) => ({ ...g, sourceIds: g.id === target ? [...g.sourceIds.filter((id) => id !== sourceId), sourceId] : g.sourceIds.filter((id) => id !== sourceId) })),
|
|
181
|
+
unassigned: [...p.unassigned.filter((s) => s.sourceId !== sourceId), ...target ? [] : [{ sourceId, reason: analysis?.uncertainty || "\u6682\u7559\u5F85\u6574\u7406\uFF0C\u540E\u7EED\u518D\u5224\u65AD\u5173\u8054" }]]
|
|
182
|
+
}));
|
|
183
|
+
}
|
|
184
|
+
function removeGroup(id) {
|
|
185
|
+
setPlan((p) => ({ ...p, groups: p.groups.filter((g) => g.id !== id), unassigned: [...p.unassigned, ...(p.groups.find((g) => g.id === id)?.sourceIds || []).map((sourceId) => ({ sourceId, reason: "\u5DF2\u79FB\u51FA\u5206\u7EC4\uFF0C\u4FDD\u7559\u5F85\u6574\u7406" }))] }));
|
|
186
|
+
}
|
|
187
|
+
async function save(confirm, openSource) {
|
|
188
|
+
if (busy) return;
|
|
189
|
+
setBusy(true);
|
|
190
|
+
setError("");
|
|
191
|
+
try {
|
|
192
|
+
let currentVersion = version;
|
|
193
|
+
if (!locked) {
|
|
194
|
+
const value = { ...plan, applyClassification: apply2, groups: groups.map((g) => ({ ...g, tags: splitTags(tagText[g.id] || "") })) };
|
|
195
|
+
const edited = await post(`/knowledge/jobs/${job.id}/plan`, { expectedRoot: root, version, plan: value }, "PATCH");
|
|
196
|
+
currentVersion = edited.planVersion;
|
|
197
|
+
setVersion(currentVersion);
|
|
198
|
+
}
|
|
199
|
+
if (confirm) {
|
|
200
|
+
await post(`/knowledge/jobs/${job.id}/confirm-plan`, { expectedRoot: root, version: currentVersion, applyClassification: apply2, expectedModel: model.model, confirmed: true });
|
|
201
|
+
onNotify(`${groups.length} \u7EC4\u8D44\u6599\u5DF2\u63D0\u4EA4\u751F\u6210\u8349\u7A3F\uFF1B${plan.unassigned.length} \u4EFD\u4FDD\u7559\u5F85\u6574\u7406`);
|
|
202
|
+
onRefresh();
|
|
203
|
+
} else if (openSource) onOpenSource(openSource);
|
|
204
|
+
else {
|
|
205
|
+
onNotify("\u5206\u7EC4\u65B9\u6848\u5DF2\u4FDD\u5B58\uFF0C\u6765\u6E90\u5206\u7C7B\u5C1A\u672A\u4FEE\u6539");
|
|
206
|
+
onRefresh();
|
|
207
|
+
}
|
|
208
|
+
} catch (e) {
|
|
209
|
+
setError(e.message);
|
|
210
|
+
if (confirm) onRefresh();
|
|
211
|
+
} finally {
|
|
212
|
+
setBusy(false);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
async function rollback() {
|
|
216
|
+
setBusy(true);
|
|
217
|
+
setError("");
|
|
218
|
+
try {
|
|
219
|
+
await post(`/knowledge/jobs/${job.id}/rollback-plan`, { expectedRoot: root, confirmed: true });
|
|
220
|
+
onNotify("\u672A\u5B8C\u6210\u7684\u5206\u7C7B\u4FEE\u6539\u5DF2\u56DE\u9000");
|
|
221
|
+
onRefresh();
|
|
222
|
+
} catch (e) {
|
|
223
|
+
setError(e.message);
|
|
224
|
+
onRefresh();
|
|
225
|
+
} finally {
|
|
226
|
+
setBusy(false);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "kl-grouping-editor", children: [
|
|
230
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "kl-grouping-summary", children: [
|
|
231
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("b", { children: [
|
|
232
|
+
groups.length,
|
|
233
|
+
" \u4E2A\u5206\u7EC4"
|
|
234
|
+
] }),
|
|
235
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { children: [
|
|
236
|
+
plan.unassigned.length,
|
|
237
|
+
" \u4EFD\u5F85\u6574\u7406"
|
|
238
|
+
] })
|
|
239
|
+
] }),
|
|
240
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "kl-knowledge-model", children: "\u5148\u6838\u5BF9\u9010\u7BC7\u5206\u6790\u4E0E\u5206\u7EC4\u7406\u7531\u3002\u65E0\u5173\u8054\u7684\u8D44\u6599\u53EF\u72EC\u7ACB\u6210\u7EC4\uFF0C\u4FE1\u606F\u4E0D\u8DB3\u7684\u8D44\u6599\u53EF\u4EE5\u7559\u5F85\u6574\u7406\u3002\u4FEE\u6539\u540E\u8BF7\u4FDD\u5B58\u65B9\u6848\uFF0C\u518D\u5173\u95ED\u7A97\u53E3\u3002" }),
|
|
241
|
+
job.error && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { role: "alert", className: "kl-form-error", children: job.error }),
|
|
242
|
+
locked && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "kl-grouping-recovery", role: "status", children: [
|
|
243
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: "\u4E0A\u6B21\u5F52\u7C7B\u5C1A\u672A\u5B8C\u6210" }),
|
|
244
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("p", { children: [
|
|
245
|
+
job.classification.steps.filter((s) => s.done).length,
|
|
246
|
+
" / ",
|
|
247
|
+
job.classification.steps.length,
|
|
248
|
+
" \u4EFD\u5DF2\u5B8C\u6210",
|
|
249
|
+
job.classification.direction === "rollback" ? "\u56DE\u9000" : "\u5F52\u7C7B",
|
|
250
|
+
"\u3002\u65B9\u6848\u5DF2\u9501\u5B9A\uFF0C\u53EF\u7EE7\u7EED\u5904\u7406\u6216\u56DE\u9000\u5DF2\u66F4\u6539\u7684\u5206\u7C7B\u3002"
|
|
251
|
+
] }),
|
|
252
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { className: "kl-secondary", disabled: busy, onClick: () => void rollback(), children: job.classification.direction === "rollback" ? "\u7EE7\u7EED\u56DE\u9000\u5206\u7C7B" : "\u56DE\u9000\u5DF2\u66F4\u6539\u7684\u5206\u7C7B" })
|
|
253
|
+
] }),
|
|
254
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "kl-grouping-groups", children: plan.groups.map((group, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { className: "kl-grouping-group", "aria-label": `\u5206\u7EC4 ${index + 1}`, children: [
|
|
255
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "kl-grouping-group-title", children: [
|
|
256
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { children: [
|
|
257
|
+
"\u5206\u7EC4 ",
|
|
258
|
+
index + 1,
|
|
259
|
+
" \xB7 ",
|
|
260
|
+
group.sourceIds.length,
|
|
261
|
+
" \u4EFD\u8D44\u6599"
|
|
262
|
+
] }),
|
|
263
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { className: "kl-icon-button kl-danger", "aria-label": `\u5220\u9664\u5206\u7EC4 ${index + 1}`, disabled: busy || locked, onClick: () => removeGroup(group.id), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, { name: "trash", size: 15 }) })
|
|
264
|
+
] }),
|
|
265
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { children: [
|
|
266
|
+
"\u5206\u7EC4\u540D\u79F0",
|
|
267
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { "aria-label": `\u5206\u7EC4\u540D\u79F0 ${index + 1}`, maxLength: 200, value: group.title, disabled: busy || locked, onChange: (e) => groupValue(group.id, { title: e.target.value }) })
|
|
268
|
+
] }),
|
|
269
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "kl-grouping-reason", children: group.reason }),
|
|
270
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("details", { className: "kl-grouping-settings", children: [
|
|
271
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("summary", { children: [
|
|
272
|
+
"\u5206\u7C7B\u4E0E\u5206\u7EC4\u8BBE\u7F6E ",
|
|
273
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: group.category })
|
|
274
|
+
] }),
|
|
275
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { children: [
|
|
276
|
+
"\u5206\u7EC4\u7406\u7531",
|
|
277
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("textarea", { "aria-label": `\u5206\u7EC4\u7406\u7531 ${index + 1}`, rows: 2, maxLength: 1200, value: group.reason, disabled: busy || locked, onChange: (e) => groupValue(group.id, { reason: e.target.value }) })
|
|
278
|
+
] }),
|
|
279
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "kl-knowledge-fields", children: [
|
|
280
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { children: [
|
|
281
|
+
"\u6765\u6E90\u5206\u7C7B",
|
|
282
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { "aria-label": `\u6765\u6E90\u5206\u7C7B ${index + 1}`, value: group.category, maxLength: 180, disabled: busy || locked, onChange: (e) => groupValue(group.id, { category: e.target.value }) })
|
|
283
|
+
] }),
|
|
284
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { children: [
|
|
285
|
+
"\u5206\u7EC4\u6807\u7B7E",
|
|
286
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { "aria-label": `\u5206\u7EC4\u6807\u7B7E ${index + 1}`, value: tagText[group.id] || "", disabled: busy || locked, onChange: (e) => setTagText((v) => ({ ...v, [group.id]: e.target.value })) })
|
|
287
|
+
] })
|
|
288
|
+
] })
|
|
289
|
+
] }),
|
|
290
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { children: group.sourceIds.map((id) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("li", { children: job.sources.find((s) => s.id === id)?.title }, id)) }),
|
|
291
|
+
!group.sourceIds.length && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "kl-muted", children: "\u6682\u65E0\u8D44\u6599\uFF0C\u4FDD\u5B58\u65F6\u4F1A\u5FFD\u7565\u7A7A\u5206\u7EC4\u3002" })
|
|
292
|
+
] }, group.id)) }),
|
|
293
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("button", { className: "kl-secondary", disabled: busy || locked || plan.groups.length >= 10, onClick: () => newGroup(), children: [
|
|
294
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, { name: "plus", size: 14 }),
|
|
295
|
+
"\u65B0\u589E\u5206\u7EC4"
|
|
296
|
+
] }),
|
|
297
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h3", { className: "kl-grouping-section-title", children: "\u9010\u7BC7\u5206\u6790\u4E0E\u6210\u5458\u8C03\u6574" }),
|
|
298
|
+
job.sources.map((source) => {
|
|
299
|
+
const analysis = job.analyses?.find((a) => a.sourceId === source.id);
|
|
300
|
+
const unassigned = plan.unassigned.find((s) => s.sourceId === source.id);
|
|
301
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("article", { className: "kl-grouping-source", "aria-label": `${source.title} \u7684\u5206\u6790`, children: [
|
|
302
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "kl-grouping-source-title", children: [
|
|
303
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: source.title }),
|
|
304
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "kl-knowledge-badge", children: analysis?.certainty === "uncertain" ? "\u9700\u6838\u5BF9" : "\u4E3B\u9898\u5EFA\u8BAE" })
|
|
305
|
+
] }),
|
|
306
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { children: analysis?.theme }),
|
|
307
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { children: [
|
|
308
|
+
"\u6240\u5C5E\u5206\u7EC4",
|
|
309
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("select", { "aria-label": `\u6240\u5C5E\u5206\u7EC4 ${source.title}`, value: plan.groups.find((g) => g.sourceIds.includes(source.id))?.id || "", disabled: busy || locked, onChange: (e) => assign(source.id, e.target.value), children: [
|
|
310
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "", children: "\u4FDD\u7559\u5F85\u6574\u7406" }),
|
|
311
|
+
plan.groups.map((g) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: g.id, children: g.title || "\u672A\u547D\u540D\u5206\u7EC4" }, g.id)),
|
|
312
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "__new__", children: "\u5355\u72EC\u6210\u7EC4" })
|
|
313
|
+
] })
|
|
314
|
+
] }),
|
|
315
|
+
unassigned && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { children: [
|
|
316
|
+
"\u5F85\u6574\u7406\u7406\u7531",
|
|
317
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { "aria-label": `\u5F85\u6574\u7406\u7406\u7531 ${source.title}`, maxLength: 1200, value: unassigned.reason, disabled: busy || locked, onChange: (e) => setPlan((p) => ({ ...p, unassigned: p.unassigned.map((s) => s.sourceId === source.id ? { ...s, reason: e.target.value } : s) })) })
|
|
318
|
+
] }),
|
|
319
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("details", { children: [
|
|
320
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("summary", { children: "\u5206\u6790\u8BE6\u60C5\u4E0E\u6765\u6E90" }),
|
|
321
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { children: analysis?.summary }),
|
|
322
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("p", { children: [
|
|
323
|
+
"\u7528\u9014\uFF1A",
|
|
324
|
+
analysis?.usage
|
|
325
|
+
] }),
|
|
326
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("p", { children: [
|
|
327
|
+
"\u6982\u5FF5\uFF1A",
|
|
328
|
+
analysis?.concepts.join("\u3001")
|
|
329
|
+
] }),
|
|
330
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("p", { children: [
|
|
331
|
+
"\u5EFA\u8BAE\u5206\u7C7B\uFF1A",
|
|
332
|
+
analysis?.category,
|
|
333
|
+
" \xB7 \u6807\u7B7E\uFF1A",
|
|
334
|
+
analysis?.tags.join("\u3001") || "\u65E0"
|
|
335
|
+
] }),
|
|
336
|
+
analysis?.uncertainty && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("p", { children: [
|
|
337
|
+
"\u5F85\u6838\u5B9E\uFF1A",
|
|
338
|
+
analysis.uncertainty
|
|
339
|
+
] }),
|
|
340
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("button", { className: "kl-secondary", disabled: busy || locked, onClick: () => void save(false, source.id), children: [
|
|
341
|
+
"\u4FDD\u5B58\u65B9\u6848\u5E76\u67E5\u770B\u6765\u6E90",
|
|
342
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, { name: "arrow", size: 14 })
|
|
343
|
+
] })
|
|
344
|
+
] })
|
|
345
|
+
] }, source.id);
|
|
346
|
+
}),
|
|
347
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "kl-grouping-sync", children: [
|
|
348
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { type: "checkbox", "aria-label": "\u540C\u6B65\u6765\u6E90\u5206\u7C7B\u548C\u6807\u7B7E", checked: apply2, disabled: busy || locked, onChange: (e) => setApply(e.target.checked) }),
|
|
349
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "\u786E\u8BA4\u540E\u540C\u6B65\u6765\u6E90\u5206\u7C7B\u548C\u6807\u7B7E\u5230\u672C\u5730\u76EE\u5F55" })
|
|
350
|
+
] }),
|
|
351
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "kl-knowledge-model", children: "\u540C\u6B65\u65F6\u4F1A\u79FB\u52A8\u5DF2\u5206\u7EC4\u8D44\u6599\u7684\u76EE\u5F55\u3001\u4FDD\u7559\u539F\u6807\u7B7E\u5E76\u6DFB\u52A0\u5206\u7EC4\u6807\u7B7E\uFF1B\u672A\u5206\u7EC4\u8D44\u6599\u4FDD\u6301\u5F85\u6574\u7406\u3002\u5173\u95ED\u540C\u6B65\u53EF\u53EA\u6309\u7EC4\u751F\u6210\u8349\u7A3F\u3002\u6BCF\u7EC4\u751F\u6210\u540E\u4ECD\u9700\u5355\u72EC\u786E\u8BA4\u4FDD\u5B58\u6B63\u5F0F\u7B14\u8BB0\u3002" }),
|
|
352
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("p", { className: "kl-knowledge-model", children: [
|
|
353
|
+
"\u751F\u6210\u8349\u7A3F\u4F7F\u7528\u6A21\u578B\uFF1A",
|
|
354
|
+
model.model || "\u5C1A\u672A\u914D\u7F6E",
|
|
355
|
+
"\u3002",
|
|
356
|
+
model.model !== job.model && `\u9010\u7BC7\u5206\u6790\u65F6\u4F7F\u7528\u7684\u662F ${job.model || "\u672A\u8BB0\u5F55\u6A21\u578B"}\u3002`,
|
|
357
|
+
"\u786E\u8BA4\u540E\u5C06\u7EE7\u7EED\u5411\u8BE5\u6A21\u578B\u53D1\u9001\u5404\u7EC4\u6B63\u6587\u53CA\u68C0\u7D22\u5230\u7684\u76F8\u5173\u77E5\u8BC6\u7B14\u8BB0\uFF0C\u7528\u4E8E\u751F\u6210\u8349\u7A3F\u548C\u5224\u65AD\u589E\u91CF\u8865\u5145\u3002\u672C\u6B21\u667A\u80FD\u6574\u7406\u53CA\u5176\u5B50\u4EFB\u52A1\u5408\u8BA1\u6700\u591A 80 \u6B21\u6A21\u578B\u8BF7\u6C42\uFF08\u5DF2\u4F7F\u7528 ",
|
|
358
|
+
job.modelCalls || 0,
|
|
359
|
+
" \u6B21\uFF09\uFF0C\u53EF\u80FD\u4EA7\u751F\u8C03\u7528\u8D39\u7528\u3002"
|
|
360
|
+
] }),
|
|
361
|
+
!!groups.length && !model.available && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { role: "alert", className: "kl-form-error", children: model.reason || "\u8BF7\u5148\u914D\u7F6E\u751F\u6210\u6A21\u578B" }),
|
|
362
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { role: "alert", className: "kl-form-error", children: error }),
|
|
363
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("footer", { children: [
|
|
364
|
+
!locked && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { className: "kl-secondary", disabled: busy, onClick: () => void save(false), children: "\u4FDD\u5B58\u5206\u7EC4\u65B9\u6848" }),
|
|
365
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { className: "kl-primary", disabled: busy || !!groups.length && !model.available || job.classification?.direction === "rollback", onClick: () => void save(true), children: busy ? "\u6B63\u5728\u5904\u7406\u2026" : locked ? "\u7EE7\u7EED\u5F52\u7C7B\u5E76\u751F\u6210\u8349\u7A3F" : groups.length ? `\u786E\u8BA4${apply2 ? "\u5F52\u7C7B" : "\u5206\u7EC4"}\u5E76\u751F\u6210 ${groups.length} \u4EFD\u8349\u7A3F` : "\u786E\u8BA4\u4FDD\u7559\u5168\u90E8\u5F85\u6574\u7406" })
|
|
366
|
+
] })
|
|
367
|
+
] });
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
// src/ui/Knowledge.tsx
|
|
371
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
372
|
+
var stateLabels = { pending: "\u5F85\u6574\u7406", running: "\u6574\u7406\u4E2D", grouping: "\u5F85\u5206\u7EC4\u786E\u8BA4", draft: "\u5F85\u786E\u8BA4", completed: "\u5DF2\u6574\u7406", failed: "\u6574\u7406\u5931\u8D25" };
|
|
373
|
+
var jobLabels = { queued: "\u6392\u961F\u4E2D", running: "\u6574\u7406\u4E2D", grouping: "\u5F85\u5206\u7EC4\u786E\u8BA4", classifying: "\u5F52\u7C7B\u4E2D", grouped: "\u5DF2\u5206\u7EC4", draft: "\u5F85\u786E\u8BA4", completed: "\u5DF2\u4FDD\u5B58", failed: "\u5931\u8D25", cancelled: "\u5DF2\u53D6\u6D88", discarded: "\u5DF2\u820D\u5F03" };
|
|
374
|
+
function KnowledgeBadge({ state }) {
|
|
375
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: `kl-knowledge-badge ${state?.status || "pending"}`, children: stateLabels[state?.status || "pending"] });
|
|
376
|
+
}
|
|
377
|
+
function StartKnowledgeDialog({ root, sourceIds, model, initialMode, onClose, onCreated }) {
|
|
378
|
+
const [sources, setSources] = (0, import_react3.useState)();
|
|
379
|
+
const [topic, setTopic] = (0, import_react3.useState)("");
|
|
380
|
+
const [error, setError] = (0, import_react3.useState)("");
|
|
381
|
+
const [busy, setBusy] = (0, import_react3.useState)(false);
|
|
382
|
+
const [mode, setMode] = (0, import_react3.useState)(initialMode || (sourceIds.length > 1 ? "smart" : "compose"));
|
|
383
|
+
const smart = mode === "smart";
|
|
384
|
+
(0, import_react3.useEffect)(() => {
|
|
385
|
+
const abort = new AbortController();
|
|
386
|
+
void Promise.all(sourceIds.map((id) => api(`/materials/${id}`, { signal: abort.signal }))).then(setSources).catch((e) => {
|
|
387
|
+
if (!abort.signal.aborted) setError(e.message);
|
|
388
|
+
});
|
|
389
|
+
return () => abort.abort();
|
|
390
|
+
}, [sourceIds]);
|
|
391
|
+
const characters = sources?.reduce((sum, source) => sum + source.content.length, 0) || 0;
|
|
392
|
+
const invalidSource = sources?.some((s) => s.deletedAt || s.kind === "note" || s.status !== "ready");
|
|
393
|
+
async function start(event) {
|
|
394
|
+
event.preventDefault();
|
|
395
|
+
setBusy(true);
|
|
396
|
+
setError("");
|
|
397
|
+
try {
|
|
398
|
+
onCreated(await post("/knowledge/jobs", { expectedRoot: root, sourceIds, topic, mode }));
|
|
399
|
+
} catch (e) {
|
|
400
|
+
setError(e.message);
|
|
401
|
+
} finally {
|
|
402
|
+
setBusy(false);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Dialog, { title: smart ? "\u667A\u80FD\u6574\u7406" : "\u751F\u6210\u77E5\u8BC6\u7B14\u8BB0", description: smart ? "\u5148\u9010\u7BC7\u5206\u6790\u3001\u5EFA\u8BAE\u5206\u7EC4\uFF0C\u518D\u786E\u8BA4\u5206\u7C7B\u4E0E\u751F\u6210\u5404\u7EC4\u77E5\u8BC6\u8349\u7A3F\u3002" : "\u5148\u63D0\u70BC\u8D44\u6599\uFF0C\u518D\u7531\u4F60\u786E\u8BA4\u3002\u539F\u59CB\u8D44\u6599\u4E0E\u6765\u6E90\u5F15\u7528\u4F1A\u4FDD\u7559\u3002", onClose: () => {
|
|
406
|
+
if (!busy) onClose();
|
|
407
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("form", { className: "kl-knowledge-form", onSubmit: (event) => void start(event), children: [
|
|
408
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "kl-knowledge-summary", children: [
|
|
409
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("b", { children: [
|
|
410
|
+
sourceIds.length,
|
|
411
|
+
" \u4EFD\u6765\u6E90\u8D44\u6599"
|
|
412
|
+
] }),
|
|
413
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { children: [
|
|
414
|
+
characters.toLocaleString(),
|
|
415
|
+
" \u5B57"
|
|
416
|
+
] })
|
|
417
|
+
] }),
|
|
418
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", { className: "kl-knowledge-source-list", children: sources?.map((s) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("li", { children: [
|
|
419
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "file", size: 14 }),
|
|
420
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: s.title })
|
|
421
|
+
] }, s.id)) }),
|
|
422
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("fieldset", { className: "kl-knowledge-mode", children: [
|
|
423
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("legend", { children: "\u6574\u7406\u65B9\u5F0F" }),
|
|
424
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { children: [
|
|
425
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { type: "radio", name: "knowledge-mode", value: "smart", checked: smart, disabled: !model.smartSupported || busy, onChange: () => setMode("smart") }),
|
|
426
|
+
"\u667A\u80FD\u5206\u7EC4",
|
|
427
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("small", { children: "\u9002\u5408\u96F6\u6563\u8D44\u6599\uFF0C\u5148\u5224\u65AD\u5173\u8054" })
|
|
428
|
+
] }),
|
|
429
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { children: [
|
|
430
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { type: "radio", name: "knowledge-mode", value: "compose", checked: !smart, disabled: busy, onChange: () => setMode("compose") }),
|
|
431
|
+
"\u540C\u4E3B\u9898\u76F4\u63A5\u7EFC\u5408",
|
|
432
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("small", { children: "\u5DF2\u786E\u8BA4\u56F4\u7ED5\u540C\u4E00\u95EE\u9898\u65F6\u4F7F\u7528" })
|
|
433
|
+
] })
|
|
434
|
+
] }),
|
|
435
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { children: [
|
|
436
|
+
smart ? "\u6574\u7406\u65B9\u5411\uFF08\u53EF\u9009\uFF09" : "\u6574\u7406\u4E3B\u9898",
|
|
437
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { "aria-label": "\u6574\u7406\u4E3B\u9898", value: topic, onChange: (e) => setTopic(e.target.value), maxLength: 300, placeholder: smart ? "\u7559\u7A7A\u53EF\u6309\u8D44\u6599\u7684\u5B9E\u9645\u4E3B\u9898\u81EA\u52A8\u5206\u7EC4" : "\u4F8B\u5982\uFF1AHarness \u5982\u4F55\u63D0\u9AD8 Agent \u7684\u53EF\u9760\u6027" }),
|
|
438
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("small", { children: smart ? "\u65B9\u5411\u7528\u4E8E\u8F85\u52A9\u5224\u65AD\uFF0C\u4E0D\u4F1A\u8981\u6C42\u628A\u65E0\u5173\u8054\u8D44\u6599\u5408\u5E76\u3002" : "\u7559\u7A7A\u65F6\u56F4\u7ED5\u8D44\u6599\u672C\u8EAB\u6574\u7406\uFF1B\u591A\u7BC7\u8D44\u6599\u4F1A\u6BD4\u8F83\u5171\u8BC6\u3001\u5DEE\u5F02\u548C\u77DB\u76FE\u3002" })
|
|
439
|
+
] }),
|
|
440
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "kl-muted", children: smart ? "\u9010\u7BC7\u63D0\u53D6\u4E3B\u9898\u3001\u6982\u5FF5\u4E0E\u7528\u9014\uFF0C\u7ED9\u51FA\u5206\u7EC4\u7406\u7531\u548C\u5206\u7C7B\u6807\u7B7E\u5EFA\u8BAE\u3002\u65E0\u5173\u8054\u8D44\u6599\u53EF\u72EC\u7ACB\u6210\u7EC4\uFF0C\u4FE1\u606F\u4E0D\u8DB3\u7684\u8D44\u6599\u4FDD\u7559\u5F85\u6574\u7406\u3002\u786E\u8BA4\u65B9\u6848\u524D\u4E0D\u79FB\u52A8\u8D44\u6599\u3002" : "\u5C06\u63D0\u70BC\u6838\u5FC3\u89C2\u70B9\u3001\u5173\u952E\u6982\u5FF5\u3001\u53EF\u590D\u7528\u65B9\u6CD5\u3001\u9002\u7528\u6761\u4EF6\u4E0E\u5C40\u9650\u3001\u5F85\u9A8C\u8BC1\u95EE\u9898\uFF0C\u5E76\u6807\u6CE8\u6765\u6E90\u6BB5\u843D\u3002" }),
|
|
441
|
+
smart && !model.smartSupported && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { role: "alert", className: "kl-form-error", children: "\u8BF7\u91CD\u542F\u8D44\u6599\u5E93\u670D\u52A1\u4EE5\u542F\u7528\u667A\u80FD\u5206\u7EC4\u3002" }),
|
|
442
|
+
model.available ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "kl-knowledge-model", children: [
|
|
443
|
+
"\u4F7F\u7528\u6A21\u578B\uFF1A",
|
|
444
|
+
model.model,
|
|
445
|
+
"\u3002\u70B9\u51FB\u5F00\u59CB\u540E\u4F1A\u5411\u8BE5\u6A21\u578B\u53D1\u9001\u6240\u9009\u6B63\u6587\u53CA\u68C0\u7D22\u5230\u7684\u76F8\u5173\u77E5\u8BC6\u7B14\u8BB0\uFF0C\u53EF\u80FD\u4EA7\u751F\u8C03\u7528\u8D39\u7528\u3002",
|
|
446
|
+
smart ? "\u9010\u7BC7\u5206\u6790\u548C\u5206\u7EC4\u6700\u591A 40 \u6B21\u8BF7\u6C42\uFF1B\u786E\u8BA4\u540E\u5404\u7EC4\u7EE7\u7EED\u751F\u6210\u8349\u7A3F\uFF0C\u6574\u6B21\u4EFB\u52A1\u5408\u8BA1\u6700\u591A 80 \u6B21\u3002" : "\u957F\u6587\u4F1A\u5206\u6BB5\u63D0\u70BC\uFF0C\u542B\u65E7\u7B14\u8BB0\u5BF9\u6BD4\u6700\u591A 22 \u6B21\u6A21\u578B\u8BF7\u6C42\u3002",
|
|
447
|
+
"\u5355\u6B21\u6700\u591A 10 \u4EFD\u3001\u6B63\u6587\u603B\u91CF 10 \u4E07\u5B57\u3002"
|
|
448
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
|
|
449
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { role: "alert", className: "kl-form-error", children: model.reason }),
|
|
450
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("a", { className: "kl-knowledge-help", href: "https://github.com/Alan-dong-dong/dsh-knowledge-library#\u5C06\u8D44\u6599\u6574\u7406\u4E3A\u77E5\u8BC6\u7B14\u8BB0", target: "_blank", rel: "noreferrer", children: [
|
|
451
|
+
"\u67E5\u770B\u6A21\u578B\u914D\u7F6E\u8BF4\u660E ",
|
|
452
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "arrow", size: 12 })
|
|
453
|
+
] })
|
|
454
|
+
] }),
|
|
455
|
+
characters > 1e5 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { role: "alert", className: "kl-form-error", children: "\u6B63\u6587\u8D85\u8FC7 10 \u4E07\u5B57\uFF0C\u8BF7\u51CF\u5C11\u9009\u62E9\u540E\u5206\u6279\u6574\u7406\u3002" }),
|
|
456
|
+
invalidSource && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { role: "alert", className: "kl-form-error", children: "\u90E8\u5206\u8D44\u6599\u5DF2\u5220\u9664\u3001\u4EC5\u5F52\u6863\u6216\u5C5E\u4E8E\u77E5\u8BC6\u7B14\u8BB0\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\u3002" }),
|
|
457
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { role: "alert", className: "kl-form-error", children: error }),
|
|
458
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("footer", { children: [
|
|
459
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "kl-secondary", disabled: busy, onClick: onClose, children: "\u53D6\u6D88" }),
|
|
460
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { className: "kl-primary", disabled: busy || !sources || !model.available || smart && !model.smartSupported || characters > 1e5 || invalidSource, children: busy ? "\u6B63\u5728\u63D0\u4EA4\u2026" : smart ? "\u5F00\u59CB\u5206\u6790\u5206\u7EC4" : "\u5F00\u59CB\u6574\u7406" })
|
|
461
|
+
] })
|
|
462
|
+
] }) });
|
|
463
|
+
}
|
|
464
|
+
function KnowledgeJobsDialog(props) {
|
|
465
|
+
const { root, overview, onClose, onRefresh, onRegenerate, onOpenSource, onSaved, onNotify } = props;
|
|
466
|
+
const [selected, setSelected] = (0, import_react3.useState)(props.jobId);
|
|
467
|
+
const [error, setError] = (0, import_react3.useState)("");
|
|
468
|
+
const [busy, setBusy] = (0, import_react3.useState)(false);
|
|
469
|
+
const job = overview.jobs.find((j) => j.id === selected);
|
|
470
|
+
async function action(name) {
|
|
471
|
+
if (!job) return;
|
|
472
|
+
setBusy(true);
|
|
473
|
+
setError("");
|
|
474
|
+
try {
|
|
475
|
+
await post(`/knowledge/jobs/${job.id}/${name}`, { expectedRoot: root });
|
|
476
|
+
onRefresh();
|
|
477
|
+
} catch (e) {
|
|
478
|
+
setError(e.message);
|
|
479
|
+
} finally {
|
|
480
|
+
setBusy(false);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Dialog, { title: job?.status === "draft" ? "\u786E\u8BA4\u77E5\u8BC6\u7B14\u8BB0" : job?.status === "grouping" ? "\u786E\u8BA4\u667A\u80FD\u5206\u7EC4" : "\u77E5\u8BC6\u6574\u7406", description: "\u5206\u6790\u3001\u5206\u7EC4\u65B9\u6848\u4E0E\u8349\u7A3F\u4FDD\u5B58\u5728\u672C\u5730\u3002\u6B63\u5F0F\u77E5\u8BC6\u7B14\u8BB0\u4ECD\u9700\u9010\u4EFD\u786E\u8BA4\u4FDD\u5B58\u3002", onClose: () => {
|
|
484
|
+
if (!busy) onClose();
|
|
485
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "kl-knowledge-jobs", children: [
|
|
486
|
+
!!selected && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { className: "kl-knowledge-back", onClick: () => {
|
|
487
|
+
setSelected(void 0);
|
|
488
|
+
setError("");
|
|
489
|
+
}, children: "\u2190 \u5168\u90E8\u6574\u7406\u4EFB\u52A1" }),
|
|
490
|
+
!overview.supported && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { role: "alert", className: "kl-form-error", children: overview.reason }),
|
|
491
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { role: "alert", className: "kl-form-error", children: error }),
|
|
492
|
+
!selected ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: !overview.jobs.length ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "kl-knowledge-empty", children: [
|
|
493
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "note", size: 26 }),
|
|
494
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { children: "\u8FD8\u6CA1\u6709\u6574\u7406\u4EFB\u52A1" }),
|
|
495
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("small", { children: "\u6253\u5F00\u4E00\u4EFD\u8D44\u6599\u70B9\u51FB\u201C\u751F\u6210\u77E5\u8BC6\u7B14\u8BB0\u201D\uFF0C\u6216\u5728\u5217\u8868\u4E2D\u9009\u62E9\u201C\u667A\u80FD\u6574\u7406\u201D\u3002" })
|
|
496
|
+
] }) : overview.jobs.map((item) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("button", { className: "kl-knowledge-job", onClick: () => {
|
|
497
|
+
setSelected(item.id);
|
|
498
|
+
setError("");
|
|
499
|
+
}, children: [
|
|
500
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
|
|
501
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: item.topic || item.sources.map((s) => s.title).join("\u3001") }),
|
|
502
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: `kl-knowledge-badge ${item.status}`, children: jobLabels[item.status] })
|
|
503
|
+
] }),
|
|
504
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { children: [
|
|
505
|
+
item.mode === "smart" ? "\u667A\u80FD\u5206\u7EC4 \xB7 " : item.parentId ? "\u5206\u7EC4\u5B50\u4EFB\u52A1 \xB7 " : "",
|
|
506
|
+
item.sourceIds.length,
|
|
507
|
+
" \u4EFD\u6765\u6E90 \xB7 ",
|
|
508
|
+
new Date(item.updatedAt).toLocaleString("zh-CN")
|
|
509
|
+
] }),
|
|
510
|
+
item.error && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("small", { children: item.error })
|
|
511
|
+
] }, item.id)) }) : !job ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "kl-muted", children: "\u6B63\u5728\u8BFB\u53D6\u6574\u7406\u4EFB\u52A1\u2026" }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
512
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "kl-knowledge-job-heading", children: [
|
|
513
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: job.topic || job.sources.map((s) => s.title).join("\u3001") }),
|
|
514
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: `kl-knowledge-badge ${job.status}`, children: jobLabels[job.status] })
|
|
515
|
+
] }),
|
|
516
|
+
job.status === "grouping" && job.plan ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(GroupingEditor, { root, job, model: overview, onRefresh, onOpenSource, onNotify }, `${job.id}:${job.planVersion}`) : job.status === "draft" && job.draft ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DraftEditor, { root, job, onRefresh, onOpenSource, onSaved, onNotify }, `${job.id}:${job.draftVersion}`) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
517
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "kl-knowledge-progress", role: "status", children: [
|
|
518
|
+
["queued", "running"].includes(job.status) && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "kl-spinner" }),
|
|
519
|
+
job.progress
|
|
520
|
+
] }),
|
|
521
|
+
job.error && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { role: "alert", className: "kl-form-error", children: job.error }),
|
|
522
|
+
job.model && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "kl-muted", children: [
|
|
523
|
+
"\u6A21\u578B\uFF1A",
|
|
524
|
+
job.model
|
|
525
|
+
] }),
|
|
526
|
+
job.status === "completed" && job.noteId && (job.sourceIds.some((id) => overview.states[id]?.noteIds.includes(job.noteId)) ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { className: "kl-primary", onClick: () => onOpenSource(job.noteId), children: "\u6253\u5F00\u77E5\u8BC6\u7B14\u8BB0" }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "kl-muted", children: "\u5173\u8054\u7B14\u8BB0\u5DF2\u79FB\u5165\u56DE\u6536\u7AD9\u6216\u6C38\u4E45\u5220\u9664\uFF0C\u53EF\u6062\u590D\u7B14\u8BB0\u6216\u91CD\u65B0\u6574\u7406\u3002" })),
|
|
527
|
+
job.status === "grouped" && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "kl-grouping-children", children: [
|
|
528
|
+
job.children?.map((child) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("button", { className: "kl-knowledge-job", onClick: () => setSelected(child.jobId), children: [
|
|
529
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
|
|
530
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: job.plan?.groups.find((g) => g.id === child.groupId)?.title || "\u5206\u7EC4\u8349\u7A3F" }),
|
|
531
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "kl-knowledge-badge", children: jobLabels[overview.jobs.find((j) => j.id === child.jobId)?.status || "queued"] })
|
|
532
|
+
] }),
|
|
533
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { children: "\u6253\u5F00\u672C\u7EC4\u4EFB\u52A1\uFF0C\u5355\u72EC\u6838\u5BF9\u5E76\u4FDD\u5B58\u77E5\u8BC6\u7B14\u8BB0" })
|
|
534
|
+
] }, child.jobId)),
|
|
535
|
+
!!job.plan?.unassigned.length && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "kl-grouping-pending", children: [
|
|
536
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: "\u4FDD\u7559\u5F85\u6574\u7406" }),
|
|
537
|
+
job.plan.unassigned.map((item) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { children: [
|
|
538
|
+
job.sources.find((s) => s.id === item.sourceId)?.title,
|
|
539
|
+
"\uFF1A",
|
|
540
|
+
item.reason
|
|
541
|
+
] }, item.sourceId))
|
|
542
|
+
] })
|
|
543
|
+
] })
|
|
544
|
+
] }),
|
|
545
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "kl-knowledge-actions", children: [
|
|
546
|
+
["queued", "running"].includes(job.status) && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { className: "kl-secondary", disabled: busy, onClick: () => void action("cancel"), children: "\u53D6\u6D88\u6574\u7406" }),
|
|
547
|
+
["draft", "failed", "grouping"].includes(job.status) && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("button", { className: "kl-secondary kl-danger", disabled: busy || !!job.classification, onClick: () => void action("discard"), children: [
|
|
548
|
+
"\u820D\u5F03",
|
|
549
|
+
job.status === "draft" ? "\u8349\u7A3F" : job.status === "grouping" ? "\u65B9\u6848" : "\u4EFB\u52A1"
|
|
550
|
+
] }),
|
|
551
|
+
["failed", "cancelled", "discarded", "completed"].includes(job.status) && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { className: "kl-secondary", onClick: () => onRegenerate(job.sourceIds, job.mode), children: "\u91CD\u65B0\u6574\u7406" })
|
|
552
|
+
] })
|
|
553
|
+
] })
|
|
554
|
+
] }) });
|
|
555
|
+
}
|
|
556
|
+
function DraftEditor({ root, job, onRefresh, onOpenSource, onSaved, onNotify }) {
|
|
557
|
+
const [draft, setDraft] = (0, import_react3.useState)(job.draft);
|
|
558
|
+
const [integration, setIntegration] = (0, import_react3.useState)(job.integration);
|
|
559
|
+
const [version, setVersion] = (0, import_react3.useState)(job.draftVersion);
|
|
560
|
+
const [tags, setTags] = (0, import_react3.useState)(draft.tags.join("\uFF0C"));
|
|
561
|
+
const [category, setCategory] = (0, import_react3.useState)(draft.category || "\u77E5\u8BC6\u7B14\u8BB0");
|
|
562
|
+
const [busy, setBusy] = (0, import_react3.useState)(false);
|
|
563
|
+
const [error, setError] = (0, import_react3.useState)("");
|
|
564
|
+
async function save(confirm, source) {
|
|
565
|
+
if (busy) return;
|
|
566
|
+
setBusy(true);
|
|
567
|
+
setError("");
|
|
568
|
+
try {
|
|
569
|
+
const edited = await post(`/knowledge/jobs/${job.id}`, { expectedRoot: root, version, draft: { ...draft, category, tags: tags.split(/[,,]/).map((t) => t.trim()).filter(Boolean) }, ...integration ? { integration: { choice: integration.choice, content: integration.content } } : {} }, "PATCH");
|
|
570
|
+
setVersion(edited.draftVersion);
|
|
571
|
+
if (confirm) {
|
|
572
|
+
const result = await post(`/knowledge/jobs/${job.id}/confirm`, { expectedRoot: root, version: edited.draftVersion, category, confirmed: true, integrationChoice: integration?.choice });
|
|
573
|
+
onSaved(result.material.id);
|
|
574
|
+
} else if (source) onOpenSource(source.id, source.segment);
|
|
575
|
+
else {
|
|
576
|
+
onNotify("\u8349\u7A3F\u5DF2\u4FDD\u5B58\uFF0C\u6B63\u5F0F\u77E5\u8BC6\u7B14\u8BB0\u5C1A\u672A\u4FEE\u6539");
|
|
577
|
+
onRefresh();
|
|
578
|
+
}
|
|
579
|
+
} catch (e) {
|
|
580
|
+
setError(e.message);
|
|
581
|
+
} finally {
|
|
582
|
+
setBusy(false);
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
const updating = integration?.choice === "append" || integration?.choice === "duplicate";
|
|
586
|
+
const confirmText = integration?.choice === "append" ? "\u786E\u8BA4\u8865\u5145\u5DF2\u6709\u7B14\u8BB0" : integration?.choice === "duplicate" ? "\u786E\u8BA4\u4EC5\u5173\u8054\u6765\u6E90" : "\u786E\u8BA4\u4FDD\u5B58\u7B14\u8BB0";
|
|
587
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("form", { className: "kl-knowledge-draft", onSubmit: (e) => {
|
|
588
|
+
e.preventDefault();
|
|
589
|
+
void save(true);
|
|
590
|
+
}, children: [
|
|
591
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "kl-knowledge-model", children: "\u8FD9\u662F\u6A21\u578B\u751F\u6210\u7684\u8349\u7A3F\uFF0C\u8BF7\u6838\u5BF9\u7406\u89E3\u4E0E\u8BC1\u636E\u3002\u4FEE\u6539\u540E\u8BF7\u4FDD\u5B58\u8349\u7A3F\uFF0C\u518D\u5173\u95ED\u7A97\u53E3\u3002" }),
|
|
592
|
+
integration && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("section", { className: "kl-note-integration", "aria-label": "\u5DF2\u6709\u77E5\u8BC6\u5BF9\u6BD4", children: [
|
|
593
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("strong", { children: [
|
|
594
|
+
"\u5EFA\u8BAE",
|
|
595
|
+
integration.recommendation === "append" ? "\u8865\u5145\u5DF2\u6709\u7B14\u8BB0" : integration.recommendation === "duplicate" ? "\u4EC5\u5173\u8054\u5DF2\u6709\u7B14\u8BB0" : "\u65B0\u5EFA\u7B14\u8BB0"
|
|
596
|
+
] }),
|
|
597
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { children: integration.reason }),
|
|
598
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "kl-knowledge-model", children: [
|
|
599
|
+
"\u68C0\u7D22\u4E86 ",
|
|
600
|
+
integration.search.scanned,
|
|
601
|
+
" \u4EFD\u6709\u6548\u7B14\u8BB0\uFF0C\u627E\u5230 ",
|
|
602
|
+
integration.search.matched,
|
|
603
|
+
" \u4EFD\u8BCD\u9762\u76F8\u5173\u7B14\u8BB0\uFF0C\u672C\u6B21\u5B8C\u6574\u5BF9\u6BD4 ",
|
|
604
|
+
integration.search.compared,
|
|
605
|
+
" \u4EFD\uFF08\u6700\u591A 5 \u4EFD\uFF09\u3002",
|
|
606
|
+
integration.search.oversized > 0 && `${integration.search.oversized} \u4EFD\u8D85\u8FC7\u5BF9\u6BD4\u957F\u5EA6\u4E0A\u9650\u3002`,
|
|
607
|
+
"\u672A\u5339\u914D\u4E0D\u4EE3\u8868\u6574\u5E93\u6CA1\u6709\u76F8\u5173\u77E5\u8BC6\u3002"
|
|
608
|
+
] }),
|
|
609
|
+
[["overlaps", "\u91CD\u590D\u5185\u5BB9"], ["additions", "\u65B0\u589E\u77E5\u8BC6"], ["conflicts", "\u5DEE\u5F02\u4E0E\u5F85\u6838\u5B9E"]].map(([key, title]) => !!integration[key].length && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "kl-integration-findings", children: [
|
|
610
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: title }),
|
|
611
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", { children: integration[key].map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("li", { children: item }, index)) })
|
|
612
|
+
] }, key)),
|
|
613
|
+
integration.target && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
614
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "kl-integration-target", children: [
|
|
615
|
+
integration.target.title,
|
|
616
|
+
" \xB7 ",
|
|
617
|
+
integration.target.category,
|
|
618
|
+
" \xB7 \u7248\u672C ",
|
|
619
|
+
integration.target.revision
|
|
620
|
+
] }),
|
|
621
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("fieldset", { className: "kl-knowledge-mode", children: [
|
|
622
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("legend", { children: "\u672C\u6B21\u5982\u4F55\u4FDD\u5B58" }),
|
|
623
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { children: [
|
|
624
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { type: "radio", name: "integration-choice", "aria-label": integration.recommendation === "duplicate" ? "\u4EC5\u5173\u8054\u5DF2\u6709\u7B14\u8BB0" : "\u8865\u5145\u5DF2\u6709\u7B14\u8BB0", checked: updating, onChange: () => setIntegration({ ...integration, choice: integration.recommendation }) }),
|
|
625
|
+
integration.recommendation === "duplicate" ? "\u4EC5\u5173\u8054\u6765\u6E90\uFF0C\u4E0D\u91CD\u590D\u6B63\u6587" : "\u8FFD\u52A0\u8865\u5145\u5230\u5DF2\u6709\u7B14\u8BB0"
|
|
626
|
+
] }),
|
|
627
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { children: [
|
|
628
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { type: "radio", name: "integration-choice", "aria-label": "\u53E6\u5B58\u4E3A\u65B0\u7B14\u8BB0", checked: !updating, onChange: () => setIntegration({ ...integration, choice: "new" }) }),
|
|
629
|
+
"\u53E6\u5B58\u4E3A\u65B0\u7B14\u8BB0"
|
|
630
|
+
] })
|
|
631
|
+
] }),
|
|
632
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("details", { children: [
|
|
633
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("summary", { children: "\u67E5\u770B\u5DF2\u6709\u7B14\u8BB0\u539F\u6587" }),
|
|
634
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("pre", { className: "kl-integration-preview", children: integration.target.content }),
|
|
635
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("button", { type: "button", className: "kl-secondary", disabled: busy, onClick: () => void save(false, { id: integration.target.id }), children: [
|
|
636
|
+
"\u4FDD\u5B58\u8349\u7A3F\u5E76\u6253\u5F00\u5DF2\u6709\u7B14\u8BB0",
|
|
637
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "arrow", size: 14 })
|
|
638
|
+
] })
|
|
639
|
+
] })
|
|
640
|
+
] })
|
|
641
|
+
] }),
|
|
642
|
+
updating ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
643
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "kl-knowledge-model", children: "\u786E\u8BA4\u540E\u4FDD\u7559\u5DF2\u6709\u6807\u9898\u3001\u5206\u7C7B\u3001\u6B63\u6587\u4E0E\u65E7\u6BB5\u843D\u5F15\u7528\uFF0C\u5408\u5E76\u65B0\u6765\u6E90\u548C\u6807\u7B7E\u3002\u66F4\u65B0\u524D\u540E\u5FEB\u7167\u4FDD\u5B58\u5728\u672C\u5730\uFF1B\u5BA1\u6838\u671F\u95F4\u7B14\u8BB0\u53D8\u5316\u4F1A\u8981\u6C42\u91CD\u65B0\u6838\u5BF9\u3002" }),
|
|
644
|
+
integration?.choice === "append" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
645
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { children: [
|
|
646
|
+
"\u672C\u6B21\u65B0\u589E\u6B63\u6587",
|
|
647
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("textarea", { "aria-label": "\u672C\u6B21\u65B0\u589E\u6B63\u6587", required: true, rows: 12, maxLength: 5e4, value: integration.content, onChange: (e) => setIntegration({ ...integration, content: e.target.value }) })
|
|
648
|
+
] }),
|
|
649
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("details", { children: [
|
|
650
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("summary", { children: "\u66F4\u65B0\u540E\u6B63\u6587\u9884\u89C8" }),
|
|
651
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("pre", { className: "kl-integration-preview", children: [
|
|
652
|
+
integration.target.content,
|
|
653
|
+
"\n\n## \u77E5\u8BC6\u8865\u5145 \xB7 " + (/* @__PURE__ */ new Date()).toISOString().slice(0, 10) + "\n\n" + integration.content
|
|
654
|
+
] })
|
|
655
|
+
] })
|
|
656
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "kl-muted", children: "\u672C\u6B21\u6CA1\u6709\u9700\u8981\u65B0\u589E\u7684\u6B63\u6587\u3002\u786E\u8BA4\u540E\u53EA\u628A\u8FD9\u4E9B\u6765\u6E90\u5173\u8054\u5230\u5DF2\u6709\u7B14\u8BB0\uFF0C\u4ECD\u4FDD\u7559\u5BF9\u6BD4\u7406\u7531\u4F9B\u6838\u67E5\u3002" })
|
|
657
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
658
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { children: [
|
|
659
|
+
"\u7B14\u8BB0\u6807\u9898",
|
|
660
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { "aria-label": "\u7B14\u8BB0\u6807\u9898", required: true, maxLength: 300, value: draft.title, onChange: (e) => setDraft({ ...draft, title: e.target.value }) })
|
|
661
|
+
] }),
|
|
662
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { children: [
|
|
663
|
+
"\u7B14\u8BB0\u6B63\u6587",
|
|
664
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("textarea", { "aria-label": "\u7B14\u8BB0\u6B63\u6587", required: true, rows: 14, maxLength: 5e4, value: draft.content, onChange: (e) => setDraft({ ...draft, content: e.target.value }) })
|
|
665
|
+
] }),
|
|
666
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { children: [
|
|
667
|
+
"\u7B14\u8BB0\u5206\u7C7B",
|
|
668
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { "aria-label": "\u7B14\u8BB0\u5206\u7C7B", value: category, onChange: (e) => setCategory(e.target.value), maxLength: 180 })
|
|
669
|
+
] })
|
|
670
|
+
] }),
|
|
671
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { children: [
|
|
672
|
+
updating ? "\u65B0\u589E\u6807\u7B7E" : "\u6807\u7B7E",
|
|
673
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { "aria-label": "\u7B14\u8BB0\u6807\u7B7E", value: tags, onChange: (e) => setTags(e.target.value), placeholder: "\u9017\u53F7\u5206\u9694" })
|
|
674
|
+
] }),
|
|
675
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("details", { className: "kl-knowledge-citations", children: [
|
|
676
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("summary", { children: [
|
|
677
|
+
draft.citations.length,
|
|
678
|
+
" \u6761\u6765\u6E90\u5F15\u7528"
|
|
679
|
+
] }),
|
|
680
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { children: "\u67E5\u770B\u6765\u6E90\u524D\u4F1A\u5148\u4FDD\u5B58\u5F53\u524D\u8349\u7A3F\u3002" }),
|
|
681
|
+
draft.citations.map((citation, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("button", { type: "button", disabled: busy, onClick: () => void save(false, { id: citation.materialId, segment: citation.segmentId }), children: [
|
|
682
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "file", size: 14 }),
|
|
683
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { children: [
|
|
684
|
+
job.sources.find((s) => s.id === citation.materialId)?.title,
|
|
685
|
+
" / ",
|
|
686
|
+
citation.segmentId
|
|
687
|
+
] }),
|
|
688
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "arrow", size: 14 })
|
|
689
|
+
] }, index))
|
|
690
|
+
] }),
|
|
691
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { role: "alert", className: "kl-form-error", children: error }),
|
|
692
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("footer", { children: [
|
|
693
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "kl-secondary", disabled: busy, onClick: () => void save(false), children: "\u4FDD\u5B58\u8349\u7A3F" }),
|
|
694
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { className: "kl-primary", disabled: busy, children: busy ? "\u6B63\u5728\u4FDD\u5B58\u2026" : confirmText })
|
|
695
|
+
] })
|
|
696
|
+
] });
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
// src/ui/App.tsx
|
|
700
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
84
701
|
var kinds = {
|
|
85
702
|
web: { label: "\u7F51\u9875", icon: "web" },
|
|
86
703
|
text: { label: "\u6587\u672C", icon: "file" },
|
|
@@ -91,38 +708,41 @@ var kinds = {
|
|
|
91
708
|
};
|
|
92
709
|
var time = (v) => `${String(Math.floor(v / 3600)).padStart(2, "0")}:${String(Math.floor(v / 60) % 60).padStart(2, "0")}:${String(Math.floor(v) % 60).padStart(2, "0")}`;
|
|
93
710
|
var date = (value) => new Intl.DateTimeFormat("zh-CN", { month: "2-digit", day: "2-digit" }).format(new Date(value));
|
|
94
|
-
|
|
95
|
-
const response = await fetch(API + path, { ...options, headers: { "Content-Type": "application/json", "X-Knowledge-Library": "1", ...options.headers } });
|
|
96
|
-
const data = await response.json();
|
|
97
|
-
if (!response.ok) throw new Error(data.error || `\u8BF7\u6C42\u5931\u8D25\uFF1A${response.status}`);
|
|
98
|
-
return data;
|
|
99
|
-
}
|
|
100
|
-
var post = (path, value, method = "POST") => api(path, { method, body: JSON.stringify(value) });
|
|
101
|
-
function splitTags(value) {
|
|
711
|
+
function splitTags2(value) {
|
|
102
712
|
return value.split(/[,,]/).map((v) => v.trim()).filter(Boolean);
|
|
103
713
|
}
|
|
104
714
|
function App() {
|
|
105
|
-
const [stats, setStats] = (0,
|
|
106
|
-
const [items, setItems] = (0,
|
|
107
|
-
const [total, setTotal] = (0,
|
|
108
|
-
const [query, setQuery] = (0,
|
|
109
|
-
const [filter, setFilter] = (0,
|
|
110
|
-
const [selected, setSelected] = (0,
|
|
111
|
-
const [detail, setDetail] = (0,
|
|
112
|
-
const [anchor, setAnchor] = (0,
|
|
113
|
-
const [editor, setEditor] = (0,
|
|
114
|
-
const [
|
|
115
|
-
const [
|
|
116
|
-
const [
|
|
117
|
-
const [
|
|
118
|
-
const [
|
|
119
|
-
const [
|
|
120
|
-
const [
|
|
121
|
-
const [
|
|
122
|
-
const [
|
|
123
|
-
const
|
|
124
|
-
const
|
|
125
|
-
const
|
|
715
|
+
const [stats, setStats] = (0, import_react4.useState)();
|
|
716
|
+
const [items, setItems] = (0, import_react4.useState)([]);
|
|
717
|
+
const [total, setTotal] = (0, import_react4.useState)(0);
|
|
718
|
+
const [query, setQuery] = (0, import_react4.useState)("");
|
|
719
|
+
const [filter, setFilter] = (0, import_react4.useState)({});
|
|
720
|
+
const [selected, setSelected] = (0, import_react4.useState)();
|
|
721
|
+
const [detail, setDetail] = (0, import_react4.useState)();
|
|
722
|
+
const [anchor, setAnchor] = (0, import_react4.useState)();
|
|
723
|
+
const [editor, setEditor] = (0, import_react4.useState)();
|
|
724
|
+
const [deletion, setDeletion] = (0, import_react4.useState)();
|
|
725
|
+
const [restoring, setRestoring] = (0, import_react4.useState)();
|
|
726
|
+
const [emptyRoot, setEmptyRoot] = (0, import_react4.useState)();
|
|
727
|
+
const [jobs, setJobs] = (0, import_react4.useState)([]);
|
|
728
|
+
const [knowledge, setKnowledge] = (0, import_react4.useState)();
|
|
729
|
+
const [batchMode, setBatchMode] = (0, import_react4.useState)(false);
|
|
730
|
+
const [checkedIds, setCheckedIds] = (0, import_react4.useState)([]);
|
|
731
|
+
const [generation, setGeneration] = (0, import_react4.useState)();
|
|
732
|
+
const [knowledgeOpen, setKnowledgeOpen] = (0, import_react4.useState)();
|
|
733
|
+
const [showJobs, setShowJobs] = (0, import_react4.useState)(false);
|
|
734
|
+
const [showInfo, setShowInfo] = (0, import_react4.useState)(false);
|
|
735
|
+
const [settingsFromJobs, setSettingsFromJobs] = (0, import_react4.useState)(false);
|
|
736
|
+
const [showNavigation, setShowNavigation] = (0, import_react4.useState)(false);
|
|
737
|
+
const [error, setError] = (0, import_react4.useState)("");
|
|
738
|
+
const [toast, setToast] = (0, import_react4.useState)("");
|
|
739
|
+
const [loading, setLoading] = (0, import_react4.useState)(true);
|
|
740
|
+
const [detailLoading, setDetailLoading] = (0, import_react4.useState)(false);
|
|
741
|
+
const [revision, setRevision] = (0, import_react4.useState)(0);
|
|
742
|
+
const [limit, setLimit] = (0, import_react4.useState)(40);
|
|
743
|
+
const searchRef = (0, import_react4.useRef)(null);
|
|
744
|
+
const detailRef = (0, import_react4.useRef)(null);
|
|
745
|
+
const refresh = (0, import_react4.useCallback)(() => setRevision((v) => v + 1), []);
|
|
126
746
|
const notify = (message) => setToast(message);
|
|
127
747
|
const chooseFilter = (next) => {
|
|
128
748
|
setFilter(next);
|
|
@@ -130,16 +750,26 @@ function App() {
|
|
|
130
750
|
setSelected(void 0);
|
|
131
751
|
setAnchor(void 0);
|
|
132
752
|
setDetail(void 0);
|
|
753
|
+
setShowNavigation(false);
|
|
754
|
+
setBatchMode(false);
|
|
755
|
+
setCheckedIds([]);
|
|
133
756
|
};
|
|
134
|
-
const refreshMeta = (0,
|
|
135
|
-
const [s, j] = await Promise.all([api("/stats"), api("/jobs")
|
|
757
|
+
const refreshMeta = (0, import_react4.useCallback)(async () => {
|
|
758
|
+
const [s, j, k] = await Promise.all([api("/stats"), api("/jobs"), api("/knowledge").catch((e) => {
|
|
759
|
+
if (e instanceof ApiError && e.status === 404) return { supported: false, available: false, reason: "\u8BF7\u91CD\u542F\u8D44\u6599\u5E93\u670D\u52A1\u4EE5\u542F\u7528\u77E5\u8BC6\u6574\u7406\u3002", jobs: [], states: {} };
|
|
760
|
+
throw e;
|
|
761
|
+
})]);
|
|
136
762
|
setStats(s);
|
|
137
763
|
setJobs(j);
|
|
764
|
+
setKnowledge(k);
|
|
138
765
|
}, []);
|
|
139
|
-
(0,
|
|
766
|
+
(0, import_react4.useEffect)(() => {
|
|
767
|
+
setCheckedIds([]);
|
|
768
|
+
}, [query]);
|
|
769
|
+
(0, import_react4.useEffect)(() => {
|
|
140
770
|
void refreshMeta().catch((e) => setError(e.message));
|
|
141
771
|
}, [revision, refreshMeta]);
|
|
142
|
-
(0,
|
|
772
|
+
(0, import_react4.useEffect)(() => {
|
|
143
773
|
const controller = new AbortController();
|
|
144
774
|
const timer = setTimeout(() => {
|
|
145
775
|
setLoading(true);
|
|
@@ -159,7 +789,7 @@ function App() {
|
|
|
159
789
|
controller.abort();
|
|
160
790
|
};
|
|
161
791
|
}, [query, filter, revision, limit]);
|
|
162
|
-
(0,
|
|
792
|
+
(0, import_react4.useEffect)(() => {
|
|
163
793
|
if (!selected) {
|
|
164
794
|
setDetail(void 0);
|
|
165
795
|
return;
|
|
@@ -174,23 +804,25 @@ function App() {
|
|
|
174
804
|
});
|
|
175
805
|
return () => controller.abort();
|
|
176
806
|
}, [selected, revision]);
|
|
177
|
-
(0,
|
|
807
|
+
(0, import_react4.useEffect)(() => {
|
|
178
808
|
if (!detail || !anchor) return;
|
|
179
809
|
const element = Array.from(detailRef.current?.querySelectorAll("[data-segment-id]") || []).find((el) => el.dataset.segmentId === anchor);
|
|
180
810
|
element?.scrollIntoView({ block: "center" });
|
|
181
811
|
}, [detail, anchor]);
|
|
182
812
|
const pending = jobs.filter((j) => ["queued", "running"].includes(j.status)).length;
|
|
183
|
-
|
|
184
|
-
|
|
813
|
+
const knowledgePending = knowledge?.jobs.filter((j) => ["queued", "running"].includes(j.status)).length || 0;
|
|
814
|
+
const draftCount = knowledge?.jobs.filter((j) => ["draft", "grouping"].includes(j.status)).length || 0;
|
|
815
|
+
(0, import_react4.useEffect)(() => {
|
|
816
|
+
if (!pending && !knowledgePending) return;
|
|
185
817
|
const interval = setInterval(refresh, 2500);
|
|
186
818
|
return () => clearInterval(interval);
|
|
187
|
-
}, [pending, refresh]);
|
|
188
|
-
(0,
|
|
819
|
+
}, [pending, knowledgePending, refresh]);
|
|
820
|
+
(0, import_react4.useEffect)(() => {
|
|
189
821
|
if (!toast) return;
|
|
190
822
|
const timer = setTimeout(() => setToast(""), 3500);
|
|
191
823
|
return () => clearTimeout(timer);
|
|
192
824
|
}, [toast]);
|
|
193
|
-
(0,
|
|
825
|
+
(0, import_react4.useEffect)(() => {
|
|
194
826
|
const listener = (event) => {
|
|
195
827
|
if ((event.ctrlKey || event.metaKey) && event.key === "k") {
|
|
196
828
|
event.preventDefault();
|
|
@@ -208,278 +840,330 @@ function App() {
|
|
|
208
840
|
setError("\u526A\u8D34\u677F\u4E0D\u53EF\u7528\uFF0C\u8BF7\u4ECE\u8D44\u6599\u8BE6\u60C5\u624B\u52A8\u590D\u5236\u8D44\u6599 ID");
|
|
209
841
|
}
|
|
210
842
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
843
|
+
function askDelete(item) {
|
|
844
|
+
if (stats) setDeletion({ id: item.id, title: item.title, root: stats.root });
|
|
845
|
+
}
|
|
846
|
+
function afterRemoval(id, message) {
|
|
847
|
+
if (selected === id) {
|
|
848
|
+
setSelected(void 0);
|
|
849
|
+
setDetail(void 0);
|
|
850
|
+
setAnchor(void 0);
|
|
851
|
+
}
|
|
852
|
+
refresh();
|
|
853
|
+
notify(message);
|
|
854
|
+
searchRef.current?.focus();
|
|
855
|
+
}
|
|
856
|
+
async function restoreItem(id) {
|
|
857
|
+
if (!stats || restoring) return;
|
|
858
|
+
setRestoring(id);
|
|
859
|
+
try {
|
|
860
|
+
await post(`/materials/${id}/restore`, { expectedRoot: stats.root });
|
|
861
|
+
afterRemoval(id, "\u8D44\u6599\u5DF2\u6062\u590D\u5230\u539F\u5206\u7C7B");
|
|
862
|
+
} catch (e) {
|
|
863
|
+
setError(e.message);
|
|
864
|
+
} finally {
|
|
865
|
+
setRestoring(void 0);
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
function openKnowledgeSource(id, segmentId) {
|
|
869
|
+
setKnowledgeOpen(void 0);
|
|
870
|
+
chooseFilter({});
|
|
871
|
+
setQuery("");
|
|
872
|
+
setSelected(id);
|
|
873
|
+
setAnchor(segmentId);
|
|
874
|
+
refresh();
|
|
875
|
+
}
|
|
876
|
+
function generateFor(ids, mode) {
|
|
877
|
+
if (stats) setGeneration({ root: stats.root, sourceIds: ids, mode });
|
|
878
|
+
}
|
|
879
|
+
const currentTitle = filter.trashed ? "\u56DE\u6536\u7AD9" : filter.category || filter.collection || (filter.tag ? `\u6807\u7B7E \xB7 ${filter.tag}` : filter.kind === "note" ? "\u77E5\u8BC6\u7B14\u8BB0" : "\u5168\u90E8\u8D44\u6599");
|
|
880
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-app", children: [
|
|
881
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("main", { className: "kl-workspace", children: [
|
|
882
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("header", { className: "kl-header", children: [
|
|
883
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h1", { children: currentTitle }),
|
|
884
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-header-actions", children: [
|
|
885
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { className: "kl-secondary", onClick: () => setEditor({ mode: "note" }), children: [
|
|
886
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "note", size: 16 }),
|
|
887
|
+
"\u5199\u7B14\u8BB0"
|
|
888
|
+
] }),
|
|
889
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { className: "kl-primary", onClick: () => setEditor({ mode: "capture" }), children: [
|
|
890
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "plus", size: 16 }),
|
|
891
|
+
"\u6536\u96C6\u8D44\u6599"
|
|
892
|
+
] })
|
|
257
893
|
] })
|
|
258
894
|
] }),
|
|
259
|
-
/* @__PURE__ */ (0,
|
|
260
|
-
/* @__PURE__ */ (0,
|
|
261
|
-
"\
|
|
262
|
-
/* @__PURE__ */ (0,
|
|
895
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-navigation", children: [
|
|
896
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("nav", { "aria-label": "\u8D44\u6599\u5BFC\u822A", children: [
|
|
897
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { "aria-pressed": !Object.values(filter).some(Boolean), onClick: () => chooseFilter({}), children: "\u5168\u90E8\u8D44\u6599" }),
|
|
898
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { "aria-pressed": filter.category === "\u6536\u4EF6\u7BB1", onClick: () => chooseFilter({ category: "\u6536\u4EF6\u7BB1" }), children: "\u6536\u4EF6\u7BB1" }),
|
|
899
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { "aria-pressed": filter.kind === "note", onClick: () => chooseFilter({ kind: "note" }), children: "\u77E5\u8BC6\u7B14\u8BB0" }),
|
|
900
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { "aria-pressed": filter.trashed === "1", onClick: () => chooseFilter({ trashed: "1" }), children: "\u56DE\u6536\u7AD9" })
|
|
263
901
|
] }),
|
|
264
|
-
|
|
265
|
-
/* @__PURE__ */ (0,
|
|
266
|
-
|
|
267
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("small", { children: c.count })
|
|
268
|
-
] }, c.name)),
|
|
269
|
-
!stats?.collections.length && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "kl-nav-hint", children: "\u628A\u4E0D\u540C\u6765\u6E90\u653E\u8FDB\u540C\u4E00\u4E13\u9898\u3002" })
|
|
270
|
-
] }),
|
|
271
|
-
!!stats?.tags.length && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "kl-nav-section", children: [
|
|
272
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "kl-nav-label", children: "\u6807\u7B7E" }),
|
|
273
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "kl-tag-cloud", children: stats.tags.slice(0, 15).map((tag) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("button", { className: filter.tag === tag.name ? "active" : "", onClick: () => chooseFilter({ tag: tag.name }), children: [
|
|
274
|
-
"#",
|
|
275
|
-
tag.name
|
|
276
|
-
] }, tag.name)) })
|
|
277
|
-
] }),
|
|
278
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "kl-nav-bottom", children: [
|
|
279
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("button", { onClick: () => setShowInfo(true), children: [
|
|
280
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "kl-live-dot" }),
|
|
281
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u4FDD\u5B58\u5728\u8FD9\u53F0\u7535\u8111" }),
|
|
282
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { name: "settings", size: 16 })
|
|
283
|
-
] }),
|
|
284
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: "\u6765\u6E90\u53EF\u8FFD\u6EAF \xB7 \u5185\u5BB9\u53EF\u5E26\u8D70" })
|
|
285
|
-
] })
|
|
286
|
-
] }),
|
|
287
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("main", { className: "kl-workspace", children: [
|
|
288
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("header", { className: "kl-header", children: [
|
|
289
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
|
|
290
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "kl-eyebrow", children: "COLLECT / CONNECT / UNDERSTAND" }),
|
|
291
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h1", { children: currentTitle }),
|
|
292
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: "\u7559\u4F4F\u503C\u5F97\u518D\u8BFB\u7684\u5185\u5BB9\uFF0C\u8BA9\u6BCF\u4E00\u6B21\u601D\u8003\u90FD\u6709\u51FA\u5904\u3002" })
|
|
293
|
-
] }),
|
|
294
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("button", { className: "kl-secondary", onClick: () => setEditor({ mode: "note" }), children: [
|
|
295
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { name: "note", size: 17 }),
|
|
296
|
-
"\u5199\u7B14\u8BB0"
|
|
902
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { className: "kl-directory-toggle", "aria-expanded": showNavigation, "aria-controls": "kl-directory", onClick: () => setShowNavigation((v) => !v), children: [
|
|
903
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "folder", size: 16 }),
|
|
904
|
+
"\u5206\u7C7B\u4E0E\u4E13\u9898"
|
|
297
905
|
] })
|
|
298
906
|
] }),
|
|
299
|
-
/* @__PURE__ */ (0,
|
|
300
|
-
/* @__PURE__ */ (0,
|
|
301
|
-
/* @__PURE__ */ (0,
|
|
302
|
-
/* @__PURE__ */ (0,
|
|
907
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-toolbar", children: [
|
|
908
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "kl-search", children: [
|
|
909
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "search", size: 19 }),
|
|
910
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { ref: searchRef, "aria-label": "\u641C\u7D22\u8D44\u6599", placeholder: "\u641C\u7D22\u6B63\u6587\u3001\u6807\u9898\u3001\u6807\u7B7E\u2026", value: query, onChange: (e) => {
|
|
303
911
|
setQuery(e.target.value);
|
|
304
912
|
setLimit(40);
|
|
305
913
|
} }),
|
|
306
|
-
/* @__PURE__ */ (0,
|
|
914
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("kbd", { children: "Ctrl K" })
|
|
307
915
|
] }),
|
|
308
|
-
/* @__PURE__ */ (0,
|
|
309
|
-
/* @__PURE__ */ (0,
|
|
310
|
-
/* @__PURE__ */ (0,
|
|
311
|
-
jobs.some((j) => j.status === "failed") && /* @__PURE__ */ (0,
|
|
312
|
-
] })
|
|
916
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { "aria-label": pending ? `\u91C7\u96C6\u4EFB\u52A1\uFF0C${pending} \u9879\u5904\u7406\u4E2D` : "\u91C7\u96C6\u4EFB\u52A1", className: `kl-job-button ${pending ? "has-jobs" : ""}`, onClick: () => setShowJobs(true), children: [
|
|
917
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "clock", size: 17 }),
|
|
918
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: pending ? `${pending} \u9879\u5904\u7406\u4E2D` : "\u91C7\u96C6\u4EFB\u52A1" }),
|
|
919
|
+
jobs.some((j) => j.status === "failed") && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("i", {})
|
|
920
|
+
] }),
|
|
921
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { "aria-label": "\u77E5\u8BC6\u6574\u7406", title: "\u77E5\u8BC6\u6574\u7406", className: `kl-job-button ${knowledgePending || draftCount ? "has-jobs" : ""}`, onClick: () => {
|
|
922
|
+
refresh();
|
|
923
|
+
if (stats) setKnowledgeOpen({ root: stats.root });
|
|
924
|
+
}, children: [
|
|
925
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "note", size: 17 }),
|
|
926
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: draftCount ? `${draftCount} \u4EFD\u5F85\u786E\u8BA4` : "\u77E5\u8BC6\u6574\u7406" }),
|
|
927
|
+
!!knowledgePending && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "kl-spinner" })
|
|
928
|
+
] }),
|
|
929
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: "kl-icon-button", "aria-label": "\u8D44\u6599\u5E93\u8BBE\u7F6E", title: "\u8D44\u6599\u5E93\u8BBE\u7F6E", onClick: () => {
|
|
930
|
+
setSettingsFromJobs(false);
|
|
931
|
+
setShowInfo(true);
|
|
932
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "settings", size: 18 }) })
|
|
313
933
|
] }),
|
|
314
|
-
!!error && /* @__PURE__ */ (0,
|
|
315
|
-
/* @__PURE__ */ (0,
|
|
316
|
-
/* @__PURE__ */ (0,
|
|
934
|
+
!!error && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-error", role: "alert", children: [
|
|
935
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: error }),
|
|
936
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { "aria-label": "\u5173\u95ED\u9519\u8BEF", onClick: () => setError(""), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "close", size: 16 }) })
|
|
317
937
|
] }),
|
|
318
|
-
/* @__PURE__ */ (0,
|
|
319
|
-
/* @__PURE__ */ (0,
|
|
320
|
-
/* @__PURE__ */ (0,
|
|
938
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-filterbar", children: [
|
|
939
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { children: [
|
|
940
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("b", { children: total }),
|
|
321
941
|
" \u4EFD\u8D44\u6599",
|
|
322
942
|
query && ` \xB7 \u201C${query}\u201D`
|
|
323
943
|
] }),
|
|
324
|
-
/* @__PURE__ */ (0,
|
|
325
|
-
/* @__PURE__ */ (0,
|
|
944
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
945
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("select", { "aria-label": "\u6309\u7C7B\u578B\u7B5B\u9009", value: filter.kind || "", onChange: (e) => {
|
|
326
946
|
setFilter({ ...filter, kind: e.target.value || void 0 });
|
|
327
947
|
setLimit(40);
|
|
328
948
|
}, children: [
|
|
329
|
-
/* @__PURE__ */ (0,
|
|
330
|
-
Object.entries(kinds).map(([value, kind]) => /* @__PURE__ */ (0,
|
|
949
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "", children: "\u6240\u6709\u7C7B\u578B" }),
|
|
950
|
+
Object.entries(kinds).map(([value, kind]) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value, children: kind.label }, value))
|
|
331
951
|
] }),
|
|
332
|
-
/* @__PURE__ */ (0,
|
|
952
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "kl-sort-label", children: "\u6700\u8FD1\u66F4\u65B0 \u2193" })
|
|
333
953
|
] })
|
|
334
954
|
] }),
|
|
335
|
-
/* @__PURE__ */ (0,
|
|
336
|
-
/* @__PURE__ */ (0,
|
|
337
|
-
|
|
338
|
-
|
|
955
|
+
filter.trashed && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-trash-toolbar", children: [
|
|
956
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: stats?.canEmptyTrash ? stats.purgePending ? `${stats.purgePending} \u4EFD\u8D44\u6599\u7684\u6587\u4EF6\u6E05\u7406\u672A\u5B8C\u6210\uFF0C\u53EF\u518D\u6B21\u6E05\u7A7A\u4EE5\u91CD\u8BD5\u3002` : "\u6E05\u7A7A\u5C06\u6C38\u4E45\u5220\u9664\u6574\u4E2A\u56DE\u6536\u7AD9\uFF0C\u4E0D\u53D7\u5F53\u524D\u641C\u7D22\u548C\u7C7B\u578B\u7B5B\u9009\u9650\u5236\u3002" : "\u8BF7\u91CD\u542F\u8D44\u6599\u5E93\u670D\u52A1\u4EE5\u542F\u7528\u6E05\u7A7A\u56DE\u6536\u7AD9\u3002" }),
|
|
957
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { className: "kl-secondary kl-danger", disabled: !stats?.canEmptyTrash || !(stats.trashed || stats.purgePending) || !!restoring, onClick: () => stats && setEmptyRoot(stats.root), children: [
|
|
958
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "trash", size: 15 }),
|
|
959
|
+
"\u6E05\u7A7A\u56DE\u6536\u7AD9"
|
|
960
|
+
] })
|
|
961
|
+
] }),
|
|
962
|
+
!filter.trashed && filter.kind !== "note" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-knowledge-toolbar", children: [
|
|
963
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: batchMode ? `\u5DF2\u9009\u62E9 ${checkedIds.length} / 10 \u4EFD\u8D44\u6599\uFF1B\u5207\u6362\u641C\u7D22\u6216\u5206\u7C7B\u4F1A\u6E05\u9664\u9009\u62E9\u3002` : knowledge?.smartSupported ? "\u96F6\u6563\u8D44\u6599\u5148\u667A\u80FD\u5206\u7EC4\uFF0C\u518D\u6309\u7EC4\u5F62\u6210\u77E5\u8BC6\u7B14\u8BB0\u3002" : "\u8BF7\u91CD\u542F\u8D44\u6599\u5E93\u670D\u52A1\u4EE5\u542F\u7528\u667A\u80FD\u5206\u7EC4\u3002" }),
|
|
964
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
965
|
+
batchMode && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: "kl-primary", disabled: !checkedIds.length || !knowledge?.smartSupported, onClick: () => generateFor(checkedIds, "smart"), children: "\u667A\u80FD\u5206\u6790\u5206\u7EC4" }),
|
|
966
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: "kl-secondary", disabled: !knowledge?.smartSupported, onClick: () => {
|
|
967
|
+
setBatchMode(!batchMode);
|
|
968
|
+
setCheckedIds([]);
|
|
969
|
+
}, children: batchMode ? "\u53D6\u6D88\u9009\u62E9" : "\u667A\u80FD\u6574\u7406" })
|
|
970
|
+
] })
|
|
971
|
+
] }),
|
|
972
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: `kl-body ${detail || detailLoading ? "with-detail" : ""}`, children: [
|
|
973
|
+
showNavigation && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("aside", { className: "kl-nav", id: "kl-directory", "aria-label": "\u5206\u7C7B\u4E0E\u4E13\u9898", children: [
|
|
974
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-directory-title", children: [
|
|
975
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u5206\u7C7B\u4E0E\u4E13\u9898" }),
|
|
976
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: "kl-icon-button", "aria-label": "\u5173\u95ED\u5206\u7C7B\u5BFC\u822A", onClick: () => setShowNavigation(false), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "close", size: 16 }) })
|
|
977
|
+
] }),
|
|
978
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-nav-section", children: [
|
|
979
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "kl-nav-label", children: "\u5206\u7C7B" }),
|
|
980
|
+
stats?.categories.filter((c) => c.name !== "\u6536\u4EF6\u7BB1").map((c) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { "aria-pressed": filter.category === c.name, className: "kl-nav-row", onClick: () => chooseFilter({ category: c.name }), children: [
|
|
981
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "folder", size: 16 }),
|
|
982
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { title: c.name, children: c.name }),
|
|
983
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("small", { children: c.count })
|
|
984
|
+
] }, c.name)),
|
|
985
|
+
!stats?.categories.some((c) => c.name !== "\u6536\u4EF6\u7BB1") && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "kl-nav-hint", children: "\u6536\u96C6\u8D44\u6599\u65F6\u6DFB\u52A0\u5206\u7C7B" })
|
|
986
|
+
] }),
|
|
987
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-nav-section", children: [
|
|
988
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "kl-nav-label", children: "\u4E13\u9898" }),
|
|
989
|
+
stats?.collections.map((c) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { "aria-pressed": filter.collection === c.name, className: "kl-nav-row", onClick: () => chooseFilter({ collection: c.name }), children: [
|
|
990
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "kl-collection-dot" }),
|
|
991
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { title: c.name, children: c.name }),
|
|
992
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("small", { children: c.count })
|
|
993
|
+
] }, c.name)),
|
|
994
|
+
!stats?.collections.length && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "kl-nav-hint", children: "\u6536\u96C6\u8D44\u6599\u65F6\u6DFB\u52A0\u4E13\u9898" })
|
|
995
|
+
] }),
|
|
996
|
+
!!stats?.tags.length && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-nav-section", children: [
|
|
997
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "kl-nav-label", children: "\u6807\u7B7E" }),
|
|
998
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "kl-tag-cloud", children: stats.tags.slice(0, 15).map((tag) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { "aria-pressed": filter.tag === tag.name, onClick: () => chooseFilter({ tag: tag.name }), children: [
|
|
999
|
+
"#",
|
|
1000
|
+
tag.name
|
|
1001
|
+
] }, tag.name)) })
|
|
1002
|
+
] }),
|
|
1003
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-nav-bottom", children: [
|
|
1004
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "kl-live-dot" }),
|
|
1005
|
+
"\u4FDD\u5B58\u5728\u8FD9\u53F0\u7535\u8111"
|
|
1006
|
+
] })
|
|
1007
|
+
] }),
|
|
1008
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("section", { className: "kl-list", "aria-label": "\u8D44\u6599\u5217\u8868", "aria-busy": loading, children: [
|
|
1009
|
+
loading && !items.length ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-empty", children: [
|
|
1010
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "kl-spinner" }),
|
|
339
1011
|
"\u6B63\u5728\u8BFB\u53D6\u8D44\u6599\u5E93\u2026"
|
|
340
|
-
] }) : !items.length ? /* @__PURE__ */ (0,
|
|
341
|
-
/* @__PURE__ */ (0,
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
/* @__PURE__ */ (0,
|
|
347
|
-
/* @__PURE__ */ (0,
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: `kl-type kl-type-${item.kind}`, children: [
|
|
358
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { name: kinds[item.kind].icon, size: 15 }),
|
|
359
|
-
kinds[item.kind].label
|
|
1012
|
+
] }) : !items.length ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-empty", children: [
|
|
1013
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: filter.trashed ? "trash" : "inbox", size: 28 }),
|
|
1014
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", { children: filter.trashed ? "\u56DE\u6536\u7AD9\u4E2D\u6CA1\u6709\u5339\u914D\u7684\u8D44\u6599" : query || Object.values(filter).some(Boolean) ? "\u6CA1\u6709\u627E\u5230\u5339\u914D\u7684\u8D44\u6599" : "\u8FD8\u6CA1\u6709\u8D44\u6599\uFF0C\u6536\u96C6\u7684\u5185\u5BB9\u4F1A\u663E\u793A\u5728\u8FD9\u91CC" }),
|
|
1015
|
+
query && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: "\u8BD5\u8BD5\u5176\u4ED6\u5173\u952E\u8BCD\uFF0C\u6216\u5207\u6362\u5206\u7C7B\u3002" }),
|
|
1016
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: "kl-secondary", onClick: () => query || Object.values(filter).some(Boolean) ? (setQuery(""), chooseFilter({})) : setEditor({ mode: "capture" }), children: query || Object.values(filter).some(Boolean) ? "\u67E5\u770B\u5168\u90E8\u8D44\u6599" : "\u6536\u96C6\u7B2C\u4E00\u4EFD\u8D44\u6599" })
|
|
1017
|
+
] }) : items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: `kl-item-row ${batchMode ? "kl-selectable" : ""}`, children: [
|
|
1018
|
+
batchMode && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "checkbox", className: "kl-material-checkbox", "aria-label": `\u9009\u62E9 ${item.title}`, checked: checkedIds.includes(item.id), disabled: item.kind === "note" || item.status !== "ready" || !!checkedIds.length && checkedIds.length >= 10 && !checkedIds.includes(item.id), onChange: (e) => setCheckedIds((ids) => e.target.checked ? [...ids, item.id] : ids.filter((id) => id !== item.id)) }),
|
|
1019
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { className: `kl-item ${selected === item.id ? "selected" : ""}`, onClick: () => {
|
|
1020
|
+
setAnchor(void 0);
|
|
1021
|
+
setSelected(item.id);
|
|
1022
|
+
}, children: [
|
|
1023
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-item-top", children: [
|
|
1024
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: `kl-type kl-type-${item.kind}`, children: [
|
|
1025
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: kinds[item.kind].icon, size: 15 }),
|
|
1026
|
+
kinds[item.kind].label
|
|
1027
|
+
] }),
|
|
1028
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("time", { children: date(item.createdAt) })
|
|
360
1029
|
] }),
|
|
361
|
-
/* @__PURE__ */ (0,
|
|
1030
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", { children: item.title }),
|
|
1031
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: item.excerpt || item.extraction }),
|
|
1032
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-item-bottom", children: [
|
|
1033
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "kl-category", children: [
|
|
1034
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "folder", size: 13 }),
|
|
1035
|
+
item.category
|
|
1036
|
+
] }),
|
|
1037
|
+
item.tags.slice(0, 2).map((tag) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "kl-chip", children: tag }, tag)),
|
|
1038
|
+
item.status === "stored" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "kl-stored", children: "\u4EC5\u5F52\u6863" }),
|
|
1039
|
+
!item.deletedAt && item.kind !== "note" && item.status === "ready" && knowledge?.supported && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(KnowledgeBadge, { state: knowledge.states[item.id] }),
|
|
1040
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "arrow", size: 15 })
|
|
1041
|
+
] })
|
|
362
1042
|
] }),
|
|
363
|
-
/* @__PURE__ */ (0,
|
|
364
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: item.excerpt || item.extraction }),
|
|
365
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "kl-item-bottom", children: [
|
|
366
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "kl-category", children: [
|
|
367
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { name: "folder", size: 13 }),
|
|
368
|
-
item.category
|
|
369
|
-
] }),
|
|
370
|
-
item.tags.slice(0, 2).map((tag) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "kl-chip", children: tag }, tag)),
|
|
371
|
-
item.status === "stored" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "kl-stored", children: "\u4EC5\u5F52\u6863" }),
|
|
372
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { name: "arrow", size: 15 })
|
|
373
|
-
] })
|
|
1043
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: `kl-icon-button kl-row-action ${item.deletedAt ? "" : "kl-danger"}`, title: item.deletedAt ? "\u6062\u590D\u8D44\u6599" : "\u5220\u9664\u8D44\u6599", "aria-label": `${item.deletedAt ? "\u6062\u590D" : "\u5220\u9664"} ${item.title}`, disabled: !stats || !!restoring, onClick: () => item.deletedAt ? void restoreItem(item.id) : askDelete(item), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: item.deletedAt ? "restore" : "trash", size: 16 }) })
|
|
374
1044
|
] }, item.id)),
|
|
375
|
-
items.length < total && /* @__PURE__ */ (0,
|
|
376
|
-
] }),
|
|
377
|
-
!selected && !!items.length && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("aside", { className: "kl-reading-placeholder", children: [
|
|
378
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "kl-placeholder-number", children: "\u62FE / \u9875" }),
|
|
379
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("h2", { children: [
|
|
380
|
-
"\u6536\u96C6\u4E4B\u540E\uFF0C",
|
|
381
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("br", {}),
|
|
382
|
-
"\u7ED9\u77E5\u8BC6\u4E00\u70B9\u751F\u957F\u7684\u7A7A\u95F4\u3002"
|
|
383
|
-
] }),
|
|
384
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { children: [
|
|
385
|
-
"\u9009\u62E9\u4E00\u4EFD\u8D44\u6599\u5F00\u59CB\u9605\u8BFB\u3002",
|
|
386
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("br", {}),
|
|
387
|
-
"\u6458\u5F55\u3001\u5173\u8054\uFF0C\u518D\u4EA4\u7ED9 Agent \u6DF1\u5165\u5206\u6790\u3002"
|
|
388
|
-
] }),
|
|
389
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
|
|
390
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { children: [
|
|
391
|
-
stats?.ready ?? 0,
|
|
392
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("small", { children: "\u53EF\u68C0\u7D22\u8D44\u6599" })
|
|
393
|
-
] }),
|
|
394
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { children: [
|
|
395
|
-
stats?.notes ?? 0,
|
|
396
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("small", { children: "\u77E5\u8BC6\u7B14\u8BB0" })
|
|
397
|
-
] })
|
|
398
|
-
] })
|
|
1045
|
+
items.length < total && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: "kl-load-more", onClick: () => setLimit((v) => Math.min(100, v + 40)), disabled: limit >= 100, children: limit >= 100 ? "\u8BF7\u7F29\u5C0F\u641C\u7D22\u8303\u56F4\uFF08\u6700\u591A\u663E\u793A 100 \u6761\uFF09" : "\u52A0\u8F7D\u66F4\u591A" })
|
|
399
1046
|
] }),
|
|
400
|
-
selected && /* @__PURE__ */ (0,
|
|
401
|
-
/* @__PURE__ */ (0,
|
|
402
|
-
/* @__PURE__ */ (0,
|
|
1047
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("section", { className: "kl-detail", "aria-label": "\u8D44\u6599\u8BE6\u60C5", ref: detailRef, children: [
|
|
1048
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-detail-toolbar", children: [
|
|
1049
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { className: "kl-back", onClick: () => {
|
|
403
1050
|
setSelected(void 0);
|
|
404
1051
|
setDetail(void 0);
|
|
405
1052
|
}, children: [
|
|
406
|
-
/* @__PURE__ */ (0,
|
|
407
|
-
/* @__PURE__ */ (0,
|
|
1053
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "close", size: 18 }),
|
|
1054
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u5173\u95ED\u9605\u8BFB" })
|
|
408
1055
|
] }),
|
|
409
|
-
detail && /* @__PURE__ */ (0,
|
|
410
|
-
/* @__PURE__ */ (0,
|
|
411
|
-
/* @__PURE__ */ (0,
|
|
412
|
-
/* @__PURE__ */ (0,
|
|
1056
|
+
detail && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
1057
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { title: "\u590D\u5236\u8D44\u6599\u5F15\u7528", "aria-label": "\u590D\u5236\u8D44\u6599\u5F15\u7528", onClick: () => void copy(`library://${detail.id}`), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "copy", size: 17 }) }),
|
|
1058
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { title: "\u5BFC\u51FA Markdown", "aria-label": "\u5BFC\u51FA Markdown", href: `${API}/materials/${detail.id}/export`, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "download", size: 17 }) }),
|
|
1059
|
+
detail.deletedAt ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { disabled: !stats || !!restoring, onClick: () => void restoreItem(detail.id), children: [
|
|
1060
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "restore", size: 16 }),
|
|
1061
|
+
"\u6062\u590D\u8D44\u6599"
|
|
1062
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
1063
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { onClick: () => setEditor({ mode: "edit", source: detail }), children: "\u7F16\u8F91\u4FE1\u606F" }),
|
|
1064
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: "kl-danger", title: "\u5220\u9664\u8D44\u6599", "aria-label": "\u5220\u9664\u8D44\u6599", disabled: !stats || !!restoring, onClick: () => askDelete(detail), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "trash", size: 17 }) })
|
|
1065
|
+
] })
|
|
413
1066
|
] })
|
|
414
1067
|
] }),
|
|
415
|
-
detailLoading ? /* @__PURE__ */ (0,
|
|
416
|
-
/* @__PURE__ */ (0,
|
|
1068
|
+
detailLoading ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-empty", children: [
|
|
1069
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "kl-spinner" }),
|
|
417
1070
|
"\u8BFB\u53D6\u4E2D\u2026"
|
|
418
|
-
] }) : detail && /* @__PURE__ */ (0,
|
|
419
|
-
/* @__PURE__ */ (0,
|
|
420
|
-
/* @__PURE__ */ (0,
|
|
421
|
-
/* @__PURE__ */ (0,
|
|
1071
|
+
] }) : detail && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("article", { children: [
|
|
1072
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-detail-kicker", children: [
|
|
1073
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: kinds[detail.kind].label }),
|
|
1074
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: detail.category })
|
|
422
1075
|
] }),
|
|
423
|
-
/* @__PURE__ */ (0,
|
|
424
|
-
/* @__PURE__ */ (0,
|
|
425
|
-
detail.sourceUrl ? /* @__PURE__ */ (0,
|
|
1076
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", { children: detail.title }),
|
|
1077
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-source", children: [
|
|
1078
|
+
detail.sourceUrl ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("a", { href: detail.sourceUrl, target: "_blank", rel: "noreferrer", children: [
|
|
426
1079
|
new URL(detail.sourceUrl).hostname,
|
|
427
|
-
/* @__PURE__ */ (0,
|
|
428
|
-
] }) : /* @__PURE__ */ (0,
|
|
429
|
-
/* @__PURE__ */ (0,
|
|
430
|
-
detail.author && /* @__PURE__ */ (0,
|
|
1080
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "arrow", size: 12 })
|
|
1081
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: detail.originalName || "\u672C\u5730\u6536\u96C6" }),
|
|
1082
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: new Date(detail.createdAt).toLocaleDateString("zh-CN") }),
|
|
1083
|
+
detail.author && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: detail.author })
|
|
431
1084
|
] }),
|
|
432
|
-
!!detail.tags.length && /* @__PURE__ */ (0,
|
|
1085
|
+
!!detail.tags.length && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "kl-detail-tags", children: detail.tags.map((t) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "kl-chip", children: [
|
|
433
1086
|
"#",
|
|
434
1087
|
t
|
|
435
1088
|
] }, t)) }),
|
|
436
|
-
detail.sourceNote && /* @__PURE__ */ (0,
|
|
437
|
-
detail.
|
|
438
|
-
/* @__PURE__ */ (0,
|
|
439
|
-
/* @__PURE__ */ (0,
|
|
440
|
-
/* @__PURE__ */ (0,
|
|
441
|
-
/* @__PURE__ */ (0,
|
|
1089
|
+
detail.sourceNote && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("aside", { className: "kl-source-note", children: detail.sourceNote }),
|
|
1090
|
+
detail.deletedAt && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-notice", children: [
|
|
1091
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "trash" }),
|
|
1092
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
1093
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "\u8FD9\u4EFD\u8D44\u6599\u5728\u56DE\u6536\u7AD9" }),
|
|
1094
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: "\u539F\u6587\u4E0E\u6765\u6E90\u5F15\u7528\u4ECD\u53EF\u67E5\u770B\uFF0C\u6062\u590D\u540E\u56DE\u5230\u539F\u5206\u7C7B\u3002" })
|
|
1095
|
+
] })
|
|
1096
|
+
] }),
|
|
1097
|
+
detail.status === "stored" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-notice", children: [
|
|
1098
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "file" }),
|
|
1099
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
1100
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "\u539F\u6587\u4EF6\u5DF2\u5B89\u5168\u5F52\u6863" }),
|
|
1101
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: detail.extraction })
|
|
442
1102
|
] })
|
|
443
1103
|
] }),
|
|
444
|
-
|
|
445
|
-
/* @__PURE__ */ (0,
|
|
446
|
-
/* @__PURE__ */ (0,
|
|
447
|
-
/* @__PURE__ */ (0,
|
|
448
|
-
|
|
1104
|
+
!detail.deletedAt && detail.kind !== "note" && detail.status === "ready" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-knowledge-source", children: [
|
|
1105
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
1106
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(KnowledgeBadge, { state: knowledge?.states[detail.id] }),
|
|
1107
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u4ECE\u8FD9\u4EFD\u8D44\u6599\u5F62\u6210\u7406\u89E3\u3001\u65B9\u6CD5\u4E0E\u5F85\u9A8C\u8BC1\u7684\u95EE\u9898\u3002" })
|
|
1108
|
+
] }),
|
|
1109
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-knowledge-actions", children: [
|
|
1110
|
+
["running", "draft", "grouping"].includes(knowledge?.states[detail.id]?.status || "") ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: "kl-secondary", onClick: () => stats && setKnowledgeOpen({ root: stats.root, jobId: knowledge?.states[detail.id]?.jobId }), children: knowledge?.states[detail.id]?.status === "grouping" ? "\u67E5\u770B\u5206\u7EC4\u65B9\u6848" : "\u67E5\u770B\u6574\u7406\u4EFB\u52A1" }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: "kl-secondary", disabled: !knowledge?.supported, onClick: () => generateFor([detail.id]), children: "\u751F\u6210\u77E5\u8BC6\u7B14\u8BB0" }),
|
|
1111
|
+
knowledge?.states[detail.id]?.noteIds.map((id) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { className: "kl-secondary", onClick: () => openKnowledgeSource(id), children: [
|
|
1112
|
+
"\u67E5\u770B\u77E5\u8BC6\u7B14\u8BB0",
|
|
1113
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "arrow", size: 14 })
|
|
1114
|
+
] }, id))
|
|
449
1115
|
] }),
|
|
450
|
-
|
|
1116
|
+
!knowledge?.supported && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "kl-muted", children: "\u8BF7\u91CD\u542F\u8D44\u6599\u5E93\u670D\u52A1\u4EE5\u542F\u7528\u77E5\u8BC6\u6574\u7406\u3002" })
|
|
1117
|
+
] }),
|
|
1118
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "kl-content", children: detail.segments.map((segment) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: `kl-segment ${anchor === segment.id ? "kl-cited" : ""}`, id: segment.id, "data-segment-id": segment.id, children: [
|
|
1119
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-segment-line", children: [
|
|
1120
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: segment.startSeconds !== void 0 ? time(segment.startSeconds) : segment.id }),
|
|
1121
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { title: "\u6458\u5F55\u4E3A\u7B14\u8BB0", "aria-label": `\u6458\u5F55 ${segment.id} \u4E3A\u7B14\u8BB0`, onClick: () => setEditor({ mode: "note", source: detail, segment }), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "note", size: 14 }) }),
|
|
1122
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { title: "\u590D\u5236\u6BB5\u843D\u5F15\u7528", "aria-label": `\u590D\u5236 ${segment.id} \u5F15\u7528`, onClick: () => void copy(`library://${detail.id}/${segment.id}`), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "copy", size: 14 }) })
|
|
1123
|
+
] }),
|
|
1124
|
+
/^#{1,6}\s/.test(segment.text) ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h3", { children: segment.text.replace(/^#{1,6}\s+/, "") }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: segment.text })
|
|
451
1125
|
] }, segment.id)) }),
|
|
452
|
-
!!detail.citations.length && /* @__PURE__ */ (0,
|
|
453
|
-
/* @__PURE__ */ (0,
|
|
454
|
-
detail.citations.map((c, i) => /* @__PURE__ */ (0,
|
|
1126
|
+
!!detail.citations.length && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-references", children: [
|
|
1127
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h3", { children: "\u6765\u6E90\u5F15\u7528" }),
|
|
1128
|
+
detail.citations.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { disabled: detail.missingSources?.includes(c.materialId), "aria-label": `\u67E5\u770B\u5F15\u7528 ${i + 1}`, onClick: () => {
|
|
455
1129
|
setAnchor(c.segmentId);
|
|
456
1130
|
setSelected(c.materialId);
|
|
457
1131
|
}, children: [
|
|
458
|
-
/* @__PURE__ */ (0,
|
|
459
|
-
/* @__PURE__ */ (0,
|
|
460
|
-
|
|
461
|
-
"\u2026",
|
|
462
|
-
c.segmentId ? ` / ${c.segmentId}` : ""
|
|
463
|
-
] }),
|
|
464
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { name: "arrow", size: 14 })
|
|
1132
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "file", size: 15 }),
|
|
1133
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: detail.missingSources?.includes(c.materialId) ? "\u6765\u6E90\u5DF2\u6C38\u4E45\u5220\u9664" : `${c.materialId.slice(0, 15)}\u2026${c.segmentId ? ` / ${c.segmentId}` : ""}` }),
|
|
1134
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "arrow", size: 14 })
|
|
465
1135
|
] }, i))
|
|
466
1136
|
] }),
|
|
467
|
-
/* @__PURE__ */ (0,
|
|
468
|
-
/* @__PURE__ */ (0,
|
|
469
|
-
/* @__PURE__ */ (0,
|
|
1137
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("footer", { className: "kl-detail-footer", children: [
|
|
1138
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
1139
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "kl-live-dot" }),
|
|
470
1140
|
detail.extraction
|
|
471
1141
|
] }),
|
|
472
|
-
detail.originalFile && /* @__PURE__ */ (0,
|
|
1142
|
+
detail.originalFile && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("a", { href: `${API}/materials/${detail.id}/original`, children: [
|
|
473
1143
|
"\u4E0B\u8F7D\u539F\u59CB\u6587\u4EF6",
|
|
474
|
-
/* @__PURE__ */ (0,
|
|
1144
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "download", size: 14 })
|
|
475
1145
|
] }),
|
|
476
|
-
/* @__PURE__ */ (0,
|
|
1146
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("code", { children: detail.id })
|
|
477
1147
|
] })
|
|
478
1148
|
] })
|
|
479
1149
|
] })
|
|
480
1150
|
] })
|
|
481
1151
|
] }),
|
|
482
|
-
|
|
1152
|
+
generation && knowledge && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(StartKnowledgeDialog, { root: generation.root, sourceIds: generation.sourceIds, model: knowledge, initialMode: generation.mode, onClose: () => setGeneration(void 0), onCreated: (job) => {
|
|
1153
|
+
setGeneration(void 0);
|
|
1154
|
+
setCheckedIds([]);
|
|
1155
|
+
setBatchMode(false);
|
|
1156
|
+
setKnowledgeOpen({ root: generation.root, jobId: job.id });
|
|
1157
|
+
refresh();
|
|
1158
|
+
} }),
|
|
1159
|
+
knowledgeOpen && knowledge && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(KnowledgeJobsDialog, { root: knowledgeOpen.root, jobId: knowledgeOpen.jobId, overview: knowledge, onClose: () => setKnowledgeOpen(void 0), onRefresh: refresh, onRegenerate: (ids, mode) => {
|
|
1160
|
+
setKnowledgeOpen(void 0);
|
|
1161
|
+
generateFor(ids, mode);
|
|
1162
|
+
}, onOpenSource: openKnowledgeSource, onSaved: (id) => {
|
|
1163
|
+
openKnowledgeSource(id);
|
|
1164
|
+
notify("\u77E5\u8BC6\u7B14\u8BB0\u5DF2\u4FDD\u5B58\uFF0C\u539F\u59CB\u8D44\u6599\u5DF2\u4FDD\u7559");
|
|
1165
|
+
}, onNotify: notify }),
|
|
1166
|
+
editor && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(EditorDialog, { editor, categories: stats?.categories.map((c) => c.name) || [], onClose: () => setEditor(void 0), onSaved: (result) => {
|
|
483
1167
|
setEditor(void 0);
|
|
484
1168
|
refresh();
|
|
485
1169
|
if (result.material) {
|
|
@@ -495,107 +1179,357 @@ function App() {
|
|
|
495
1179
|
notify("\u7F51\u9875\u5DF2\u52A0\u5165\u91C7\u96C6\u961F\u5217");
|
|
496
1180
|
}
|
|
497
1181
|
} }),
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
1182
|
+
deletion && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(DeleteDialog, { item: deletion, onClose: () => setDeletion(void 0), onDeleted: () => {
|
|
1183
|
+
setDeletion(void 0);
|
|
1184
|
+
afterRemoval(deletion.id, "\u8D44\u6599\u5DF2\u79FB\u5165\u56DE\u6536\u7AD9\uFF0C\u53EF\u968F\u65F6\u6062\u590D");
|
|
1185
|
+
} }),
|
|
1186
|
+
emptyRoot && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(EmptyTrashDialog, { root: emptyRoot, onClose: () => setEmptyRoot(void 0), onEmptied: (result) => {
|
|
1187
|
+
setEmptyRoot(void 0);
|
|
1188
|
+
setSelected(void 0);
|
|
1189
|
+
setDetail(void 0);
|
|
1190
|
+
setAnchor(void 0);
|
|
1191
|
+
setError("");
|
|
1192
|
+
refresh();
|
|
1193
|
+
if (result.errors.length || result.pending) setError(`\u5DF2\u6C38\u4E45\u5220\u9664 ${result.deleted} \u4EFD\u8D44\u6599\uFF1B${result.pending} \u4EFD\u6587\u4EF6\u5F85\u6E05\u7406\u3002${result.errors.join("\uFF1B")}`);
|
|
1194
|
+
else notify(`\u56DE\u6536\u7AD9\u5DF2\u6E05\u7A7A\uFF0C\u6C38\u4E45\u5220\u9664 ${result.deleted} \u4EFD\u8D44\u6599`);
|
|
1195
|
+
searchRef.current?.focus();
|
|
1196
|
+
} }),
|
|
1197
|
+
showJobs && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Dialog, { title: "\u91C7\u96C6\u4EFB\u52A1", description: "\u7F51\u9875\u5728\u540E\u53F0\u63D0\u53D6\u6B63\u6587\u3002\u5173\u95ED\u5E94\u7528\u540E\uFF0C\u4E0B\u6B21\u542F\u52A8\u4F1A\u6062\u590D\u672A\u5B8C\u6210\u4EFB\u52A1\u3002", onClose: () => setShowJobs(false), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "kl-jobs", children: !jobs.length ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "kl-muted", children: "\u8FD8\u6CA1\u6709\u91C7\u96C6\u4EFB\u52A1\u3002\u6DFB\u52A0\u4E00\u4E2A\u7F51\u9875\u94FE\u63A5\u5F00\u59CB\u3002" }) : jobs.map((job) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-job", children: [
|
|
1198
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
1199
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: `kl-job-status ${job.status}`, children: job.status === "failed" && job.errorCode === "PAGE_REQUIRES_BROWSER" ? "\u9700\u6D4F\u89C8\u5668\u9A8C\u8BC1" : { queued: "\u6392\u961F\u4E2D", running: "\u63D0\u53D6\u4E2D", completed: "\u5DF2\u5B8C\u6210", failed: "\u5931\u8D25" }[job.status] }),
|
|
1200
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("time", { children: date(job.createdAt) })
|
|
502
1201
|
] }),
|
|
503
|
-
/* @__PURE__ */ (0,
|
|
504
|
-
job.error && /* @__PURE__ */ (0,
|
|
505
|
-
/* @__PURE__ */ (0,
|
|
506
|
-
job.materialId && /* @__PURE__ */ (0,
|
|
1202
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: job.url }),
|
|
1203
|
+
job.error && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { role: job.status === "failed" ? "alert" : void 0, children: job.error }),
|
|
1204
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-job-actions", children: [
|
|
1205
|
+
job.materialId && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { onClick: () => {
|
|
507
1206
|
setSelected(job.materialId);
|
|
508
1207
|
setShowJobs(false);
|
|
509
1208
|
refresh();
|
|
510
1209
|
}, children: [
|
|
511
1210
|
"\u67E5\u770B\u8D44\u6599 ",
|
|
512
|
-
/* @__PURE__ */ (0,
|
|
1211
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "arrow", size: 14 })
|
|
513
1212
|
] }),
|
|
514
|
-
job.status === "failed" && /* @__PURE__ */ (0,
|
|
1213
|
+
job.status === "failed" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
1214
|
+
/^https?:\/\//i.test(job.url) && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("a", { href: job.url, target: "_blank", rel: "noopener noreferrer", children: [
|
|
1215
|
+
"\u6253\u5F00\u539F\u7F51\u9875",
|
|
1216
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "arrow", size: 14 })
|
|
1217
|
+
] }),
|
|
1218
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { onClick: () => {
|
|
1219
|
+
setShowJobs(false);
|
|
1220
|
+
setEditor({ mode: "capture", initialType: "text", sourceUrl: job.url });
|
|
1221
|
+
}, children: "\u7C98\u8D34\u6B63\u6587" }),
|
|
1222
|
+
/fake-ip/i.test(job.error || "") && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { onClick: () => {
|
|
1223
|
+
setShowJobs(false);
|
|
1224
|
+
setSettingsFromJobs(true);
|
|
1225
|
+
setShowInfo(true);
|
|
1226
|
+
}, children: "\u4EE3\u7406\u517C\u5BB9\u8BBE\u7F6E" }),
|
|
1227
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { onClick: () => void post(`/jobs/${job.id}/retry`, {}).then(refresh).catch((e) => setError(e.message)), children: "\u91CD\u65B0\u91C7\u96C6" })
|
|
1228
|
+
] })
|
|
515
1229
|
] })
|
|
516
1230
|
] }, job.id)) }) }),
|
|
517
|
-
showInfo && /* @__PURE__ */ (0,
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
1231
|
+
showInfo && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SettingsDialog, { root: stats?.root || "", warnings: stats?.warnings || [], onClose: () => {
|
|
1232
|
+
setShowInfo(false);
|
|
1233
|
+
if (settingsFromJobs) setShowJobs(true);
|
|
1234
|
+
setSettingsFromJobs(false);
|
|
1235
|
+
}, onChanged: () => {
|
|
1236
|
+
setSelected(void 0);
|
|
1237
|
+
setDetail(void 0);
|
|
1238
|
+
setAnchor(void 0);
|
|
1239
|
+
setItems([]);
|
|
1240
|
+
setQuery("");
|
|
1241
|
+
chooseFilter({});
|
|
1242
|
+
refresh();
|
|
1243
|
+
notify("\u8D44\u6599\u5E93\u76EE\u5F55\u5DF2\u5207\u6362");
|
|
1244
|
+
}, onRebuilt: () => {
|
|
1245
|
+
refresh();
|
|
1246
|
+
notify("\u7D22\u5F15\u5DF2\u91CD\u5EFA");
|
|
1247
|
+
}, onProxySaved: (enabled) => {
|
|
1248
|
+
refresh();
|
|
1249
|
+
notify(enabled ? "\u4EE3\u7406\u517C\u5BB9\u5DF2\u5F00\u542F\uFF0C\u53EF\u91CD\u65B0\u91C7\u96C6\u5931\u8D25\u4EFB\u52A1" : "\u4EE3\u7406\u517C\u5BB9\u5DF2\u5173\u95ED");
|
|
1250
|
+
if (settingsFromJobs) {
|
|
1251
|
+
setShowInfo(false);
|
|
1252
|
+
setShowJobs(true);
|
|
1253
|
+
setSettingsFromJobs(false);
|
|
1254
|
+
}
|
|
1255
|
+
} }),
|
|
1256
|
+
toast && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-toast", role: "status", children: [
|
|
1257
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "check", size: 17 }),
|
|
530
1258
|
toast
|
|
531
1259
|
] })
|
|
532
1260
|
] });
|
|
533
1261
|
}
|
|
534
|
-
function
|
|
535
|
-
const
|
|
536
|
-
const
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
1262
|
+
function DeleteDialog({ item, onClose, onDeleted }) {
|
|
1263
|
+
const [busy, setBusy] = (0, import_react4.useState)(false);
|
|
1264
|
+
const [error, setError] = (0, import_react4.useState)("");
|
|
1265
|
+
async function remove() {
|
|
1266
|
+
setBusy(true);
|
|
1267
|
+
setError("");
|
|
1268
|
+
try {
|
|
1269
|
+
await post(`/materials/${item.id}`, { expectedRoot: item.root }, "DELETE");
|
|
1270
|
+
onDeleted();
|
|
1271
|
+
} catch (e) {
|
|
1272
|
+
setError(e.message);
|
|
1273
|
+
} finally {
|
|
1274
|
+
setBusy(false);
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Dialog, { title: "\u5220\u9664\u8D44\u6599", description: "\u8D44\u6599\u5C06\u79FB\u5165\u56DE\u6536\u7AD9\uFF0C\u539F\u6587\u4EF6\u4FDD\u7559\uFF0C\u53EF\u968F\u65F6\u6062\u590D\u3002", onClose: () => {
|
|
1278
|
+
if (!busy) onClose();
|
|
1279
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-delete-dialog", children: [
|
|
1280
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "kl-delete-title", children: item.title }),
|
|
1281
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "kl-muted", children: "\u5DF2\u6709\u7B14\u8BB0\u4ECD\u80FD\u67E5\u770B\u8FD9\u4EFD\u8D44\u6599\u7684\u6765\u6E90\u5F15\u7528\u3002" }),
|
|
1282
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "kl-form-error", role: "alert", children: error }),
|
|
1283
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("footer", { children: [
|
|
1284
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: "kl-secondary", disabled: busy, onClick: onClose, children: "\u53D6\u6D88" }),
|
|
1285
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: "kl-secondary kl-danger", disabled: busy, onClick: () => void remove(), children: busy ? "\u6B63\u5728\u5220\u9664\u2026" : "\u79FB\u5165\u56DE\u6536\u7AD9" })
|
|
1286
|
+
] })
|
|
1287
|
+
] }) });
|
|
1288
|
+
}
|
|
1289
|
+
function EmptyTrashDialog({ root, onClose, onEmptied }) {
|
|
1290
|
+
const [snapshot, setSnapshot] = (0, import_react4.useState)();
|
|
1291
|
+
const [busy, setBusy] = (0, import_react4.useState)(false);
|
|
1292
|
+
const [error, setError] = (0, import_react4.useState)("");
|
|
1293
|
+
(0, import_react4.useEffect)(() => {
|
|
1294
|
+
const abort = new AbortController();
|
|
1295
|
+
void api("/trash", { signal: abort.signal }).then(setSnapshot).catch((e) => {
|
|
1296
|
+
if (!abort.signal.aborted) setError(e.message);
|
|
1297
|
+
});
|
|
1298
|
+
return () => abort.abort();
|
|
1299
|
+
}, []);
|
|
1300
|
+
async function empty() {
|
|
1301
|
+
if (!snapshot || busy) return;
|
|
1302
|
+
setBusy(true);
|
|
1303
|
+
setError("");
|
|
1304
|
+
try {
|
|
1305
|
+
onEmptied(await post("/trash/empty", { expectedRoot: root, confirmed: true, token: snapshot.token }));
|
|
1306
|
+
} catch (e) {
|
|
1307
|
+
setError(e.message);
|
|
1308
|
+
setSnapshot(void 0);
|
|
1309
|
+
} finally {
|
|
1310
|
+
setBusy(false);
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Dialog, { title: "\u6E05\u7A7A\u56DE\u6536\u7AD9", description: "\u6C38\u4E45\u5220\u9664\u540E\u65E0\u6CD5\u6062\u590D\uFF0C\u8BF7\u786E\u8BA4\u6574\u4E2A\u56DE\u6536\u7AD9\u5185\u7684\u8D44\u6599\u90FD\u4E0D\u518D\u9700\u8981\u3002", onClose: () => {
|
|
1314
|
+
if (!busy) onClose();
|
|
1315
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-delete-dialog", children: [
|
|
1316
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "kl-delete-title", children: snapshot ? `\u5C06\u6C38\u4E45\u5220\u9664\u56DE\u6536\u7AD9\u4E2D\u7684\u5168\u90E8 ${snapshot.count} \u4EFD\u8D44\u6599\u3002` : error ? "\u8BF7\u5173\u95ED\u7A97\u53E3\u540E\u91CD\u65B0\u786E\u8BA4\u3002" : "\u6B63\u5728\u6838\u5BF9\u56DE\u6536\u7AD9\u2026" }),
|
|
1317
|
+
!!snapshot?.pending && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { children: [
|
|
1318
|
+
"\u53E6\u6709 ",
|
|
1319
|
+
snapshot.pending,
|
|
1320
|
+
" \u4EFD\u5DF2\u786E\u8BA4\u5220\u9664\u7684\u6587\u4EF6\u5C06\u7EE7\u7EED\u6E05\u7406\u3002"
|
|
1321
|
+
] }),
|
|
1322
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "kl-muted", children: "\u6B63\u6587\u3001\u539F\u59CB\u9644\u4EF6\u548C\u7D22\u5F15\u5C06\u88AB\u79FB\u9664\u3002\u76F8\u5173\u7B14\u8BB0\u7684\u6B63\u6587\u4F1A\u4FDD\u7559\uFF0C\u5F15\u7528\u8FD9\u4E9B\u8D44\u6599\u7684\u4F4D\u7F6E\u5C06\u6807\u8BB0\u4E3A\u201C\u6765\u6E90\u5DF2\u6C38\u4E45\u5220\u9664\u201D\u3002" }),
|
|
1323
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { role: "alert", className: "kl-form-error", children: error }),
|
|
1324
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("footer", { children: [
|
|
1325
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: "kl-secondary", disabled: busy, onClick: onClose, children: "\u53D6\u6D88" }),
|
|
1326
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: "kl-secondary kl-danger", disabled: busy || !snapshot || !(snapshot.count || snapshot.pending), onClick: () => void empty(), children: busy ? "\u6B63\u5728\u6C38\u4E45\u5220\u9664\u2026" : "\u6C38\u4E45\u6E05\u7A7A" })
|
|
1327
|
+
] })
|
|
1328
|
+
] }) });
|
|
1329
|
+
}
|
|
1330
|
+
function SettingsDialog({ root, warnings, onClose, onChanged, onRebuilt, onProxySaved }) {
|
|
1331
|
+
const [settings, setSettings] = (0, import_react4.useState)();
|
|
1332
|
+
const [proxyMode, setProxyMode] = (0, import_react4.useState)(false);
|
|
1333
|
+
const [target, setTarget] = (0, import_react4.useState)(root);
|
|
1334
|
+
const [listing, setListing] = (0, import_react4.useState)();
|
|
1335
|
+
const [browsePath, setBrowsePath] = (0, import_react4.useState)("");
|
|
1336
|
+
const [browsing, setBrowsing] = (0, import_react4.useState)(false);
|
|
1337
|
+
const [busy, setBusy] = (0, import_react4.useState)(false);
|
|
1338
|
+
const [saving, setSaving] = (0, import_react4.useState)(false);
|
|
1339
|
+
const [error, setError] = (0, import_react4.useState)("");
|
|
1340
|
+
const request = (0, import_react4.useRef)();
|
|
1341
|
+
(0, import_react4.useEffect)(() => {
|
|
1342
|
+
const abort = new AbortController();
|
|
1343
|
+
void api("/settings", { signal: abort.signal }).then((data) => {
|
|
1344
|
+
setSettings(data);
|
|
1345
|
+
setProxyMode(data.allowProxyFakeIp === true);
|
|
1346
|
+
}).catch((e) => {
|
|
1347
|
+
if (!abort.signal.aborted) setError(e.message);
|
|
1348
|
+
});
|
|
557
1349
|
return () => {
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
previous?.focus();
|
|
1350
|
+
abort.abort();
|
|
1351
|
+
request.current?.abort();
|
|
561
1352
|
};
|
|
562
1353
|
}, []);
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
},
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
1354
|
+
(0, import_react4.useEffect)(() => {
|
|
1355
|
+
setTarget(root);
|
|
1356
|
+
}, [root]);
|
|
1357
|
+
async function browse(path) {
|
|
1358
|
+
request.current?.abort();
|
|
1359
|
+
const abort = new AbortController();
|
|
1360
|
+
request.current = abort;
|
|
1361
|
+
setBusy(true);
|
|
1362
|
+
setError("");
|
|
1363
|
+
setListing(void 0);
|
|
1364
|
+
try {
|
|
1365
|
+
const result = await post("/directory/list", { path }, "POST", abort.signal);
|
|
1366
|
+
setListing(result);
|
|
1367
|
+
setBrowsePath(result.path);
|
|
1368
|
+
} catch (e) {
|
|
1369
|
+
if (!abort.signal.aborted) setError(e.message);
|
|
1370
|
+
} finally {
|
|
1371
|
+
if (!abort.signal.aborted) setBusy(false);
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
async function pick() {
|
|
1375
|
+
if (settings?.picker === "browse") {
|
|
1376
|
+
setBrowsing(true);
|
|
1377
|
+
setListing(void 0);
|
|
1378
|
+
setBrowsePath(target);
|
|
1379
|
+
await browse(target || void 0);
|
|
1380
|
+
return;
|
|
1381
|
+
}
|
|
1382
|
+
setBusy(true);
|
|
1383
|
+
setError("");
|
|
1384
|
+
const abort = new AbortController();
|
|
1385
|
+
request.current = abort;
|
|
1386
|
+
try {
|
|
1387
|
+
const result = await post("/directory/pick", {}, "POST", abort.signal);
|
|
1388
|
+
if (result.path) setTarget(result.path);
|
|
1389
|
+
} catch (e) {
|
|
1390
|
+
if (!abort.signal.aborted) setError(e.message);
|
|
1391
|
+
} finally {
|
|
1392
|
+
if (!abort.signal.aborted) setBusy(false);
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
async function change() {
|
|
1396
|
+
setSaving(true);
|
|
1397
|
+
setError("");
|
|
1398
|
+
try {
|
|
1399
|
+
const result = await post("/settings/root", { root: target.trim(), expectedRoot: root });
|
|
1400
|
+
setTarget(result.root);
|
|
1401
|
+
onChanged();
|
|
1402
|
+
} catch (e) {
|
|
1403
|
+
setError(e.message);
|
|
1404
|
+
} finally {
|
|
1405
|
+
setSaving(false);
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
async function saveProxyMode() {
|
|
1409
|
+
if (!settings) return;
|
|
1410
|
+
setSaving(true);
|
|
1411
|
+
setError("");
|
|
1412
|
+
try {
|
|
1413
|
+
const result = await post("/settings/network", { allowProxyFakeIp: proxyMode, expected: settings.allowProxyFakeIp, expectedRoot: root });
|
|
1414
|
+
setSettings({ ...settings, allowProxyFakeIp: result.allowProxyFakeIp });
|
|
1415
|
+
setProxyMode(result.allowProxyFakeIp);
|
|
1416
|
+
onProxySaved(result.allowProxyFakeIp);
|
|
1417
|
+
} catch (e) {
|
|
1418
|
+
setError(e.message);
|
|
1419
|
+
} finally {
|
|
1420
|
+
setSaving(false);
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
const changed = target.trim() && target.trim() !== root;
|
|
1424
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Dialog, { title: "\u4F60\u7684\u8D44\u6599\uFF0C\u7531\u4F60\u4FDD\u7BA1", description: "\u5185\u5BB9\u4EE5\u666E\u901A\u6587\u4EF6\u4FDD\u5B58\uFF0C\u7D22\u5F15\u53EF\u4EE5\u91CD\u5EFA\u3002", onClose: () => {
|
|
1425
|
+
if (!saving) onClose();
|
|
1426
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-info", children: [
|
|
1427
|
+
browsing ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-folder-browser", "aria-label": "\u9009\u62E9\u8D44\u6599\u5E93\u76EE\u5F55", children: [
|
|
1428
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-folder-heading", children: [
|
|
1429
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "\u9009\u62E9\u8D44\u6599\u5E93\u76EE\u5F55" }),
|
|
1430
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: "kl-secondary", disabled: busy, onClick: () => void browse(), children: "\u4E3B\u76EE\u5F55" })
|
|
570
1431
|
] }),
|
|
571
|
-
/* @__PURE__ */ (0,
|
|
1432
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("form", { className: "kl-folder-path", onSubmit: (e) => {
|
|
1433
|
+
e.preventDefault();
|
|
1434
|
+
void browse(browsePath);
|
|
1435
|
+
}, children: [
|
|
1436
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { "aria-label": "\u6D4F\u89C8\u76EE\u5F55\u8DEF\u5F84", value: browsePath, onChange: (e) => setBrowsePath(e.target.value) }),
|
|
1437
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: "kl-secondary", disabled: busy || !browsePath.trim(), children: "\u524D\u5F80" })
|
|
1438
|
+
] }),
|
|
1439
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("nav", { className: "kl-folder-crumbs", "aria-label": "\u76EE\u5F55\u5C42\u7EA7", children: listing?.crumbs.map((c) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { disabled: busy, onClick: () => void browse(c.path), children: [
|
|
1440
|
+
c.name,
|
|
1441
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "/" })
|
|
1442
|
+
] }, c.path)) }),
|
|
1443
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "kl-folder-entries", "aria-busy": busy, children: busy ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "kl-muted", children: "\u6B63\u5728\u8BFB\u53D6\u76EE\u5F55\u2026" }) : listing && !listing.entries.length ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "kl-muted", children: "\u6B64\u76EE\u5F55\u6CA1\u6709\u5B50\u6587\u4EF6\u5939" }) : listing?.entries.map((entry) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { onClick: () => void browse(entry.path), children: [
|
|
1444
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "folder", size: 17 }),
|
|
1445
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: entry.name }),
|
|
1446
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "arrow", size: 15 })
|
|
1447
|
+
] }, entry.path)) }),
|
|
1448
|
+
listing?.truncated && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "kl-muted", children: "\u5B50\u76EE\u5F55\u8F83\u591A\uFF0C\u4EC5\u663E\u793A\u90E8\u5206\u3002\u53EF\u586B\u5199\u5B8C\u6574\u8DEF\u5F84\u524D\u5F80\u3002" }),
|
|
1449
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-folder-actions", children: [
|
|
1450
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: "kl-secondary", onClick: () => {
|
|
1451
|
+
request.current?.abort();
|
|
1452
|
+
setBusy(false);
|
|
1453
|
+
setBrowsing(false);
|
|
1454
|
+
setError("");
|
|
1455
|
+
}, children: "\u53D6\u6D88\u9009\u62E9" }),
|
|
1456
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: "kl-primary", disabled: busy || !listing, onClick: () => {
|
|
1457
|
+
setTarget(listing.path);
|
|
1458
|
+
setBrowsing(false);
|
|
1459
|
+
setError("");
|
|
1460
|
+
}, children: "\u9009\u62E9\u6B64\u76EE\u5F55" })
|
|
1461
|
+
] })
|
|
1462
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
1463
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("label", { htmlFor: "kl-library-root", children: "\u8D44\u6599\u5E93\u76EE\u5F55" }),
|
|
1464
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-root-field", children: [
|
|
1465
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { id: "kl-library-root", value: target, title: target, spellCheck: false, readOnly: !settings?.canChange, disabled: saving || busy, onChange: (e) => setTarget(e.target.value) }),
|
|
1466
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { className: "kl-secondary", disabled: !settings?.canChange || !settings.picker || busy || saving, onClick: () => void pick(), children: [
|
|
1467
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "folder", size: 16 }),
|
|
1468
|
+
busy ? "\u9009\u62E9\u4E2D\u2026" : "\u9009\u62E9\u76EE\u5F55"
|
|
1469
|
+
] })
|
|
1470
|
+
] }),
|
|
1471
|
+
settings && !settings.canChange && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "kl-muted", children: "\u8BF7\u5728 Harness \u4E2D\u9009\u62E9\u548C\u5207\u6362\u76EE\u5F55\uFF1B\u72EC\u7ACB\u9884\u89C8\u53EF\u901A\u8FC7\u542F\u52A8\u914D\u7F6E\u6307\u5B9A\u76EE\u5F55\u3002" }),
|
|
1472
|
+
!!changed && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-root-confirm", children: [
|
|
1473
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: "\u5207\u6362\u540E\u5C06\u8BFB\u53D6\u65B0\u76EE\u5F55\uFF0C\u5E76\u5C06\u540E\u7EED\u8D44\u6599\u4FDD\u5B58\u5230\u90A3\u91CC\u3002\u539F\u76EE\u5F55\u7684\u8D44\u6599\u4F1A\u4FDD\u7559\uFF0C\u4E0D\u4F1A\u81EA\u52A8\u642C\u8FC1\u3002" }),
|
|
1474
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
1475
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: "kl-secondary", disabled: saving || busy, onClick: () => {
|
|
1476
|
+
setTarget(root);
|
|
1477
|
+
setError("");
|
|
1478
|
+
}, children: "\u53D6\u6D88\u4FEE\u6539" }),
|
|
1479
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: "kl-primary", disabled: saving || busy, onClick: () => void change(), children: saving ? "\u6B63\u5728\u5207\u6362\u2026" : "\u5207\u6362\u8D44\u6599\u5E93" })
|
|
1480
|
+
] })
|
|
1481
|
+
] }),
|
|
1482
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("section", { className: "kl-network-settings", "aria-label": "\u7F51\u9875\u91C7\u96C6\u8BBE\u7F6E", children: [
|
|
1483
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h3", { children: "\u7F51\u9875\u91C7\u96C6" }),
|
|
1484
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "kl-proxy-option", children: [
|
|
1485
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "checkbox", "aria-describedby": "kl-proxy-help", checked: proxyMode, disabled: !settings?.canChangeNetwork || saving || busy, onChange: (e) => {
|
|
1486
|
+
setProxyMode(e.target.checked);
|
|
1487
|
+
setError("");
|
|
1488
|
+
} }),
|
|
1489
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "Clash/Mihomo \u4EE3\u7406\u517C\u5BB9\uFF08fake-IP\uFF09" })
|
|
1490
|
+
] }),
|
|
1491
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { id: "kl-proxy-help", children: "\u672C\u673A\u4F7F\u7528 Clash/Mihomo TUN \u7684 fake-IP DNS \u65F6\u5F00\u542F\uFF0C\u5141\u8BB8\u901A\u8FC7\u4EE3\u7406\u91C7\u96C6\u89E3\u6790\u5230 198.18.* \u6216 198.19.* \u7684\u7F51\u7AD9\u3002\u672C\u673A\u53CA\u5176\u4ED6\u5185\u7F51\u5730\u5740\u4ECD\u4E0D\u5141\u8BB8\u8BBF\u95EE\u3002" }),
|
|
1492
|
+
settings?.canChangeNetwork && !settings.canChange && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "kl-muted", children: "\u6B64\u8BBE\u7F6E\u7528\u4E8E\u5F53\u524D\u8D44\u6599\u5E93\u7684\u72EC\u7ACB\u9884\u89C8\uFF0C\u4FDD\u5B58\u540E\u5BF9\u540E\u7EED\u91C7\u96C6\u751F\u6548\u3002" }),
|
|
1493
|
+
settings && !settings.canChangeNetwork && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "kl-muted", children: "\u5F53\u524D\u73AF\u5883\u65E0\u6CD5\u4FDD\u5B58\u91C7\u96C6\u8BBE\u7F6E\u3002" }),
|
|
1494
|
+
settings?.canChangeNetwork && proxyMode !== settings.allowProxyFakeIp && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: "kl-secondary", disabled: saving || busy, onClick: () => void saveProxyMode(), children: saving ? "\u6B63\u5728\u4FDD\u5B58\u2026" : "\u4FDD\u5B58\u91C7\u96C6\u8BBE\u7F6E" })
|
|
1495
|
+
] }),
|
|
1496
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: "\u6BCF\u4EFD\u8D44\u6599\u4FDD\u7559\u539F\u59CB\u6587\u4EF6\u3001\u6B63\u6587\u3001\u5143\u6570\u636E\u548C\u5F15\u7528\u6BB5\u843D\u3002\u5206\u7C7B\u5BF9\u5E94\u672C\u5730\u6587\u4EF6\u5939\uFF0C\u63D2\u4EF6\u5378\u8F7D\u4E0D\u4F1A\u5220\u9664\u8FD9\u4E9B\u6587\u4EF6\u3002" }),
|
|
1497
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: "\u672C\u7248\u672C\u53EF\u63D0\u53D6\u6587\u7AE0\u6B63\u6587\u53CA\u5B57\u5E55\uFF1B\u97F3\u89C6\u9891\u3001PDF \u7B49\u683C\u5F0F\u53EF\u4EE5\u5F52\u6863\uFF0C\u81EA\u52A8\u8F6C\u5199\u548C OCR \u5C1A\u672A\u63A5\u5165\u3002" }),
|
|
1498
|
+
warnings.map((w) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { role: "alert", children: w }, w)),
|
|
1499
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: "kl-secondary", disabled: busy || saving, onClick: () => {
|
|
1500
|
+
setSaving(true);
|
|
1501
|
+
setError("");
|
|
1502
|
+
void post("/rebuild", {}).then(onRebuilt).catch((e) => setError(e.message)).finally(() => setSaving(false));
|
|
1503
|
+
}, children: "\u4ECE\u8D44\u6599\u6587\u4EF6\u91CD\u5EFA\u7D22\u5F15" })
|
|
572
1504
|
] }),
|
|
573
|
-
children
|
|
1505
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "kl-settings-error", role: "alert", children: error })
|
|
574
1506
|
] }) });
|
|
575
1507
|
}
|
|
576
1508
|
function EditorDialog({ editor, categories, onClose, onSaved }) {
|
|
577
1509
|
const editing = editor.mode === "edit";
|
|
578
1510
|
const note = editor.mode === "note";
|
|
579
1511
|
const source = editor.source;
|
|
580
|
-
const [type, setType] = (0,
|
|
581
|
-
const [
|
|
582
|
-
const [
|
|
1512
|
+
const [type, setType] = (0, import_react4.useState)(editor.initialType || "url");
|
|
1513
|
+
const [sourceUrl, setSourceUrl] = (0, import_react4.useState)(editor.sourceUrl || "");
|
|
1514
|
+
const [title, setTitle] = (0, import_react4.useState)(editing ? source?.title || "" : note && source ? `${source.title} \xB7 \u6458\u5F55` : "");
|
|
1515
|
+
const [content, setContent] = (0, import_react4.useState)(editor.segment ? `> ${editor.segment.text}
|
|
583
1516
|
|
|
584
1517
|
` : "");
|
|
585
|
-
const [category, setCategory] = (0,
|
|
586
|
-
const [tags, setTags] = (0,
|
|
587
|
-
const [collection, setCollection] = (0,
|
|
588
|
-
const [sourceNote, setSourceNote] = (0,
|
|
589
|
-
const [file, setFile] = (0,
|
|
590
|
-
const [busy, setBusy] = (0,
|
|
591
|
-
const [error, setError] = (0,
|
|
1518
|
+
const [category, setCategory] = (0, import_react4.useState)(editing ? source?.category || "\u6536\u4EF6\u7BB1" : note ? "\u77E5\u8BC6\u7B14\u8BB0" : "\u6536\u4EF6\u7BB1");
|
|
1519
|
+
const [tags, setTags] = (0, import_react4.useState)(editing ? source?.tags.join("\uFF0C") || "" : "");
|
|
1520
|
+
const [collection, setCollection] = (0, import_react4.useState)(source?.collection || "");
|
|
1521
|
+
const [sourceNote, setSourceNote] = (0, import_react4.useState)(editing ? source?.sourceNote || "" : "");
|
|
1522
|
+
const [file, setFile] = (0, import_react4.useState)();
|
|
1523
|
+
const [busy, setBusy] = (0, import_react4.useState)(false);
|
|
1524
|
+
const [error, setError] = (0, import_react4.useState)("");
|
|
592
1525
|
const citations = source && note ? [{ materialId: source.id, ...editor.segment ? { segmentId: editor.segment.id } : {} }] : [];
|
|
593
1526
|
async function submit(event) {
|
|
594
1527
|
event.preventDefault();
|
|
595
1528
|
setError("");
|
|
596
1529
|
setBusy(true);
|
|
597
1530
|
try {
|
|
598
|
-
const data = { title, category, tags:
|
|
1531
|
+
const data = { title, category, tags: splitTags2(tags), collection, sourceNote };
|
|
1532
|
+
if (!editing && !note && type === "text" && sourceUrl.trim()) data.sourceUrl = sourceUrl.trim();
|
|
599
1533
|
let result;
|
|
600
1534
|
if (editing) result = await post(`/materials/${source.id}`, data, "PATCH");
|
|
601
1535
|
else if (note) result = await post("/notes", { ...data, content, citations });
|
|
@@ -622,84 +1556,475 @@ function EditorDialog({ editor, categories, onClose, onSaved }) {
|
|
|
622
1556
|
setContent("");
|
|
623
1557
|
setError("");
|
|
624
1558
|
};
|
|
625
|
-
return /* @__PURE__ */ (0,
|
|
1559
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Dialog, { title: editing ? "\u6574\u7406\u8D44\u6599" : note ? "\u5199\u4E00\u4EFD\u77E5\u8BC6\u7B14\u8BB0" : "\u6536\u96C6\u4E00\u4EFD\u8D44\u6599", description: editing ? "\u5206\u7C7B\u4F1A\u540C\u6B65\u5230\u672C\u5730\u6587\u4EF6\u5939\uFF0C\u539F\u6587\u548C\u5F15\u7528\u4FDD\u6301\u4E0D\u53D8\u3002" : note ? "\u5199\u4E0B\u7406\u89E3\uFF0C\u4E5F\u7559\u4E0B\u5B83\u7684\u6765\u6E90\u3002" : "\u5148\u6536\u96C6\uFF0C\u518D\u6162\u6162\u6574\u7406\u3002\u6240\u6709\u5185\u5BB9\u4FDD\u5B58\u5728\u4F60\u7684\u7535\u8111\u3002", onClose: () => {
|
|
626
1560
|
if (!busy) onClose();
|
|
627
|
-
}, children: /* @__PURE__ */ (0,
|
|
628
|
-
!editing && !note && /* @__PURE__ */ (0,
|
|
629
|
-
/* @__PURE__ */ (0,
|
|
1561
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("form", { onSubmit: submit, className: "kl-editor", children: [
|
|
1562
|
+
!editing && !note && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "kl-tabs", role: "tablist", "aria-label": "\u91C7\u96C6\u65B9\u5F0F", children: ["url", "text", "file"].map((value) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { type: "button", role: "tab", "aria-selected": type === value, className: type === value ? "active" : "", onClick: () => changeType(value), children: [
|
|
1563
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: value === "url" ? "web" : value === "file" ? "upload" : "file", size: 17 }),
|
|
630
1564
|
value === "url" ? "\u7F51\u9875\u94FE\u63A5" : value === "file" ? "\u672C\u5730\u6587\u4EF6" : "\u6587\u672C\u6458\u5F55"
|
|
631
1565
|
] }, value)) }),
|
|
632
|
-
!editing && !note && type === "url" && /* @__PURE__ */ (0,
|
|
1566
|
+
!editing && !note && type === "url" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { children: [
|
|
633
1567
|
"\u7F51\u9875\u5730\u5740",
|
|
634
|
-
/* @__PURE__ */ (0,
|
|
635
|
-
/* @__PURE__ */ (0,
|
|
1568
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "url", required: true, placeholder: "https://\u2026", value: content, onChange: (e) => setContent(e.target.value) }),
|
|
1569
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("small", { children: "\u652F\u6301\u53EF\u76F4\u63A5\u8BBF\u95EE\u7684\u6587\u7AE0\u7F51\u9875\u3002\u767B\u5F55\u9875\u6216\u52A8\u6001\u9875\u9762\u53EF\u590D\u5236\u6B63\u6587\u5BFC\u5165\u3002" })
|
|
636
1570
|
] }),
|
|
637
|
-
!editing && !note && type === "file" && /* @__PURE__ */ (0,
|
|
638
|
-
/* @__PURE__ */ (0,
|
|
639
|
-
/* @__PURE__ */ (0,
|
|
640
|
-
/* @__PURE__ */ (0,
|
|
641
|
-
/* @__PURE__ */ (0,
|
|
642
|
-
/* @__PURE__ */ (0,
|
|
1571
|
+
!editing && !note && type === "file" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "kl-upload", children: [
|
|
1572
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "upload", size: 27 }),
|
|
1573
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: file?.name || "\u9009\u62E9\u6216\u62D6\u5165\u6587\u4EF6" }),
|
|
1574
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u6587\u672C\u3001HTML\u3001SRT / VTT \u5B57\u5E55\u53CA\u5176\u4ED6\u6587\u4EF6 \xB7 \u6700\u5927 64 MB" }),
|
|
1575
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { "aria-label": "\u9009\u62E9\u672C\u5730\u6587\u4EF6", type: "file", onChange: (e) => setFile(e.target.files?.[0]) }),
|
|
1576
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("small", { children: "\u89C6\u9891\u548C PDF \u53EF\u5F52\u6863\uFF0C\u5F53\u524D\u7248\u672C\u4E0D\u4F1A\u81EA\u52A8\u8F6C\u5199\u6216 OCR\u3002" })
|
|
643
1577
|
] }),
|
|
644
|
-
/* @__PURE__ */ (0,
|
|
1578
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { children: [
|
|
645
1579
|
"\u6807\u9898",
|
|
646
|
-
!editing && !note && /* @__PURE__ */ (0,
|
|
647
|
-
/* @__PURE__ */ (0,
|
|
1580
|
+
!editing && !note && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("em", { children: "\u53EF\u9009" }),
|
|
1581
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { required: editing || note, value: title, onChange: (e) => setTitle(e.target.value), placeholder: type === "url" && !note ? "\u81EA\u52A8\u63D0\u53D6\u7F51\u9875\u6807\u9898\uFF0C\u4E5F\u53EF\u4EE5\u81EA\u5DF1\u586B\u5199" : "\u7ED9\u8FD9\u4EFD\u5185\u5BB9\u8D77\u4E2A\u540D\u5B57", maxLength: 300 })
|
|
648
1582
|
] }),
|
|
649
|
-
!editing && (note || type === "text") && /* @__PURE__ */ (0,
|
|
1583
|
+
!editing && (note || type === "text") && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { children: [
|
|
650
1584
|
note ? "\u7B14\u8BB0\u5185\u5BB9" : "\u6B63\u6587",
|
|
651
|
-
/* @__PURE__ */ (0,
|
|
1585
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("textarea", { required: true, rows: 7, value: content, onChange: (e) => setContent(e.target.value), placeholder: note ? "\u8BB0\u5F55\u4F60\u7684\u7406\u89E3\u3001\u7ED3\u8BBA\u4E0E\u5C1A\u5F85\u9A8C\u8BC1\u7684\u95EE\u9898\u2026" : "\u7C98\u8D34\u60F3\u4FDD\u7559\u7684\u6587\u5B57\uFF0C\u652F\u6301 Markdown\u2026" })
|
|
1586
|
+
] }),
|
|
1587
|
+
!editing && !note && type === "text" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { children: [
|
|
1588
|
+
"\u6765\u6E90\u7F51\u9875",
|
|
1589
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("em", { children: "\u53EF\u9009" }),
|
|
1590
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "url", "aria-label": "\u6765\u6E90\u7F51\u9875", placeholder: "https://\u2026", value: sourceUrl, onChange: (e) => setSourceUrl(e.target.value) }),
|
|
1591
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("small", { children: "\u4FDD\u7559\u539F\u7F51\u9875\u5730\u5740\uFF0C\u65B9\u4FBF\u56DE\u6EAF\u6765\u6E90\u3002" })
|
|
652
1592
|
] }),
|
|
653
|
-
!!citations.length && /* @__PURE__ */ (0,
|
|
654
|
-
/* @__PURE__ */ (0,
|
|
655
|
-
/* @__PURE__ */ (0,
|
|
1593
|
+
!!citations.length && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-citation-preview", children: [
|
|
1594
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "file", size: 16 }),
|
|
1595
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { children: [
|
|
656
1596
|
"\u5F15\u7528\uFF1A",
|
|
657
1597
|
source.title,
|
|
658
1598
|
editor.segment ? ` / ${editor.segment.id}` : ""
|
|
659
1599
|
] })
|
|
660
1600
|
] }),
|
|
661
|
-
/* @__PURE__ */ (0,
|
|
662
|
-
/* @__PURE__ */ (0,
|
|
1601
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kl-form-grid", children: [
|
|
1602
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { children: [
|
|
663
1603
|
"\u5206\u7C7B",
|
|
664
|
-
/* @__PURE__ */ (0,
|
|
665
|
-
/* @__PURE__ */ (0,
|
|
1604
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { list: "kl-categories", value: category, onChange: (e) => setCategory(e.target.value), placeholder: "\u4F8B\u5982 \u6280\u672F/AI" }),
|
|
1605
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("datalist", { id: "kl-categories", children: categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: c }, c)) })
|
|
666
1606
|
] }),
|
|
667
|
-
/* @__PURE__ */ (0,
|
|
1607
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { children: [
|
|
668
1608
|
"\u4E13\u9898",
|
|
669
|
-
/* @__PURE__ */ (0,
|
|
670
|
-
/* @__PURE__ */ (0,
|
|
1609
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("em", { children: "\u53EF\u9009" }),
|
|
1610
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { value: collection, onChange: (e) => setCollection(e.target.value), placeholder: "\u56F4\u7ED5\u4E00\u4E2A\u95EE\u9898\u7EC4\u7EC7\u8D44\u6599" })
|
|
671
1611
|
] })
|
|
672
1612
|
] }),
|
|
673
|
-
/* @__PURE__ */ (0,
|
|
1613
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { children: [
|
|
674
1614
|
"\u6807\u7B7E",
|
|
675
|
-
/* @__PURE__ */ (0,
|
|
676
|
-
/* @__PURE__ */ (0,
|
|
1615
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("em", { children: "\u53EF\u9009" }),
|
|
1616
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { value: tags, onChange: (e) => setTags(e.target.value), placeholder: "\u7528\u9017\u53F7\u5206\u9694\uFF0C\u4F8B\u5982\uFF1A\u5F85\u8BFB\uFF0CRAG\uFF0C\u5B9E\u8DF5" })
|
|
677
1617
|
] }),
|
|
678
|
-
/* @__PURE__ */ (0,
|
|
1618
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { children: [
|
|
679
1619
|
"\u6765\u6E90\u5907\u6CE8",
|
|
680
|
-
/* @__PURE__ */ (0,
|
|
681
|
-
/* @__PURE__ */ (0,
|
|
1620
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("em", { children: "\u53EF\u9009" }),
|
|
1621
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { value: sourceNote, onChange: (e) => setSourceNote(e.target.value), placeholder: "\u4E3A\u4EC0\u4E48\u503C\u5F97\u4FDD\u5B58\uFF0C\u6216\u8005\u5B83\u6765\u81EA\u54EA\u91CC" })
|
|
682
1622
|
] }),
|
|
683
|
-
error && /* @__PURE__ */ (0,
|
|
684
|
-
/* @__PURE__ */ (0,
|
|
685
|
-
/* @__PURE__ */ (0,
|
|
686
|
-
/* @__PURE__ */ (0,
|
|
1623
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "kl-form-error", role: "alert", children: error }),
|
|
1624
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("footer", { children: [
|
|
1625
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { children: [
|
|
1626
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "kl-live-dot" }),
|
|
687
1627
|
"\u4EC5\u4FDD\u5B58\u5728\u672C\u5730"
|
|
688
1628
|
] }),
|
|
689
|
-
/* @__PURE__ */ (0,
|
|
690
|
-
/* @__PURE__ */ (0,
|
|
1629
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "kl-secondary", disabled: busy, onClick: onClose, children: "\u53D6\u6D88" }),
|
|
1630
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { className: "kl-primary", type: "submit", disabled: busy, children: [
|
|
691
1631
|
busy ? "\u4FDD\u5B58\u4E2D\u2026" : editing ? "\u4FDD\u5B58\u4FEE\u6539" : note ? "\u4FDD\u5B58\u7B14\u8BB0" : type === "url" ? "\u5F00\u59CB\u91C7\u96C6" : "\u4FDD\u5B58\u8D44\u6599",
|
|
692
|
-
!busy && /* @__PURE__ */ (0,
|
|
1632
|
+
!busy && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "arrow", size: 16 })
|
|
693
1633
|
] })
|
|
694
1634
|
] })
|
|
695
1635
|
] }) });
|
|
696
1636
|
}
|
|
697
1637
|
|
|
698
1638
|
// src/ui/style.css
|
|
699
|
-
var style_default = ':root { font-synthesis: none; }\n.kl-app,.kl-app *,.kl-modal-backdrop * { box-sizing:border-box; }\n.kl-app { --kl-paper:#faf9f5;--kl-ink:#283a31;--kl-muted:#82887f;--kl-line:#e5e6df;--kl-green:#315b45;--kl-soft:#eaf0e7;--kl-serif:"Noto Serif SC","Source Han Serif SC","Songti SC","SimSun",serif; font-family:"PingFang SC","Microsoft YaHei","Segoe UI",sans-serif;color:var(--kl-ink);font-size:13px;display:flex;background:var(--kl-paper);height:100%;min-height:560px;width:100%;overflow:hidden; }\nbody:has(> #root) { margin:0; }\n#root>.kl-app { height:100dvh; }\n.kl-app button,.kl-app input,.kl-app textarea,.kl-app select { font:inherit; }\n.kl-app button { cursor:pointer;color:inherit; }\n.kl-app button:disabled { opacity:.5;cursor:wait; }\n.kl-app button,.kl-app a,.kl-app input,.kl-app textarea,.kl-app select { -webkit-tap-highlight-color:transparent; }\n.kl-app button:focus-visible,.kl-app a:focus-visible { outline:2px solid #5c886b;outline-offset:3px; }\n.kl-app input:focus,.kl-app textarea:focus,.kl-app select:focus { outline:2px solid #b2c6ae;outline-offset:1px; }\n.kl-app svg { flex-shrink:0; }\n.kl-primary,.kl-secondary { border-radius:7px;display:inline-flex;align-items:center;justify-content:center;gap:9px;padding:10px 15px;min-height:39px;transition:background .18s;white-space:nowrap; }\n.kl-app .kl-primary { color:#fff;background:#315b45;border:1px solid #315b45; }\n.kl-app .kl-primary:hover { background:#244c37; }\n.kl-secondary { background:transparent;border:1px solid #d7dcd3; }\n.kl-secondary:hover { background:#eef1e9; }\n.kl-nav { width:218px;flex-shrink:0;border-right:1px solid var(--kl-line);padding:28px 18px 18px;background:#f2f3ed;display:flex;flex-direction:column;overflow-y:auto; }\n.kl-brand { display:flex;gap:11px;align-items:center;padding:0 6px 28px; }\n.kl-mark { width:39px;height:42px;color:#315b45;display:grid;place-items:center;border:1px solid #9fae96;border-radius:9px 9px 2px 2px; }\n.kl-brand strong { display:block;font-family:var(--kl-serif);font-size:24px;letter-spacing:4px;font-weight:600;line-height:1.2; }\n.kl-brand div>span { font-size:10px;display:block;letter-spacing:2px;color:var(--kl-muted);margin-top:5px; }\n.kl-version { margin-left:auto;color:#a2aa99;font:10px Georgia,serif;align-self:flex-start;padding-top:5px; }\n.kl-add { width:100%;margin-bottom:25px; }\n.kl-nav nav { display:grid;gap:5px; }\n.kl-nav nav>button,.kl-nav-row { width:100%;display:flex;align-items:center;gap:10px;background:none;border:0;border-radius:6px;padding:10px;text-align:left;min-width:0; }\n.kl-nav button.active { background:#e1e8dc;color:#254b35; }\n.kl-nav nav>button:hover,.kl-nav-row:hover { background:#e9ede3; }\n.kl-nav nav small,.kl-nav-row small { margin-left:auto;color:#8b9285;font-size:11px; }\n.kl-nav-row>span:not(.kl-collection-dot) { overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }\n.kl-nav-section { margin-top:27px; }\n.kl-nav-label { padding:0 10px 9px;color:#5d6c5b;font-size:11px;letter-spacing:1px;display:flex;justify-content:space-between; }\n.kl-nav-label>span { font-size:9px;letter-spacing:0;color:#9aa293; }\n.kl-nav-hint { color:#9aa092;font-size:11px;line-height:1.9;padding:0 10px;margin:4px 0; }\n.kl-collection-dot { width:7px;height:7px;border-radius:50%;border:1px solid #7e9177;flex-shrink:0;margin:0 4px; }\n.kl-tag-cloud { display:flex;flex-wrap:wrap;gap:5px;padding:3px 8px; }\n.kl-tag-cloud button { padding:4px 6px;border:0;background:transparent;color:#7d8775;font-size:11px;border-radius:4px; }\n.kl-nav-bottom { margin-top:auto;padding-top:35px; }\n.kl-nav-bottom>button { display:flex;align-items:center;gap:8px;border:0;background:transparent;width:100%;padding:9px 6px;font-size:11px; }\n.kl-nav-bottom svg { margin-left:auto; }\n.kl-nav-bottom p { color:#a0a696;font-size:9px;letter-spacing:1px;margin:4px 6px; }\n.kl-live-dot { width:6px;height:6px;border-radius:50%;background:#6a8f60;display:inline-block;flex-shrink:0; }\n.kl-workspace { min-width:0;flex:1;display:flex;flex-direction:column; }\n.kl-header { padding:36px 38px 26px;display:flex;align-items:center;justify-content:space-between;gap:20px; }\n.kl-eyebrow { font-size:9px;letter-spacing:2.4px;color:#8b957f;margin-bottom:12px; }\n.kl-header h1 { font-family:var(--kl-serif);font-size:30px;font-weight:500;letter-spacing:2px;margin:0 0 10px;line-height:1.35; }\n.kl-header p { font-size:12px;color:#8c9187;margin:0; }\n.kl-toolbar { padding:0 38px 22px;display:flex;gap:15px;align-items:center; }\n.kl-search { display:flex;align-items:center;gap:11px;flex:1;min-width:0;background:#fff;border:1px solid #dde1d6;border-radius:7px;padding:11px 13px;color:#88937e; }\n.kl-search input { border:0;background:none;flex:1;min-width:0;color:#344732;font-size:12px; }\n.kl-search input:focus { outline:0; }\n.kl-search:focus-within { border-color:#709170;box-shadow:0 0 0 2px #dce7d8; }\n.kl-search kbd { font:9px "Segoe UI",sans-serif;color:#9ba291;border:1px solid #e8ebe2;border-radius:3px;padding:2px 4px; }\n.kl-job-button { border:0;background:none;display:flex;align-items:center;gap:7px;font-size:11px!important;color:#77836d!important;padding:8px 0 8px 5px;white-space:nowrap; }\n.kl-job-button i { height:5px;width:5px;background:#b5844d;border-radius:50%; }\n.kl-job-button.has-jobs { color:#315b45!important; }\n.kl-filterbar { display:flex;align-items:center;justify-content:space-between;padding:13px 38px;border-top:1px solid var(--kl-line);border-bottom:1px solid var(--kl-line);color:#939a8c;font-size:11px; }\n.kl-filterbar b { font-weight:500;color:#456141; }\n.kl-filterbar>div { display:flex;align-items:center;gap:18px; }\n.kl-filterbar select { border:0;background:transparent;color:#77806f;max-width:110px;font-size:11px; }\n.kl-sort-label { color:#969e8f; }\n.kl-body { display:flex;flex:1;min-height:0;overflow:hidden; }\n.kl-list { flex:1;min-width:0;overflow-y:auto;padding:0 26px; }\n.kl-body.with-detail .kl-list { flex:0 0 36%;padding:0 18px;min-width:250px; }\n.kl-item { width:100%;display:block;text-align:left;padding:23px 13px;border:0;border-bottom:1px solid var(--kl-line);background:transparent;position:relative; }\n.kl-item:hover { background:#f2f4ed; }\n.kl-item.selected { background:#edf2e8; }\n.kl-item.selected:before { content:"";position:absolute;left:0;top:22px;bottom:22px;width:3px;background:#4d7350;border-radius:0 2px 2px 0; }\n.kl-item-top { display:flex;justify-content:space-between;align-items:center;margin-bottom:12px; }\n.kl-type { display:inline-flex;gap:5px;align-items:center;font-size:10px;color:#86907c; }\n.kl-type-note { color:#aa8654; }\n.kl-type-web { color:#6c8d79; }\n.kl-type-transcript,.kl-type-video { color:#8b819f; }\n.kl-item time { font:10px "Segoe UI",sans-serif;color:#a3a89a; }\n.kl-item h2 { font-size:15px;font-weight:500;line-height:1.6;margin:0 0 8px;color:#344631; }\n.kl-item>p { font-size:11px;line-height:1.9;color:#93988b;margin:0 0 14px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere; }\n.kl-item-bottom { display:flex;align-items:center;gap:6px;flex-wrap:wrap; }\n.kl-category { color:#88927d;font-size:10px;display:flex;align-items:center;gap:4px;margin-right:3px;max-width:55%;overflow:hidden;white-space:nowrap; }\n.kl-chip { font-size:9px;padding:3px 6px;background:#edf0e7;color:#7c896e;border-radius:3px;white-space:nowrap; }\n.kl-item.selected .kl-chip { background:#e3eadd; }\n.kl-item-bottom>svg { margin-left:auto;color:#abb39f; }\n.kl-stored { color:#a88759;font-size:9px; }\n.kl-reading-placeholder { flex:0 0 44%;border-left:1px solid var(--kl-line);padding:70px 40px 35px;background:#f6f6f0;display:flex;flex-direction:column;justify-content:center; }\n.kl-placeholder-number { font-family:var(--kl-serif);font-size:12px;letter-spacing:4px;color:#9fae94;margin-bottom:40px; }\n.kl-reading-placeholder h2 { font-family:var(--kl-serif);font-size:25px;font-weight:400;line-height:1.8;letter-spacing:1px;margin:0 0 19px; }\n.kl-reading-placeholder>p { color:#8c9681;line-height:2;font-size:11px; }\n.kl-reading-placeholder>div:last-child { display:flex;gap:50px;border-top:1px solid #e1e5d8;padding-top:25px;margin-top:45px; }\n.kl-reading-placeholder>div:last-child span { font:30px Georgia,serif;color:#668061; }\n.kl-reading-placeholder small { display:block;font:10px "Microsoft YaHei",sans-serif;color:#9ca58f;margin-top:9px; }\n.kl-detail { flex:1;min-width:0;overflow-y:auto;border-left:1px solid var(--kl-line);background:#fffefa; }\n.kl-detail-toolbar { display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #eceee5;padding:12px 24px;position:sticky;top:0;background:#fffefa;z-index:1; }\n.kl-detail-toolbar>div { display:flex;align-items:center;gap:13px; }\n.kl-detail-toolbar button,.kl-detail-toolbar a { display:flex;align-items:center;gap:5px;background:none;border:0;padding:4px;color:#88937d;text-decoration:none;font-size:10px; }\n.kl-detail article { padding:32px 36px 40px; }\n.kl-detail-kicker { display:flex;gap:10px;font-size:10px;color:#7c8b6d; }\n.kl-detail-kicker span+span:before { content:"/";margin-right:10px;color:#b4bda9; }\n.kl-detail article>h2 { font-family:var(--kl-serif);font-size:25px;font-weight:500;line-height:1.6;letter-spacing:.5px;margin:15px 0;overflow-wrap:anywhere; }\n.kl-source { display:flex;flex-wrap:wrap;align-items:center;gap:13px;color:#9ca58e;font-size:10px; }\n.kl-source a { color:#778b66;display:flex;align-items:center;gap:4px;text-decoration:none; }\n.kl-detail-tags { display:flex;gap:6px;margin-top:16px; }\n.kl-source-note { border-left:2px solid #bacaa9;padding:9px 12px;font-size:11px;line-height:1.8;color:#869677;background:#f7f8f2;margin:22px 0; }\n.kl-content { margin-top:28px; }\n.kl-segment { margin-bottom:20px; }\n.kl-segment.kl-cited { background:#f0f4e7;box-shadow:0 0 0 10px #f0f4e7;border-radius:2px; }\n.kl-segment-line { display:flex;align-items:center;gap:9px;margin-bottom:5px;font:9px "Segoe UI",sans-serif;color:#b0b7a6; }\n.kl-segment-line>span { margin-right:auto; }\n.kl-segment-line button { background:none;border:0;color:#a4af98;padding:2px;opacity:.3; }\n.kl-segment:hover button,.kl-segment:focus-within button { opacity:1; }\n.kl-segment p { white-space:pre-wrap;overflow-wrap:anywhere;font-size:13px;line-height:2.05;margin:0;color:#59644f; }\n.kl-segment h3 { font-size:17px;line-height:1.8;margin:0;font-weight:500;color:#3f5538; }\n.kl-detail-footer { margin-top:40px;padding-top:18px;border-top:1px solid #e8ecdf;font-size:9px;color:#a0aa92; }\n.kl-detail-footer>div { display:flex;gap:6px;align-items:center;line-height:1.9; }\n.kl-detail-footer a { display:flex;align-items:center;gap:6px;color:#7d8f6a;text-decoration:none;margin:12px 0; }\n.kl-detail-footer code { display:block;font-size:8px;margin-top:12px;overflow-wrap:anywhere; }\n.kl-empty { min-height:350px;height:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:10px;padding:40px 20px;text-align:center;color:#8d9983; }\n.kl-empty-art { display:flex;align-items:center;gap:12px;margin-bottom:20px;position:relative;height:80px;color:#819675; }\n.kl-empty-art>svg { width:66px;height:80px;padding:14px 8px;border:1px solid #bdcbb0;background:#f5f8ee;transform:rotate(-5deg); }\n.kl-empty-art>span { width:38px;height:56px;border:1px solid #d3dcc9;background:#f4f6ee;transform:rotate(12deg); }\n.kl-empty-art>span:first-child { transform:rotate(-14deg); }\n.kl-empty h2 { font:20px var(--kl-serif);font-weight:400;color:#627557;letter-spacing:1px;margin:8px 0; }\n.kl-empty p { font-size:12px;margin:0 0 15px;line-height:1.9; }\n.kl-empty .kl-secondary { font-size:11px; }\n.kl-load-more { width:100%;padding:18px;border:0;background:transparent;font-size:11px;color:#79906a; }\n.kl-notice { display:flex;gap:12px;padding:18px;background:#f4f2e9;margin-top:25px;border-radius:5px;color:#8d805e; }\n.kl-notice strong { font-size:12px;font-weight:500; }\n.kl-notice p { font-size:11px;line-height:1.9;margin:7px 0 0; }\n.kl-references { background:#f1f5eb;padding:17px;border-radius:5px;margin-top:24px; }\n.kl-references h3 { font-size:11px;color:#718561;margin:0 0 12px; }\n.kl-references button { display:flex;gap:7px;align-items:center;border:0;background:none;font-size:10px;color:#7b8f6b;padding:6px 0;width:100%; }\n.kl-references button>svg:last-child { margin-left:auto; }\n.kl-modal-backdrop { position:fixed;inset:0;background:#1c2a2355;backdrop-filter:blur(3px);z-index:1000;display:flex;align-items:center;justify-content:center;padding:24px; }\n.kl-dialog { background:#fffefa;color:#344631;width:580px;max-width:100%;max-height:90dvh;overflow:auto;border-radius:12px;box-shadow:0 20px 90px #15241633;animation:kl-enter .18s ease-out; }\n.kl-dialog>header { padding:25px 28px 20px;border-bottom:1px solid #e9ecdf;display:flex;justify-content:space-between;align-items:flex-start;gap:18px; }\n.kl-dialog>header h2 { font:24px var(--kl-serif);margin:0 0 9px;letter-spacing:1px; }\n.kl-dialog>header p { color:#97a08b;font-size:11px;line-height:1.8;margin:0; }\n.kl-dialog>header>button { border:0;background:none;color:#9eaa92;padding:2px; }\n.kl-editor { padding:22px 28px 0; }\n.kl-tabs { display:flex;background:#f0f3e9;border-radius:6px;padding:4px;gap:5px;margin-bottom:22px; }\n.kl-tabs button { flex:1;display:flex;align-items:center;justify-content:center;gap:7px;background:none;border:0;color:#93a082;border-radius:4px;padding:9px;font-size:12px; }\n.kl-tabs button.active { background:#fffefa;box-shadow:0 1px 4px #536b3320;color:#3f6332; }\n.kl-editor label { display:flex;flex-direction:column;gap:7px;font-size:11px;color:#6e805d;margin-bottom:16px;position:relative; }\n.kl-editor label>em { position:absolute;right:0;top:0;font-size:9px;color:#a1ac94;font-style:normal; }\n.kl-editor input,.kl-editor textarea { width:100%;background:#fffefa;border:1px solid #dce3d3;border-radius:5px;padding:10px 11px;color:#4b603e;font-size:12px; }\n.kl-editor input::placeholder,.kl-editor textarea::placeholder { color:#b0b9a5; }\n.kl-editor textarea { resize:vertical;line-height:1.8;min-height:120px;max-height:280px; }\n.kl-editor label>small { color:#a0ac91;font-size:10px;line-height:1.7; }\n.kl-form-grid { display:grid;grid-template-columns:1fr 1fr;gap:16px; }\n.kl-editor footer { display:flex;align-items:center;gap:9px;margin:20px -28px 0;padding:17px 28px;border-top:1px solid #e7ecdf; }\n.kl-editor footer>span { display:flex;align-items:center;gap:6px;font-size:10px;color:#9ba98c;margin-right:auto; }\n.kl-editor footer button { font-size:12px; }\n.kl-editor .kl-upload { align-items:center;gap:12px;position:relative;border:1px dashed #bacba9;background:#f5f8f0;padding:22px 16px;border-radius:6px;text-align:center; }\n.kl-upload>strong { font-size:12px;font-weight:400; }\n.kl-upload>span { font-size:10px;color:#93a280; }\n.kl-upload input { position:absolute;inset:0;opacity:0;cursor:pointer; }\n.kl-citation-preview { display:flex;gap:8px;align-items:center;background:#edf4e6;font-size:10px;color:#718a60;padding:10px;border-radius:5px;margin-bottom:18px; }\n.kl-jobs,.kl-info { padding:24px 28px; }\n.kl-muted { color:#97a58b;font-size:12px; }\n.kl-job { border-bottom:1px solid #e6ecdc;padding:0 0 18px;margin-bottom:18px; }\n.kl-job>div { display:flex;justify-content:space-between;align-items:center; }\n.kl-job time { font-size:10px;color:#a2ad95; }\n.kl-job>strong { display:block;overflow-wrap:anywhere;font-size:12px;font-weight:400;margin:12px 0;color:#7f8f6d; }\n.kl-job>p { font-size:11px;color:#ac6e51;line-height:1.8; }\n.kl-job button { display:flex;align-items:center;gap:4px;color:#6b8756;font-size:11px;border:0;background:none;padding:4px 0; }\n.kl-job-status { font-size:10px;border-radius:3px;padding:4px 7px;background:#eef2e6;color:#7f9568; }\n.kl-job-status.failed { background:#fbede4;color:#ae7452; }\n.kl-job-status.running { background:#e4f0df;color:#528342; }\n.kl-info label { display:block;font-size:11px;color:#849772;margin-bottom:10px; }\n.kl-info code { display:block;overflow-wrap:anywhere;background:#f0f4e9;padding:14px;border-radius:5px;font-size:11px;color:#647d4f; }\n.kl-info p { font-size:12px;line-height:2;color:#8d9d7b;margin:20px 0; }\n.kl-info button { font-size:11px; }\n.kl-error,.kl-form-error { background:#f9ede6;color:#a25b40;font-size:12px;line-height:1.8;padding:11px 15px; }\n.kl-error { display:flex;align-items:center;gap:12px;margin:0 38px 15px;border-radius:5px; }\n.kl-error button { margin-left:auto;border:0;background:none;color:inherit;display:flex; }\n.kl-form-error { border-radius:5px;margin-bottom:14px; }\n.kl-toast { position:fixed;bottom:28px;left:50%;transform:translateX(-50%);background:#2f513a;color:#f1f7eb;padding:12px 22px;display:flex;gap:9px;align-items:center;border-radius:8px;box-shadow:0 5px 20px #213b2a25;font-size:12px;z-index:1100; }\n.kl-spinner { height:20px;width:20px;border:2px solid #d4e0c8;border-top-color:#718c5f;border-radius:50%;animation:kl-spin 1s linear infinite; }\n@keyframes kl-spin { to { transform:rotate(360deg); } }\n@keyframes kl-enter { from { opacity:0;transform:translateY(8px); } to { opacity:1;transform:translateY(0); } }\n@media(min-width:1500px) { .kl-header,.kl-toolbar { padding-left:48px;padding-right:48px; }.kl-filterbar { padding-left:48px;padding-right:48px; }.kl-detail article { padding:40px 50px; }.kl-body.with-detail .kl-list { flex-basis:39%; } }\n@media(max-width:1050px) { .kl-nav { width:180px;padding:25px 12px 15px; }.kl-header { padding:28px 25px 22px; }.kl-toolbar { padding:0 25px 20px; }.kl-filterbar { padding:12px 25px; }.kl-detail article { padding:25px 24px; }.kl-body.with-detail .kl-list { flex-basis:34%;min-width:220px;padding:0 10px; }.kl-reading-placeholder { padding:35px 25px; }.kl-reading-placeholder h2 { font-size:21px; }.kl-item h2 { font-size:13px; }.kl-detail-toolbar { padding:10px 16px; }.kl-back span { display:none; } }\n@media(max-width:760px) { .kl-app { min-height:500px; }.kl-nav { width:64px;padding:22px 8px; }.kl-brand { padding:0 0 22px;justify-content:center; }.kl-brand>div,.kl-version,.kl-nav-section,.kl-nav-bottom,.kl-nav nav span,.kl-nav nav small { display:none; }.kl-mark { width:34px;height:38px; }.kl-nav .kl-add { font-size:0;gap:0;padding:10px;margin-bottom:15px; }.kl-nav nav>button { justify-content:center;padding:11px; }.kl-header { padding:24px 20px 20px; }.kl-header h1 { font-size:24px; }.kl-header p { font-size:10px;max-width:230px;line-height:1.8; }.kl-eyebrow { font-size:7px;letter-spacing:1.2px; }.kl-header>.kl-secondary { font-size:10px;padding:8px 10px; }.kl-toolbar { padding:0 20px 18px;gap:8px; }.kl-search kbd { display:none; }.kl-job-button span { display:none; }.kl-filterbar { padding:12px 20px; }.kl-sort-label { display:none; }.kl-body.with-detail .kl-list { display:none; }.kl-reading-placeholder { display:none; }.kl-detail { border-left:0; }.kl-list { padding:0 10px; }.kl-detail article { padding:24px 24px; }.kl-detail-toolbar { padding:10px 20px; }.kl-back span { display:inline; }.kl-empty h2 { font-size:18px;line-height:1.8; }.kl-modal-backdrop { padding:10px; }.kl-dialog { max-height:94dvh; }.kl-dialog>header { padding:22px 20px 17px; }.kl-editor { padding:18px 20px 0; }.kl-editor footer { margin-left:-20px;margin-right:-20px;padding:15px 20px; }.kl-editor footer>span { font-size:8px; }.kl-form-grid { gap:10px; }.kl-error { margin:0 20px 14px; } }\n@media(prefers-reduced-motion:reduce) { .kl-app * { animation:none!important;transition:none!important; } }\n';
|
|
1639
|
+
var style_default = `/* Harness owns the palette and font. Fallbacks are for the standalone preview. */
|
|
1640
|
+
.kl-app {
|
|
1641
|
+
--kl-bg: var(--dsw-alias-bg-base, light-dark(#fff, #191a1e));
|
|
1642
|
+
--kl-panel: var(--dsw-alias-bg-layer-1, light-dark(#fff, #24252a));
|
|
1643
|
+
--kl-sidebar: var(--dsw-specific-sidebar-fill, light-dark(#f8f9fa, #202126));
|
|
1644
|
+
--kl-ink: var(--dsw-alias-label-primary, light-dark(#18191d, #f3f4f6));
|
|
1645
|
+
--kl-secondary: var(--dsw-alias-label-secondary, light-dark(#555963, #c0c2c9));
|
|
1646
|
+
--kl-muted: var(--dsw-alias-label-tertiary, light-dark(#858991, #979ba5));
|
|
1647
|
+
--kl-caption: var(--dsw-alias-label-caption, light-dark(#a3a7b0, #737781));
|
|
1648
|
+
--kl-line: var(--dsw-alias-border-l3, light-dark(#0000001f, #ffffff29));
|
|
1649
|
+
--kl-divider: var(--dsw-alias-border-l1, light-dark(#0000000a, #ffffff0f));
|
|
1650
|
+
--kl-hover: var(--dsw-alias-interactive-bg-hover, light-dark(#2631480f, #ffffff14));
|
|
1651
|
+
--kl-active: var(--dsw-alias-interactive-bg-active, light-dark(#2631481a, #ffffff24));
|
|
1652
|
+
--kl-primary: var(--dsw-alias-button-primary-fill, light-dark(#14151a, #f3f4f6));
|
|
1653
|
+
--kl-primary-hover: var(--dsw-alias-button-primary-hover, light-dark(#373941, #dfe1e6));
|
|
1654
|
+
--kl-on-primary: var(--dsw-alias-label-primary-foreground, light-dark(#fff, #14151a));
|
|
1655
|
+
--kl-focus: var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary, #4d6bfe));
|
|
1656
|
+
--kl-link: var(--dsw-alias-link, light-dark(#4162e7, #91a2ff));
|
|
1657
|
+
--kl-success: var(--dsw-alias-state-success-primary, #36a774);
|
|
1658
|
+
--kl-error: var(--dsw-alias-state-error-primary, light-dark(#c63e43, #ff8589));
|
|
1659
|
+
--kl-warn: var(--dsw-alias-state-warn-label, light-dark(#926316, #d5ad62));
|
|
1660
|
+
--kl-radius: var(--dsw-radius-md, 12px);
|
|
1661
|
+
--kl-radius-lg: var(--dsw-radius-lg, 16px);
|
|
1662
|
+
--kl-gutter: clamp(24px, 4cqi, 48px);
|
|
1663
|
+
font-family: var(--dsw-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif);
|
|
1664
|
+
font-size: 14px;
|
|
1665
|
+
line-height: 1.6;
|
|
1666
|
+
font-synthesis: none;
|
|
1667
|
+
color: var(--kl-ink);
|
|
1668
|
+
background: var(--kl-bg);
|
|
1669
|
+
width: 100%;
|
|
1670
|
+
height: 100%;
|
|
1671
|
+
min-width: 0;
|
|
1672
|
+
min-height: 0;
|
|
1673
|
+
display: flex;
|
|
1674
|
+
overflow: hidden;
|
|
1675
|
+
container: knowledge-library / inline-size;
|
|
1676
|
+
}
|
|
1677
|
+
.kl-app, .kl-app * { box-sizing: border-box; }
|
|
1678
|
+
.kl-preview { margin: 0; color-scheme: light dark; }
|
|
1679
|
+
.kl-preview > #root > .kl-app { height: 100dvh; }
|
|
1680
|
+
.kl-app button, .kl-app input, .kl-app textarea, .kl-app select { font: inherit; color: inherit; }
|
|
1681
|
+
.kl-app button, .kl-app a { -webkit-tap-highlight-color: transparent; }
|
|
1682
|
+
.kl-app button { cursor: pointer; transition: background-color .12s, color .12s, border-color .12s; }
|
|
1683
|
+
.kl-app button:disabled { opacity: .5; cursor: not-allowed; }
|
|
1684
|
+
.kl-app :is(button, a, input, textarea, select):focus-visible { outline: 2px solid var(--kl-focus); outline-offset: 2px; }
|
|
1685
|
+
.kl-app input::placeholder, .kl-app textarea::placeholder { color: var(--kl-caption); }
|
|
1686
|
+
.kl-app svg { flex-shrink: 0; }
|
|
1687
|
+
.kl-app :is(time, small) { font-variant-numeric: tabular-nums; }
|
|
1688
|
+
.kl-app :is(.kl-list, .kl-nav, .kl-detail, .kl-dialog) {
|
|
1689
|
+
scrollbar-width: thin;
|
|
1690
|
+
scrollbar-color: var(--dsw-alias-scrollbar-bg-l2, #8885) transparent;
|
|
1691
|
+
overscroll-behavior: contain;
|
|
1692
|
+
}
|
|
1693
|
+
.kl-workspace { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
|
|
1694
|
+
.kl-primary, .kl-secondary {
|
|
1695
|
+
min-height: 32px; border-radius: var(--kl-radius-lg); padding: 5px 12px; font-size: 13px !important;
|
|
1696
|
+
display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
|
|
1697
|
+
}
|
|
1698
|
+
.kl-app .kl-primary { color: var(--kl-on-primary); background: var(--kl-primary); border: 1px solid transparent; }
|
|
1699
|
+
.kl-app .kl-primary:hover:not(:disabled) { background: var(--kl-primary-hover); }
|
|
1700
|
+
.kl-secondary { background: transparent; border: .5px solid var(--kl-line); }
|
|
1701
|
+
.kl-secondary:hover:not(:disabled) { background: var(--kl-hover); }
|
|
1702
|
+
.kl-app .kl-icon-button {
|
|
1703
|
+
width: 32px; height: 32px; padding: 6px; border: 0; border-radius: 8px; flex: none;
|
|
1704
|
+
display: inline-flex; align-items: center; justify-content: center; color: var(--kl-muted); background: transparent;
|
|
1705
|
+
}
|
|
1706
|
+
.kl-app .kl-icon-button:hover { color: var(--kl-ink); background: var(--kl-hover); }
|
|
1707
|
+
.kl-header { padding: 28px var(--kl-gutter) 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
|
|
1708
|
+
[data-platform="darwin"] .kl-header { padding-top: calc(28px + var(--dsh-frame-top-clearance, 0px)); }
|
|
1709
|
+
.kl-header h1 { margin: 0; min-width: 0; font-size: 20px; line-height: 28px; font-weight: 500; overflow-wrap: anywhere; }
|
|
1710
|
+
.kl-header-actions { display: flex; align-items: center; gap: 8px; flex: none; }
|
|
1711
|
+
.kl-navigation { padding: 0 var(--kl-gutter) 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
|
|
1712
|
+
.kl-navigation nav { display: flex; flex-wrap: wrap; gap: 8px 12px; }
|
|
1713
|
+
.kl-navigation button { border: 0; border-radius: 14px; background: transparent; color: var(--kl-muted); padding: 3px 10px; min-height: 28px; }
|
|
1714
|
+
.kl-navigation button:hover, .kl-navigation button[aria-pressed="true"], .kl-navigation button[aria-expanded="true"] { background: var(--kl-hover); color: var(--kl-ink); }
|
|
1715
|
+
.kl-navigation .kl-directory-toggle { display: flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
|
|
1716
|
+
.kl-toolbar { padding: 0 var(--kl-gutter) 16px; display: flex; gap: 12px; align-items: center; }
|
|
1717
|
+
.kl-search { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; height: 36px; border: .5px solid var(--kl-line); border-radius: var(--kl-radius); padding: 0 10px; color: var(--kl-caption); }
|
|
1718
|
+
.kl-search > svg { width: 16px; height: 16px; }
|
|
1719
|
+
.kl-search input { width: 0; min-width: 0; flex: 1; border: 0; padding: 0; height: 100%; background: transparent; color: var(--kl-ink); font-size: 14px; }
|
|
1720
|
+
.kl-app .kl-search input:focus-visible { outline: none; }
|
|
1721
|
+
.kl-search:focus-within { border-color: var(--kl-focus); }
|
|
1722
|
+
.kl-search kbd { color: var(--kl-caption); border: .5px solid var(--kl-line); border-radius: 4px; padding: 0 4px; font-family: inherit; font-size: 10px; line-height: 18px; white-space: nowrap; }
|
|
1723
|
+
.kl-app .kl-job-button { border: 0; border-radius: 8px; background: transparent; display: flex; align-items: center; gap: 6px; color: var(--kl-muted); padding: 6px; min-height: 32px; white-space: nowrap; font-size: 13px; }
|
|
1724
|
+
.kl-job-button:hover { background: var(--kl-hover); }
|
|
1725
|
+
.kl-job-button i { width: 5px; height: 5px; border-radius: 50%; corner-shape: round; background: var(--kl-error); }
|
|
1726
|
+
.kl-app .kl-job-button.has-jobs { color: var(--kl-link); }
|
|
1727
|
+
.kl-filterbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 var(--kl-gutter) 12px; color: var(--kl-muted); font-size: 12px; }
|
|
1728
|
+
.kl-filterbar > span { min-width: 0; overflow-wrap: anywhere; }
|
|
1729
|
+
.kl-filterbar b { font-weight: 400; }
|
|
1730
|
+
.kl-filterbar > div { display: flex; align-items: center; gap: 16px; flex: none; }
|
|
1731
|
+
.kl-filterbar select { background: var(--kl-bg); color: var(--kl-muted); border: 0; border-radius: 6px; padding: 3px; max-width: 110px; font-size: 12px; }
|
|
1732
|
+
.kl-trash-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 var(--kl-gutter) 12px; }
|
|
1733
|
+
.kl-trash-toolbar p { color: var(--kl-muted); font-size: 12px; margin: 0; min-width: 0; }
|
|
1734
|
+
.kl-trash-toolbar button { flex: none; }
|
|
1735
|
+
.kl-knowledge-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 var(--kl-gutter) 12px; }
|
|
1736
|
+
.kl-knowledge-toolbar p { margin: 0; font-size: 12px; color: var(--kl-muted); }
|
|
1737
|
+
.kl-knowledge-toolbar > div, .kl-knowledge-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
|
|
1738
|
+
.kl-knowledge-toolbar > div { flex: none; }
|
|
1739
|
+
.kl-knowledge-badge { display: inline-flex; align-items: center; padding: 2px 6px; border-radius: 5px; background: var(--kl-hover); color: var(--kl-muted); font-size: 11px; line-height: 18px; white-space: nowrap; font-weight: 400; }
|
|
1740
|
+
.kl-knowledge-badge:is(.draft, .running, .queued, .grouping, .classifying) { color: var(--kl-link); }
|
|
1741
|
+
.kl-knowledge-badge.failed { color: var(--kl-error); }
|
|
1742
|
+
.kl-knowledge-badge.completed { color: var(--kl-ink); }
|
|
1743
|
+
.kl-item-bottom { flex-wrap: wrap; }
|
|
1744
|
+
.kl-item-row.kl-selectable { padding-left: 30px; }
|
|
1745
|
+
.kl-material-checkbox { position: absolute; left: 9px; top: 17px; width: 15px; height: 15px; accent-color: var(--kl-primary); cursor: pointer; }
|
|
1746
|
+
.kl-knowledge-source { border-block: .5px solid var(--kl-line); padding-block: 16px; margin: 20px 0; }
|
|
1747
|
+
.kl-knowledge-source > div:first-child { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--kl-muted); margin-bottom: 12px; }
|
|
1748
|
+
.kl-knowledge-form, .kl-knowledge-jobs { padding: 0 24px 24px; }
|
|
1749
|
+
.kl-knowledge-form label, .kl-knowledge-draft label { display: flex; flex-direction: column; gap: 7px; font-size: 13px; margin: 16px 0; }
|
|
1750
|
+
.kl-knowledge-form input, .kl-knowledge-draft input, .kl-knowledge-draft textarea { width: 100%; border: .5px solid var(--kl-line); border-radius: 8px; padding: 10px 12px; color: var(--kl-ink); background: var(--kl-bg); min-width: 0; font: inherit; }
|
|
1751
|
+
.kl-knowledge-draft textarea { line-height: 1.8; resize: vertical; font-size: 13px; }
|
|
1752
|
+
.kl-knowledge-form small, .kl-knowledge-jobs small { font-size: 12px; color: var(--kl-muted); line-height: 1.7; }
|
|
1753
|
+
.kl-knowledge-summary { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
|
|
1754
|
+
.kl-knowledge-summary b { font-weight: 500; }
|
|
1755
|
+
.kl-knowledge-summary span { color: var(--kl-muted); }
|
|
1756
|
+
.kl-knowledge-source-list { padding: 0; list-style: none; max-height: 150px; overflow: auto; }
|
|
1757
|
+
.kl-knowledge-source-list li { display: flex; align-items: center; gap: 8px; margin-block: 8px; font-size: 13px; overflow-wrap: anywhere; }
|
|
1758
|
+
.kl-knowledge-model { color: var(--kl-muted); font-size: 12px; line-height: 1.8; }
|
|
1759
|
+
.kl-knowledge-help { font-size: 12px; color: var(--kl-link); display: inline-flex; align-items: center; gap: 4px; }
|
|
1760
|
+
.kl-knowledge-form > .kl-muted { font-size: 13px; line-height: 1.8; }
|
|
1761
|
+
.kl-knowledge-form footer, .kl-knowledge-draft footer { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 20px; }
|
|
1762
|
+
.kl-knowledge-back { background: transparent; border: 0; padding: 0; color: var(--kl-muted); font-size: 12px; margin-bottom: 18px; }
|
|
1763
|
+
.kl-knowledge-empty { display: flex; align-items: center; flex-direction: column; text-align: center; padding: 24px 0; color: var(--kl-muted); }
|
|
1764
|
+
.kl-knowledge-empty p { color: var(--kl-ink); }
|
|
1765
|
+
.kl-knowledge-job { display: block; width: 100%; border: 0; border-top: .5px solid var(--kl-line); background: transparent; text-align: left; padding: 16px 0; }
|
|
1766
|
+
.kl-knowledge-job:hover { background: var(--kl-hover); }
|
|
1767
|
+
.kl-knowledge-job > div, .kl-knowledge-job-heading { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; }
|
|
1768
|
+
.kl-knowledge-job strong, .kl-knowledge-job-heading strong { font-size: 14px; font-weight: 500; overflow-wrap: anywhere; min-width: 0; }
|
|
1769
|
+
.kl-knowledge-job p { color: var(--kl-muted); font-size: 12px; margin: 8px 0 0; }
|
|
1770
|
+
.kl-knowledge-job small { display: block; margin-top: 8px; }
|
|
1771
|
+
.kl-knowledge-progress { display: flex; align-items: center; gap: 8px; color: var(--kl-muted); font-size: 13px; margin: 20px 0; }
|
|
1772
|
+
.kl-knowledge-jobs > .kl-knowledge-actions { margin-top: 18px; }
|
|
1773
|
+
.kl-knowledge-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
|
|
1774
|
+
.kl-knowledge-citations { font-size: 12px; color: var(--kl-muted); border-block: .5px solid var(--kl-line); padding-block: 12px; }
|
|
1775
|
+
.kl-knowledge-citations summary { cursor: pointer; }
|
|
1776
|
+
.kl-knowledge-citations button { border: 0; background: transparent; display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 8px 0; }
|
|
1777
|
+
.kl-knowledge-citations button span { min-width: 0; overflow-wrap: anywhere; }
|
|
1778
|
+
.kl-knowledge-mode { margin: 16px 0; padding: 12px; border: .5px solid var(--kl-line); border-radius: 8px; }
|
|
1779
|
+
.kl-knowledge-mode legend { padding: 0 4px; font-size: 12px; color: var(--kl-muted); }
|
|
1780
|
+
.kl-knowledge-mode label { flex-direction: row; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
|
|
1781
|
+
.kl-knowledge-mode input { width: 15px; padding: 0; accent-color: var(--kl-primary); }
|
|
1782
|
+
.kl-knowledge-mode small { margin-left: auto; }
|
|
1783
|
+
.kl-grouping-editor { margin-top: 18px; }
|
|
1784
|
+
.kl-grouping-summary { display: flex; align-items: center; gap: 14px; font-size: 13px; }
|
|
1785
|
+
.kl-grouping-summary b { font-weight: 500; }
|
|
1786
|
+
.kl-grouping-summary span { color: var(--kl-muted); }
|
|
1787
|
+
.kl-grouping-group { border: .5px solid var(--kl-line); border-radius: 8px; padding: 12px 14px; margin: 12px 0; }
|
|
1788
|
+
.kl-grouping-group-title, .kl-grouping-source-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
|
|
1789
|
+
.kl-grouping-group-title { font-size: 12px; color: var(--kl-muted); }
|
|
1790
|
+
.kl-grouping-group ul { margin: 10px 0 0; padding-left: 18px; color: var(--kl-muted); font-size: 12px; line-height: 1.8; }
|
|
1791
|
+
.kl-grouping-group li { overflow-wrap: anywhere; }
|
|
1792
|
+
.kl-grouping-editor label { display: flex; flex-direction: column; gap: 7px; margin: 12px 0; font-size: 12px; }
|
|
1793
|
+
.kl-grouping-editor :is(input,textarea,select) { width: 100%; min-width: 0; border: .5px solid var(--kl-line); border-radius: 8px; padding: 9px 10px; background: var(--kl-bg); color: var(--kl-ink); font: inherit; }
|
|
1794
|
+
.kl-grouping-editor textarea { line-height: 1.7; resize: vertical; }
|
|
1795
|
+
.kl-grouping-reason { margin: 8px 0; font-size: 12px; line-height: 1.8; color: var(--kl-muted); overflow-wrap: anywhere; }
|
|
1796
|
+
.kl-grouping-settings summary, .kl-grouping-source summary { cursor: pointer; font-size: 12px; color: var(--kl-muted); }
|
|
1797
|
+
.kl-grouping-settings summary span { margin-left: 8px; color: var(--kl-ink); }
|
|
1798
|
+
.kl-grouping-section-title { font-size: 14px; font-weight: 500; margin: 24px 0 10px; }
|
|
1799
|
+
.kl-grouping-source { border-top: .5px solid var(--kl-line); padding: 14px 0; }
|
|
1800
|
+
.kl-grouping-source-title strong { font-size: 13px; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
|
|
1801
|
+
.kl-grouping-source p, .kl-grouping-pending p, .kl-grouping-recovery p { font-size: 12px; line-height: 1.8; color: var(--kl-muted); overflow-wrap: anywhere; }
|
|
1802
|
+
.kl-grouping-source details button { margin-top: 8px; }
|
|
1803
|
+
.kl-grouping-editor .kl-grouping-sync { flex-direction: row; align-items: center; gap: 8px; margin-top: 20px; }
|
|
1804
|
+
.kl-grouping-sync input { width: 15px; height: 15px; padding: 0; accent-color: var(--kl-primary); flex: none; }
|
|
1805
|
+
.kl-grouping-editor footer { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
|
|
1806
|
+
.kl-grouping-recovery { border-left: 2px solid var(--kl-link); padding-left: 12px; font-size: 13px; }
|
|
1807
|
+
.kl-grouping-pending { border-top: .5px solid var(--kl-line); padding-top: 14px; font-size: 13px; }
|
|
1808
|
+
.kl-note-integration { border: .5px solid var(--kl-line); border-radius: 8px; padding: 14px; margin: 16px 0; }
|
|
1809
|
+
.kl-note-integration > strong { font-size: 14px; font-weight: 500; }
|
|
1810
|
+
.kl-note-integration p, .kl-integration-findings { font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; }
|
|
1811
|
+
.kl-integration-findings { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 12px; padding: 8px 0; border-top: .5px solid var(--kl-line); }
|
|
1812
|
+
.kl-integration-findings > span { color: var(--kl-muted); }
|
|
1813
|
+
.kl-integration-findings ul { margin: 0; padding-left: 16px; }
|
|
1814
|
+
.kl-integration-target { font-weight: 500; }
|
|
1815
|
+
.kl-integration-preview { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 300px; overflow-y: auto; padding: 12px; background: var(--kl-hover); border-radius: 6px; font: inherit; font-size: 12px; line-height: 1.8; }
|
|
1816
|
+
.kl-note-integration details summary, .kl-knowledge-draft > details summary { cursor: pointer; font-size: 12px; color: var(--kl-muted); }
|
|
1817
|
+
.kl-body { position: relative; display: flex; flex: 1; min-height: 0; overflow: hidden; }
|
|
1818
|
+
.kl-list { flex: 1; min-width: 0; min-height: 0; overflow-y: auto; padding: 0 calc(var(--kl-gutter) - 8px) 24px; }
|
|
1819
|
+
.kl-body.with-detail .kl-list { flex: 0 0 38%; padding: 0 16px 24px calc(var(--kl-gutter) - 8px); }
|
|
1820
|
+
.kl-item { width: 100%; display: block; text-align: left; padding: 14px 12px; margin-bottom: 2px; border: 0; border-radius: var(--kl-radius); background: transparent; }
|
|
1821
|
+
.kl-item:hover, .kl-item.selected { background: var(--kl-hover); }
|
|
1822
|
+
.kl-item-row { position: relative; }
|
|
1823
|
+
.kl-item-row .kl-item { padding-right: 48px; }
|
|
1824
|
+
.kl-app .kl-row-action { position: absolute; top: 8px; right: 8px; }
|
|
1825
|
+
.kl-app .kl-danger, .kl-app .kl-danger:hover { color: var(--kl-error); }
|
|
1826
|
+
.kl-item-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 5px; }
|
|
1827
|
+
.kl-type { display: inline-flex; gap: 5px; align-items: center; font-size: 12px; color: var(--kl-muted); }
|
|
1828
|
+
.kl-item time { color: var(--kl-muted); font-size: 12px; }
|
|
1829
|
+
.kl-item h2 { margin: 0 0 5px; font-size: 14px; line-height: 23px; font-weight: 500; overflow-wrap: anywhere; }
|
|
1830
|
+
.kl-item > p { margin: 0 0 10px; font-size: 13px; line-height: 21px; color: var(--kl-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
|
|
1831
|
+
.kl-item-bottom { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
|
|
1832
|
+
.kl-category { display: flex; align-items: center; gap: 4px; max-width: 60%; overflow: hidden; white-space: nowrap; color: var(--kl-muted); font-size: 11px; }
|
|
1833
|
+
.kl-chip { padding: 1px 6px; border-radius: 5px; background: var(--kl-hover); color: var(--kl-secondary); font-size: 11px; max-width: 100%; overflow-wrap: anywhere; }
|
|
1834
|
+
.kl-item-bottom > svg { margin-left: auto; color: var(--kl-caption); }
|
|
1835
|
+
.kl-stored { color: var(--kl-warn); font-size: 11px; }
|
|
1836
|
+
.kl-load-more { width: 100%; padding: 16px; border: 0; border-radius: 8px; background: transparent; color: var(--kl-muted); font-size: 13px; }
|
|
1837
|
+
.kl-load-more:hover { background: var(--kl-hover); }
|
|
1838
|
+
|
|
1839
|
+
/* An optional directory leaves the default view as uncluttered as native pages. */
|
|
1840
|
+
.kl-nav { width: 200px; max-width: 80%; flex: none; padding: 12px; margin-left: var(--kl-gutter); border-right: .5px solid var(--kl-line); background: var(--kl-bg); overflow-y: auto; display: flex; flex-direction: column; }
|
|
1841
|
+
.kl-directory-title { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 500; }
|
|
1842
|
+
.kl-nav-section { margin-top: 20px; }
|
|
1843
|
+
.kl-nav-label { padding: 0 8px 8px; color: var(--kl-muted); font-size: 12px; }
|
|
1844
|
+
.kl-nav-row { width: 100%; display: flex; align-items: center; gap: 8px; background: transparent; border: 0; border-radius: 8px; padding: 8px; text-align: left; min-width: 0; font-size: 13px !important; }
|
|
1845
|
+
.kl-nav-row > span:not(.kl-collection-dot) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1846
|
+
.kl-nav-row > svg { color: var(--kl-muted); }
|
|
1847
|
+
.kl-nav-row small { margin-left: auto; color: var(--kl-muted); font-size: 11px; }
|
|
1848
|
+
.kl-nav button:hover, .kl-nav button[aria-pressed="true"] { background: var(--kl-hover); }
|
|
1849
|
+
.kl-nav-hint { color: var(--kl-muted); font-size: 12px; margin: 0; padding: 0 8px; }
|
|
1850
|
+
.kl-collection-dot { width: 6px; height: 6px; border-radius: 50%; corner-shape: round; border: 1px solid var(--kl-muted); flex: none; margin: 0 5px; }
|
|
1851
|
+
.kl-tag-cloud { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 4px; }
|
|
1852
|
+
.kl-tag-cloud button { background: transparent; color: var(--kl-muted); border: 0; border-radius: 6px; padding: 3px 6px; font-size: 12px; max-width: 100%; overflow-wrap: anywhere; }
|
|
1853
|
+
.kl-nav-bottom { display: flex; align-items: center; gap: 6px; margin-top: auto; padding: 28px 8px 8px; color: var(--kl-muted); font-size: 11px; }
|
|
1854
|
+
.kl-live-dot { width: 5px; height: 5px; border-radius: 50%; corner-shape: round; background: var(--kl-success); display: inline-block; flex-shrink: 0; }
|
|
1855
|
+
.kl-detail { flex: 1; min-width: 0; min-height: 0; overflow-y: auto; border-left: .5px solid var(--kl-line); background: var(--kl-bg); }
|
|
1856
|
+
.kl-detail-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 20px; border-bottom: .5px solid var(--kl-divider); position: sticky; top: 0; background: var(--kl-bg); z-index: 1; }
|
|
1857
|
+
.kl-detail-toolbar > div { display: flex; align-items: center; gap: 4px; }
|
|
1858
|
+
.kl-detail-toolbar button, .kl-detail-toolbar a { display: flex; align-items: center; gap: 5px; background: transparent; border: 0; border-radius: 8px; min-height: 32px; padding: 6px 8px; color: var(--kl-muted); text-decoration: none; font-size: 12px; white-space: nowrap; }
|
|
1859
|
+
.kl-detail-toolbar :is(button, a):hover { color: var(--kl-ink); background: var(--kl-hover); }
|
|
1860
|
+
.kl-detail article { max-width: 800px; margin: 0 auto; padding: 24px 28px 40px; }
|
|
1861
|
+
.kl-detail-kicker { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--kl-muted); overflow-wrap: anywhere; }
|
|
1862
|
+
.kl-detail-kicker span + span::before { content: "/"; margin-right: 8px; color: var(--kl-caption); }
|
|
1863
|
+
.kl-detail article > h2 { margin: 10px 0 12px; font-size: 20px; font-weight: 500; line-height: 1.5; overflow-wrap: anywhere; }
|
|
1864
|
+
.kl-source { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: var(--kl-muted); font-size: 12px; overflow-wrap: anywhere; }
|
|
1865
|
+
.kl-source a { color: var(--kl-link); display: flex; align-items: center; gap: 4px; text-decoration: none; }
|
|
1866
|
+
.kl-source a:hover { text-decoration: underline; }
|
|
1867
|
+
.kl-detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
|
|
1868
|
+
.kl-source-note { border-left: 2px solid var(--kl-line); padding: 10px 12px; font-size: 13px; line-height: 1.7; color: var(--kl-secondary); background: var(--kl-sidebar); margin: 20px 0; overflow-wrap: anywhere; }
|
|
1869
|
+
.kl-content { margin-top: 24px; }
|
|
1870
|
+
.kl-segment { margin-bottom: 20px; scroll-margin-top: 64px; }
|
|
1871
|
+
.kl-segment.kl-cited { background: var(--kl-hover); box-shadow: 0 0 0 8px var(--kl-hover); border-radius: 4px; }
|
|
1872
|
+
.kl-segment-line { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; font-size: 11px; color: var(--kl-muted); font-variant-numeric: tabular-nums; }
|
|
1873
|
+
.kl-segment-line > span { margin-right: auto; }
|
|
1874
|
+
.kl-segment-line button { display: grid; place-items: center; width: 26px; height: 26px; background: transparent; border: 0; border-radius: 6px; color: var(--kl-muted); opacity: .6; padding: 4px; }
|
|
1875
|
+
.kl-segment:hover button, .kl-segment:focus-within button { opacity: 1; }
|
|
1876
|
+
.kl-segment-line button:hover { background: var(--kl-hover); }
|
|
1877
|
+
.kl-segment p { white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--dsh-content-font-size, 14px); line-height: 1.8; margin: 0; color: var(--kl-ink); }
|
|
1878
|
+
.kl-segment h3 { font-size: calc(16px + var(--dsh-content-font-delta, 0px)); line-height: 1.7; margin: 0; font-weight: 500; overflow-wrap: anywhere; }
|
|
1879
|
+
.kl-detail-footer { margin-top: 32px; padding-top: 16px; border-top: .5px solid var(--kl-line); font-size: 11px; color: var(--kl-muted); }
|
|
1880
|
+
.kl-detail-footer > div { display: flex; gap: 6px; align-items: center; }
|
|
1881
|
+
.kl-detail-footer a { display: flex; align-items: center; gap: 6px; color: var(--kl-link); text-decoration: none; margin: 12px 0; }
|
|
1882
|
+
.kl-detail-footer code { display: block; font-size: 10px; margin-top: 12px; overflow-wrap: anywhere; }
|
|
1883
|
+
.kl-empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 48px 20px; text-align: center; color: var(--kl-muted); }
|
|
1884
|
+
.kl-empty > svg { color: var(--kl-caption); margin-bottom: 4px; }
|
|
1885
|
+
.kl-empty h2 { font-size: 14px; font-weight: 400; line-height: 1.6; margin: 0; color: var(--kl-muted); }
|
|
1886
|
+
.kl-empty p { font-size: 13px; margin: 0; }
|
|
1887
|
+
.kl-empty .kl-secondary { margin-top: 12px; color: var(--kl-ink); }
|
|
1888
|
+
.kl-notice { display: flex; gap: 10px; padding: 14px; background: var(--kl-sidebar); margin-top: 20px; border-radius: 10px; color: var(--kl-secondary); }
|
|
1889
|
+
.kl-notice strong { font-size: 13px; font-weight: 500; }
|
|
1890
|
+
.kl-notice p { font-size: 12px; line-height: 1.7; margin: 4px 0 0; }
|
|
1891
|
+
.kl-references { background: var(--kl-sidebar); padding: 14px; border-radius: 10px; margin-top: 24px; }
|
|
1892
|
+
.kl-references h3 { font-size: 13px; font-weight: 500; margin: 0 0 8px; }
|
|
1893
|
+
.kl-references button { display: flex; gap: 7px; align-items: center; border: 0; background: transparent; color: var(--kl-link); border-radius: 6px; font-size: 12px; padding: 6px; width: 100%; text-align: left; }
|
|
1894
|
+
.kl-references button:hover { background: var(--kl-hover); }
|
|
1895
|
+
.kl-references button > svg:last-child { margin-left: auto; }
|
|
1896
|
+
.kl-references button > span { min-width: 0; overflow-wrap: anywhere; }
|
|
1897
|
+
|
|
1898
|
+
/* Dialogs remain descendants of .kl-app, so they inherit the same theme. */
|
|
1899
|
+
.kl-modal-backdrop { position: fixed; inset: 0; background: var(--dsw-alias-bg-mask-1, #0006); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 24px; }
|
|
1900
|
+
.kl-dialog { background: var(--kl-panel); color: var(--kl-ink); width: 580px; max-width: 100%; max-height: calc(100dvh - 48px); overflow: auto; border: .5px solid var(--kl-line); border-radius: var(--kl-radius-lg); box-shadow: var(--dsw-elevation-prominent, 0 16px 64px #0003); animation: kl-enter .15s ease-out; }
|
|
1901
|
+
.kl-dialog > header { padding: 24px 24px 18px; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
|
|
1902
|
+
.kl-dialog > header h2 { margin: 0 0 6px; font-size: 18px; line-height: 26px; font-weight: 500; }
|
|
1903
|
+
.kl-dialog > header p { margin: 0; color: var(--kl-muted); font-size: 12px; line-height: 1.7; }
|
|
1904
|
+
.kl-dialog > header > button { border: 0; border-radius: 8px; background: transparent; color: var(--kl-muted); padding: 4px; display: flex; }
|
|
1905
|
+
.kl-dialog > header > button:hover { background: var(--kl-hover); }
|
|
1906
|
+
.kl-delete-dialog { padding: 0 24px 24px; }
|
|
1907
|
+
.kl-delete-title { margin: 0 0 12px; font-weight: 500; overflow-wrap: anywhere; }
|
|
1908
|
+
.kl-delete-dialog footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
|
|
1909
|
+
.kl-editor { padding: 0 24px; }
|
|
1910
|
+
.kl-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
|
|
1911
|
+
.kl-tabs button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; background: transparent; border: 0; color: var(--kl-muted); border-radius: 14px; min-height: 32px; padding: 5px 8px; font-size: 13px; }
|
|
1912
|
+
.kl-tabs button:hover, .kl-tabs button.active { background: var(--kl-hover); color: var(--kl-ink); }
|
|
1913
|
+
.kl-editor label { display: flex; flex-direction: column; gap: 7px; font-size: 13px; color: var(--kl-secondary); margin-bottom: 16px; position: relative; min-width: 0; }
|
|
1914
|
+
.kl-editor label > em { position: absolute; right: 0; top: 0; font-size: 11px; color: var(--kl-muted); font-style: normal; }
|
|
1915
|
+
.kl-editor input, .kl-editor textarea { width: 100%; background: transparent; border: .5px solid var(--kl-line); border-radius: 10px; padding: 9px 11px; color: var(--kl-ink); font-size: 13px; }
|
|
1916
|
+
.kl-editor textarea { resize: vertical; line-height: 1.7; min-height: 120px; max-height: 280px; }
|
|
1917
|
+
.kl-editor label > small { color: var(--kl-muted); font-size: 11px; line-height: 1.7; }
|
|
1918
|
+
.kl-form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
|
|
1919
|
+
.kl-editor footer { display: flex; align-items: center; gap: 8px; margin: 20px -24px 0; padding: 16px 24px; border-top: .5px solid var(--kl-divider); }
|
|
1920
|
+
.kl-editor footer > span { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--kl-muted); margin-right: auto; }
|
|
1921
|
+
.kl-editor .kl-upload { align-items: center; gap: 10px; border: 1px dashed var(--kl-line); background: var(--kl-sidebar); padding: 22px 16px; border-radius: var(--kl-radius); text-align: center; }
|
|
1922
|
+
.kl-upload > strong { font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
|
|
1923
|
+
.kl-upload > span { font-size: 11px; color: var(--kl-muted); }
|
|
1924
|
+
.kl-upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
|
|
1925
|
+
.kl-upload:focus-within { outline: 2px solid var(--kl-focus); outline-offset: 2px; }
|
|
1926
|
+
.kl-citation-preview { display: flex; gap: 8px; align-items: center; background: var(--kl-sidebar); font-size: 12px; color: var(--kl-secondary); padding: 10px; border-radius: 8px; margin-bottom: 18px; overflow-wrap: anywhere; }
|
|
1927
|
+
.kl-jobs, .kl-info { padding: 0 24px 24px; }
|
|
1928
|
+
.kl-muted { color: var(--kl-muted); font-size: 13px; }
|
|
1929
|
+
.kl-job { border-bottom: .5px solid var(--kl-line); padding: 0 0 18px; margin-bottom: 18px; }
|
|
1930
|
+
.kl-job:last-child { margin-bottom: 0; }
|
|
1931
|
+
.kl-job > div { display: flex; justify-content: space-between; align-items: center; }
|
|
1932
|
+
.kl-job time { font-size: 11px; color: var(--kl-muted); }
|
|
1933
|
+
.kl-job > strong { display: block; overflow-wrap: anywhere; font-size: 13px; font-weight: 400; margin: 12px 0; }
|
|
1934
|
+
.kl-job > p { font-size: 12px; color: var(--kl-error); line-height: 1.7; }
|
|
1935
|
+
.kl-job button, .kl-job a { display: flex; align-items: center; gap: 4px; color: var(--kl-link); font-size: 12px; border: 0; background: transparent; border-radius: 6px; padding: 4px; text-decoration: none; }
|
|
1936
|
+
.kl-job button:hover, .kl-job a:hover { background: var(--kl-hover); }
|
|
1937
|
+
.kl-job .kl-job-actions { justify-content: flex-start; flex-wrap: wrap; gap: 8px; }
|
|
1938
|
+
.kl-job-status { font-size: 11px; border-radius: 6px; padding: 3px 7px; background: var(--kl-hover); color: var(--kl-secondary); }
|
|
1939
|
+
.kl-job-status.failed { color: var(--kl-error); }
|
|
1940
|
+
.kl-job-status.running { color: var(--kl-link); }
|
|
1941
|
+
.kl-info label { display: block; font-size: 12px; color: var(--kl-muted); margin-bottom: 8px; }
|
|
1942
|
+
.kl-info code { display: block; overflow-wrap: anywhere; background: var(--kl-sidebar); padding: 12px; border-radius: 8px; font-size: 12px; }
|
|
1943
|
+
.kl-info p { font-size: 13px; line-height: 1.8; color: var(--kl-secondary); margin: 16px 0; }
|
|
1944
|
+
.kl-root-field, .kl-folder-path { display: flex; gap: 8px; align-items: center; }
|
|
1945
|
+
.kl-root-field input, .kl-folder-path input { flex: 1; min-width: 0; border: .5px solid var(--kl-line); background: var(--kl-panel); border-radius: var(--kl-radius); padding: 10px 12px; font-size: 12px; }
|
|
1946
|
+
.kl-root-field input[readonly] { background: var(--kl-sidebar); }
|
|
1947
|
+
.kl-root-field button, .kl-folder-path button { flex-shrink: 0; }
|
|
1948
|
+
.kl-root-confirm { margin-top: 14px; padding: 12px; border: .5px solid var(--kl-line); border-radius: 10px; background: var(--kl-sidebar); }
|
|
1949
|
+
.kl-root-confirm p { margin: 0 0 12px; }
|
|
1950
|
+
.kl-root-confirm > div, .kl-folder-actions { display: flex; justify-content: flex-end; gap: 8px; }
|
|
1951
|
+
.kl-folder-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
|
|
1952
|
+
.kl-folder-heading strong { font-size: 14px; font-weight: 500; }
|
|
1953
|
+
.kl-folder-crumbs { display: flex; flex-wrap: wrap; gap: 4px; margin: 12px 0; }
|
|
1954
|
+
.kl-folder-crumbs button { border: 0; background: transparent; padding: 3px 0; font-size: 12px; color: var(--kl-muted); overflow-wrap: anywhere; }
|
|
1955
|
+
.kl-folder-crumbs span { padding: 0 6px; color: var(--kl-caption); }
|
|
1956
|
+
.kl-folder-entries { height: 240px; overflow: auto; border: .5px solid var(--kl-line); border-radius: 10px; padding: 6px; }
|
|
1957
|
+
.kl-folder-entries > button { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; border: 0; border-radius: 6px; padding: 10px; background: transparent; }
|
|
1958
|
+
.kl-folder-entries > button:hover { background: var(--kl-hover); }
|
|
1959
|
+
.kl-folder-entries > button span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
|
|
1960
|
+
.kl-folder-entries > p { padding: 0 10px; }
|
|
1961
|
+
.kl-folder-actions { margin-top: 16px; }
|
|
1962
|
+
.kl-info .kl-settings-error { color: var(--kl-error); overflow-wrap: anywhere; }
|
|
1963
|
+
.kl-network-settings { margin-top: 20px; padding-top: 16px; border-top: .5px solid var(--kl-line); }
|
|
1964
|
+
.kl-network-settings h3 { font-size: 13px; font-weight: 500; margin: 0 0 12px; }
|
|
1965
|
+
.kl-info .kl-proxy-option { display: flex; align-items: flex-start; gap: 8px; color: var(--kl-ink); font-size: 13px; line-height: 20px; cursor: pointer; }
|
|
1966
|
+
.kl-proxy-option input { flex: none; width: 16px; height: 16px; margin: 2px 0; accent-color: var(--kl-ink); }
|
|
1967
|
+
.kl-network-settings p { font-size: 12px; margin: 8px 0 12px; }
|
|
1968
|
+
.kl-error, .kl-form-error { background: var(--kl-sidebar); color: var(--kl-error); font-size: 13px; line-height: 1.7; padding: 10px 12px; border-radius: 8px; overflow-wrap: anywhere; }
|
|
1969
|
+
.kl-error { display: flex; align-items: center; gap: 12px; margin: 0 var(--kl-gutter) 14px; }
|
|
1970
|
+
.kl-error button { margin-left: auto; border: 0; background: transparent; color: inherit; display: flex; padding: 4px; }
|
|
1971
|
+
.kl-form-error { margin-bottom: 14px; }
|
|
1972
|
+
.kl-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); max-width: calc(100vw - 32px); background: var(--dsw-alias-toast-bg, #303136); color: var(--dsw-alias-toast-label, #fff); padding: 10px 16px; display: flex; gap: 8px; align-items: center; border-radius: 12px; box-shadow: 0 4px 20px #0002; font-size: 13px; z-index: 1100; }
|
|
1973
|
+
.kl-spinner { height: 20px; width: 20px; border: 2px solid var(--kl-line); border-top-color: var(--kl-muted); border-radius: 50%; corner-shape: round; animation: kl-spin 1s linear infinite; }
|
|
1974
|
+
@keyframes kl-spin { to { transform: rotate(360deg); } }
|
|
1975
|
+
@keyframes kl-enter { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
|
|
1976
|
+
|
|
1977
|
+
/* Respond to the plugin's available space, including the host's side panels. */
|
|
1978
|
+
@container knowledge-library (max-width: 900px) {
|
|
1979
|
+
.kl-body.with-detail .kl-list { display: none; }
|
|
1980
|
+
.kl-detail { border-left: 0; }
|
|
1981
|
+
.kl-detail article { padding: 24px var(--kl-gutter) 36px; }
|
|
1982
|
+
.kl-detail-toolbar { padding: 8px calc(var(--kl-gutter) - 8px); }
|
|
1983
|
+
.kl-nav { position: absolute; top: 0; bottom: 0; left: 0; z-index: 2; margin: 0; width: 240px; border-top: .5px solid var(--kl-line); box-shadow: 8px 0 24px #0001; }
|
|
1984
|
+
}
|
|
1985
|
+
@container knowledge-library (max-width: 520px) {
|
|
1986
|
+
.kl-header { padding: 20px 20px 18px; flex-wrap: wrap; gap: 12px; }
|
|
1987
|
+
.kl-header h1 { font-size: 20px; }
|
|
1988
|
+
.kl-header-actions { margin-left: auto; }
|
|
1989
|
+
.kl-navigation { padding: 0 20px 12px; flex-wrap: wrap; gap: 8px; }
|
|
1990
|
+
.kl-navigation nav { gap: 4px; }
|
|
1991
|
+
.kl-navigation .kl-directory-toggle { margin-left: auto; }
|
|
1992
|
+
.kl-toolbar { padding: 0 20px 12px; gap: 4px; }
|
|
1993
|
+
.kl-search kbd, .kl-job-button span, .kl-sort-label { display: none; }
|
|
1994
|
+
.kl-filterbar { padding: 0 20px 10px; }
|
|
1995
|
+
.kl-trash-toolbar { padding: 0 20px 12px; flex-wrap: wrap; }
|
|
1996
|
+
.kl-knowledge-toolbar { padding: 0 20px 12px; flex-wrap: wrap; }
|
|
1997
|
+
.kl-list { padding: 0 12px 16px; }
|
|
1998
|
+
.kl-empty { padding: 40px 12px; }
|
|
1999
|
+
.kl-detail article { padding: 20px; }
|
|
2000
|
+
.kl-detail-toolbar { padding: 8px 12px; }
|
|
2001
|
+
.kl-detail-toolbar { flex-wrap: wrap; }
|
|
2002
|
+
.kl-detail-toolbar > div { margin-left: auto; }
|
|
2003
|
+
.kl-error { margin: 0 20px 12px; }
|
|
2004
|
+
}
|
|
2005
|
+
/* Fixed dialogs use viewport width even when the host panel is narrow. */
|
|
2006
|
+
@media (max-width: 600px) {
|
|
2007
|
+
.kl-modal-backdrop { padding: 12px; }
|
|
2008
|
+
.kl-dialog { max-height: calc(100dvh - 24px); }
|
|
2009
|
+
.kl-dialog > header { padding: 20px 18px 16px; }
|
|
2010
|
+
.kl-knowledge-form, .kl-knowledge-jobs { padding-inline: 18px; }
|
|
2011
|
+
.kl-knowledge-fields { grid-template-columns: 1fr; gap: 0; }
|
|
2012
|
+
.kl-editor { padding: 0 18px; }
|
|
2013
|
+
.kl-editor footer { margin-left: -18px; margin-right: -18px; padding: 14px 18px; }
|
|
2014
|
+
.kl-editor footer > span { font-size: 10px; }
|
|
2015
|
+
.kl-tabs { gap: 4px; }
|
|
2016
|
+
.kl-tabs button { padding: 5px; font-size: 12px; }
|
|
2017
|
+
.kl-form-grid { gap: 12px; }
|
|
2018
|
+
.kl-jobs, .kl-info { padding: 0 18px 20px; }
|
|
2019
|
+
.kl-delete-dialog { padding: 0 18px 20px; }
|
|
2020
|
+
}
|
|
2021
|
+
@media (prefers-reduced-motion: reduce) {
|
|
2022
|
+
.kl-app * { animation: none !important; transition: none !important; }
|
|
2023
|
+
}
|
|
2024
|
+
`;
|
|
700
2025
|
|
|
701
2026
|
// src/client.tsx
|
|
702
|
-
var
|
|
2027
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
703
2028
|
var inject = ["slots"];
|
|
704
2029
|
function apply(ctx) {
|
|
705
2030
|
ctx.effect(() => {
|
|
@@ -709,13 +2034,13 @@ function apply(ctx) {
|
|
|
709
2034
|
document.head.append(style);
|
|
710
2035
|
return () => style.remove();
|
|
711
2036
|
});
|
|
712
|
-
ctx.slots.inject("main", () => ctx.slots.register({ name: "main", key: "knowledge-library" }, () => /* @__PURE__ */ (0,
|
|
2037
|
+
ctx.slots.inject("main", () => ctx.slots.register({ name: "main", key: "knowledge-library" }, () => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(App, {})));
|
|
713
2038
|
ctx.slots.inject("sidebar.panellist", () => ctx.slots.register({
|
|
714
2039
|
name: "sidebar.panellist",
|
|
715
2040
|
id: "knowledge-library",
|
|
716
2041
|
order: 20,
|
|
717
2042
|
label: "\u8D44\u6599\u5E93"
|
|
718
|
-
}, () => /* @__PURE__ */ (0,
|
|
2043
|
+
}, () => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(LibraryIcon, { size: 20 })));
|
|
719
2044
|
}
|
|
720
2045
|
|
|
721
2046
|
return module.exports;}});
|