@burdenoff/microfe-botmanor 2026.1120.15 → 2026.1120.17

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.
@@ -19,22 +19,23 @@ import { useLLMModels as le, useLLMProviders as ue } from "../hooks/useLLMProvid
19
19
  import { useCreateKnowledgeBase as de, useDeleteKnowledgeBase as fe, useKnowledgeBase as pe, useKnowledgeDocuments as me, useLoadKnowledgeBaseUsage as he, useRebuildKnowledgeBaseIndex as ge, useRemoveKnowledgeDocument as _e, useUpdateKnowledgeBase as ve } from "../hooks/useKnowledgeBases.js";
20
20
  import { configuredEmbeddingModels as ye } from "../utils/embedding-models.js";
21
21
  import { confirmAction as h } from "../utils/confirmAction.js";
22
+ import { useUnsavedChangesGuard as be } from "../utils/leaveGuard.js";
22
23
  import { formatRelativeTime as g } from "../utils/formatters.js";
23
- import { knowledgeBaseDeleteMessage as be } from "../utils/kbDelete.js";
24
- import { KB_CHUNK_SIZE_RANGE as _, KB_FIELD_MESSAGES as xe, indexStatusHelp as Se, isDocumentBusy as Ce, isIndexBusy as we, parseKbNumber as v, validateKbForm as Te } from "../utils/kbSettings.js";
24
+ import { knowledgeBaseDeleteMessage as xe } from "../utils/kbDelete.js";
25
+ import { KB_CHUNK_SIZE_RANGE as _, KB_FIELD_MESSAGES as Se, indexStatusHelp as Ce, isDocumentBusy as we, isIndexBusy as Te, parseKbNumber as v, validateKbForm as Ee } from "../utils/kbSettings.js";
25
26
  import "../permissions/index.js";
26
- import { useEffect as Ee, useRef as De, useState as y } from "react";
27
- import { GlassCard as Oe, PagePurpose as ke } from "@burdenoff/fe-libs/ui";
27
+ import { useEffect as De, useRef as Oe, useState as y } from "react";
28
+ import { GlassCard as ke, PagePurpose as Ae } from "@burdenoff/fe-libs/ui";
28
29
  import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
29
- import { useParams as Ae } from "react-router";
30
- import { AlertTriangle as C, ArrowLeft as w, Boxes as je, Database as T, FileText as Me, Layers as Ne, RefreshCw as Pe, Save as E, Settings as D, Trash2 as O } from "lucide-react";
31
- import { toast as k } from "sonner";
30
+ import { useParams as je } from "react-router";
31
+ import { AlertTriangle as C, ArrowLeft as w, Boxes as Me, Database as T, FileText as Ne, Layers as Pe, RefreshCw as Fe, Save as E, Settings as D, Trash2 as Ie } from "lucide-react";
32
+ import { toast as O } from "sonner";
32
33
  // src/botlit/pages/KnowledgeBaseDetailPage.tsx
