@contenify/chatbot 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +146 -338
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +146 -338
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +89 -21
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -77,7 +77,7 @@ var api_default = api;
|
|
|
77
77
|
|
|
78
78
|
// services/preferences.service.ts
|
|
79
79
|
var getMyPreferencesApi = async () => {
|
|
80
|
-
const { data } = await api_default.get("/preferences/me");
|
|
80
|
+
const { data } = await api_default.get("/chatboat/preferences/me");
|
|
81
81
|
return data.data;
|
|
82
82
|
};
|
|
83
83
|
var savePreferencesApi = async ({
|
|
@@ -155,7 +155,7 @@ var savePreferencesApi = async ({
|
|
|
155
155
|
if (targetAudience !== void 0) {
|
|
156
156
|
formData.append("targetAudience", targetAudience);
|
|
157
157
|
}
|
|
158
|
-
const { data } = await api_default.put("/preferences", formData, {
|
|
158
|
+
const { data } = await api_default.put("/chatboat/preferences", formData, {
|
|
159
159
|
headers: {
|
|
160
160
|
"Content-Type": "multipart/form-data"
|
|
161
161
|
}
|
|
@@ -292,6 +292,13 @@ function extractArticleContent(raw) {
|
|
|
292
292
|
};
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
|
+
var hexToRgba = (hex, opacity) => {
|
|
296
|
+
const sanitizedHex = hex.replace("#", "");
|
|
297
|
+
const r = parseInt(sanitizedHex.substring(0, 2), 16);
|
|
298
|
+
const g = parseInt(sanitizedHex.substring(2, 4), 16);
|
|
299
|
+
const b = parseInt(sanitizedHex.substring(4, 6), 16);
|
|
300
|
+
return `rgba(${r}, ${g}, ${b}, ${opacity})`;
|
|
301
|
+
};
|
|
295
302
|
|
|
296
303
|
// components/chatbot/ChatWindow.tsx
|
|
297
304
|
import { Check, Copy, Edit3, Send, SendHorizontal, Zap, X as X2, RefreshCcw as RefreshCcw2, FileText, ListChecks, Share2, BookOpen, Mail, Key } from "lucide-react";
|
|
@@ -819,19 +826,19 @@ function NewsList({
|
|
|
819
826
|
|
|
820
827
|
// services/news.service.ts
|
|
821
828
|
var getTrendingNews = async () => {
|
|
822
|
-
const { data } = await api_default.get("/
|
|
829
|
+
const { data } = await api_default.get("/chatboat/trending");
|
|
823
830
|
return data.data;
|
|
824
831
|
};
|
|
825
832
|
var getNewsSources = async () => {
|
|
826
|
-
const { data } = await api_default.get("/
|
|
833
|
+
const { data } = await api_default.get("/chatboat/scrape/sources");
|
|
827
834
|
return data.data;
|
|
828
835
|
};
|
|
829
836
|
var scrapeNewsSource = async (sourceId) => {
|
|
830
|
-
const { data } = await api_default.post("/
|
|
837
|
+
const { data } = await api_default.post("/chatboat/scrape/source", { sourceId });
|
|
831
838
|
return data.data;
|
|
832
839
|
};
|
|
833
840
|
var getNewsBySource = async (sourceId) => {
|
|
834
|
-
const { data } = await api_default.get(`/
|
|
841
|
+
const { data } = await api_default.get(`/chatboat/scrape/by-source/${sourceId}`);
|
|
835
842
|
return data.data;
|
|
836
843
|
};
|
|
837
844
|
|
|
@@ -966,7 +973,6 @@ function ChatWindow({
|
|
|
966
973
|
const handleSourceSelect = (option) => {
|
|
967
974
|
var _a2;
|
|
968
975
|
const sourceId = (_a2 = option == null ? void 0 : option.value) != null ? _a2 : null;
|
|
969
|
-
console.log("Selected source:", option);
|
|
970
976
|
setSelectedSource(sourceId);
|
|
971
977
|
fetchNews(sourceId);
|
|
972
978
|
};
|
|
@@ -1019,103 +1025,91 @@ function ChatWindow({
|
|
|
1019
1025
|
messages.map((msg) => {
|
|
1020
1026
|
var _a2;
|
|
1021
1027
|
const parsed = formatAIContent(msg.content);
|
|
1022
|
-
return /* @__PURE__ */
|
|
1023
|
-
/* @__PURE__ */ jsx5("div", { className: "cnfy-msg-
|
|
1024
|
-
"
|
|
1028
|
+
return /* @__PURE__ */ jsx5("div", { className: "cnfy-msg", children: /* @__PURE__ */ jsxs4("div", { className: msg.role === "assistant" ? `cnfy-msg-body` : `cnfy-msg-body you`, children: [
|
|
1029
|
+
msg.role === "assistant" && parsed.blocks.length > 0 && /* @__PURE__ */ jsx5("div", { className: "cnfy-msg-copy-row", children: /* @__PURE__ */ jsx5(
|
|
1030
|
+
"button",
|
|
1025
1031
|
{
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
},
|
|
1030
|
-
children: msg.role === "assistant" ? "AI" : "You"
|
|
1032
|
+
onClick: () => handleCopy(parsed.blocks, msg.id),
|
|
1033
|
+
className: "cnfy-copy-btn",
|
|
1034
|
+
title: "Copy to clipboard",
|
|
1035
|
+
children: copiedId === msg.id ? /* @__PURE__ */ jsx5(Check, { size: 16, className: "cnfy-copy-icon--copied" }) : /* @__PURE__ */ jsx5(Copy, { size: 16 })
|
|
1031
1036
|
}
|
|
1032
1037
|
) }),
|
|
1033
|
-
|
|
1034
|
-
|
|
1038
|
+
parsed.blocks.map((block, idx) => {
|
|
1039
|
+
if (block.type === "h1") {
|
|
1040
|
+
return /* @__PURE__ */ jsx5(
|
|
1041
|
+
"h1",
|
|
1042
|
+
{
|
|
1043
|
+
className: "cnfy-block-h1",
|
|
1044
|
+
children: block.text
|
|
1045
|
+
},
|
|
1046
|
+
idx
|
|
1047
|
+
);
|
|
1048
|
+
}
|
|
1049
|
+
if (block.type === "h2") {
|
|
1050
|
+
return /* @__PURE__ */ jsx5(
|
|
1051
|
+
"h2",
|
|
1052
|
+
{
|
|
1053
|
+
className: "cnfy-block-h2",
|
|
1054
|
+
children: block.text
|
|
1055
|
+
},
|
|
1056
|
+
idx
|
|
1057
|
+
);
|
|
1058
|
+
}
|
|
1059
|
+
return /* @__PURE__ */ jsx5("p", { className: "cnfy-block-p", children: block.text }, idx);
|
|
1060
|
+
}),
|
|
1061
|
+
parsed.metaKeywords.length > 0 && /* @__PURE__ */ jsx5("div", { className: "cnfy-msg-keywords", children: /* @__PURE__ */ jsx5("div", { className: "cnfy-msg-keywords-list", children: parsed.metaKeywords.map((tag, i) => /* @__PURE__ */ jsxs4(
|
|
1062
|
+
"span",
|
|
1063
|
+
{
|
|
1064
|
+
className: "cnfy-msg-keyword-tag",
|
|
1065
|
+
children: [
|
|
1066
|
+
"#",
|
|
1067
|
+
tag
|
|
1068
|
+
]
|
|
1069
|
+
},
|
|
1070
|
+
i
|
|
1071
|
+
)) }) }),
|
|
1072
|
+
msg.role === "assistant" && (analyzedData == null ? void 0 : analyzedData.messageId) === msg.id && analyzedData.options.length > 0 && /* @__PURE__ */ jsx5("div", { className: "cnfy-action-options", children: analyzedData.options.map((option) => {
|
|
1073
|
+
const IconComponent = ACTION_ICONS[option.id] || FileText;
|
|
1074
|
+
return /* @__PURE__ */ jsxs4(
|
|
1035
1075
|
"button",
|
|
1036
1076
|
{
|
|
1037
|
-
onClick: () =>
|
|
1038
|
-
className: "cnfy-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
{
|
|
1058
|
-
className: "cnfy-block-h2",
|
|
1059
|
-
children: block.text
|
|
1060
|
-
},
|
|
1061
|
-
idx
|
|
1062
|
-
);
|
|
1077
|
+
onClick: () => onSelectAction == null ? void 0 : onSelectAction(option.id, analyzedData.url, analyzedData.content),
|
|
1078
|
+
className: "cnfy-action-btn",
|
|
1079
|
+
children: [
|
|
1080
|
+
/* @__PURE__ */ jsx5(IconComponent, { size: 16 }),
|
|
1081
|
+
option.name
|
|
1082
|
+
]
|
|
1083
|
+
},
|
|
1084
|
+
option.id
|
|
1085
|
+
);
|
|
1086
|
+
}) }),
|
|
1087
|
+
msg.role === "assistant" && parsed.blocks.length > 0 && !(analyzedData == null ? void 0 : analyzedData.messageId) && (!isStreaming || msg.id !== ((_a2 = messages[messages.length - 1]) == null ? void 0 : _a2.id)) && /* @__PURE__ */ jsxs4("div", { className: "cnfy-msg-actions", children: [
|
|
1088
|
+
/* @__PURE__ */ jsxs4(
|
|
1089
|
+
"button",
|
|
1090
|
+
{
|
|
1091
|
+
onClick: () => handleEdit(parsed.blocks, parsed.metaKeywords, msg.id),
|
|
1092
|
+
className: "cnfy-btn-edit",
|
|
1093
|
+
children: [
|
|
1094
|
+
/* @__PURE__ */ jsx5(Edit3, { size: 16 }),
|
|
1095
|
+
"Edit"
|
|
1096
|
+
]
|
|
1063
1097
|
}
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
"span",
|
|
1098
|
+
),
|
|
1099
|
+
/* @__PURE__ */ jsxs4(
|
|
1100
|
+
"button",
|
|
1068
1101
|
{
|
|
1069
|
-
|
|
1102
|
+
onClick: () => handlePost(msg.content, parsed.metaKeywords),
|
|
1103
|
+
className: "cnfy-btn-post",
|
|
1104
|
+
style: { backgroundColor: primaryColor, color: "#fff" },
|
|
1070
1105
|
children: [
|
|
1071
|
-
|
|
1072
|
-
|
|
1106
|
+
/* @__PURE__ */ jsx5(Send, { size: 16 }),
|
|
1107
|
+
"Post"
|
|
1073
1108
|
]
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1076
|
-
)) }) }),
|
|
1077
|
-
msg.role === "assistant" && (analyzedData == null ? void 0 : analyzedData.messageId) === msg.id && analyzedData.options.length > 0 && /* @__PURE__ */ jsx5("div", { className: "cnfy-action-options", children: analyzedData.options.map((option) => {
|
|
1078
|
-
const IconComponent = ACTION_ICONS[option.id] || FileText;
|
|
1079
|
-
return /* @__PURE__ */ jsxs4(
|
|
1080
|
-
"button",
|
|
1081
|
-
{
|
|
1082
|
-
onClick: () => onSelectAction == null ? void 0 : onSelectAction(option.id, analyzedData.url, analyzedData.content),
|
|
1083
|
-
className: "cnfy-action-btn",
|
|
1084
|
-
children: [
|
|
1085
|
-
/* @__PURE__ */ jsx5(IconComponent, { size: 16 }),
|
|
1086
|
-
option.name
|
|
1087
|
-
]
|
|
1088
|
-
},
|
|
1089
|
-
option.id
|
|
1090
|
-
);
|
|
1091
|
-
}) }),
|
|
1092
|
-
msg.role === "assistant" && parsed.blocks.length > 0 && !(analyzedData == null ? void 0 : analyzedData.messageId) && (!isStreaming || msg.id !== ((_a2 = messages[messages.length - 1]) == null ? void 0 : _a2.id)) && /* @__PURE__ */ jsxs4("div", { className: "cnfy-msg-actions", children: [
|
|
1093
|
-
/* @__PURE__ */ jsxs4(
|
|
1094
|
-
"button",
|
|
1095
|
-
{
|
|
1096
|
-
onClick: () => handleEdit(parsed.blocks, parsed.metaKeywords, msg.id),
|
|
1097
|
-
className: "cnfy-btn-edit",
|
|
1098
|
-
children: [
|
|
1099
|
-
/* @__PURE__ */ jsx5(Edit3, { size: 16 }),
|
|
1100
|
-
"Edit"
|
|
1101
|
-
]
|
|
1102
|
-
}
|
|
1103
|
-
),
|
|
1104
|
-
/* @__PURE__ */ jsxs4(
|
|
1105
|
-
"button",
|
|
1106
|
-
{
|
|
1107
|
-
onClick: () => handlePost(msg.content, parsed.metaKeywords),
|
|
1108
|
-
className: "cnfy-btn-post",
|
|
1109
|
-
style: { backgroundColor: primaryColor, color: "#fff" },
|
|
1110
|
-
children: [
|
|
1111
|
-
/* @__PURE__ */ jsx5(Send, { size: 16 }),
|
|
1112
|
-
"Post"
|
|
1113
|
-
]
|
|
1114
|
-
}
|
|
1115
|
-
)
|
|
1116
|
-
] })
|
|
1109
|
+
}
|
|
1110
|
+
)
|
|
1117
1111
|
] })
|
|
1118
|
-
] }, msg.id);
|
|
1112
|
+
] }) }, msg.id);
|
|
1119
1113
|
}),
|
|
1120
1114
|
/* @__PURE__ */ jsx5("div", { ref: bottomRef })
|
|
1121
1115
|
] }) }),
|
|
@@ -1355,14 +1349,14 @@ var triggerScrape = async ({
|
|
|
1355
1349
|
state,
|
|
1356
1350
|
cities
|
|
1357
1351
|
}) => {
|
|
1358
|
-
const { data } = await api_default.post("/scrape/trigger", {
|
|
1352
|
+
const { data } = await api_default.post("/chatboat/scrape/trigger", {
|
|
1359
1353
|
state,
|
|
1360
1354
|
cities
|
|
1361
1355
|
});
|
|
1362
1356
|
return data;
|
|
1363
1357
|
};
|
|
1364
1358
|
var getScrapeStatus = async () => {
|
|
1365
|
-
const { data } = await api_default.get("/scrape/status");
|
|
1359
|
+
const { data } = await api_default.get("/chatboat/scrape/status");
|
|
1366
1360
|
return data.data;
|
|
1367
1361
|
};
|
|
1368
1362
|
|
|
@@ -1418,23 +1412,6 @@ var LANGUAGE_OPTIONS = [
|
|
|
1418
1412
|
{ value: "en", label: "English" },
|
|
1419
1413
|
{ value: "hi", label: "Hindi" }
|
|
1420
1414
|
];
|
|
1421
|
-
var TONE_OPTIONS = [
|
|
1422
|
-
{ value: "formal", label: "Formal" },
|
|
1423
|
-
{ value: "casual", label: "Casual" },
|
|
1424
|
-
{ value: "engaging", label: "Engaging" },
|
|
1425
|
-
{ value: "professional", label: "Professional" }
|
|
1426
|
-
];
|
|
1427
|
-
var STYLE_OPTIONS = [
|
|
1428
|
-
{ value: "news", label: "News Article" },
|
|
1429
|
-
{ value: "blog", label: "Blog Post" },
|
|
1430
|
-
{ value: "editorial", label: "Editorial" },
|
|
1431
|
-
{ value: "summary", label: "Summary" }
|
|
1432
|
-
];
|
|
1433
|
-
var WORD_COUNT_OPTIONS = [
|
|
1434
|
-
{ value: "short", label: "Short (~300 words)" },
|
|
1435
|
-
{ value: "medium", label: "Medium (~600 words)" },
|
|
1436
|
-
{ value: "long", label: "Long (~1000+ words)" }
|
|
1437
|
-
];
|
|
1438
1415
|
function PreferencesPage() {
|
|
1439
1416
|
var _a, _b, _c;
|
|
1440
1417
|
const { preferences, loading, refreshPreferences, updatePreferences } = usePreferences();
|
|
@@ -1445,12 +1422,6 @@ function PreferencesPage() {
|
|
|
1445
1422
|
const [state, setState] = useState6(null);
|
|
1446
1423
|
const [cities, setCities] = useState6([]);
|
|
1447
1424
|
const [language, setLanguage] = useState6(null);
|
|
1448
|
-
const [tone, setTone] = useState6(null);
|
|
1449
|
-
const [style, setStyle] = useState6(null);
|
|
1450
|
-
const [wordCount, setWordCount] = useState6(null);
|
|
1451
|
-
const [includeQuotes, setIncludeQuotes] = useState6(true);
|
|
1452
|
-
const [includeFAQ, setIncludeFAQ] = useState6(false);
|
|
1453
|
-
const [targetAudience, setTargetAudience] = useState6("");
|
|
1454
1425
|
const [saving, setSaving] = useState6(false);
|
|
1455
1426
|
const [success, setSuccess] = useState6(false);
|
|
1456
1427
|
const [scraping, setScraping] = useState6(false);
|
|
@@ -1460,13 +1431,7 @@ function PreferencesPage() {
|
|
|
1460
1431
|
botName: "",
|
|
1461
1432
|
state: void 0,
|
|
1462
1433
|
cities: [],
|
|
1463
|
-
language: void 0
|
|
1464
|
-
tone: void 0,
|
|
1465
|
-
style: void 0,
|
|
1466
|
-
wordCount: void 0,
|
|
1467
|
-
includeQuotes: true,
|
|
1468
|
-
includeFAQ: false,
|
|
1469
|
-
targetAudience: ""
|
|
1434
|
+
language: void 0
|
|
1470
1435
|
});
|
|
1471
1436
|
useEffect7(() => {
|
|
1472
1437
|
const fetchScrapeStatus = async () => {
|
|
@@ -1506,7 +1471,7 @@ function PreferencesPage() {
|
|
|
1506
1471
|
}
|
|
1507
1472
|
};
|
|
1508
1473
|
useEffect7(() => {
|
|
1509
|
-
var _a2, _b2, _c2, _d, _e
|
|
1474
|
+
var _a2, _b2, _c2, _d, _e;
|
|
1510
1475
|
if (preferences) {
|
|
1511
1476
|
const name = ((_a2 = preferences.chatbot) == null ? void 0 : _a2.name) || "";
|
|
1512
1477
|
const pState = (_b2 = preferences.localization) == null ? void 0 : _b2.state;
|
|
@@ -1524,38 +1489,11 @@ function PreferencesPage() {
|
|
|
1524
1489
|
const langOption = LANGUAGE_OPTIONS.find((opt) => opt.value === pLanguage);
|
|
1525
1490
|
setLanguage(langOption || null);
|
|
1526
1491
|
}
|
|
1527
|
-
const pTone = (_f = preferences.content) == null ? void 0 : _f.tone;
|
|
1528
|
-
const pStyle = (_g = preferences.content) == null ? void 0 : _g.style;
|
|
1529
|
-
const pWordCount = (_h = preferences.content) == null ? void 0 : _h.wordCount;
|
|
1530
|
-
const pIncludeQuotes = (_j = (_i = preferences.content) == null ? void 0 : _i.includeQuotes) != null ? _j : true;
|
|
1531
|
-
const pIncludeFAQ = (_l = (_k = preferences.content) == null ? void 0 : _k.includeFAQ) != null ? _l : false;
|
|
1532
|
-
const pTargetAudience = ((_m = preferences.content) == null ? void 0 : _m.targetAudience) || "";
|
|
1533
|
-
if (pTone) {
|
|
1534
|
-
const toneOption = TONE_OPTIONS.find((opt) => opt.value === pTone);
|
|
1535
|
-
setTone(toneOption || null);
|
|
1536
|
-
}
|
|
1537
|
-
if (pStyle) {
|
|
1538
|
-
const styleOption = STYLE_OPTIONS.find((opt) => opt.value === pStyle);
|
|
1539
|
-
setStyle(styleOption || null);
|
|
1540
|
-
}
|
|
1541
|
-
if (pWordCount) {
|
|
1542
|
-
const wordCountOption = WORD_COUNT_OPTIONS.find((opt) => opt.value === pWordCount);
|
|
1543
|
-
setWordCount(wordCountOption || null);
|
|
1544
|
-
}
|
|
1545
|
-
setIncludeQuotes(pIncludeQuotes);
|
|
1546
|
-
setIncludeFAQ(pIncludeFAQ);
|
|
1547
|
-
setTargetAudience(pTargetAudience);
|
|
1548
1492
|
setOriginalValues({
|
|
1549
1493
|
botName: name,
|
|
1550
1494
|
state: pState,
|
|
1551
1495
|
cities: pCities,
|
|
1552
|
-
language: pLanguage
|
|
1553
|
-
tone: pTone,
|
|
1554
|
-
style: pStyle,
|
|
1555
|
-
wordCount: pWordCount,
|
|
1556
|
-
includeQuotes: pIncludeQuotes,
|
|
1557
|
-
includeFAQ: pIncludeFAQ,
|
|
1558
|
-
targetAudience: pTargetAudience
|
|
1496
|
+
language: pLanguage
|
|
1559
1497
|
});
|
|
1560
1498
|
}
|
|
1561
1499
|
}, [preferences]);
|
|
@@ -1587,27 +1525,6 @@ function PreferencesPage() {
|
|
|
1587
1525
|
if (currentLanguage !== originalValues.language) {
|
|
1588
1526
|
payload.language = currentLanguage;
|
|
1589
1527
|
}
|
|
1590
|
-
const currentTone = tone == null ? void 0 : tone.value;
|
|
1591
|
-
if (currentTone !== originalValues.tone) {
|
|
1592
|
-
payload.tone = currentTone;
|
|
1593
|
-
}
|
|
1594
|
-
const currentStyle = style == null ? void 0 : style.value;
|
|
1595
|
-
if (currentStyle !== originalValues.style) {
|
|
1596
|
-
payload.style = currentStyle;
|
|
1597
|
-
}
|
|
1598
|
-
const currentWordCount = wordCount == null ? void 0 : wordCount.value;
|
|
1599
|
-
if (currentWordCount !== originalValues.wordCount) {
|
|
1600
|
-
payload.wordCount = currentWordCount;
|
|
1601
|
-
}
|
|
1602
|
-
if (includeQuotes !== originalValues.includeQuotes) {
|
|
1603
|
-
payload.includeQuotes = includeQuotes;
|
|
1604
|
-
}
|
|
1605
|
-
if (includeFAQ !== originalValues.includeFAQ) {
|
|
1606
|
-
payload.includeFAQ = includeFAQ;
|
|
1607
|
-
}
|
|
1608
|
-
if (targetAudience !== originalValues.targetAudience) {
|
|
1609
|
-
payload.targetAudience = targetAudience;
|
|
1610
|
-
}
|
|
1611
1528
|
if (Object.keys(payload).length === 0) {
|
|
1612
1529
|
toast.error("No changes to save");
|
|
1613
1530
|
setSaving(false);
|
|
@@ -1680,150 +1597,6 @@ function PreferencesPage() {
|
|
|
1680
1597
|
] })
|
|
1681
1598
|
] })
|
|
1682
1599
|
] }),
|
|
1683
|
-
/* @__PURE__ */ jsxs7("div", { className: "cnfy-dash-card", children: [
|
|
1684
|
-
/* @__PURE__ */ jsx10("h2", { className: "cnfy-dash-card-title", children: "Localization Settings" }),
|
|
1685
|
-
/* @__PURE__ */ jsxs7("div", { className: "cnfy-dash-field", children: [
|
|
1686
|
-
/* @__PURE__ */ jsx10("label", { className: "cnfy-dash-label", children: "State" }),
|
|
1687
|
-
/* @__PURE__ */ jsx10(
|
|
1688
|
-
ClientSelect_default,
|
|
1689
|
-
{
|
|
1690
|
-
options: STATE_OPTIONS,
|
|
1691
|
-
value: state,
|
|
1692
|
-
onChange: (option) => setState(option),
|
|
1693
|
-
placeholder: "Select state"
|
|
1694
|
-
}
|
|
1695
|
-
)
|
|
1696
|
-
] }),
|
|
1697
|
-
/* @__PURE__ */ jsxs7("div", { className: "cnfy-dash-field", children: [
|
|
1698
|
-
/* @__PURE__ */ jsx10("label", { className: "cnfy-dash-label", children: "Cities" }),
|
|
1699
|
-
/* @__PURE__ */ jsx10(
|
|
1700
|
-
ClientSelect_default,
|
|
1701
|
-
{
|
|
1702
|
-
isMulti: true,
|
|
1703
|
-
options: CITY_OPTIONS,
|
|
1704
|
-
value: cities,
|
|
1705
|
-
onChange: (options) => setCities(options),
|
|
1706
|
-
placeholder: "Select cities",
|
|
1707
|
-
isDisabled: !state
|
|
1708
|
-
}
|
|
1709
|
-
)
|
|
1710
|
-
] }),
|
|
1711
|
-
/* @__PURE__ */ jsxs7("div", { className: "cnfy-dash-field", children: [
|
|
1712
|
-
/* @__PURE__ */ jsx10("label", { className: "cnfy-dash-label", children: "Language" }),
|
|
1713
|
-
/* @__PURE__ */ jsx10(
|
|
1714
|
-
ClientSelect_default,
|
|
1715
|
-
{
|
|
1716
|
-
options: LANGUAGE_OPTIONS,
|
|
1717
|
-
value: language,
|
|
1718
|
-
onChange: (option) => setLanguage(option),
|
|
1719
|
-
placeholder: "Select language"
|
|
1720
|
-
}
|
|
1721
|
-
)
|
|
1722
|
-
] })
|
|
1723
|
-
] }),
|
|
1724
|
-
/* @__PURE__ */ jsxs7("div", { className: "cnfy-dash-card", children: [
|
|
1725
|
-
/* @__PURE__ */ jsx10("h2", { className: "cnfy-dash-card-title", children: "Content Generation Settings" }),
|
|
1726
|
-
/* @__PURE__ */ jsxs7("div", { className: "cnfy-dash-field", children: [
|
|
1727
|
-
/* @__PURE__ */ jsx10("label", { className: "cnfy-dash-label", children: "Tone" }),
|
|
1728
|
-
/* @__PURE__ */ jsx10(
|
|
1729
|
-
ClientSelect_default,
|
|
1730
|
-
{
|
|
1731
|
-
options: TONE_OPTIONS,
|
|
1732
|
-
value: tone,
|
|
1733
|
-
onChange: (option) => setTone(option),
|
|
1734
|
-
placeholder: "Select tone"
|
|
1735
|
-
}
|
|
1736
|
-
),
|
|
1737
|
-
/* @__PURE__ */ jsx10("p", { className: "cnfy-dash-hint", children: "The writing tone for generated content" })
|
|
1738
|
-
] }),
|
|
1739
|
-
/* @__PURE__ */ jsxs7("div", { className: "cnfy-dash-field", children: [
|
|
1740
|
-
/* @__PURE__ */ jsx10("label", { className: "cnfy-dash-label", children: "Style" }),
|
|
1741
|
-
/* @__PURE__ */ jsx10(
|
|
1742
|
-
ClientSelect_default,
|
|
1743
|
-
{
|
|
1744
|
-
options: STYLE_OPTIONS,
|
|
1745
|
-
value: style,
|
|
1746
|
-
onChange: (option) => setStyle(option),
|
|
1747
|
-
placeholder: "Select style"
|
|
1748
|
-
}
|
|
1749
|
-
),
|
|
1750
|
-
/* @__PURE__ */ jsx10("p", { className: "cnfy-dash-hint", children: "The format/style of generated articles" })
|
|
1751
|
-
] }),
|
|
1752
|
-
/* @__PURE__ */ jsxs7("div", { className: "cnfy-dash-field", children: [
|
|
1753
|
-
/* @__PURE__ */ jsx10("label", { className: "cnfy-dash-label", children: "Word Count" }),
|
|
1754
|
-
/* @__PURE__ */ jsx10(
|
|
1755
|
-
ClientSelect_default,
|
|
1756
|
-
{
|
|
1757
|
-
options: WORD_COUNT_OPTIONS,
|
|
1758
|
-
value: wordCount,
|
|
1759
|
-
onChange: (option) => setWordCount(option),
|
|
1760
|
-
placeholder: "Select word count"
|
|
1761
|
-
}
|
|
1762
|
-
),
|
|
1763
|
-
/* @__PURE__ */ jsx10("p", { className: "cnfy-dash-hint", children: "Target length for generated content" })
|
|
1764
|
-
] }),
|
|
1765
|
-
/* @__PURE__ */ jsxs7("div", { className: "cnfy-dash-field", children: [
|
|
1766
|
-
/* @__PURE__ */ jsx10("label", { className: "cnfy-dash-label", children: "Target Audience" }),
|
|
1767
|
-
/* @__PURE__ */ jsx10(
|
|
1768
|
-
"input",
|
|
1769
|
-
{
|
|
1770
|
-
value: targetAudience,
|
|
1771
|
-
onChange: (e) => setTargetAudience(e.target.value),
|
|
1772
|
-
className: "cnfy-dash-input",
|
|
1773
|
-
placeholder: "e.g. tech-savvy millennials, business professionals"
|
|
1774
|
-
}
|
|
1775
|
-
),
|
|
1776
|
-
/* @__PURE__ */ jsx10("p", { className: "cnfy-dash-hint", children: "Describe your target audience for personalized content" })
|
|
1777
|
-
] }),
|
|
1778
|
-
/* @__PURE__ */ jsxs7("div", { className: "cnfy-toggle-group", children: [
|
|
1779
|
-
/* @__PURE__ */ jsxs7("div", { className: "cnfy-toggle-row", children: [
|
|
1780
|
-
/* @__PURE__ */ jsxs7("div", { children: [
|
|
1781
|
-
/* @__PURE__ */ jsx10("p", { className: "cnfy-toggle-label", children: "Include Quotes" }),
|
|
1782
|
-
/* @__PURE__ */ jsx10("p", { className: "cnfy-toggle-desc", children: "Add relevant quotes to generated articles" })
|
|
1783
|
-
] }),
|
|
1784
|
-
/* @__PURE__ */ jsx10(
|
|
1785
|
-
"button",
|
|
1786
|
-
{
|
|
1787
|
-
type: "button",
|
|
1788
|
-
role: "switch",
|
|
1789
|
-
"aria-checked": includeQuotes,
|
|
1790
|
-
onClick: () => setIncludeQuotes(!includeQuotes),
|
|
1791
|
-
className: "cnfy-toggle",
|
|
1792
|
-
style: { backgroundColor: includeQuotes ? primaryColor : "#d1d5db" },
|
|
1793
|
-
children: /* @__PURE__ */ jsx10(
|
|
1794
|
-
"span",
|
|
1795
|
-
{
|
|
1796
|
-
className: `cnfy-toggle-thumb ${includeQuotes ? "cnfy-toggle-thumb--on" : ""}`
|
|
1797
|
-
}
|
|
1798
|
-
)
|
|
1799
|
-
}
|
|
1800
|
-
)
|
|
1801
|
-
] }),
|
|
1802
|
-
/* @__PURE__ */ jsxs7("div", { className: "cnfy-toggle-row", children: [
|
|
1803
|
-
/* @__PURE__ */ jsxs7("div", { children: [
|
|
1804
|
-
/* @__PURE__ */ jsx10("p", { className: "cnfy-toggle-label", children: "Include FAQ Section" }),
|
|
1805
|
-
/* @__PURE__ */ jsx10("p", { className: "cnfy-toggle-desc", children: "Add FAQ section at the end of articles" })
|
|
1806
|
-
] }),
|
|
1807
|
-
/* @__PURE__ */ jsx10(
|
|
1808
|
-
"button",
|
|
1809
|
-
{
|
|
1810
|
-
type: "button",
|
|
1811
|
-
role: "switch",
|
|
1812
|
-
"aria-checked": includeFAQ,
|
|
1813
|
-
onClick: () => setIncludeFAQ(!includeFAQ),
|
|
1814
|
-
className: "cnfy-toggle",
|
|
1815
|
-
style: { backgroundColor: includeFAQ ? primaryColor : "#d1d5db" },
|
|
1816
|
-
children: /* @__PURE__ */ jsx10(
|
|
1817
|
-
"span",
|
|
1818
|
-
{
|
|
1819
|
-
className: `cnfy-toggle-thumb ${includeFAQ ? "cnfy-toggle-thumb--on" : ""}`
|
|
1820
|
-
}
|
|
1821
|
-
)
|
|
1822
|
-
}
|
|
1823
|
-
)
|
|
1824
|
-
] })
|
|
1825
|
-
] })
|
|
1826
|
-
] }),
|
|
1827
1600
|
/* @__PURE__ */ jsxs7("div", { className: "cnfy-dash-card", children: [
|
|
1828
1601
|
/* @__PURE__ */ jsxs7("div", { className: "cnfy-dash-card-header", children: [
|
|
1829
1602
|
/* @__PURE__ */ jsx10("h2", { className: "cnfy-dash-card-title-inline", children: "News Scraping" }),
|
|
@@ -1861,25 +1634,63 @@ function PreferencesPage() {
|
|
|
1861
1634
|
onClick: handleScrape,
|
|
1862
1635
|
disabled: scraping || (scrapeStatus == null ? void 0 : scrapeStatus.isRunning),
|
|
1863
1636
|
className: "cnfy-dash-btn-save",
|
|
1864
|
-
style: { backgroundColor: primaryColor },
|
|
1637
|
+
style: { backgroundColor: hexToRgba(primaryColor, 0.8) },
|
|
1865
1638
|
children: scraping ? "Starting Scrape..." : (scrapeStatus == null ? void 0 : scrapeStatus.isRunning) ? "Scraping in Progress..." : "Start Scraping"
|
|
1866
1639
|
}
|
|
1867
1640
|
)
|
|
1868
1641
|
] })
|
|
1869
1642
|
] }),
|
|
1870
|
-
/* @__PURE__ */ jsxs7("div", { className: "cnfy-dash-
|
|
1871
|
-
/* @__PURE__ */ jsx10(
|
|
1872
|
-
|
|
1873
|
-
{
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1643
|
+
/* @__PURE__ */ jsxs7("div", { className: "cnfy-dash-card", children: [
|
|
1644
|
+
/* @__PURE__ */ jsx10("h2", { className: "cnfy-dash-card-title", children: "Localization Settings" }),
|
|
1645
|
+
/* @__PURE__ */ jsxs7("div", { className: "cnfy-dash-field", children: [
|
|
1646
|
+
/* @__PURE__ */ jsx10("label", { className: "cnfy-dash-label", children: "State" }),
|
|
1647
|
+
/* @__PURE__ */ jsx10(
|
|
1648
|
+
ClientSelect_default,
|
|
1649
|
+
{
|
|
1650
|
+
options: STATE_OPTIONS,
|
|
1651
|
+
value: state,
|
|
1652
|
+
onChange: (option) => setState(option),
|
|
1653
|
+
placeholder: "Select state"
|
|
1654
|
+
}
|
|
1655
|
+
)
|
|
1656
|
+
] }),
|
|
1657
|
+
/* @__PURE__ */ jsxs7("div", { className: "cnfy-dash-field", children: [
|
|
1658
|
+
/* @__PURE__ */ jsx10("label", { className: "cnfy-dash-label", children: "Cities" }),
|
|
1659
|
+
/* @__PURE__ */ jsx10(
|
|
1660
|
+
ClientSelect_default,
|
|
1661
|
+
{
|
|
1662
|
+
isMulti: true,
|
|
1663
|
+
options: CITY_OPTIONS,
|
|
1664
|
+
value: cities,
|
|
1665
|
+
onChange: (options) => setCities(options),
|
|
1666
|
+
placeholder: "Select cities",
|
|
1667
|
+
isDisabled: !state
|
|
1668
|
+
}
|
|
1669
|
+
)
|
|
1670
|
+
] }),
|
|
1671
|
+
/* @__PURE__ */ jsxs7("div", { className: "cnfy-dash-field", children: [
|
|
1672
|
+
/* @__PURE__ */ jsx10("label", { className: "cnfy-dash-label", children: "Language" }),
|
|
1673
|
+
/* @__PURE__ */ jsx10(
|
|
1674
|
+
ClientSelect_default,
|
|
1675
|
+
{
|
|
1676
|
+
options: LANGUAGE_OPTIONS,
|
|
1677
|
+
value: language,
|
|
1678
|
+
onChange: (option) => setLanguage(option),
|
|
1679
|
+
placeholder: "Select language"
|
|
1680
|
+
}
|
|
1681
|
+
)
|
|
1682
|
+
] })
|
|
1683
|
+
] }),
|
|
1684
|
+
/* @__PURE__ */ jsx10("div", { className: "cnfy-dash-actions", children: /* @__PURE__ */ jsx10(
|
|
1685
|
+
"button",
|
|
1686
|
+
{
|
|
1687
|
+
onClick: handleSave,
|
|
1688
|
+
disabled: saving,
|
|
1689
|
+
className: "cnfy-dash-btn-save",
|
|
1690
|
+
style: { backgroundColor: primaryColor },
|
|
1691
|
+
children: saving ? "Saving..." : "Save Preferences"
|
|
1692
|
+
}
|
|
1693
|
+
) })
|
|
1883
1694
|
] });
|
|
1884
1695
|
}
|
|
1885
1696
|
|
|
@@ -1997,19 +1808,16 @@ var rewriteNewsStreamApi = async ({
|
|
|
1997
1808
|
try {
|
|
1998
1809
|
const API_BASE_URL = getApiBaseUrl();
|
|
1999
1810
|
const apiKey = getApiKey();
|
|
2000
|
-
console.log("\u{1F680} Starting stream request to:", `${API_BASE_URL}/chat/rewrite/stream`);
|
|
2001
|
-
console.log("\u{1F4E6} Payload:", payload);
|
|
2002
1811
|
const headers = {
|
|
2003
1812
|
"Content-Type": "application/json"
|
|
2004
1813
|
};
|
|
2005
1814
|
if (apiKey) {
|
|
2006
1815
|
headers["x-api-key"] = apiKey;
|
|
2007
1816
|
}
|
|
2008
|
-
const response = await fetch(`${API_BASE_URL}/
|
|
1817
|
+
const response = await fetch(`${API_BASE_URL}/chatboat/rewrite/stream`, {
|
|
2009
1818
|
method: "POST",
|
|
2010
1819
|
headers,
|
|
2011
1820
|
credentials: "include",
|
|
2012
|
-
// Include cookies for authentication
|
|
2013
1821
|
body: JSON.stringify(payload)
|
|
2014
1822
|
});
|
|
2015
1823
|
console.log("\u{1F4E1} Response status:", response.status);
|