strapi-plugin-faqchatbot 1.0.4 → 1.0.8
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/_chunks/{App-BLjeG5zk.mjs → App-ClKpIPkC.mjs} +66 -27
- package/dist/_chunks/{App-B9KjKqVf.js → App-DracDGJ6.js} +66 -27
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +2598 -38
- package/dist/server/index.mjs +2597 -38
- package/package.json +1 -1
|
@@ -25033,6 +25033,7 @@ const ChatbotPreview = () => {
|
|
|
25033
25033
|
const decoder = new TextDecoder();
|
|
25034
25034
|
let botMessage = "";
|
|
25035
25035
|
setMessages((prev) => [...prev, { text: "", isUser: false }]);
|
|
25036
|
+
let isCardsEvent = false;
|
|
25036
25037
|
while (true) {
|
|
25037
25038
|
const { done, value } = await reader.read();
|
|
25038
25039
|
if (done) break;
|
|
@@ -25040,7 +25041,18 @@ const ChatbotPreview = () => {
|
|
|
25040
25041
|
const lines = chunk.split("\n");
|
|
25041
25042
|
for (let rawLine of lines) {
|
|
25042
25043
|
const line = rawLine.replace(/\r/g, "");
|
|
25043
|
-
if (line
|
|
25044
|
+
if (!line) continue;
|
|
25045
|
+
if (line.startsWith("event: cards")) {
|
|
25046
|
+
isCardsEvent = true;
|
|
25047
|
+
continue;
|
|
25048
|
+
}
|
|
25049
|
+
if (isCardsEvent && line.startsWith("data: ")) {
|
|
25050
|
+
isCardsEvent = false;
|
|
25051
|
+
continue;
|
|
25052
|
+
}
|
|
25053
|
+
if (line.includes("[DONE]")) {
|
|
25054
|
+
return;
|
|
25055
|
+
}
|
|
25044
25056
|
if (line.startsWith("data: ")) {
|
|
25045
25057
|
const token = line.replace("data: ", "");
|
|
25046
25058
|
botMessage += token;
|
|
@@ -25656,7 +25668,12 @@ const HomePage = () => {
|
|
|
25656
25668
|
);
|
|
25657
25669
|
setActiveCollections(initialActive);
|
|
25658
25670
|
} catch (err) {
|
|
25659
|
-
|
|
25671
|
+
console.log("SAVE ERROR:", err);
|
|
25672
|
+
const message = err?.response?.data?.error || err?.response?.data?.message || "Invalid settings. Please check Base Domain.";
|
|
25673
|
+
toggleNotification({
|
|
25674
|
+
type: "warning",
|
|
25675
|
+
message
|
|
25676
|
+
});
|
|
25660
25677
|
} finally {
|
|
25661
25678
|
setIsLoading(false);
|
|
25662
25679
|
}
|
|
@@ -25665,9 +25682,9 @@ const HomePage = () => {
|
|
|
25665
25682
|
init();
|
|
25666
25683
|
}, [get2]);
|
|
25667
25684
|
const handleUpdateCardStyle = (uid, style) => {
|
|
25668
|
-
setActiveCollections(
|
|
25669
|
-
(c2) => c2.uid === uid ? { ...c2, cardStyle: style } : c2
|
|
25670
|
-
)
|
|
25685
|
+
setActiveCollections(
|
|
25686
|
+
(prev) => prev.map((c2) => c2.uid === uid ? { ...c2, cardStyle: style } : c2)
|
|
25687
|
+
);
|
|
25671
25688
|
};
|
|
25672
25689
|
const handleRemoveCollection = (uid) => {
|
|
25673
25690
|
setActiveCollections((prev) => prev.filter((c2) => c2.uid !== uid));
|
|
@@ -25734,21 +25751,33 @@ const HomePage = () => {
|
|
|
25734
25751
|
setIsSaving(false);
|
|
25735
25752
|
}
|
|
25736
25753
|
};
|
|
25737
|
-
if (isLoading)
|
|
25754
|
+
if (isLoading)
|
|
25755
|
+
return /* @__PURE__ */ jsx(Flex, { justifyContent: "center", height: "100vh", children: /* @__PURE__ */ jsx(Loader, {}) });
|
|
25738
25756
|
return /* @__PURE__ */ jsxs(Main, { children: [
|
|
25739
|
-
/* @__PURE__ */ jsx(
|
|
25740
|
-
|
|
25741
|
-
|
|
25742
|
-
|
|
25743
|
-
|
|
25744
|
-
|
|
25745
|
-
|
|
25746
|
-
|
|
25747
|
-
|
|
25748
|
-
|
|
25749
|
-
|
|
25750
|
-
|
|
25751
|
-
|
|
25757
|
+
/* @__PURE__ */ jsx(
|
|
25758
|
+
Box,
|
|
25759
|
+
{
|
|
25760
|
+
background: "neutral100",
|
|
25761
|
+
position: "sticky",
|
|
25762
|
+
top: 0,
|
|
25763
|
+
zIndex: 2,
|
|
25764
|
+
padding: 8,
|
|
25765
|
+
paddingBottom: 6,
|
|
25766
|
+
children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", children: [
|
|
25767
|
+
/* @__PURE__ */ jsx(Typography, { variant: "beta", fontWeight: "bold", children: "Chatbot Configuration" }),
|
|
25768
|
+
/* @__PURE__ */ jsx(
|
|
25769
|
+
Button,
|
|
25770
|
+
{
|
|
25771
|
+
onClick: save,
|
|
25772
|
+
loading: isSaving,
|
|
25773
|
+
startIcon: /* @__PURE__ */ jsx(Check, {}),
|
|
25774
|
+
disabled: !openaiKey || openaiKey.trim() === "",
|
|
25775
|
+
children: "Save Settings"
|
|
25776
|
+
}
|
|
25777
|
+
)
|
|
25778
|
+
] })
|
|
25779
|
+
}
|
|
25780
|
+
),
|
|
25752
25781
|
/* @__PURE__ */ jsxs(Box, { paddingLeft: 8, paddingTop: 2, paddingRight: 8, background: "neutral100", children: [
|
|
25753
25782
|
/* @__PURE__ */ jsx(
|
|
25754
25783
|
ConfigSettings,
|
|
@@ -25766,16 +25795,26 @@ const HomePage = () => {
|
|
|
25766
25795
|
collections: activeCollections,
|
|
25767
25796
|
cardOptions,
|
|
25768
25797
|
onToggleField: (uid, fName) => {
|
|
25769
|
-
setActiveCollections(
|
|
25770
|
-
|
|
25771
|
-
|
|
25772
|
-
|
|
25798
|
+
setActiveCollections(
|
|
25799
|
+
(prev) => prev.map(
|
|
25800
|
+
(c2) => c2.uid !== uid ? c2 : {
|
|
25801
|
+
...c2,
|
|
25802
|
+
fields: c2.fields.map(
|
|
25803
|
+
(f2) => f2.name === fName ? { ...f2, enabled: !f2.enabled } : f2
|
|
25804
|
+
)
|
|
25805
|
+
}
|
|
25806
|
+
)
|
|
25807
|
+
);
|
|
25773
25808
|
},
|
|
25774
25809
|
onToggleAll: (uid, val) => {
|
|
25775
|
-
setActiveCollections(
|
|
25776
|
-
|
|
25777
|
-
|
|
25778
|
-
|
|
25810
|
+
setActiveCollections(
|
|
25811
|
+
(prev) => prev.map(
|
|
25812
|
+
(c2) => c2.uid !== uid ? c2 : {
|
|
25813
|
+
...c2,
|
|
25814
|
+
fields: c2.fields.map((f2) => ({ ...f2, enabled: val }))
|
|
25815
|
+
}
|
|
25816
|
+
)
|
|
25817
|
+
);
|
|
25779
25818
|
},
|
|
25780
25819
|
onRemoveCollection: handleRemoveCollection,
|
|
25781
25820
|
onUpdateCardStyle: handleUpdateCardStyle,
|
|
@@ -25055,6 +25055,7 @@ const ChatbotPreview = () => {
|
|
|
25055
25055
|
const decoder = new TextDecoder();
|
|
25056
25056
|
let botMessage = "";
|
|
25057
25057
|
setMessages((prev) => [...prev, { text: "", isUser: false }]);
|
|
25058
|
+
let isCardsEvent = false;
|
|
25058
25059
|
while (true) {
|
|
25059
25060
|
const { done, value } = await reader.read();
|
|
25060
25061
|
if (done) break;
|
|
@@ -25062,7 +25063,18 @@ const ChatbotPreview = () => {
|
|
|
25062
25063
|
const lines = chunk.split("\n");
|
|
25063
25064
|
for (let rawLine of lines) {
|
|
25064
25065
|
const line = rawLine.replace(/\r/g, "");
|
|
25065
|
-
if (line
|
|
25066
|
+
if (!line) continue;
|
|
25067
|
+
if (line.startsWith("event: cards")) {
|
|
25068
|
+
isCardsEvent = true;
|
|
25069
|
+
continue;
|
|
25070
|
+
}
|
|
25071
|
+
if (isCardsEvent && line.startsWith("data: ")) {
|
|
25072
|
+
isCardsEvent = false;
|
|
25073
|
+
continue;
|
|
25074
|
+
}
|
|
25075
|
+
if (line.includes("[DONE]")) {
|
|
25076
|
+
return;
|
|
25077
|
+
}
|
|
25066
25078
|
if (line.startsWith("data: ")) {
|
|
25067
25079
|
const token = line.replace("data: ", "");
|
|
25068
25080
|
botMessage += token;
|
|
@@ -25678,7 +25690,12 @@ const HomePage = () => {
|
|
|
25678
25690
|
);
|
|
25679
25691
|
setActiveCollections(initialActive);
|
|
25680
25692
|
} catch (err) {
|
|
25681
|
-
|
|
25693
|
+
console.log("SAVE ERROR:", err);
|
|
25694
|
+
const message = err?.response?.data?.error || err?.response?.data?.message || "Invalid settings. Please check Base Domain.";
|
|
25695
|
+
toggleNotification({
|
|
25696
|
+
type: "warning",
|
|
25697
|
+
message
|
|
25698
|
+
});
|
|
25682
25699
|
} finally {
|
|
25683
25700
|
setIsLoading(false);
|
|
25684
25701
|
}
|
|
@@ -25687,9 +25704,9 @@ const HomePage = () => {
|
|
|
25687
25704
|
init();
|
|
25688
25705
|
}, [get2]);
|
|
25689
25706
|
const handleUpdateCardStyle = (uid, style) => {
|
|
25690
|
-
setActiveCollections(
|
|
25691
|
-
(c2) => c2.uid === uid ? { ...c2, cardStyle: style } : c2
|
|
25692
|
-
)
|
|
25707
|
+
setActiveCollections(
|
|
25708
|
+
(prev) => prev.map((c2) => c2.uid === uid ? { ...c2, cardStyle: style } : c2)
|
|
25709
|
+
);
|
|
25693
25710
|
};
|
|
25694
25711
|
const handleRemoveCollection = (uid) => {
|
|
25695
25712
|
setActiveCollections((prev) => prev.filter((c2) => c2.uid !== uid));
|
|
@@ -25756,21 +25773,33 @@ const HomePage = () => {
|
|
|
25756
25773
|
setIsSaving(false);
|
|
25757
25774
|
}
|
|
25758
25775
|
};
|
|
25759
|
-
if (isLoading)
|
|
25776
|
+
if (isLoading)
|
|
25777
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", height: "100vh", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, {}) });
|
|
25760
25778
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { children: [
|
|
25761
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
25762
|
-
|
|
25763
|
-
|
|
25764
|
-
|
|
25765
|
-
|
|
25766
|
-
|
|
25767
|
-
|
|
25768
|
-
|
|
25769
|
-
|
|
25770
|
-
|
|
25771
|
-
|
|
25772
|
-
|
|
25773
|
-
|
|
25779
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
25780
|
+
designSystem.Box,
|
|
25781
|
+
{
|
|
25782
|
+
background: "neutral100",
|
|
25783
|
+
position: "sticky",
|
|
25784
|
+
top: 0,
|
|
25785
|
+
zIndex: 2,
|
|
25786
|
+
padding: 8,
|
|
25787
|
+
paddingBottom: 6,
|
|
25788
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", children: [
|
|
25789
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", fontWeight: "bold", children: "Chatbot Configuration" }),
|
|
25790
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
25791
|
+
designSystem.Button,
|
|
25792
|
+
{
|
|
25793
|
+
onClick: save,
|
|
25794
|
+
loading: isSaving,
|
|
25795
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Check, {}),
|
|
25796
|
+
disabled: !openaiKey || openaiKey.trim() === "",
|
|
25797
|
+
children: "Save Settings"
|
|
25798
|
+
}
|
|
25799
|
+
)
|
|
25800
|
+
] })
|
|
25801
|
+
}
|
|
25802
|
+
),
|
|
25774
25803
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { paddingLeft: 8, paddingTop: 2, paddingRight: 8, background: "neutral100", children: [
|
|
25775
25804
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
25776
25805
|
ConfigSettings,
|
|
@@ -25788,16 +25817,26 @@ const HomePage = () => {
|
|
|
25788
25817
|
collections: activeCollections,
|
|
25789
25818
|
cardOptions,
|
|
25790
25819
|
onToggleField: (uid, fName) => {
|
|
25791
|
-
setActiveCollections(
|
|
25792
|
-
|
|
25793
|
-
|
|
25794
|
-
|
|
25820
|
+
setActiveCollections(
|
|
25821
|
+
(prev) => prev.map(
|
|
25822
|
+
(c2) => c2.uid !== uid ? c2 : {
|
|
25823
|
+
...c2,
|
|
25824
|
+
fields: c2.fields.map(
|
|
25825
|
+
(f2) => f2.name === fName ? { ...f2, enabled: !f2.enabled } : f2
|
|
25826
|
+
)
|
|
25827
|
+
}
|
|
25828
|
+
)
|
|
25829
|
+
);
|
|
25795
25830
|
},
|
|
25796
25831
|
onToggleAll: (uid, val) => {
|
|
25797
|
-
setActiveCollections(
|
|
25798
|
-
|
|
25799
|
-
|
|
25800
|
-
|
|
25832
|
+
setActiveCollections(
|
|
25833
|
+
(prev) => prev.map(
|
|
25834
|
+
(c2) => c2.uid !== uid ? c2 : {
|
|
25835
|
+
...c2,
|
|
25836
|
+
fields: c2.fields.map((f2) => ({ ...f2, enabled: val }))
|
|
25837
|
+
}
|
|
25838
|
+
)
|
|
25839
|
+
);
|
|
25801
25840
|
},
|
|
25802
25841
|
onRemoveCollection: handleRemoveCollection,
|
|
25803
25842
|
onUpdateCardStyle: handleUpdateCardStyle,
|
package/dist/admin/index.js
CHANGED
|
@@ -37,7 +37,7 @@ const index = {
|
|
|
37
37
|
defaultMessage: PLUGIN_ID
|
|
38
38
|
},
|
|
39
39
|
Component: async () => {
|
|
40
|
-
const { App } = await Promise.resolve().then(() => require("../_chunks/App-
|
|
40
|
+
const { App } = await Promise.resolve().then(() => require("../_chunks/App-DracDGJ6.js"));
|
|
41
41
|
return App;
|
|
42
42
|
}
|
|
43
43
|
});
|
package/dist/admin/index.mjs
CHANGED