33
- var Fe = 5e3, Ie = [
34
+ var Le = 5e3, Re = [
34
35
  "RECURSIVE",
35
36
  "FIXED",
36
37
  "SENTENCE"
37
- ], A = {
38
+ ], ze = {
38
39
  RECURSIVE: {
39
40
  key: "recursive",
40
41
  fallback: "Splits on paragraphs, then sentences, then words, keeping related text together. The best default."
@@ -47,7 +48,12 @@ var Fe = 5e3, Ie = [
47
48
  key: "sentence",
48
49
  fallback: "Packs whole sentences into each chunk, never cutting one in half."
49
50
  }
50
- }, Le = {
51
+ }, Be = "kb-add-content", Ve = "rounded-md border border-border-default bg-surface-primary px-2 py-1 text-sm text-text-primary";
52
+ function He(e) {
53
+ let t = e.replace(/_/g, " ").toLowerCase();
54
+ return t.charAt(0).toUpperCase() + t.slice(1);
55
+ }
56
+ var Ue = {
51
57
  name: "",
52
58
  description: "",
53
59
  embeddingModel: "",
@@ -56,7 +62,7 @@ var Fe = 5e3, Ie = [
56
62
  chunkSize: "512",
57
63
  chunkOverlap: "50"
58
64
  };
59
- function Re(e) {
65
+ function We(e) {
60
66
  return {
61
67
  name: e.name,
62
68
  description: e.description ?? "",
@@ -67,128 +73,139 @@ function Re(e) {
67
73
  chunkOverlap: String(e.chunkOverlap)
68
74
  };
69
75
  }
70
- var ze = "flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm", j = ({ isNew: j }) => {
71
- let M = e(), Ve = ne(), { kbId: N, botId: He } = Ae(), P = He ? `bots/${He}/knowledge` : "knowledge", { navigateTo: F } = t(), I = le(), L = ue(), R = I.loading || L.loading, z = I.error || L.error, B = ye(I.data ?? [], L.data ?? []), { data: V, loading: Ue, error: We, refetch: H } = pe(j ? void 0 : N), U = me(j ? void 0 : N), W = U.data, [Ge, Ke] = de(), [qe, Je] = ve(), [Ye, Xe] = ge(), [Ze, Qe] = fe(), [$e] = _e(), et = he(), [tt, G] = y(!1), [K, q] = y(Le), [nt, J] = y(!1), [rt, it] = y(null), at = De(null);
72
- Ee(() => {
73
- V && !j && at.current !== V.id && (at.current = V.id, q(Re(V)));
74
- }, [V, j]);
75
- let Y = we(V?.indexStatus) || W.some((e) => Ce(e.status));
76
- Ee(() => {
77
- if (j || !Y) return;
76
+ var Ge = "flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm", k = ({ isNew: k }) => {
77
+ let A = e(), qe = ne(), { kbId: j, botId: Je } = je(), M = Je ? `bots/${Je}/knowledge` : "knowledge", { navigateTo: N } = t(), P = le(), F = ue(), I = P.loading || F.loading, L = P.error || F.error, R = ye(P.data ?? [], F.data ?? []), { data: z, loading: Ye, error: Xe, refetch: B } = pe(k ? void 0 : j), V = me(k ? void 0 : j), H = V.data, [Ze, Qe] = de(), [$e, et] = ve(), [tt, nt] = ge(), [rt, it] = fe(), [at] = _e(), ot = he(), [st, U] = y(!1), [W, G] = y(Ue), [ct, K] = y(!1), [lt, ut] = y(null), [q, dt] = y(""), [ft, pt] = y(!1), mt = !!k && !ft && JSON.stringify(W) !== JSON.stringify(Ue), ht = Oe(null);
78
+ De(() => {
79
+ z && !k && ht.current !== z.id && (ht.current = z.id, G(We(z)));
80
+ }, [z, k]);
81
+ let J = Te(z?.indexStatus) || H.some((e) => we(e.status));
82
+ De(() => {
83
+ if (k || !J) return;
78
84
  let e = window.setInterval(() => {
79
- H(), U.refetch();
80
- }, Fe);
85
+ B(), V.refetch();
86
+ }, Le);
81
87
  return () => window.clearInterval(e);
82
88
  }, [
83
- j,
84
- Y,
85
- H,
86
- U
89
+ k,
90
+ J,
91
+ B,
92
+ V
87
93
  ]);
88
- let X = Te({
89
- name: K.name,
90
- embeddingModel: K.embeddingModel,
91
- chunkSize: K.chunkSize,
92
- chunkOverlap: K.chunkOverlap
93
- }, j ? "create" : "edit"), Z = (e) => {
94
- let t = nt ? X[e] : void 0;
95
- return t ? M(`botlit.kb.errors.${t}`, xe[t]) : void 0;
96
- }, ot = async (e) => {
97
- if (e.preventDefault(), !Ke.loading) {
98
- if (R) k.error(M("botlit.kb.catalogLoading", "The model list is still loading. Try again in a moment."));
99
- else if (Object.keys(X).length > 0) J(!0);
100
- else if (!B.some((e) => e.id === K.embeddingModel)) J(!0), k.error(M("botlit.kb.modelUnavailable", "Choose a configured embedding model. Register one in Settings first."));
94
+ let Y = /* @__PURE__ */ new Map();
95
+ for (let e of H) Y.set(e.status, (Y.get(e.status) ?? 0) + 1);
96
+ let gt = [...Y.entries()].sort(([e], [t]) => e.localeCompare(t)), _t = Y.has(q) ? q : "", vt = _t ? H.filter((e) => e.status === _t) : H, X = Ee({
97
+ name: W.name,
98
+ embeddingModel: W.embeddingModel,
99
+ chunkSize: W.chunkSize,
100
+ chunkOverlap: W.chunkOverlap
101
+ }, k ? "create" : "edit"), Z = (e) => {
102
+ let t = ct ? X[e] : void 0;
103
+ return t ? A(`botlit.kb.errors.${t}`, Se[t]) : void 0;
104
+ };
105
+ be(mt, A), q && !V.loading && !Y.has(q) && dt("");
106
+ let yt = async () => {
107
+ (!mt || await h({
108
+ title: A("botlit.kb.discard.title", "Discard this knowledge base?"),
109
+ message: A("botlit.kb.discard.message", "You have unsaved changes. If you leave now they will be lost."),
110
+ confirmLabel: A("botlit.kb.discard.confirm", "Discard"),
111
+ cancelLabel: A("botlit.kb.discard.keepEditing", "Keep editing")
112
+ })) && (pt(!0), N(M));
113
+ }, bt = async (e) => {
114
+ if (e.preventDefault(), !Qe.loading) {
115
+ if (I) O.error(A("botlit.kb.catalogLoading", "The model list is still loading. Try again in a moment."));
116
+ else if (Object.keys(X).length > 0) K(!0);
117
+ else if (!R.some((e) => e.id === W.embeddingModel)) K(!0), O.error(A("botlit.kb.modelUnavailable", "Choose a configured embedding model. Register one in Settings first."));
101
118
  else try {
102
- let e = await Ge({
103
- name: K.name.trim(),
104
- description: K.description.trim() || null,
105
- embeddingModel: K.embeddingModel,
106
- embeddingDimensions: K.embeddingDimensions,
107
- chunkingStrategy: K.chunkingStrategy,
108
- chunkSize: v(K.chunkSize),
109
- chunkOverlap: v(K.chunkOverlap)
119
+ let e = await Ze({
120
+ name: W.name.trim(),
121
+ description: W.description.trim() || null,
122
+ embeddingModel: W.embeddingModel,
123
+ embeddingDimensions: W.embeddingDimensions,
124
+ chunkingStrategy: W.chunkingStrategy,
125
+ chunkSize: v(W.chunkSize),
126
+ chunkOverlap: v(W.chunkOverlap)
110
127
  });
111
- k.success(M("botlit.kb.created", "Knowledge base \"{{name}}\" created", { name: e.name })), F(`knowledge/${e.id}`);
128
+ O.success(A("botlit.kb.created", "Knowledge base \"{{name}}\" created", { name: e.name })), pt(!0), N(`knowledge/${e.id}`);
112
129
  } catch (e) {
113
- k.error(e instanceof Error ? e.message : M("botlit.kb.createFailed", "Failed to create knowledge base"));
130
+ O.error(e instanceof Error ? e.message : A("botlit.kb.createFailed", "Failed to create knowledge base"));
114
131
  }
115
132
  }
116
- }, st = async (e) => {
117
- if (e.preventDefault(), !N || !V || Je.loading) return;
133
+ }, xt = async (e) => {
134
+ if (e.preventDefault(), !j || !z || et.loading) return;
118
135
  if (Object.keys(X).length > 0) {
119
- J(!0);
136
+ K(!0);
120
137
  return;
121
138
  }
122
- let t = v(K.chunkSize), n = v(K.chunkOverlap), ee = t !== V.chunkSize || n !== V.chunkOverlap || K.chunkingStrategy !== V.chunkingStrategy;
139
+ let t = v(W.chunkSize), n = v(W.chunkOverlap), ee = t !== z.chunkSize || n !== z.chunkOverlap || W.chunkingStrategy !== z.chunkingStrategy;
123
140
  try {
124
- await qe({
125
- kbId: N,
141
+ await $e({
142
+ kbId: j,
126
143
  input: {
127
- name: K.name.trim(),
128
- description: K.description.trim() || null,
129
- chunkingStrategy: K.chunkingStrategy,
144
+ name: W.name.trim(),
145
+ description: W.description.trim() || null,
146
+ chunkingStrategy: W.chunkingStrategy,
130
147
  chunkSize: t,
131
148
  chunkOverlap: n
132
149
  }
133
- }), await H(), k.success(M("botlit.kb.updated", "Knowledge base updated")), G(!1), J(!1), ee && V.totalDocuments > 0 && await h({
134
- title: M("botlit.kb.rebuildPrompt.title", "Rebuild the index?"),
135
- message: M("botlit.kb.rebuildPrompt.message", "The chunk settings changed. Your {{count}} existing document(s) keep their old chunks until the index is rebuilt. Rebuild now?", { count: V.totalDocuments }),
136
- confirmLabel: M("botlit.kb.rebuild", "Rebuild Index"),
137
- cancelLabel: M("botlit.kb.rebuildPrompt.later", "Later")
138
- }) && await ct();
150
+ }), await B(), O.success(A("botlit.kb.updated", "Knowledge base updated")), U(!1), K(!1), ee && z.totalDocuments > 0 && await h({
151
+ title: A("botlit.kb.rebuildPrompt.title", "Rebuild the index?"),
152
+ message: A("botlit.kb.rebuildPrompt.message", "The chunk settings changed. Your {{count}} existing document(s) keep their old chunks until the index is rebuilt. Rebuild now?", { count: z.totalDocuments }),
153
+ confirmLabel: A("botlit.kb.rebuild", "Rebuild Index"),
154
+ cancelLabel: A("botlit.kb.rebuildPrompt.later", "Later")
155
+ }) && await St();
139
156
  } catch (e) {
140
- k.error(e instanceof Error ? e.message : M("botlit.kb.updateFailed", "Failed to update knowledge base"));
157
+ O.error(e instanceof Error ? e.message : A("botlit.kb.updateFailed", "Failed to update knowledge base"));
141
158
  }
142
- }, ct = async () => {
143
- if (N) {
144
- it(null);
159
+ }, St = async () => {
160
+ if (j) {
161
+ ut(null);
145
162
  try {
146
- if (!await Ye(N)) {
147
- k.error(M("botlit.kb.rebuildNotDone", "The index could not be rebuilt."));
163
+ if (!await tt(j)) {
164
+ O.error(A("botlit.kb.rebuildNotDone", "The index could not be rebuilt."));
148
165
  return;
149
166
  }
150
- k.success(M("botlit.kb.rebuilt", "Index rebuilt"));
167
+ O.success(A("botlit.kb.rebuilt", "Index rebuilt"));
151
168
  } catch (e) {
152
- it(M("botlit.kb.rebuildMaybeRunning", "The rebuild did not report back. A large library can still be rebuilding in the background: this page keeps refreshing, so check the index status.")), k.error(e instanceof Error ? e.message : M("botlit.kb.rebuildFailed", "Failed to rebuild the index"));
169
+ ut(A("botlit.kb.rebuildMaybeRunning", "The rebuild did not report back. A large library can still be rebuilding in the background: this page keeps refreshing, so check the index status.")), O.error(e instanceof Error ? e.message : A("botlit.kb.rebuildFailed", "Failed to rebuild the index"));
153
170
  } finally {
154
- await H(), await U.refetch();
171
+ await B(), await V.refetch();
155
172
  }
156
173
  }
157
- }, lt = async () => {
158
- if (!N || !V) return;
159
- let e = await et(N).catch(() => null);
174
+ }, Ct = async () => {
175
+ if (!j || !z) return;
176
+ let e = await ot(j).catch(() => null);
160
177
  if (await h({
161
- title: M("botlit.kb.delete.title", "Delete knowledge base?"),
162
- message: be(M, V.name, e),
163
- confirmLabel: M("botlit.common.delete", "Delete"),
164
- cancelLabel: M("botlit.common.cancel", "Cancel")
178
+ title: A("botlit.kb.delete.title", "Delete knowledge base?"),
179
+ message: xe(A, z.name, e),
180
+ confirmLabel: A("botlit.common.delete", "Delete"),
181
+ cancelLabel: A("botlit.common.cancel", "Cancel")
165
182
  })) try {
166
- if (!await Ze(N)) {
167
- k.error(M("botlit.kb.delete.notDeleted", "The knowledge base could not be deleted."));
183
+ if (!await rt(j)) {
184
+ O.error(A("botlit.kb.delete.notDeleted", "The knowledge base could not be deleted."));
168
185
  return;
169
186
  }
170
- k.success(M("botlit.kb.delete.success", "Knowledge base \"{{name}}\" deleted", { name: V.name })), F(P);
187
+ O.success(A("botlit.kb.delete.success", "Knowledge base \"{{name}}\" deleted", { name: z.name })), N(M);
171
188
  } catch (e) {
172
- k.error(e instanceof Error ? e.message : M("botlit.kb.delete.error", "Failed to delete the knowledge base"));
189
+ O.error(e instanceof Error ? e.message : A("botlit.kb.delete.error", "Failed to delete the knowledge base"));
173
190
  }
174
- }, ut = async (e) => {
191
+ }, wt = async (e) => {
175
192
  if (await h({
176
- title: M("botlit.kb.document.removeTitle", "Remove document?"),
177
- message: M("botlit.kb.document.removeMessage", "Remove \"{{title}}\" from this knowledge base? Agents stop answering from it. This cannot be undone.", { title: e.title }),
178
- confirmLabel: M("botlit.kb.document.remove", "Remove"),
179
- cancelLabel: M("botlit.common.cancel", "Cancel")
193
+ title: A("botlit.kb.document.removeTitle", "Remove document?"),
194
+ message: A("botlit.kb.document.removeMessage", "Remove \"{{title}}\" from this knowledge base? Agents stop answering from it. This cannot be undone.", { title: e.title }),
195
+ confirmLabel: A("botlit.kb.document.remove", "Remove"),
196
+ cancelLabel: A("botlit.common.cancel", "Cancel")
180
197
  })) try {
181
- if (!await $e(e.id)) {
182
- k.error(M("botlit.kb.document.notRemoved", "The document could not be removed."));
198
+ if (!await at(e.id)) {
199
+ O.error(A("botlit.kb.document.notRemoved", "The document could not be removed."));
183
200
  return;
184
201
  }
185
- k.success(M("botlit.kb.document.removed", "Document \"{{title}}\" removed", { title: e.title })), await U.refetch(), await H();
202
+ O.success(A("botlit.kb.document.removed", "Document \"{{title}}\" removed", { title: e.title })), await V.refetch(), await B();
186
203
  } catch (e) {
187
- k.error(e instanceof Error ? e.message : M("botlit.kb.document.removeFailed", "Failed to remove the document"));
204
+ O.error(e instanceof Error ? e.message : A("botlit.kb.document.removeFailed", "Failed to remove the document"));
188
205
  }
189
- }, Q = (e) => `kb-form-${e}`, dt = (e) => /* @__PURE__ */ S(b, { children: [
206
+ }, Q = (e) => `kb-form-${e}`, Tt = (e) => /* @__PURE__ */ S(b, { children: [
190
207
  /* @__PURE__ */ x(p, {
191
- label: M("botlit.kb.form.name", "Name"),
208
+ label: A("botlit.kb.form.name", "Name"),
192
209
  required: !0,
193
210
  htmlFor: Q("name"),
194
211
  error: Z("name"),
@@ -197,55 +214,55 @@ var ze = "flex h-10 w-full rounded-md border border-border-default bg-bg-surface
197
214
  required: !0,
198
215
  "aria-invalid": Z("name") ? !0 : void 0,
199
216
  "aria-describedby": Z("name") ? `${Q("name")}-error` : void 0,
200
- placeholder: M("botlit.kb.form.namePlaceholder", "e.g., Product Documentation"),
201
- value: K.name,
202
- onChange: (e) => q({
203
- ...K,
217
+ placeholder: A("botlit.kb.form.namePlaceholder", "e.g., Product Documentation"),
218
+ value: W.name,
219
+ onChange: (e) => G({
220
+ ...W,
204
221
  name: e.target.value
205
222
  })
206
223
  })
207
224
  }),
208
225
  /* @__PURE__ */ x(p, {
209
- label: M("botlit.kb.form.description", "Description"),
226
+ label: A("botlit.kb.form.description", "Description"),
210
227
  htmlFor: Q("description"),
211
228
  children: /* @__PURE__ */ x(se, {
212
229
  id: Q("description"),
213
- placeholder: M("botlit.kb.form.descriptionPlaceholder", "What kind of knowledge will this store?"),
214
- value: K.description,
215
- onChange: (e) => q({
216
- ...K,
230
+ placeholder: A("botlit.kb.form.descriptionPlaceholder", "What kind of knowledge will this store?"),
231
+ value: W.description,
232
+ onChange: (e) => G({
233
+ ...W,
217
234
  description: e.target.value
218
235
  }),
219
236
  rows: 3
220
237
  })
221
238
  }),
222
239
  e && /* @__PURE__ */ S(p, {
223
- label: M("botlit.kb.form.embeddingModel", "Embedding Model"),
240
+ label: A("botlit.kb.form.embeddingModel", "Embedding Model"),
224
241
  required: !0,
225
242
  htmlFor: Q("model"),
226
243
  error: Z("embeddingModel"),
227
244
  children: [
228
245
  /* @__PURE__ */ S("select", {
229
246
  id: Q("model"),
230
- className: ze,
231
- "aria-label": M("botlit.kb.form.embeddingModel", "Embedding Model"),
247
+ className: Ge,
248
+ "aria-label": A("botlit.kb.form.embeddingModel", "Embedding Model"),
232
249
  required: !0,
233
250
  "aria-invalid": Z("embeddingModel") ? !0 : void 0,
234
251
  "aria-describedby": Z("embeddingModel") ? `${Q("model")}-error` : void 0,
235
- disabled: R || !!z,
236
- value: K.embeddingModel,
252
+ disabled: I || !!L,
253
+ value: W.embeddingModel,
237
254
  onChange: (e) => {
238
- let t = B.find((t) => t.id === e.target.value);
239
- q({
240
- ...K,
255
+ let t = R.find((t) => t.id === e.target.value);
256
+ G({
257
+ ...W,
241
258
  embeddingModel: e.target.value,
242
- embeddingDimensions: t?.dimensions ?? K.embeddingDimensions
259
+ embeddingDimensions: t?.dimensions ?? W.embeddingDimensions
243
260
  });
244
261
  },
245
262
  children: [/* @__PURE__ */ x("option", {
246
263
  value: "",
247
- children: M("botlit.kb.form.chooseModel", "Choose a configured embedding model")
248
- }), B.map((e) => /* @__PURE__ */ S("option", {
264
+ children: A("botlit.kb.form.chooseModel", "Choose a configured embedding model")
265
+ }), R.map((e) => /* @__PURE__ */ S("option", {
249
266
  value: e.id,
250
267
  children: [
251
268
  e.label,
@@ -255,29 +272,29 @@ var ze = "flex h-10 w-full rounded-md border border-border-default bg-bg-surface
255
272
  ]
256
273
  }, e.id))]
257
274
  }),
258
- R && /* @__PURE__ */ x("p", {
275
+ I && /* @__PURE__ */ x("p", {
259
276
  role: "status",
260
- children: M("botlit.kb.form.loadingModels", "Loading configured embedding models…")
277
+ children: A("botlit.kb.form.loadingModels", "Loading configured embedding models…")
261
278
  }),
262
- z && /* @__PURE__ */ S("div", {
279
+ L && /* @__PURE__ */ S("div", {
263
280
  role: "alert",
264
- children: [/* @__PURE__ */ x("p", { children: M("botlit.kb.form.modelsFailed", "Could not load configured models. Try loading the catalog again.") }), /* @__PURE__ */ x(f, {
281
+ children: [/* @__PURE__ */ x("p", { children: A("botlit.kb.form.modelsFailed", "Could not load configured models. Try loading the catalog again.") }), /* @__PURE__ */ x(f, {
265
282
  type: "button",
266
283
  variant: "secondary",
267
284
  onClick: () => {
268
- I.refetch(), L.refetch();
285
+ P.refetch(), F.refetch();
269
286
  },
270
- children: M("botlit.kb.form.retryModels", "Retry model catalog")
287
+ children: A("botlit.kb.form.retryModels", "Retry model catalog")
271
288
  })]
272
289
  }),
273
- !R && !z && B.length === 0 && /* @__PURE__ */ S("div", {
290
+ !I && !L && R.length === 0 && /* @__PURE__ */ S("div", {
274
291
  className: "text-sm text-text-secondary",
275
- children: [/* @__PURE__ */ x("p", { children: M("botlit.kb.form.noModels", "No embedding model is registered yet. Register one with an active provider in Settings first.") }), /* @__PURE__ */ x(f, {
292
+ children: [/* @__PURE__ */ x("p", { children: A("botlit.kb.form.noModels", "No embedding model is registered yet. Register one with an active provider in Settings first.") }), /* @__PURE__ */ x(f, {
276
293
  type: "button",
277
294
  variant: "ghost",
278
295
  className: "px-0",
279
- onClick: () => F("settings"),
280
- children: M("botlit.kb.form.openSettings", "Open Settings")
296
+ onClick: () => N("settings"),
297
+ children: A("botlit.kb.form.openSettings", "Open Settings")
281
298
  })]
282
299
  })
283
300
  ]
@@ -286,29 +303,29 @@ var ze = "flex h-10 w-full rounded-md border border-border-default bg-bg-surface
286
303
  className: "grid grid-cols-1 gap-4 md:grid-cols-3",
287
304
  children: [
288
305
  /* @__PURE__ */ x(p, {
289
- label: M("botlit.kb.form.strategy", "Chunking Strategy"),
306
+ label: A("botlit.kb.form.strategy", "Chunking Strategy"),
290
307
  htmlFor: Q("strategy"),
291
- description: M(`botlit.kb.strategyHelp.${A[Be(K.chunkingStrategy)].key}`, A[Be(K.chunkingStrategy)].fallback),
308
+ description: A(`botlit.kb.strategyHelp.${ze[Ke(W.chunkingStrategy)].key}`, ze[Ke(W.chunkingStrategy)].fallback),
292
309
  children: /* @__PURE__ */ x("select", {
293
310
  id: Q("strategy"),
294
- className: ze,
311
+ className: Ge,
295
312
  "aria-describedby": `${Q("strategy")}-description`,
296
- value: K.chunkingStrategy,
297
- onChange: (e) => q({
298
- ...K,
313
+ value: W.chunkingStrategy,
314
+ onChange: (e) => G({
315
+ ...W,
299
316
  chunkingStrategy: e.target.value
300
317
  }),
301
- children: Ie.map((e) => /* @__PURE__ */ x("option", {
318
+ children: Re.map((e) => /* @__PURE__ */ x("option", {
302
319
  value: e,
303
320
  children: e
304
321
  }, e))
305
322
  })
306
323
  }),
307
324
  /* @__PURE__ */ x(p, {
308
- label: M("botlit.kb.form.chunkSize", "Chunk Size"),
325
+ label: A("botlit.kb.form.chunkSize", "Chunk Size"),
309
326
  htmlFor: Q("chunk-size"),
310
327
  error: Z("chunkSize"),
311
- description: M("botlit.kb.form.chunkSizeHelp", "In approximate tokens, {{min}} to {{max}}. Empty uses {{default}} when creating.", {
328
+ description: A("botlit.kb.form.chunkSizeHelp", "In approximate tokens, {{min}} to {{max}}. Empty uses {{default}} when creating.", {
312
329
  min: _.min,
313
330
  max: _.max,
314
331
  default: 512
@@ -321,18 +338,18 @@ var ze = "flex h-10 w-full rounded-md border border-border-default bg-bg-surface
321
338
  step: 1,
322
339
  "aria-invalid": Z("chunkSize") ? !0 : void 0,
323
340
  "aria-describedby": Z("chunkSize") ? `${Q("chunk-size")}-error` : `${Q("chunk-size")}-description`,
324
- value: K.chunkSize,
325
- onChange: (e) => q({
326
- ...K,
341
+ value: W.chunkSize,
342
+ onChange: (e) => G({
343
+ ...W,
327
344
  chunkSize: e.target.value
328
345
  })
329
346
  })
330
347
  }),
331
348
  /* @__PURE__ */ x(p, {
332
- label: M("botlit.kb.form.chunkOverlap", "Chunk Overlap"),
349
+ label: A("botlit.kb.form.chunkOverlap", "Chunk Overlap"),
333
350
  htmlFor: Q("chunk-overlap"),
334
351
  error: Z("chunkOverlap"),
335
- description: M("botlit.kb.form.chunkOverlapHelp", "Tokens shared between neighbouring chunks. 0 or more, and below the chunk size."),
352
+ description: A("botlit.kb.form.chunkOverlapHelp", "Tokens shared between neighbouring chunks. 0 or more, and below the chunk size."),
336
353
  children: /* @__PURE__ */ x(m, {
337
354
  id: Q("chunk-overlap"),
338
355
  type: "number",
@@ -340,32 +357,32 @@ var ze = "flex h-10 w-full rounded-md border border-border-default bg-bg-surface
340
357
  step: 1,
341
358
  "aria-invalid": Z("chunkOverlap") ? !0 : void 0,
342
359
  "aria-describedby": Z("chunkOverlap") ? `${Q("chunk-overlap")}-error` : `${Q("chunk-overlap")}-description`,
343
- value: K.chunkOverlap,
344
- onChange: (e) => q({
345
- ...K,
360
+ value: W.chunkOverlap,
361
+ onChange: (e) => G({
362
+ ...W,
346
363
  chunkOverlap: e.target.value
347
364
  })
348
365
  })
349
366
  })
350
367
  ]
351
368
  })
352
- ] }), ft = nt && Object.keys(X).length > 0 ? /* @__PURE__ */ S("div", {
369
+ ] }), $ = ct && Object.keys(X).length > 0 ? /* @__PURE__ */ S("div", {
353
370
  role: "alert",
354
371
  className: "flex items-start gap-2 rounded-lg border border-status-error-border bg-status-error-bg-subtle p-3 text-sm text-text-primary",
355
372
  children: [/* @__PURE__ */ x(C, {
356
373
  size: 16,
357
374
  className: "mt-0.5 text-status-error-text",
358
375
  "aria-hidden": "true"
359
- }), /* @__PURE__ */ x("p", { children: M("botlit.kb.errors.summary", "Fix the highlighted fields before saving.") })]
376
+ }), /* @__PURE__ */ x("p", { children: A("botlit.kb.errors.summary", "Fix the highlighted fields before saving.") })]
360
377
  }) : null;
361
- if (j) return /* @__PURE__ */ x(a, {
362
- title: M("botlit.kb.createTitle", "Create Knowledge Base"),
363
- description: M("botlit.kb.createDescription", "Set up an embedding index your agents can retrieve from"),
378
+ if (k) return /* @__PURE__ */ x(a, {
379
+ title: A("botlit.kb.createTitle", "Create Knowledge Base"),
380
+ description: A("botlit.kb.createDescription", "Set up an embedding index your agents can retrieve from"),
364
381
  leading: /* @__PURE__ */ x(f, {
365
382
  variant: "ghost",
366
383
  size: "icon",
367
- "aria-label": M("botlit.kb.back", "Back to knowledge bases"),
368
- onClick: () => F(P),
384
+ "aria-label": A("botlit.kb.back", "Back to knowledge bases"),
385
+ onClick: () => void yt(),
369
386
  children: /* @__PURE__ */ x(w, {
370
387
  size: 20,
371
388
  "aria-hidden": "true"
@@ -375,71 +392,71 @@ var ze = "flex h-10 w-full rounded-md border border-border-default bg-bg-surface
375
392
  className: "flex gap-2",
376
393
  children: [/* @__PURE__ */ x(f, {
377
394
  variant: "outline",
378
- onClick: () => F(P),
379
- children: M("botlit.common.cancel", "Cancel")
395
+ onClick: () => void yt(),
396
+ children: A("botlit.common.cancel", "Cancel")
380
397
  }), /* @__PURE__ */ x(f, {
381
398
  type: "submit",
382
399
  form: "kb-create-form",
383
400
  leftIcon: /* @__PURE__ */ x(E, { size: 16 }),
384
- isLoading: Ke.loading,
385
- children: M("botlit.kb.create", "Create")
401
+ isLoading: Qe.loading,
402
+ children: A("botlit.kb.create", "Create")
386
403
  })]
387
404
  }),
388
405
  children: /* @__PURE__ */ S("form", {
389
406
  id: "kb-create-form",
390
407
  noValidate: !0,
391
- onSubmit: (e) => void ot(e),
408
+ onSubmit: (e) => void bt(e),
392
409
  className: "max-w-3xl space-y-6",
393
- children: [ft, /* @__PURE__ */ S(s, { children: [/* @__PURE__ */ S(u, { children: [/* @__PURE__ */ x(d, { children: M("botlit.kb.indexConfig", "Index Configuration") }), /* @__PURE__ */ x(l, { children: M("botlit.kb.indexConfigCreateHelp", "The embedding model and its vector width are fixed once documents are indexed.") })] }), /* @__PURE__ */ x(c, {
410
+ children: [$, /* @__PURE__ */ S(s, { children: [/* @__PURE__ */ S(u, { children: [/* @__PURE__ */ x(d, { children: A("botlit.kb.indexConfig", "Index Configuration") }), /* @__PURE__ */ x(l, { children: A("botlit.kb.indexConfigCreateHelp", "The embedding model and its vector width are fixed once documents are indexed.") })] }), /* @__PURE__ */ x(c, {
394
411
  className: "space-y-4",
395
- children: dt(!0)
412
+ children: Tt(!0)
396
413
  })] })]
397
414
  })
398
415
  });
399
- if (Ue) return /* @__PURE__ */ x(a, {
400
- title: M("botlit.common.loading", "Loading..."),
416
+ if (Ye) return /* @__PURE__ */ x(a, {
417
+ title: A("botlit.common.loading", "Loading..."),
401
418
  children: /* @__PURE__ */ x("div", {
402
419
  role: "status",
403
420
  "aria-busy": "true",
404
- "aria-label": M("botlit.common.loading", "Loading..."),
421
+ "aria-label": A("botlit.common.loading", "Loading..."),
405
422
  className: "h-96 rounded-lg bg-bg-sunken motion-safe:animate-vc-shimmer"
406
423
  })
407
424
  });
408
- if (We) return /* @__PURE__ */ x(a, {
409
- title: M("botlit.kb.errorTitle", "Knowledge Base"),
425
+ if (Xe) return /* @__PURE__ */ x(a, {
426
+ title: A("botlit.kb.errorTitle", "Knowledge Base"),
410
427
  children: /* @__PURE__ */ x(o, {
411
- resource: M("botlit.kb.thisResource", "this knowledge base"),
412
- error: We,
413
- onRetry: () => void H()
428
+ resource: A("botlit.kb.thisResource", "this knowledge base"),
429
+ error: Xe,
430
+ onRetry: () => void B()
414
431
  })
415
432
  });
416
- if (!V) return /* @__PURE__ */ x(a, {
417
- title: M("botlit.kb.notFound.title", "Knowledge Base Not Found"),
433
+ if (!z) return /* @__PURE__ */ x(a, {
434
+ title: A("botlit.kb.notFound.title", "Knowledge Base Not Found"),
418
435
  children: /* @__PURE__ */ x(ae, {
419
436
  illustration: "empty-files",
420
- title: M("botlit.kb.notFound.title", "Knowledge Base Not Found"),
421
- description: M("botlit.kb.notFound.description", "This knowledge base doesn't exist."),
437
+ title: A("botlit.kb.notFound.title", "Knowledge Base Not Found"),
438
+ description: A("botlit.kb.notFound.description", "This knowledge base doesn't exist."),
422
439
  action: /* @__PURE__ */ x(f, {
423
- onClick: () => F(P),
424
- children: M("botlit.kb.notFound.back", "Back to Knowledge Bases")
440
+ onClick: () => N(M),
441
+ children: A("botlit.kb.notFound.back", "Back to Knowledge Bases")
425
442
  })
426
443
  })
427
444
  });
428
- let $ = Se(V.indexStatus), pt = !R && !z && !B.some((e) => e.id === V.embeddingModel);
445
+ let Et = Ce(z.indexStatus), Dt = !I && !L && !R.some((e) => e.id === z.embeddingModel);
429
446
  return /* @__PURE__ */ x(a, {
430
- title: V.name,
447
+ title: z.name,
431
448
  leading: /* @__PURE__ */ x(f, {
432
449
  variant: "ghost",
433
450
  size: "icon",
434
- "aria-label": M("botlit.kb.back", "Back to knowledge bases"),
435
- onClick: () => F(P),
451
+ "aria-label": A("botlit.kb.back", "Back to knowledge bases"),
452
+ onClick: () => N(M),
436
453
  children: /* @__PURE__ */ x(w, {
437
454
  size: 20,
438
455
  "aria-hidden": "true"
439
456
  })
440
457
  }),
441
- meta: /* @__PURE__ */ x(ce, { status: V.indexStatus }),
442
- description: V.description,
458
+ meta: /* @__PURE__ */ x(ce, { status: z.indexStatus }),
459
+ description: z.description,
443
460
  actions: /* @__PURE__ */ S("div", {
444
461
  className: "flex gap-2",
445
462
  children: [
@@ -447,65 +464,83 @@ var ze = "flex h-10 w-full rounded-md border border-border-default bg-bg-surface
447
464
  permission: r.KNOWLEDGE_MANAGE,
448
465
  children: /* @__PURE__ */ x(f, {
449
466
  variant: "outline",
450
- leftIcon: /* @__PURE__ */ x(Pe, { size: 16 }),
451
- onClick: () => void ct(),
452
- isLoading: Xe.loading,
453
- children: M("botlit.kb.rebuild", "Rebuild Index")
467
+ leftIcon: /* @__PURE__ */ x(Fe, { size: 16 }),
468
+ onClick: () => void St(),
469
+ isLoading: nt.loading,
470
+ children: A("botlit.kb.rebuild", "Rebuild Index")
454
471
  })
455
472
  }),
456
- tt ? /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(f, {
473
+ st ? /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(f, {
457
474
  variant: "outline",
458
475
  onClick: () => {
459
- q(Re(V)), G(!1), J(!1);
476
+ G(We(z)), U(!1), K(!1);
460
477
  },
461
- children: M("botlit.common.cancel", "Cancel")
478
+ children: A("botlit.common.cancel", "Cancel")
462
479
  }), /* @__PURE__ */ x(f, {
463
480
  type: "submit",
464
481
  form: "kb-edit-form",
465
482
  leftIcon: /* @__PURE__ */ x(E, { size: 16 }),
466
- isLoading: Je.loading,
467
- children: M("botlit.kb.save", "Save")
483
+ isLoading: et.loading,
484
+ children: A("botlit.kb.save", "Save")
468
485
  })] }) : /* @__PURE__ */ x(i, {
469
486
  permission: r.KNOWLEDGE_UPDATE,
470
487
  children: /* @__PURE__ */ x(f, {
471
488
  leftIcon: /* @__PURE__ */ x(D, { size: 16 }),
472
- onClick: () => G(!0),
473
- children: M("botlit.kb.configure", "Configure")
489
+ onClick: () => U(!0),
490
+ children: A("botlit.kb.configure", "Configure")
474
491
  })
475
492
  }),
476
- Ve(r.KNOWLEDGE_DELETE) && /* @__PURE__ */ x(f, {
493
+ qe(r.KNOWLEDGE_DELETE) && /* @__PURE__ */ x(f, {
477
494
  variant: "destructive",
478
- leftIcon: /* @__PURE__ */ x(O, { size: 16 }),
479
- isLoading: Qe.loading,
480
- onClick: () => void lt(),
481
- children: M("botlit.common.delete", "Delete")
495
+ leftIcon: /* @__PURE__ */ x(Ie, { size: 16 }),
496
+ isLoading: it.loading,
497
+ onClick: () => void Ct(),
498
+ children: A("botlit.common.delete", "Delete")
482
499
  })
483
500
  ]
484
501
  }),
485
502
  children: /* @__PURE__ */ S("div", {
486
503
  className: "space-y-6",
487
504
  children: [
488
- /* @__PURE__ */ x(ke, {
505
+ /* @__PURE__ */ x(Ae, {
489
506
  icon: /* @__PURE__ */ x(T, { size: 18 }),
490
- children: M("botlit.kb.purpose", "This knowledge base is one searchable library your agents can draw on. Review how its documents are chunked and indexed, rebuild the index when content changes, and confirm it is healthy, so agents retrieve accurate, up-to-date passages and can cite them in their answers.")
507
+ children: A("botlit.kb.purpose", "This knowledge base is one searchable library your agents can draw on. Review how its documents are chunked and indexed, rebuild the index when content changes, and confirm it is healthy, so agents retrieve accurate, up-to-date passages and can cite them in their answers.")
491
508
  }),
492
509
  /* @__PURE__ */ S("p", {
493
510
  role: "status",
494
511
  className: "text-sm text-text-secondary",
495
512
  "data-testid": "kb-status-help",
496
- children: [M(`botlit.kb.statusHelp.${$.key}`, $.fallback), Y && ` ${M("botlit.kb.refreshing", "This page refreshes by itself while indexing runs.")}`]
513
+ children: [A(`botlit.kb.statusHelp.${Et.key}`, Et.fallback), J && ` ${A("botlit.kb.refreshing", "This page refreshes by itself while indexing runs.")}`]
514
+ }),
515
+ z.totalDocuments === 0 && !J && j && /* @__PURE__ */ x(i, {
516
+ permission: r.KNOWLEDGE_MANAGE,
517
+ children: /* @__PURE__ */ S("div", {
518
+ className: "flex flex-wrap items-center gap-3 rounded-lg border border-border-subtle p-4",
519
+ children: [/* @__PURE__ */ x("p", {
520
+ className: "text-sm",
521
+ children: A("botlit.kb.addContentHint", "Next step: add content. Import a public web page, paste text or upload a text file, and it is indexed for your agents.")
522
+ }), /* @__PURE__ */ x(f, {
523
+ type: "button",
524
+ size: "sm",
525
+ onClick: () => document.getElementById(Be)?.scrollIntoView({
526
+ behavior: "smooth",
527
+ block: "start"
528
+ }),
529
+ children: A("botlit.kb.addContent", "Add content")
530
+ })]
531
+ })
497
532
  }),
498
- Xe.loading && /* @__PURE__ */ x("p", {
533
+ nt.loading && /* @__PURE__ */ x("p", {
499
534
  role: "status",
500
535
  className: "text-sm text-text-secondary",
501
- children: M("botlit.kb.rebuilding", "Rebuilding the index. This can take a few minutes for a large library.")
536
+ children: A("botlit.kb.rebuilding", "Rebuilding the index. This can take a few minutes for a large library.")
502
537
  }),
503
- rt && /* @__PURE__ */ x("p", {
538
+ lt && /* @__PURE__ */ x("p", {
504
539
  role: "alert",
505
540
  className: "text-sm text-status-warning-text",
506
- children: rt
541
+ children: lt
507
542
  }),
508
- pt && /* @__PURE__ */ S("div", {
543
+ Dt && /* @__PURE__ */ S("div", {
509
544
  role: "alert",
510
545
  "data-testid": "kb-model-warning",
511
546
  className: "flex items-start gap-2 rounded-lg border border-status-warning-border bg-status-warning-bg-subtle p-3 text-sm",
@@ -513,18 +548,18 @@ var ze = "flex h-10 w-full rounded-md border border-border-default bg-bg-surface
513
548
  size: 16,
514
549
  className: "mt-0.5 shrink-0 text-status-warning-text",
515
550
  "aria-hidden": "true"
516
- }), /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", { children: M("botlit.kb.modelWarning", "The embedding model of this knowledge base ({{model}}) is no longer available: it was deleted or turned off, or its provider was. Documents cannot be indexed and searches fail until a usable model is registered again in Settings.", { model: V.embeddingModel }) }), /* @__PURE__ */ x(f, {
551
+ }), /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", { children: A("botlit.kb.modelWarning", "The embedding model of this knowledge base ({{model}}) is no longer available: it was deleted or turned off, or its provider was. Documents cannot be indexed and searches fail until a usable model is registered again in Settings.", { model: z.embeddingModel }) }), /* @__PURE__ */ x(f, {
517
552
  type: "button",
518
553
  variant: "ghost",
519
554
  className: "px-0",
520
- onClick: () => F("settings"),
521
- children: M("botlit.kb.form.openSettings", "Open Settings")
555
+ onClick: () => N("settings"),
556
+ children: A("botlit.kb.form.openSettings", "Open Settings")
522
557
  })] })]
523
558
  }),
524
559
  /* @__PURE__ */ S("div", {
525
560
  className: "grid grid-cols-2 gap-4 md:grid-cols-4",
526
561
  children: [
527
- /* @__PURE__ */ S(Oe, {
562
+ /* @__PURE__ */ S(ke, {
528
563
  treatment: "glass",
529
564
  glow: !0,
530
565
  className: "p-6 text-center",
@@ -538,11 +573,11 @@ var ze = "flex h-10 w-full rounded-md border border-border-default bg-bg-surface
538
573
  }),
539
574
  /* @__PURE__ */ x("p", {
540
575
  className: "text-lg font-bold capitalize text-text-primary",
541
- children: V.indexStatus.toLowerCase()
576
+ children: z.indexStatus.toLowerCase()
542
577
  }),
543
578
  /* @__PURE__ */ x("p", {
544
579
  className: "text-sm text-text-secondary",
545
- children: M("botlit.kb.indexStatus", "Index Status")
580
+ children: A("botlit.kb.indexStatus", "Index Status")
546
581
  })
547
582
  ]
548
583
  }),
@@ -550,128 +585,155 @@ var ze = "flex h-10 w-full rounded-md border border-border-default bg-bg-surface
550
585
  className: "pt-6 text-center",
551
586
  children: [/* @__PURE__ */ x("p", {
552
587
  className: "text-3xl font-bold text-text-primary",
553
- children: V.totalDocuments
588
+ children: z.totalDocuments
554
589
  }), /* @__PURE__ */ x("p", {
555
590
  className: "text-sm text-text-secondary",
556
- children: M("botlit.kb.documents", "Documents")
591
+ children: A("botlit.kb.documents", "Documents")
557
592
  })]
558
593
  }) }),
559
594
  /* @__PURE__ */ x(s, { children: /* @__PURE__ */ S(c, {
560
595
  className: "pt-6 text-center",
561
596
  children: [/* @__PURE__ */ x("p", {
562
597
  className: "text-3xl font-bold text-text-primary",
563
- children: V.totalChunks
598
+ children: z.totalChunks
564
599
  }), /* @__PURE__ */ x("p", {
565
600
  className: "text-sm text-text-secondary",
566
- children: M("botlit.kb.chunks", "Chunks")
601
+ children: A("botlit.kb.chunks", "Chunks")
567
602
  })]
568
603
  }) }),
569
604
  /* @__PURE__ */ x(s, { children: /* @__PURE__ */ S(c, {
570
605
  className: "pt-6 text-center",
571
606
  children: [/* @__PURE__ */ x("p", {
572
607
  className: "text-3xl font-bold text-text-primary",
573
- children: V.vectorCount
608
+ children: z.vectorCount
574
609
  }), /* @__PURE__ */ x("p", {
575
610
  className: "text-sm text-text-secondary",
576
- children: M("botlit.kb.vectors", "Vectors")
611
+ children: A("botlit.kb.vectors", "Vectors")
577
612
  })]
578
613
  }) })
579
614
  ]
580
615
  }),
581
- /* @__PURE__ */ x(oe, { knowledgeBaseId: V.id }),
616
+ /* @__PURE__ */ x(oe, { knowledgeBaseId: z.id }),
582
617
  /* @__PURE__ */ S(s, { children: [/* @__PURE__ */ S(u, { children: [/* @__PURE__ */ S(d, {
583
618
  className: "flex items-center gap-2",
584
- children: [/* @__PURE__ */ x(Ne, {
619
+ children: [/* @__PURE__ */ x(Pe, {
585
620
  size: 18,
586
621
  "aria-hidden": "true"
587
- }), M("botlit.kb.indexConfig", "Index Configuration")]
588
- }), /* @__PURE__ */ x(l, { children: M("botlit.kb.indexConfigHelp", "How documents are embedded and split before they are indexed") })] }), /* @__PURE__ */ x(c, {
622
+ }), A("botlit.kb.indexConfig", "Index Configuration")]
623
+ }), /* @__PURE__ */ x(l, { children: A("botlit.kb.indexConfigHelp", "How documents are embedded and split before they are indexed") })] }), /* @__PURE__ */ x(c, {
589
624
  className: "space-y-4",
590
- children: tt ? /* @__PURE__ */ S("form", {
625
+ children: st ? /* @__PURE__ */ S("form", {
591
626
  id: "kb-edit-form",
592
627
  noValidate: !0,
593
- onSubmit: (e) => void st(e),
628
+ onSubmit: (e) => void xt(e),
594
629
  className: "space-y-4",
595
- children: [ft, dt(!1)]
630
+ children: [$, Tt(!1)]
596
631
  }) : /* @__PURE__ */ S("div", {
597
632
  className: "grid grid-cols-2 gap-6 md:grid-cols-3",
598
633
  children: [
599
634
  /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
600
635
  className: "text-sm text-text-secondary",
601
- children: M("botlit.kb.embeddingModel", "Embedding Model")
636
+ children: A("botlit.kb.embeddingModel", "Embedding Model")
602
637
  }), /* @__PURE__ */ x("p", {
603
638
  className: "font-mono text-sm font-medium",
604
- children: V.embeddingModel
639
+ children: z.embeddingModel
605
640
  })] }),
606
641
  /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
607
642
  className: "text-sm text-text-secondary",
608
- children: M("botlit.kb.dimensions", "Dimensions")
643
+ children: A("botlit.kb.dimensions", "Dimensions")
609
644
  }), /* @__PURE__ */ x("p", {
610
645
  className: "font-medium",
611
- children: V.embeddingDimensions
646
+ children: z.embeddingDimensions
612
647
  })] }),
613
648
  /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
614
649
  className: "text-sm text-text-secondary",
615
- children: M("botlit.kb.form.strategy", "Chunking Strategy")
650
+ children: A("botlit.kb.form.strategy", "Chunking Strategy")
616
651
  }), /* @__PURE__ */ x("p", {
617
652
  className: "font-medium",
618
- children: V.chunkingStrategy
653
+ children: z.chunkingStrategy
619
654
  })] }),
620
655
  /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
621
656
  className: "text-sm text-text-secondary",
622
- children: M("botlit.kb.form.chunkSize", "Chunk Size")
657
+ children: A("botlit.kb.form.chunkSize", "Chunk Size")
623
658
  }), /* @__PURE__ */ x("p", {
624
659
  className: "font-medium",
625
- children: V.chunkSize
660
+ children: z.chunkSize
626
661
  })] }),
627
662
  /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
628
663
  className: "text-sm text-text-secondary",
629
- children: M("botlit.kb.form.chunkOverlap", "Chunk Overlap")
664
+ children: A("botlit.kb.form.chunkOverlap", "Chunk Overlap")
630
665
  }), /* @__PURE__ */ x("p", {
631
666
  className: "font-medium",
632
- children: V.chunkOverlap
667
+ children: z.chunkOverlap
633
668
  })] }),
634
669
  /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
635
670
  className: "text-sm text-text-secondary",
636
- children: M("botlit.kb.lastIndexed", "Last Indexed")
671
+ children: A("botlit.kb.lastIndexed", "Last Indexed")
637
672
  }), /* @__PURE__ */ x("p", {
638
673
  className: "font-medium",
639
- children: V.lastIndexedAt ? g(V.lastIndexedAt) : M("botlit.kb.never", "Never")
674
+ children: z.lastIndexedAt ? g(z.lastIndexedAt) : A("botlit.kb.never", "Never")
640
675
  })] })
641
676
  ]
642
677
  })
643
678
  })] }),
644
- N && /* @__PURE__ */ x(i, {
679
+ j && /* @__PURE__ */ x(i, {
645
680
  permission: r.KNOWLEDGE_MANAGE,
646
- children: /* @__PURE__ */ x(re, { knowledgeBaseId: N })
681
+ children: /* @__PURE__ */ x("div", {
682
+ id: Be,
683
+ children: /* @__PURE__ */ x(re, { knowledgeBaseId: j })
684
+ })
647
685
  }),
648
- N && /* @__PURE__ */ x(ie, {
649
- knowledgeBaseId: N,
650
- documentTitles: new Map(W.map((e) => [e.id, e.title]))
686
+ j && /* @__PURE__ */ x(ie, {
687
+ knowledgeBaseId: j,
688
+ documentTitles: new Map(H.map((e) => [e.id, e.title]))
651
689
  }),
652
- /* @__PURE__ */ S(s, { children: [/* @__PURE__ */ S(u, { children: [/* @__PURE__ */ S(d, {
653
- className: "flex items-center gap-2",
654
- children: [/* @__PURE__ */ x(Me, {
655
- size: 18,
656
- "aria-hidden": "true"
657
- }), M("botlit.kb.documentsTitle", "Documents ({{count}})", { count: V.totalDocuments })]
658
- }), /* @__PURE__ */ x(l, { children: M("botlit.kb.documentsHelp", "Source documents indexed into this knowledge base") })] }), /* @__PURE__ */ x(c, {
690
+ /* @__PURE__ */ S(s, { children: [/* @__PURE__ */ S(u, { children: [
691
+ /* @__PURE__ */ S(d, {
692
+ className: "flex items-center gap-2",
693
+ children: [/* @__PURE__ */ x(Ne, {
694
+ size: 18,
695
+ "aria-hidden": "true"
696
+ }), A("botlit.kb.documentsTitle", "Documents ({{count}})", { count: z.totalDocuments })]
697
+ }),
698
+ /* @__PURE__ */ x(l, { children: A("botlit.kb.documentsHelp", "Source documents indexed into this knowledge base") }),
699
+ gt.length > 1 && /* @__PURE__ */ S("label", {
700
+ className: "mt-2 flex items-center gap-2 text-sm",
701
+ children: [/* @__PURE__ */ x("span", {
702
+ className: "text-text-secondary",
703
+ children: A("botlit.kb.documentFilter.label", "Show")
704
+ }), /* @__PURE__ */ S("select", {
705
+ className: Ve,
706
+ value: q,
707
+ onChange: (e) => dt(e.target.value),
708
+ children: [/* @__PURE__ */ x("option", {
709
+ value: "",
710
+ children: A("botlit.kb.documentFilter.all", "All documents ({{count}})", { count: H.length })
711
+ }), gt.map(([e, t]) => /* @__PURE__ */ x("option", {
712
+ value: e,
713
+ children: A(`botlit.kb.documentFilter.${e.toLowerCase()}`, "{{status}} ({{count}})", {
714
+ status: He(e),
715
+ count: t
716
+ })
717
+ }, e))]
718
+ })]
719
+ })
720
+ ] }), /* @__PURE__ */ x(c, {
659
721
  className: "p-0",
660
- children: U.loading ? /* @__PURE__ */ x("p", {
722
+ children: V.loading ? /* @__PURE__ */ x("p", {
661
723
  role: "status",
662
724
  "aria-busy": "true",
663
725
  className: "p-8 text-center text-text-secondary",
664
- children: M("botlit.kb.documentsLoading", "Loading documents…")
665
- }) : U.error ? /* @__PURE__ */ x("div", {
726
+ children: A("botlit.kb.documentsLoading", "Loading documents…")
727
+ }) : V.error ? /* @__PURE__ */ x("div", {
666
728
  className: "p-4",
667
729
  children: /* @__PURE__ */ x(o, {
668
- resource: M("botlit.kb.documentsResource", "documents"),
669
- error: U.error,
670
- onRetry: () => void U.refetch()
730
+ resource: A("botlit.kb.documentsResource", "documents"),
731
+ error: V.error,
732
+ onRetry: () => void V.refetch()
671
733
  })
672
- }) : W.length > 0 ? /* @__PURE__ */ x("ul", {
734
+ }) : vt.length > 0 ? /* @__PURE__ */ x("ul", {
673
735
  className: "divide-y divide-border-subtle",
674
- children: W.map((e) => /* @__PURE__ */ S("li", {
736
+ children: vt.map((e) => /* @__PURE__ */ S("li", {
675
737
  className: "flex items-center justify-between gap-4 p-4",
676
738
  children: [/* @__PURE__ */ S("div", {
677
739
  className: "min-w-0",
@@ -682,7 +744,7 @@ var ze = "flex h-10 w-full rounded-md border border-border-default bg-bg-surface
682
744
  }),
683
745
  /* @__PURE__ */ x("p", {
684
746
  className: "text-sm text-text-secondary",
685
- children: M("botlit.kb.document.meta", "{{chunks}} chunks · added {{added}}", {
747
+ children: A("botlit.kb.document.meta", "{{chunks}} chunks · added {{added}}", {
686
748
  chunks: e.chunkCount,
687
749
  added: g(e.addedAt)
688
750
  })
@@ -694,12 +756,12 @@ var ze = "flex h-10 w-full rounded-md border border-border-default bg-bg-surface
694
756
  ]
695
757
  }), /* @__PURE__ */ S("div", {
696
758
  className: "flex items-center gap-3",
697
- children: [/* @__PURE__ */ x(ce, { status: e.status }), Ve(r.KNOWLEDGE_DELETE) && /* @__PURE__ */ x(f, {
759
+ children: [/* @__PURE__ */ x(ce, { status: e.status }), qe(r.KNOWLEDGE_DELETE) && /* @__PURE__ */ x(f, {
698
760
  variant: "ghost",
699
761
  size: "icon",
700
- "aria-label": M("botlit.kb.document.removeFor", "Remove {{title}}", { title: e.title }),
701
- onClick: () => void ut(e),
702
- children: /* @__PURE__ */ x(O, {
762
+ "aria-label": A("botlit.kb.document.removeFor", "Remove {{title}}", { title: e.title }),
763
+ onClick: () => void wt(e),
764
+ children: /* @__PURE__ */ x(Ie, {
703
765
  size: 16,
704
766
  "aria-hidden": "true"
705
767
  })
@@ -708,53 +770,53 @@ var ze = "flex h-10 w-full rounded-md border border-border-default bg-bg-surface
708
770
  }, e.id))
709
771
  }) : /* @__PURE__ */ S("div", {
710
772
  className: "p-8 text-center text-text-secondary",
711
- children: [/* @__PURE__ */ x(je, {
773
+ children: [/* @__PURE__ */ x(Me, {
712
774
  className: "mx-auto mb-2 h-8 w-8 opacity-50",
713
775
  "aria-hidden": "true"
714
- }), /* @__PURE__ */ x("p", { children: M("botlit.kb.noDocuments", "No documents indexed yet") })]
776
+ }), /* @__PURE__ */ x("p", { children: A("botlit.kb.noDocuments", "No documents indexed yet") })]
715
777
  })
716
778
  })] }),
717
- N && /* @__PURE__ */ x(i, {
779
+ j && /* @__PURE__ */ x(i, {
718
780
  permission: r.KNOWLEDGE_MANAGE,
719
- children: /* @__PURE__ */ x(ee, { knowledgeBaseId: N })
781
+ children: /* @__PURE__ */ x(ee, { knowledgeBaseId: j })
720
782
  }),
721
- N && /* @__PURE__ */ x(te, {
722
- knowledgeBaseId: N,
723
- documents: W
783
+ j && /* @__PURE__ */ x(te, {
784
+ knowledgeBaseId: j,
785
+ documents: H
724
786
  }),
725
- N && /* @__PURE__ */ x(i, {
787
+ j && /* @__PURE__ */ x(i, {
726
788
  permission: r.KNOWLEDGE_MANAGE,
727
- children: /* @__PURE__ */ x(n, { knowledgeBaseId: N })
789
+ children: /* @__PURE__ */ x(n, { knowledgeBaseId: j })
728
790
  }),
729
791
  /* @__PURE__ */ S(s, { children: [/* @__PURE__ */ x(u, { children: /* @__PURE__ */ S(d, {
730
792
  className: "flex items-center gap-2",
731
793
  children: [/* @__PURE__ */ x(D, {
732
794
  size: 18,
733
795
  "aria-hidden": "true"
734
- }), M("botlit.kb.metadata", "Metadata")]
796
+ }), A("botlit.kb.metadata", "Metadata")]
735
797
  }) }), /* @__PURE__ */ x(c, { children: /* @__PURE__ */ S("div", {
736
798
  className: "grid grid-cols-2 gap-6 text-sm md:grid-cols-3",
737
799
  children: [
738
800
  /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
739
801
  className: "text-text-secondary",
740
- children: M("botlit.kb.createdAt", "Created")
802
+ children: A("botlit.kb.createdAt", "Created")
741
803
  }), /* @__PURE__ */ x("p", {
742
804
  className: "font-medium",
743
- children: g(V.createdAt)
805
+ children: g(z.createdAt)
744
806
  })] }),
745
807
  /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
746
808
  className: "text-text-secondary",
747
- children: M("botlit.kb.updatedLabel", "Updated")
809
+ children: A("botlit.kb.updatedLabel", "Updated")
748
810
  }), /* @__PURE__ */ x("p", {
749
811
  className: "font-medium",
750
- children: g(V.updatedAt)
812
+ children: g(z.updatedAt)
751
813
  })] }),
752
814
  /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
753
815
  className: "text-text-secondary",
754
- children: M("botlit.kb.lastIndexed", "Last Indexed")
816
+ children: A("botlit.kb.lastIndexed", "Last Indexed")
755
817
  }), /* @__PURE__ */ x("p", {
756
818
  className: "font-medium",
757
- children: V.lastIndexedAt ? g(V.lastIndexedAt) : "—"
819
+ children: z.lastIndexedAt ? g(z.lastIndexedAt) : "—"
758
820
  })] })
759
821
  ]
760
822
  }) })] })
@@ -762,9 +824,9 @@ var ze = "flex h-10 w-full rounded-md border border-border-default bg-bg-surface
762
824
  })
763
825
  });
764
826
  };
765
- function Be(e) {
766
- return Ie.find((t) => t === e) ?? "RECURSIVE";
827
+ function Ke(e) {
828
+ return Re.find((t) => t === e) ?? "RECURSIVE";
767
829
  }
768
- export { j as KnowledgeBaseDetailPage };
830
+ export { k as KnowledgeBaseDetailPage };
769
831
 
770
832
  //# sourceMappingURL=KnowledgeBaseDetailPage.js.map