@burdenoff/microfe-botmanor 2026.1118.2 → 2026.1118.3
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/dist/botlit/components/AssistantRuntimeSetupPanel.js +46 -34
- package/dist/botlit/components/AssistantRuntimeSetupPanel.js.map +1 -1
- package/dist/botlit/components/KnowledgeSourceImportPanel.js +92 -71
- package/dist/botlit/components/KnowledgeSourceImportPanel.js.map +1 -1
- package/dist/botlit/utils/knowledgeImportStatus.d.ts +17 -0
- package/dist/botlit/utils/knowledgeImportStatus.js +60 -0
- package/dist/botlit/utils/knowledgeImportStatus.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,76 +1,88 @@
|
|
|
1
1
|
import { useAssistantRuntimeSetup as e } from "../hooks/useAssistantRuntimeSetup.js";
|
|
2
2
|
import { useBotlit as t } from "../providers/BotlitProvider.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { graphqlErrorMessage as n } from "../utils/errors.js";
|
|
4
|
+
import { Button as r } from "./Button.js";
|
|
5
|
+
import { useState as i } from "react";
|
|
6
|
+
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
6
7
|
// src/botlit/components/AssistantRuntimeSetupPanel.tsx
|
|
7
|
-
function
|
|
8
|
+
function c({ agentId: e, onConfigured: n }) {
|
|
8
9
|
let { workspaceId: r, currentUser: i } = t();
|
|
9
|
-
return /* @__PURE__ */
|
|
10
|
+
return /* @__PURE__ */ o(l, {
|
|
10
11
|
agentId: e,
|
|
11
12
|
onConfigured: n
|
|
12
13
|
}, `${r}:${i?.id}:${e}`);
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
-
let { connections:
|
|
16
|
-
return /* @__PURE__ */
|
|
15
|
+
function l({ agentId: t, onConfigured: c }) {
|
|
16
|
+
let { connections: l, configure: u } = e(t), [d, f] = i(""), [p, m] = i(""), [h, g] = i(!1);
|
|
17
|
+
return /* @__PURE__ */ s("section", {
|
|
17
18
|
className: "space-y-4 rounded-lg border border-border-default p-5",
|
|
18
19
|
children: [
|
|
19
|
-
/* @__PURE__ */
|
|
20
|
+
/* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("h2", {
|
|
20
21
|
className: "text-lg font-semibold",
|
|
21
22
|
children: "Assistant setup"
|
|
22
|
-
}), /* @__PURE__ */
|
|
23
|
+
}), /* @__PURE__ */ o("p", {
|
|
23
24
|
className: "text-sm text-text-secondary",
|
|
24
25
|
children: "Connect this assistant to Fluidgrids for answers and recovery. Course teachers also receive content ingestion workflows."
|
|
25
26
|
})] }),
|
|
26
|
-
|
|
27
|
+
l.isPending ? /* @__PURE__ */ o("p", {
|
|
27
28
|
role: "status",
|
|
28
29
|
children: "Loading connections…"
|
|
29
|
-
}) :
|
|
30
|
+
}) : l.isError ? /* @__PURE__ */ s("div", {
|
|
30
31
|
role: "alert",
|
|
31
|
-
children: [/* @__PURE__ */
|
|
32
|
+
children: [/* @__PURE__ */ o("p", { children: "Connections could not be loaded. Check your access and try again." }), /* @__PURE__ */ o(r, {
|
|
32
33
|
variant: "outline",
|
|
33
|
-
onClick: () => void
|
|
34
|
+
onClick: () => void l.refetch(),
|
|
34
35
|
children: "Reload connections"
|
|
35
36
|
})]
|
|
36
|
-
}) :
|
|
37
|
+
}) : l.data?.length ? /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ s("label", {
|
|
37
38
|
className: "grid gap-2 text-sm font-medium",
|
|
38
|
-
children: ["Workflow connection", /* @__PURE__ */
|
|
39
|
+
children: ["Workflow connection", /* @__PURE__ */ s("select", {
|
|
39
40
|
className: "h-10 rounded-md border border-border-default bg-bg-surface px-3",
|
|
40
|
-
value:
|
|
41
|
-
disabled:
|
|
41
|
+
value: d,
|
|
42
|
+
disabled: u.isPending,
|
|
42
43
|
onChange: (e) => {
|
|
43
|
-
|
|
44
|
+
f(e.target.value), m("");
|
|
44
45
|
},
|
|
45
|
-
children: [/* @__PURE__ */
|
|
46
|
+
children: [/* @__PURE__ */ o("option", {
|
|
46
47
|
value: "",
|
|
47
48
|
children: "Choose a connection"
|
|
48
|
-
}),
|
|
49
|
+
}), l.data.map((e) => /* @__PURE__ */ o("option", {
|
|
49
50
|
value: e.id,
|
|
50
51
|
children: e.name
|
|
51
52
|
}, e.id))]
|
|
52
53
|
})]
|
|
53
|
-
}), /* @__PURE__ */
|
|
54
|
-
disabled: !
|
|
55
|
-
isLoading:
|
|
54
|
+
}), /* @__PURE__ */ o(r, {
|
|
55
|
+
disabled: !d,
|
|
56
|
+
isLoading: u.isPending,
|
|
56
57
|
onClick: async () => {
|
|
57
|
-
|
|
58
|
+
m(""), g(!1);
|
|
58
59
|
try {
|
|
59
|
-
let e = await
|
|
60
|
-
|
|
61
|
-
} catch {
|
|
62
|
-
|
|
60
|
+
let e = await u.mutateAsync(d);
|
|
61
|
+
m(e.ready ? "Assistant configured and ready." : "Workflows configured. Activate the assistant and finish indexing its knowledge before using it."), c();
|
|
62
|
+
} catch (e) {
|
|
63
|
+
g(!0), m(n(e, "Setup could not be completed. Check the model, knowledge scope and your permissions, then try again."));
|
|
63
64
|
}
|
|
64
65
|
},
|
|
65
66
|
children: "Configure assistant"
|
|
66
|
-
})] }) : /* @__PURE__ */
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
})] }) : /* @__PURE__ */ s("div", {
|
|
68
|
+
className: "space-y-2 text-sm",
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ o("p", { children: "This workspace has no BotManor Assistant Runtime connection yet. The runtime lets FluidGrids answer questions and process knowledge imports for this assistant." }),
|
|
71
|
+
/* @__PURE__ */ o("p", { children: "In Integrations, connect “BotManor Assistant Runtime”, then select “Reload connections”." }),
|
|
72
|
+
/* @__PURE__ */ o(r, {
|
|
73
|
+
variant: "outline",
|
|
74
|
+
onClick: () => void l.refetch(),
|
|
75
|
+
children: "Reload connections"
|
|
76
|
+
})
|
|
77
|
+
]
|
|
78
|
+
}),
|
|
79
|
+
p && /* @__PURE__ */ o("p", {
|
|
80
|
+
role: h ? "alert" : "status",
|
|
81
|
+
children: p
|
|
70
82
|
})
|
|
71
83
|
]
|
|
72
84
|
});
|
|
73
85
|
}
|
|
74
|
-
export {
|
|
86
|
+
export { c as AssistantRuntimeSetupPanel };
|
|
75
87
|
|
|
76
88
|
//# sourceMappingURL=AssistantRuntimeSetupPanel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantRuntimeSetupPanel.js","names":["_Fragment","Fragment$1","AssistantRuntimeSetupPanel","useBotlit","ScopedSetupPanel","workspaceId","currentUser","agentId","useAssistantRuntimeSetup","selected","setSelected","useState","message","setMessage","failed","setFailed","connections","Button","configure","event","connection","result","onConfigured"],"sources":["../../../src/botlit/components/AssistantRuntimeSetupPanel.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { useAssistantRuntimeSetup } from '../hooks/useAssistantRuntimeSetup';\nimport { useBotlit } from '../providers/BotlitProvider';\nimport { Button } from './Button';\n\nexport function AssistantRuntimeSetupPanel({\n agentId,\n onConfigured,\n}: {\n agentId: string;\n onConfigured: () => void;\n}) {\n const { workspaceId, currentUser } = useBotlit();\n return (\n <ScopedSetupPanel\n key={`${workspaceId}:${currentUser?.id}:${agentId}`}\n agentId={agentId}\n onConfigured={onConfigured}\n />\n );\n}\n\nfunction ScopedSetupPanel({\n agentId,\n onConfigured,\n}: {\n agentId: string;\n onConfigured: () => void;\n}) {\n const { connections, configure } = useAssistantRuntimeSetup(agentId);\n const [selected, setSelected] = useState('');\n const [message, setMessage] = useState('');\n const [failed, setFailed] = useState(false);\n return (\n <section className=\"space-y-4 rounded-lg border border-border-default p-5\">\n <div>\n <h2 className=\"text-lg font-semibold\">Assistant setup</h2>\n <p className=\"text-sm text-text-secondary\">\n Connect this assistant to Fluidgrids for answers and recovery. Course teachers also\n receive content ingestion workflows.\n </p>\n </div>\n {connections.isPending ? (\n <p role=\"status\">Loading connections…</p>\n ) : connections.isError ? (\n <div role=\"alert\">\n <p>Connections could not be loaded. Check your access and try again.</p>\n <Button variant=\"outline\" onClick={() => void connections.refetch()}>\n Reload connections\n </Button>\n </div>\n ) : !connections.data?.length ? (\n <p>\n
|
|
1
|
+
{"version":3,"file":"AssistantRuntimeSetupPanel.js","names":["_Fragment","Fragment$1","AssistantRuntimeSetupPanel","useBotlit","ScopedSetupPanel","workspaceId","currentUser","agentId","useAssistantRuntimeSetup","selected","setSelected","useState","message","setMessage","failed","setFailed","connections","Button","configure","event","connection","result","onConfigured","error","graphqlErrorMessage"],"sources":["../../../src/botlit/components/AssistantRuntimeSetupPanel.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { useAssistantRuntimeSetup } from '../hooks/useAssistantRuntimeSetup';\nimport { useBotlit } from '../providers/BotlitProvider';\nimport { graphqlErrorMessage } from '../utils/errors';\nimport { Button } from './Button';\n\nexport function AssistantRuntimeSetupPanel({\n agentId,\n onConfigured,\n}: {\n agentId: string;\n onConfigured: () => void;\n}) {\n const { workspaceId, currentUser } = useBotlit();\n return (\n <ScopedSetupPanel\n key={`${workspaceId}:${currentUser?.id}:${agentId}`}\n agentId={agentId}\n onConfigured={onConfigured}\n />\n );\n}\n\nfunction ScopedSetupPanel({\n agentId,\n onConfigured,\n}: {\n agentId: string;\n onConfigured: () => void;\n}) {\n const { connections, configure } = useAssistantRuntimeSetup(agentId);\n const [selected, setSelected] = useState('');\n const [message, setMessage] = useState('');\n const [failed, setFailed] = useState(false);\n return (\n <section className=\"space-y-4 rounded-lg border border-border-default p-5\">\n <div>\n <h2 className=\"text-lg font-semibold\">Assistant setup</h2>\n <p className=\"text-sm text-text-secondary\">\n Connect this assistant to Fluidgrids for answers and recovery. Course teachers also\n receive content ingestion workflows.\n </p>\n </div>\n {connections.isPending ? (\n <p role=\"status\">Loading connections…</p>\n ) : connections.isError ? (\n <div role=\"alert\">\n <p>Connections could not be loaded. Check your access and try again.</p>\n <Button variant=\"outline\" onClick={() => void connections.refetch()}>\n Reload connections\n </Button>\n </div>\n ) : !connections.data?.length ? (\n <div className=\"space-y-2 text-sm\">\n <p>\n This workspace has no BotManor Assistant Runtime connection yet. The runtime lets\n FluidGrids answer questions and process knowledge imports for this assistant.\n </p>\n <p>\n In Integrations, connect “BotManor Assistant Runtime”, then select “Reload connections”.\n </p>\n <Button variant=\"outline\" onClick={() => void connections.refetch()}>\n Reload connections\n </Button>\n </div>\n ) : (\n <>\n <label className=\"grid gap-2 text-sm font-medium\">\n Workflow connection\n <select\n className=\"h-10 rounded-md border border-border-default bg-bg-surface px-3\"\n value={selected}\n disabled={configure.isPending}\n onChange={(event) => {\n setSelected(event.target.value);\n setMessage('');\n }}\n >\n <option value=\"\">Choose a connection</option>\n {connections.data.map((connection) => (\n <option key={connection.id} value={connection.id}>\n {connection.name}\n </option>\n ))}\n </select>\n </label>\n <Button\n disabled={!selected}\n isLoading={configure.isPending}\n onClick={async () => {\n setMessage('');\n setFailed(false);\n try {\n const result = await configure.mutateAsync(selected);\n setMessage(\n result.ready\n ? 'Assistant configured and ready.'\n : 'Workflows configured. Activate the assistant and finish indexing its knowledge before using it.'\n );\n onConfigured();\n } catch (error) {\n setFailed(true);\n // The service names what is missing (model, provider key, connection or FluidGrids step).\n setMessage(\n graphqlErrorMessage(\n error,\n 'Setup could not be completed. Check the model, knowledge scope and your permissions, then try again.'\n )\n );\n }\n }}\n >\n Configure assistant\n </Button>\n </>\n )}\n {message && <p role={failed ? 'alert' : 'status'}>{message}</p>}\n </section>\n );\n}\n"],"mappings":";;;;;;;AAMA,SAAgBE,EAA2B,EACzC,YACA,mBAIC;CACD,IAAM,EAAE,gBAAa,mBAAgBC,EAAU;CAC/C,OACE,kBAACC,GAAD;EAEW;EACK;CACf,GAHM,GAAGC,EAAY,GAAGC,GAAa,GAAG,GAAGC,GAG3C;AAEL;AAEA,SAASH,EAAiB,EACxB,YACA,mBAIC;CACD,IAAM,EAAE,gBAAa,iBAAcI,EAAyBD,CAAO,GAC7D,CAAC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MnD,AALAI,EACEQ,EAAO,QACH,oCACA,iGACN,GACAC,EAAa;KACf,SAASC,GAAO;MAGd,AAFAR,EAAU,EAAI,GAEdF,EACEW,EACED,GACA,sGACF,CACF;KACF;IACF;IACD,UAAA;GAEO,CAAA,CACR,EAAA,CAAA,IA7DF,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA;KACE,kBAAC,KAAD,EAAA,UAAG,kKAGA,CAAA;KACH,kBAAC,KAAD,EAAA,UAAG,2FAEA,CAAA;KACH,kBAACN,GAAD;MAAQ,SAAQ;MAAU,eAAe,KAAKD,EAAY,QAAQ;MAAG,UAAA;KAE7D,CAAA;IACL;GAEL,CAAA;GAkDDJ,KAAW,kBAAC,KAAD;IAAG,MAAME,IAAS,UAAU;IAAW,UAAAF;GAAW,CAAA;EACvD;;AAEb"}
|
|
@@ -1,134 +1,155 @@
|
|
|
1
1
|
import { useKnowledgeSourceImports as e } from "../hooks/useKnowledgeSourceImports.js";
|
|
2
2
|
import { useBotlit as t } from "../providers/BotlitProvider.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { graphqlErrorMessage as n } from "../utils/errors.js";
|
|
4
|
+
import { knowledgeImportStatus as r } from "../utils/knowledgeImportStatus.js";
|
|
5
|
+
import { Button as i } from "./Button.js";
|
|
6
|
+
import { useRef as a, useState as o } from "react";
|
|
7
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
6
8
|
// src/botlit/components/KnowledgeSourceImportPanel.tsx
|
|
7
|
-
|
|
9
|
+
var l = {
|
|
10
|
+
info: "text-text-secondary",
|
|
11
|
+
success: "text-status-success-text",
|
|
12
|
+
warning: "text-status-warning-text",
|
|
13
|
+
error: "text-status-error-text"
|
|
14
|
+
};
|
|
15
|
+
function u({ knowledgeBaseId: e }) {
|
|
8
16
|
let { workspaceId: n, currentUser: r } = t();
|
|
9
|
-
return /* @__PURE__ */
|
|
17
|
+
return /* @__PURE__ */ s(d, { knowledgeBaseId: e }, `${n}:${r?.id}:${e}`);
|
|
10
18
|
}
|
|
11
|
-
function
|
|
12
|
-
let
|
|
13
|
-
return /* @__PURE__ */
|
|
19
|
+
function d({ knowledgeBaseId: t }) {
|
|
20
|
+
let u = e(t), [d, f] = o("website"), [p, m] = o(""), [h, g] = o(""), [_, v] = o(""), y = a(null);
|
|
21
|
+
return /* @__PURE__ */ c("section", {
|
|
14
22
|
className: "space-y-4 rounded-lg border border-border-default p-5",
|
|
15
23
|
children: [
|
|
16
|
-
/* @__PURE__ */
|
|
24
|
+
/* @__PURE__ */ s("h2", {
|
|
17
25
|
className: "text-lg font-semibold",
|
|
18
26
|
children: "Import website or text knowledge"
|
|
19
27
|
}),
|
|
20
|
-
/* @__PURE__ */
|
|
28
|
+
/* @__PURE__ */ s("p", {
|
|
21
29
|
className: "text-sm text-text-secondary",
|
|
22
30
|
children: "Fluidgrids captures each source and checkpoints embedding batches. Course content uses the BuildMyIQ course import. Use a new knowledge base for the first managed import."
|
|
23
31
|
}),
|
|
24
|
-
/* @__PURE__ */
|
|
32
|
+
/* @__PURE__ */ c("label", {
|
|
25
33
|
className: "grid gap-2 text-sm",
|
|
26
|
-
children: ["Source type", /* @__PURE__ */
|
|
34
|
+
children: ["Source type", /* @__PURE__ */ c("select", {
|
|
27
35
|
className: "h-10 rounded-md border border-border-default bg-bg-surface px-3",
|
|
28
|
-
value:
|
|
29
|
-
disabled:
|
|
36
|
+
value: d,
|
|
37
|
+
disabled: u.queue.isPending,
|
|
30
38
|
onChange: (e) => {
|
|
31
|
-
|
|
39
|
+
f(e.target.value), g("");
|
|
32
40
|
},
|
|
33
|
-
children: [/* @__PURE__ */
|
|
41
|
+
children: [/* @__PURE__ */ s("option", {
|
|
34
42
|
value: "website",
|
|
35
43
|
children: "Public website page"
|
|
36
|
-
}), /* @__PURE__ */
|
|
44
|
+
}), /* @__PURE__ */ s("option", {
|
|
37
45
|
value: "text",
|
|
38
46
|
children: "Text or Markdown"
|
|
39
47
|
})]
|
|
40
48
|
})]
|
|
41
49
|
}),
|
|
42
|
-
/* @__PURE__ */
|
|
50
|
+
/* @__PURE__ */ c("label", {
|
|
43
51
|
className: "grid gap-2 text-sm",
|
|
44
|
-
children: ["Title", /* @__PURE__ */
|
|
52
|
+
children: ["Title", /* @__PURE__ */ s("input", {
|
|
45
53
|
className: "h-10 rounded-md border border-border-default bg-bg-surface px-3",
|
|
46
|
-
value:
|
|
54
|
+
value: p,
|
|
47
55
|
maxLength: 255,
|
|
48
|
-
disabled:
|
|
49
|
-
onChange: (e) =>
|
|
56
|
+
disabled: u.queue.isPending,
|
|
57
|
+
onChange: (e) => m(e.target.value)
|
|
50
58
|
})]
|
|
51
59
|
}),
|
|
52
|
-
/* @__PURE__ */
|
|
60
|
+
/* @__PURE__ */ c("label", {
|
|
53
61
|
className: "grid gap-2 text-sm",
|
|
54
|
-
children: [
|
|
62
|
+
children: [d === "website" ? "Exact public HTTPS page" : "Source text", /* @__PURE__ */ s("textarea", {
|
|
55
63
|
className: "rounded-md border border-border-default bg-bg-surface p-3",
|
|
56
|
-
rows:
|
|
57
|
-
value:
|
|
58
|
-
disabled:
|
|
59
|
-
onChange: (e) =>
|
|
64
|
+
rows: d === "website" ? 2 : 6,
|
|
65
|
+
value: h,
|
|
66
|
+
disabled: u.queue.isPending,
|
|
67
|
+
onChange: (e) => g(e.target.value)
|
|
60
68
|
})]
|
|
61
69
|
}),
|
|
62
|
-
/* @__PURE__ */
|
|
70
|
+
/* @__PURE__ */ s("p", {
|
|
63
71
|
className: "text-sm text-text-secondary",
|
|
64
72
|
children: "Website imports capture one static page without signing in. Cross-origin redirects and embedded documents are rejected. Text sources must fit within 240 KiB; split larger sources."
|
|
65
73
|
}),
|
|
66
|
-
/* @__PURE__ */
|
|
67
|
-
disabled: !
|
|
68
|
-
isLoading:
|
|
74
|
+
/* @__PURE__ */ s(i, {
|
|
75
|
+
disabled: !p.trim() || !h.trim(),
|
|
76
|
+
isLoading: u.queue.isPending,
|
|
69
77
|
onClick: async () => {
|
|
70
|
-
if (
|
|
71
|
-
|
|
78
|
+
if (d === "text" && new TextEncoder().encode(h).length > 245760 || d === "website" && h.length > 2048) {
|
|
79
|
+
v("The source is too large. Split it into smaller sources.");
|
|
72
80
|
return;
|
|
73
81
|
}
|
|
74
82
|
let e = JSON.stringify([
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
83
|
+
d,
|
|
84
|
+
p,
|
|
85
|
+
h
|
|
78
86
|
]);
|
|
79
|
-
|
|
87
|
+
y.current?.fingerprint !== e && (y.current = {
|
|
80
88
|
id: crypto.randomUUID(),
|
|
81
89
|
fingerprint: e
|
|
82
90
|
});
|
|
83
91
|
try {
|
|
84
|
-
await
|
|
85
|
-
clientRequestId:
|
|
86
|
-
title:
|
|
87
|
-
...
|
|
88
|
-
}),
|
|
89
|
-
} catch {
|
|
90
|
-
|
|
92
|
+
await u.queue.mutateAsync({
|
|
93
|
+
clientRequestId: y.current.id,
|
|
94
|
+
title: p,
|
|
95
|
+
...d === "website" ? { sourceUrl: h.trim() } : { content: h }
|
|
96
|
+
}), y.current = null, g(""), v("Source queued. Its progress will appear below.");
|
|
97
|
+
} catch (e) {
|
|
98
|
+
v(n(e, "Admission could not be confirmed. Retry the same source to reuse its request ID. Check the source, embedding configuration and management permission."));
|
|
91
99
|
}
|
|
92
100
|
},
|
|
93
101
|
children: "Queue import"
|
|
94
102
|
}),
|
|
95
|
-
|
|
103
|
+
_ && /* @__PURE__ */ s("p", {
|
|
96
104
|
role: "status",
|
|
97
|
-
children:
|
|
105
|
+
children: _
|
|
98
106
|
}),
|
|
99
|
-
|
|
107
|
+
u.imports.isError ? /* @__PURE__ */ s("p", {
|
|
100
108
|
role: "alert",
|
|
101
109
|
children: "Imports could not be loaded. Knowledge management permission is required."
|
|
102
|
-
}) :
|
|
110
|
+
}) : u.imports.isPending ? /* @__PURE__ */ s("p", {
|
|
103
111
|
role: "status",
|
|
104
112
|
children: "Loading imports…"
|
|
105
|
-
}) :
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
113
|
+
}) : u.imports.data?.map((e) => {
|
|
114
|
+
let t = r(e);
|
|
115
|
+
return /* @__PURE__ */ c("div", {
|
|
116
|
+
className: "flex items-start justify-between gap-3 text-sm",
|
|
117
|
+
children: [/* @__PURE__ */ c("div", {
|
|
118
|
+
className: "grid gap-1",
|
|
119
|
+
children: [/* @__PURE__ */ c("span", { children: [
|
|
120
|
+
e.title,
|
|
121
|
+
" · ",
|
|
122
|
+
/* @__PURE__ */ s("span", {
|
|
123
|
+
className: l[t.tone],
|
|
124
|
+
children: t.label
|
|
125
|
+
})
|
|
126
|
+
] }), t.detail && /* @__PURE__ */ s("span", {
|
|
127
|
+
role: t.tone === "error" || t.tone === "warning" ? "alert" : void 0,
|
|
128
|
+
className: "text-text-secondary",
|
|
129
|
+
children: t.detail
|
|
130
|
+
})]
|
|
131
|
+
}), e.status === "BLOCKED" && /* @__PURE__ */ s(i, {
|
|
132
|
+
variant: "outline",
|
|
133
|
+
isLoading: u.retry.isPending,
|
|
134
|
+
onClick: async () => {
|
|
135
|
+
try {
|
|
136
|
+
await u.retry.mutateAsync(e.id), v("Import recovery queued.");
|
|
137
|
+
} catch (e) {
|
|
138
|
+
v(n(e, "Recovery failed. The embedding profile must still match the original import."));
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
children: "Retry import"
|
|
142
|
+
})]
|
|
143
|
+
}, e.id);
|
|
144
|
+
}),
|
|
145
|
+
/* @__PURE__ */ s(i, {
|
|
125
146
|
variant: "outline",
|
|
126
|
-
onClick: () => void
|
|
147
|
+
onClick: () => void u.imports.refetch(),
|
|
127
148
|
children: "Refresh imports"
|
|
128
149
|
})
|
|
129
150
|
]
|
|
130
151
|
});
|
|
131
152
|
}
|
|
132
|
-
export {
|
|
153
|
+
export { u as KnowledgeSourceImportPanel };
|
|
133
154
|
|
|
134
155
|
//# sourceMappingURL=KnowledgeSourceImportPanel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KnowledgeSourceImportPanel.js","names":["KnowledgeSourceImportPanel","useBotlit","ScopedImportPanel","workspaceId","currentUser","knowledgeBaseId","sources","useKnowledgeSourceImports","kind","setKind","useState","title","setTitle","value","setValue","message","setMessage","pending","useRef","event","Button","fingerprint","row"],"sources":["../../../src/botlit/components/KnowledgeSourceImportPanel.tsx"],"sourcesContent":["import { useRef, useState } from 'react';\nimport { useKnowledgeSourceImports } from '../hooks/useKnowledgeSourceImports';\nimport { useBotlit } from '../providers/BotlitProvider';\nimport { Button } from './Button';\n\nexport function KnowledgeSourceImportPanel({ knowledgeBaseId }: { knowledgeBaseId: string }) {\n const { workspaceId, currentUser } = useBotlit();\n return (\n <ScopedImportPanel\n key={`${workspaceId}:${currentUser?.id}:${knowledgeBaseId}`}\n knowledgeBaseId={knowledgeBaseId}\n />\n );\n}\nfunction ScopedImportPanel({ knowledgeBaseId }: { knowledgeBaseId: string }) {\n const sources = useKnowledgeSourceImports(knowledgeBaseId);\n const [kind, setKind] = useState('website'),\n [title, setTitle] = useState(''),\n [value, setValue] = useState(''),\n [message, setMessage] = useState('');\n const pending = useRef<{ id: string; fingerprint: string } | null>(null);\n return (\n <section className=\"space-y-4 rounded-lg border border-border-default p-5\">\n <h2 className=\"text-lg font-semibold\">Import website or text knowledge</h2>\n <p className=\"text-sm text-text-secondary\">\n Fluidgrids captures each source and checkpoints embedding batches. Course content uses the\n BuildMyIQ course import. Use a new knowledge base for the first managed import.\n </p>\n <label className=\"grid gap-2 text-sm\">\n Source type\n <select\n className=\"h-10 rounded-md border border-border-default bg-bg-surface px-3\"\n value={kind}\n disabled={sources.queue.isPending}\n onChange={(event) => {\n setKind(event.target.value);\n setValue('');\n }}\n >\n <option value=\"website\">Public website page</option>\n <option value=\"text\">Text or Markdown</option>\n </select>\n </label>\n <label className=\"grid gap-2 text-sm\">\n Title\n <input\n className=\"h-10 rounded-md border border-border-default bg-bg-surface px-3\"\n value={title}\n maxLength={255}\n disabled={sources.queue.isPending}\n onChange={(event) => setTitle(event.target.value)}\n />\n </label>\n <label className=\"grid gap-2 text-sm\">\n {kind === 'website' ? 'Exact public HTTPS page' : 'Source text'}\n <textarea\n className=\"rounded-md border border-border-default bg-bg-surface p-3\"\n rows={kind === 'website' ? 2 : 6}\n value={value}\n disabled={sources.queue.isPending}\n onChange={(event) => setValue(event.target.value)}\n />\n </label>\n <p className=\"text-sm text-text-secondary\">\n Website imports capture one static page without signing in. Cross-origin redirects and\n embedded documents are rejected. Text sources must fit within 240 KiB; split larger sources.\n </p>\n <Button\n disabled={!title.trim() || !value.trim()}\n isLoading={sources.queue.isPending}\n onClick={async () => {\n if (\n (kind === 'text' && new TextEncoder().encode(value).length > 245760) ||\n (kind === 'website' && value.length > 2048)\n ) {\n setMessage('The source is too large. Split it into smaller sources.');\n return;\n }\n const fingerprint = JSON.stringify([kind, title, value]);\n if (pending.current?.fingerprint !== fingerprint)\n pending.current = { id: crypto.randomUUID(), fingerprint };\n try {\n await sources.queue.mutateAsync({\n clientRequestId: pending.current.id,\n title,\n ...(kind === 'website' ? { sourceUrl: value.trim() } : { content: value }),\n });\n pending.current = null;\n setValue('');\n setMessage('Source queued. Its progress will appear below.');\n } catch {\n setMessage(\n 'Admission could not be confirmed. Retry the same source to reuse its request ID. Check the source, embedding configuration and management permission.'\n );\n }\n }}\n >\n Queue import\n </Button>\n {message && <p role=\"status\">{message}</p>}\n {sources.imports.isError ? (\n <p role=\"alert\">\n Imports could not be loaded. Knowledge management permission is required.\n </p>\n ) : sources.imports.isPending ? (\n <p role=\"status\">Loading imports…</p>\n ) : (\n sources.imports.data?.map((row) => (\n <div key={row.id} className=\"flex items-center justify-between gap-3 text-sm\">\n <span>\n {row.title} · {row.status.toLowerCase()}\n </span>\n {row.status === 'BLOCKED' && (\n <Button\n variant=\"outline\"\n isLoading={sources.retry.isPending}\n onClick={async () => {\n try {\n await sources.retry.mutateAsync(row.id);\n setMessage('Import recovery queued.');\n } catch {\n setMessage(\n 'Recovery failed. The embedding profile must still match the original import.'\n );\n }\n }}\n >\n Retry import\n </Button>\n )}\n </div>\n ))\n )}\n <Button variant=\"outline\" onClick={() => void sources.imports.refetch()}>\n Refresh imports\n </Button>\n </section>\n );\n}\n"],"mappings":";;;;;;AAKA,SAAgBA,EAA2B,EAAE,sBAAgD;CAC3F,IAAM,EAAE,gBAAa,mBAAgBC,EAAU;CAC/C,OACE,kBAACC,GAAD,EAEmB,mBAClB,GAFM,GAAGC,EAAY,GAAGC,GAAa,GAAG,GAAGC,GAE3C;AAEL;AACA,SAASH,EAAkB,EAAE,sBAAgD;CAC3E,IAAMI,IAAUC,EAA0BF,CAAe,GACnD,CAACG,GAAMC,KAAWC,EAAS,SAAS,GACxC,CAACC,GAAOC,KAAYF,EAAS,EAAE,GAC/B,CAACG,GAAOC,KAAYJ,EAAS,EAAE,GAC/B,CAACK,GAASC,KAAcN,EAAS,EAAE,GAC/BO,IAAUC,EAAmD,IAAI;CACvE,OACE,kBAAC,WAAD;EAAS,WAAU;EAAnB,UAAA;GACE,kBAAC,MAAD;IAAI,WAAU;IAAwB,UAAA;GAAoC,CAAA;GAC1E,kBAAC,KAAD;IAAG,WAAU;IAA8B,UAAA;GAGxC,CAAA;GACH,kBAAC,SAAD;IAAO,WAAU;IAAjB,UAAA,CAAsC,eAEpC,kBAAC,UAAD;KACE,WAAU;KACV,OAAOV;KACP,UAAUF,EAAQ,MAAM;KACxB,WAAW,MAAU;MAEnB,AADAG,EAAQU,EAAM,OAAO,KAAK,GAC1BL,EAAS,EAAE;KACb;KAPF,UAAA,CASE,kBAAC,UAAD;MAAQ,OAAM;MAAU,UAAA;KAA2B,CAAA,GACnD,k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F;KACF;IACF;IACD,UAAA;GAEO,CAAA;GACPD,KAAW,kBAAC,KAAD;IAAG,MAAK;IAAU,UAAAA;GAAW,CAAA;GACxCT,EAAQ,QAAQ,UACf,kBAAC,KAAD;IAAG,MAAK;IAAQ,UAAA;GAEb,CAAA,IACDA,EAAQ,QAAQ,YAClB,kBAAC,KAAD;IAAG,MAAK;IAAS,UAAA;GAAmB,CAAA,IAEpCA,EAAQ,QAAQ,MAAM,KAAK,MACzB,kBAAC,OAAD;IAAkB,WAAU;IAA5B,UAAA,CACE,kBAAC,QAAD,EAAA,UAAA;KACGgB,EAAI;KAAM;KAAIA,EAAI,OAAO,YAAY;IAClC,EAAA,CAAA,GACLA,EAAI,WAAW,aACd,kBAACF,GAAD;KACE,SAAQ;KACR,WAAWd,EAAQ,MAAM;KACzB,SAAS,YAAY;MACnB,IAAI;OAEF,AADA,MAAMA,EAAQ,MAAM,YAAYgB,EAAI,EAAE,GACtCN,EAAW,yBAAyB;MACtC,QAAQ;OACN,EACE,8EACF;MACF;KACF;KACD,UAAA;IAEO,CAAA,CAEP;GAtBK,GAAAM,EAAI,EAsBT,CACN;GAEH,kBAACF,GAAD;IAAQ,SAAQ;IAAU,eAAe,KAAKd,EAAQ,QAAQ,QAAQ;IAAG,UAAA;GAEjE,CAAA;EACD;;AAEb"}
|
|
1
|
+
{"version":3,"file":"KnowledgeSourceImportPanel.js","names":["TONE_CLASS","KnowledgeSourceImportPanel","useBotlit","ScopedImportPanel","workspaceId","currentUser","knowledgeBaseId","sources","useKnowledgeSourceImports","kind","setKind","useState","title","setTitle","value","setValue","message","setMessage","pending","useRef","event","Button","fingerprint","error","graphqlErrorMessage","status","knowledgeImportStatus","row"],"sources":["../../../src/botlit/components/KnowledgeSourceImportPanel.tsx"],"sourcesContent":["import { useRef, useState } from 'react';\nimport { useKnowledgeSourceImports } from '../hooks/useKnowledgeSourceImports';\nimport { useBotlit } from '../providers/BotlitProvider';\nimport { graphqlErrorMessage } from '../utils/errors';\nimport { knowledgeImportStatus } from '../utils/knowledgeImportStatus';\nimport { Button } from './Button';\n\nconst TONE_CLASS = {\n info: 'text-text-secondary',\n success: 'text-status-success-text',\n warning: 'text-status-warning-text',\n error: 'text-status-error-text',\n} as const;\n\nexport function KnowledgeSourceImportPanel({ knowledgeBaseId }: { knowledgeBaseId: string }) {\n const { workspaceId, currentUser } = useBotlit();\n return (\n <ScopedImportPanel\n key={`${workspaceId}:${currentUser?.id}:${knowledgeBaseId}`}\n knowledgeBaseId={knowledgeBaseId}\n />\n );\n}\nfunction ScopedImportPanel({ knowledgeBaseId }: { knowledgeBaseId: string }) {\n const sources = useKnowledgeSourceImports(knowledgeBaseId);\n const [kind, setKind] = useState('website'),\n [title, setTitle] = useState(''),\n [value, setValue] = useState(''),\n [message, setMessage] = useState('');\n const pending = useRef<{ id: string; fingerprint: string } | null>(null);\n return (\n <section className=\"space-y-4 rounded-lg border border-border-default p-5\">\n <h2 className=\"text-lg font-semibold\">Import website or text knowledge</h2>\n <p className=\"text-sm text-text-secondary\">\n Fluidgrids captures each source and checkpoints embedding batches. Course content uses the\n BuildMyIQ course import. Use a new knowledge base for the first managed import.\n </p>\n <label className=\"grid gap-2 text-sm\">\n Source type\n <select\n className=\"h-10 rounded-md border border-border-default bg-bg-surface px-3\"\n value={kind}\n disabled={sources.queue.isPending}\n onChange={(event) => {\n setKind(event.target.value);\n setValue('');\n }}\n >\n <option value=\"website\">Public website page</option>\n <option value=\"text\">Text or Markdown</option>\n </select>\n </label>\n <label className=\"grid gap-2 text-sm\">\n Title\n <input\n className=\"h-10 rounded-md border border-border-default bg-bg-surface px-3\"\n value={title}\n maxLength={255}\n disabled={sources.queue.isPending}\n onChange={(event) => setTitle(event.target.value)}\n />\n </label>\n <label className=\"grid gap-2 text-sm\">\n {kind === 'website' ? 'Exact public HTTPS page' : 'Source text'}\n <textarea\n className=\"rounded-md border border-border-default bg-bg-surface p-3\"\n rows={kind === 'website' ? 2 : 6}\n value={value}\n disabled={sources.queue.isPending}\n onChange={(event) => setValue(event.target.value)}\n />\n </label>\n <p className=\"text-sm text-text-secondary\">\n Website imports capture one static page without signing in. Cross-origin redirects and\n embedded documents are rejected. Text sources must fit within 240 KiB; split larger sources.\n </p>\n <Button\n disabled={!title.trim() || !value.trim()}\n isLoading={sources.queue.isPending}\n onClick={async () => {\n if (\n (kind === 'text' && new TextEncoder().encode(value).length > 245760) ||\n (kind === 'website' && value.length > 2048)\n ) {\n setMessage('The source is too large. Split it into smaller sources.');\n return;\n }\n const fingerprint = JSON.stringify([kind, title, value]);\n if (pending.current?.fingerprint !== fingerprint)\n pending.current = { id: crypto.randomUUID(), fingerprint };\n try {\n await sources.queue.mutateAsync({\n clientRequestId: pending.current.id,\n title,\n ...(kind === 'website' ? { sourceUrl: value.trim() } : { content: value }),\n });\n pending.current = null;\n setValue('');\n setMessage('Source queued. Its progress will appear below.');\n } catch (error) {\n setMessage(\n graphqlErrorMessage(\n error,\n 'Admission could not be confirmed. Retry the same source to reuse its request ID. Check the source, embedding configuration and management permission.'\n )\n );\n }\n }}\n >\n Queue import\n </Button>\n {message && <p role=\"status\">{message}</p>}\n {sources.imports.isError ? (\n <p role=\"alert\">\n Imports could not be loaded. Knowledge management permission is required.\n </p>\n ) : sources.imports.isPending ? (\n <p role=\"status\">Loading imports…</p>\n ) : (\n sources.imports.data?.map((row) => {\n const status = knowledgeImportStatus(row);\n return (\n <div key={row.id} className=\"flex items-start justify-between gap-3 text-sm\">\n <div className=\"grid gap-1\">\n <span>\n {row.title} · <span className={TONE_CLASS[status.tone]}>{status.label}</span>\n </span>\n {status.detail && (\n <span\n role={\n status.tone === 'error' || status.tone === 'warning' ? 'alert' : undefined\n }\n className=\"text-text-secondary\"\n >\n {status.detail}\n </span>\n )}\n </div>\n {row.status === 'BLOCKED' && (\n <Button\n variant=\"outline\"\n isLoading={sources.retry.isPending}\n onClick={async () => {\n try {\n await sources.retry.mutateAsync(row.id);\n setMessage('Import recovery queued.');\n } catch (error) {\n setMessage(\n graphqlErrorMessage(\n error,\n 'Recovery failed. The embedding profile must still match the original import.'\n )\n );\n }\n }}\n >\n Retry import\n </Button>\n )}\n </div>\n );\n })\n )}\n <Button variant=\"outline\" onClick={() => void sources.imports.refetch()}>\n Refresh imports\n </Button>\n </section>\n );\n}\n"],"mappings":";;;;;;;;AAOA,IAAMA,IAAa;CACjB,MAAM;CACN,SAAS;CACT,SAAS;CACT,OAAO;AACT;AAEA,SAAgBC,EAA2B,EAAE,sBAAgD;CAC3F,IAAM,EAAE,gBAAa,mBAAgBC,EAAU;CAC/C,OACE,kBAACC,GAAD,EAEmB,mBAClB,GAFM,GAAGC,EAAY,GAAGC,GAAa,GAAG,GAAGC,GAE3C;AAEL;AACA,SAASH,EAAkB,EAAE,sBAAgD;CAC3E,IAAMI,IAAUC,EAA0BF,CAAe,GACnD,CAACG,GAAMC,KAAWC,EAAS,SAAS,GACxC,CAACC,GAAOC,KAAYF,EAAS,EAAE,GAC/B,CAACG,GAAOC,KAAYJ,EAAS,EAAE,GAC/B,CAACK,GAASC,KAAcN,EAAS,EAAE,GAC/BO,IAAUC,EAAmD,IAAI;CACvE,OACE,kBAAC,WAAD;EAAS,WAAU;EAAnB,UAAA;GACE,kBAAC,MAAD;IAAI,WAAU;IAAwB,UAAA;GAAoC,CAAA;GAC1E,kBAAC,KAAD;IAAG,WAAU;IAA8B,UAAA;GAGxC,CAAA;GACH,kBAAC,SAAD;IAAO,WAAU;IAAjB,UAAA,CAAsC,eAEpC,kBAAC,UAAD;KACE,WAAU;KACV,OAAOV;KACP,UAAUF,EAAQ,MAAM;KACxB,WAAW,MAAU;MAEnB,AADAG,EAAQU,EAAM,OAAO,KAAK,GAC1BL,EAAS,EAAE;KACb;KAPF,UAAA,CASE,kBAAC,UAAD;MAAQ,OAAM;MAAU,UAAA;KAA2B,CAAA,GACnD,kBAAC,UAAD;MAAQ,OAAM;MAAO,UAAA;KAAwB,CAAA,CACvC;IACH,CAAA,CAAA;;GACP,kBAAC,SAAD;IAAO,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UAAAA;GAAW,CAAA;GACxCT,EAAQ,QAAQ,UACf,kBAAC,KAAD;IAAG,MAAK;IAAQ,UAAA;GAEb,CAAA,IACDA,EAAQ,QAAQ,YAClB,kBAAC,KAAD;IAAG,MAAK;IAAS,UAAA;GAAmB,CAAA,IAEpCA,EAAQ,QAAQ,MAAM,KAAK,MAAQ;IACjC,IAAMkB,IAASC,EAAsBC,CAAG;IACxC,OACE,kBAAC,OAAD;KAAkB,WAAU;KAA5B,UAAA,CACE,kBAAC,OAAD;MAAK,WAAU;MAAf,UAAA,CACE,kBAAC,QAAD,EAAA,UAAA;OACGA,EAAI;OAAM;OAAG,kBAAC,QAAD;QAAM,WAAW3B,EAAWyB,EAAO;QAAQ,UAAAA,EAAO;OAAY,CAAA;MACxE,EAAA,CAAA,GACLA,EAAO,UACN,kBAAC,QAAD;OACE,MACEA,EAAO,SAAS,WAAWA,EAAO,SAAS,YAAY,UAAU,KAAA;OAEnE,WAAU;OAET,UAAAA,EAAO;MACJ,CAAA,CAEL;KACJ,CAAA,GAAAE,EAAI,WAAW,aACd,kBAACN,GAAD;MACE,SAAQ;MACR,WAAWd,EAAQ,MAAM;MACzB,SAAS,YAAY;OACnB,IAAI;QAEF,AADA,MAAMA,EAAQ,MAAM,YAAYoB,EAAI,EAAE,GACtCV,EAAW,yBAAyB;OACtC,SAASM,GAAO;QACd,EACEC,EACED,GACA,8EACF,CACF;OACF;MACF;MACD,UAAA;KAEO,CAAA,CAEP;IArCK,GAAAI,EAAI,EAqCT;GAET,CAAC;GAEH,kBAACN,GAAD;IAAQ,SAAQ;IAAU,eAAe,KAAKd,EAAQ,QAAQ,QAAQ;IAAG,UAAA;GAEjE,CAAA;EACD;;AAEb"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* User-facing status for a queued knowledge source. The backend stores a
|
|
3
|
+
* stage-specific `errorCode` (wspace-botmanor-svc KnowledgeIngestionFailure)
|
|
4
|
+
* so the screen can say what is missing instead of showing "ready" forever.
|
|
5
|
+
*/
|
|
6
|
+
export interface KnowledgeImportStatusRow {
|
|
7
|
+
status: string;
|
|
8
|
+
errorCode: string | null;
|
|
9
|
+
failureCount: number;
|
|
10
|
+
}
|
|
11
|
+
export interface KnowledgeImportStatus {
|
|
12
|
+
label: string;
|
|
13
|
+
detail?: string;
|
|
14
|
+
tone: 'info' | 'success' | 'warning' | 'error';
|
|
15
|
+
}
|
|
16
|
+
export declare function knowledgeImportErrorDetail(errorCode: string | null): string | undefined;
|
|
17
|
+
export declare function knowledgeImportStatus(row: KnowledgeImportStatusRow): KnowledgeImportStatus;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// src/botlit/utils/knowledgeImportStatus.ts
|
|
2
|
+
var e = {
|
|
3
|
+
RUNTIME_NOT_CONFIGURED: "No assistant runtime is configured in this workspace, so nothing will process this source. Open an assistant that uses this knowledge base and complete \"Assistant setup\" with a BotManor Assistant Runtime connection.",
|
|
4
|
+
EMBEDDING_PROVIDER_NOT_CONFIGURED: "The knowledge base's embedding model has no usable provider. In Settings, link an OpenAI (or compatible) provider to an Integrations connection that holds your API key, or use managed AWS Bedrock where it is enabled.",
|
|
5
|
+
EMBEDDING_PROVIDER_UNAVAILABLE: "The embedding provider rejected or did not answer the request. Check the API key, model name and provider quota, then retry.",
|
|
6
|
+
ACCOUNT_BUDGET_UNAVAILABLE: "Managed model spending is not set up for this account, or today's limit is used up. Ask an account administrator to configure the assistant budget, or use your own provider key.",
|
|
7
|
+
VECTOR_STORE_UNAVAILABLE: "The vector store is temporarily unavailable. The import retries automatically.",
|
|
8
|
+
ARTIFACT_STORE_UNAVAILABLE: "Source storage is temporarily unavailable. The import retries automatically.",
|
|
9
|
+
SOURCE_URL_UNREACHABLE: "The page could not be fetched. It must be a public HTTPS page that loads without signing in and without cross-origin redirects.",
|
|
10
|
+
SOURCE_CONTENT_INVALID: "The source has no usable text, or it is larger than 256 KiB. Split or fix it, then import it again.",
|
|
11
|
+
SOURCE_PROFILE_CHANGED: "The knowledge base's embedding or chunking settings changed after this source was queued. Import it again into a knowledge base with the current settings.",
|
|
12
|
+
SOURCE_IMPORT_UNAVAILABLE: "The import did not complete. It retries automatically."
|
|
13
|
+
};
|
|
14
|
+
function t(t) {
|
|
15
|
+
if (t) return e[t] ?? e.SOURCE_IMPORT_UNAVAILABLE;
|
|
16
|
+
}
|
|
17
|
+
function n(e) {
|
|
18
|
+
let n = t(e.errorCode);
|
|
19
|
+
switch (e.status) {
|
|
20
|
+
case "COMPLETED": return {
|
|
21
|
+
label: "Indexed",
|
|
22
|
+
tone: "success"
|
|
23
|
+
};
|
|
24
|
+
case "CANCELLED": return {
|
|
25
|
+
label: "Cancelled",
|
|
26
|
+
detail: "The source expired before it was processed.",
|
|
27
|
+
tone: "warning"
|
|
28
|
+
};
|
|
29
|
+
case "BLOCKED": return {
|
|
30
|
+
label: "Stopped after repeated failures",
|
|
31
|
+
detail: `${(n ?? "").replace(/ ?(The import|It) retries automatically\./, "").trim()} Fix the cause, then select "Retry import".`.trim(),
|
|
32
|
+
tone: "error"
|
|
33
|
+
};
|
|
34
|
+
case "PROCESSING": return {
|
|
35
|
+
label: "Processing",
|
|
36
|
+
tone: "info"
|
|
37
|
+
};
|
|
38
|
+
case "READY": return e.errorCode === "RUNTIME_NOT_CONFIGURED" ? {
|
|
39
|
+
label: "Waiting for setup",
|
|
40
|
+
detail: n,
|
|
41
|
+
tone: "warning"
|
|
42
|
+
} : e.errorCode ? {
|
|
43
|
+
label: `Retrying (attempt ${e.failureCount + 1} of 8)`,
|
|
44
|
+
detail: n,
|
|
45
|
+
tone: "warning"
|
|
46
|
+
} : {
|
|
47
|
+
label: "Queued",
|
|
48
|
+
detail: "Processing usually starts within a minute.",
|
|
49
|
+
tone: "info"
|
|
50
|
+
};
|
|
51
|
+
default: return {
|
|
52
|
+
label: e.status.toLowerCase(),
|
|
53
|
+
detail: n,
|
|
54
|
+
tone: "info"
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
export { t as knowledgeImportErrorDetail, n as knowledgeImportStatus };
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=knowledgeImportStatus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"knowledgeImportStatus.js","names":["ERROR_DETAILS","knowledgeImportErrorDetail","errorCode","knowledgeImportStatus","detail","row"],"sources":["../../../src/botlit/utils/knowledgeImportStatus.ts"],"sourcesContent":["/**\n * User-facing status for a queued knowledge source. The backend stores a\n * stage-specific `errorCode` (wspace-botmanor-svc KnowledgeIngestionFailure)\n * so the screen can say what is missing instead of showing \"ready\" forever.\n */\nexport interface KnowledgeImportStatusRow {\n status: string;\n errorCode: string | null;\n failureCount: number;\n}\n\nexport interface KnowledgeImportStatus {\n label: string;\n detail?: string;\n tone: 'info' | 'success' | 'warning' | 'error';\n}\n\nconst ERROR_DETAILS: Record<string, string> = {\n RUNTIME_NOT_CONFIGURED:\n 'No assistant runtime is configured in this workspace, so nothing will process this source. Open an assistant that uses this knowledge base and complete \"Assistant setup\" with a BotManor Assistant Runtime connection.',\n EMBEDDING_PROVIDER_NOT_CONFIGURED:\n \"The knowledge base's embedding model has no usable provider. In Settings, link an OpenAI (or compatible) provider to an Integrations connection that holds your API key, or use managed AWS Bedrock where it is enabled.\",\n EMBEDDING_PROVIDER_UNAVAILABLE:\n 'The embedding provider rejected or did not answer the request. Check the API key, model name and provider quota, then retry.',\n ACCOUNT_BUDGET_UNAVAILABLE:\n \"Managed model spending is not set up for this account, or today's limit is used up. Ask an account administrator to configure the assistant budget, or use your own provider key.\",\n VECTOR_STORE_UNAVAILABLE:\n 'The vector store is temporarily unavailable. The import retries automatically.',\n ARTIFACT_STORE_UNAVAILABLE:\n 'Source storage is temporarily unavailable. The import retries automatically.',\n SOURCE_URL_UNREACHABLE:\n 'The page could not be fetched. It must be a public HTTPS page that loads without signing in and without cross-origin redirects.',\n SOURCE_CONTENT_INVALID:\n 'The source has no usable text, or it is larger than 256 KiB. Split or fix it, then import it again.',\n SOURCE_PROFILE_CHANGED:\n \"The knowledge base's embedding or chunking settings changed after this source was queued. Import it again into a knowledge base with the current settings.\",\n SOURCE_IMPORT_UNAVAILABLE: 'The import did not complete. It retries automatically.',\n};\n\nexport function knowledgeImportErrorDetail(errorCode: string | null): string | undefined {\n if (!errorCode) return undefined;\n return ERROR_DETAILS[errorCode] ?? ERROR_DETAILS.SOURCE_IMPORT_UNAVAILABLE;\n}\n\nexport function knowledgeImportStatus(row: KnowledgeImportStatusRow): KnowledgeImportStatus {\n const detail = knowledgeImportErrorDetail(row.errorCode);\n switch (row.status) {\n case 'COMPLETED':\n return { label: 'Indexed', tone: 'success' };\n case 'CANCELLED':\n return {\n label: 'Cancelled',\n detail: 'The source expired before it was processed.',\n tone: 'warning',\n };\n case 'BLOCKED':\n // Blocked rows are not polled or retried: replace any automatic-retry promise with the manual step.\n return {\n label: 'Stopped after repeated failures',\n detail:\n `${(detail ?? '').replace(/ ?(The import|It) retries automatically\\./, '').trim()} Fix the cause, then select \"Retry import\".`.trim(),\n tone: 'error',\n };\n case 'PROCESSING':\n return { label: 'Processing', tone: 'info' };\n case 'READY':\n if (row.errorCode === 'RUNTIME_NOT_CONFIGURED')\n return { label: 'Waiting for setup', detail, tone: 'warning' };\n if (row.errorCode)\n return {\n label: `Retrying (attempt ${row.failureCount + 1} of 8)`,\n detail,\n tone: 'warning',\n };\n return {\n label: 'Queued',\n detail: 'Processing usually starts within a minute.',\n tone: 'info',\n };\n default:\n return { label: row.status.toLowerCase(), detail, tone: 'info' };\n }\n}\n"],"mappings":";AAiBA,IAAMA,IAAwC;CAC5C,wBACE;CACF,mCACE;CACF,gCACE;CACF,4BACE;CACF,0BACE;CACF,4BACE;CACF,wBACE;CACF,wBACE;CACF,wBACE;CACF,2BAA2B;AAC7B;AAEA,SAAgBC,EAA2B,GAA8C;CACvF,IAAKC,GACL,OAAOF,EAAcE,MAAcF,EAAc;AACnD;AAEA,SAAgBG,EAAsB,GAAsD;CAC1F,IAAMC,IAASH,EAA2BI,EAAI,SAAS;CACvD,QAAQA,EAAI,QAAZ;EACE,KAAK,aACH,OAAO;GAAE,OAAO;GAAW,MAAM;EAAU;EAC7C,KAAK,aACH,OAAO;GACL,OAAO;GACP,QAAQ;GACR,MAAM;EACR;EACF,KAAK,WAEH,OAAO;GACL,OAAO;GACP,QACE,IAAID,KAAU,GAAA,CAAI,QAAQ,6CAA6C,EAAE,CAAC,CAAC,KAAK,EAAE,6CAA6C,KAAK;GACtI,MAAM;EACR;EACF,KAAK,cACH,OAAO;GAAE,OAAO;GAAc,MAAM;EAAO;EAC7C,KAAK,SASH,OARIC,EAAI,cAAc,2BACb;GAAE,OAAO;GAAqB;GAAQ,MAAM;EAAU,IAC3DA,EAAI,YACC;GACL,OAAO,qBAAqBA,EAAI,eAAe,EAAE;GACjD;GACA,MAAM;EACR,IACK;GACL,OAAO;GACP,QAAQ;GACR,MAAM;EACR;EACF,SACE,OAAO;GAAE,OAAOA,EAAI,OAAO,YAAY;GAAG;GAAQ,MAAM;EAAO;CACnE;AACF"}
|
package/package.json
CHANGED