@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.js
CHANGED
|
@@ -110,7 +110,7 @@ var api_default = api;
|
|
|
110
110
|
|
|
111
111
|
// services/preferences.service.ts
|
|
112
112
|
var getMyPreferencesApi = async () => {
|
|
113
|
-
const { data } = await api_default.get("/preferences/me");
|
|
113
|
+
const { data } = await api_default.get("/chatboat/preferences/me");
|
|
114
114
|
return data.data;
|
|
115
115
|
};
|
|
116
116
|
var savePreferencesApi = async ({
|
|
@@ -188,7 +188,7 @@ var savePreferencesApi = async ({
|
|
|
188
188
|
if (targetAudience !== void 0) {
|
|
189
189
|
formData.append("targetAudience", targetAudience);
|
|
190
190
|
}
|
|
191
|
-
const { data } = await api_default.put("/preferences", formData, {
|
|
191
|
+
const { data } = await api_default.put("/chatboat/preferences", formData, {
|
|
192
192
|
headers: {
|
|
193
193
|
"Content-Type": "multipart/form-data"
|
|
194
194
|
}
|
|
@@ -325,6 +325,13 @@ function extractArticleContent(raw) {
|
|
|
325
325
|
};
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
|
+
var hexToRgba = (hex, opacity) => {
|
|
329
|
+
const sanitizedHex = hex.replace("#", "");
|
|
330
|
+
const r = parseInt(sanitizedHex.substring(0, 2), 16);
|
|
331
|
+
const g = parseInt(sanitizedHex.substring(2, 4), 16);
|
|
332
|
+
const b = parseInt(sanitizedHex.substring(4, 6), 16);
|
|
333
|
+
return `rgba(${r}, ${g}, ${b}, ${opacity})`;
|
|
334
|
+
};
|
|
328
335
|
|
|
329
336
|
// components/chatbot/ChatWindow.tsx
|
|
330
337
|
var import_lucide_react4 = require("lucide-react");
|
|
@@ -842,19 +849,19 @@ function NewsList({
|
|
|
842
849
|
|
|
843
850
|
// services/news.service.ts
|
|
844
851
|
var getTrendingNews = async () => {
|
|
845
|
-
const { data } = await api_default.get("/
|
|
852
|
+
const { data } = await api_default.get("/chatboat/trending");
|
|
846
853
|
return data.data;
|
|
847
854
|
};
|
|
848
855
|
var getNewsSources = async () => {
|
|
849
|
-
const { data } = await api_default.get("/
|
|
856
|
+
const { data } = await api_default.get("/chatboat/scrape/sources");
|
|
850
857
|
return data.data;
|
|
851
858
|
};
|
|
852
859
|
var scrapeNewsSource = async (sourceId) => {
|
|
853
|
-
const { data } = await api_default.post("/
|
|
860
|
+
const { data } = await api_default.post("/chatboat/scrape/source", { sourceId });
|
|
854
861
|
return data.data;
|
|
855
862
|
};
|
|
856
863
|
var getNewsBySource = async (sourceId) => {
|
|
857
|
-
const { data } = await api_default.get(`/
|
|
864
|
+
const { data } = await api_default.get(`/chatboat/scrape/by-source/${sourceId}`);
|
|
858
865
|
return data.data;
|
|
859
866
|
};
|
|
860
867
|
|
|
@@ -989,7 +996,6 @@ function ChatWindow({
|
|
|
989
996
|
const handleSourceSelect = (option) => {
|
|
990
997
|
var _a2;
|
|
991
998
|
const sourceId = (_a2 = option == null ? void 0 : option.value) != null ? _a2 : null;
|
|
992
|
-
console.log("Selected source:", option);
|
|
993
999
|
setSelectedSource(sourceId);
|
|
994
1000
|
fetchNews(sourceId);
|
|
995
1001
|
};
|
|
@@ -1042,103 +1048,91 @@ function ChatWindow({
|
|
|
1042
1048
|
messages.map((msg) => {
|
|
1043
1049
|
var _a2;
|
|
1044
1050
|
const parsed = formatAIContent(msg.content);
|
|
1045
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.
|
|
1046
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "cnfy-msg-
|
|
1047
|
-
"
|
|
1051
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "cnfy-msg", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: msg.role === "assistant" ? `cnfy-msg-body` : `cnfy-msg-body you`, children: [
|
|
1052
|
+
msg.role === "assistant" && parsed.blocks.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "cnfy-msg-copy-row", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1053
|
+
"button",
|
|
1048
1054
|
{
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
},
|
|
1053
|
-
children: msg.role === "assistant" ? "AI" : "You"
|
|
1055
|
+
onClick: () => handleCopy(parsed.blocks, msg.id),
|
|
1056
|
+
className: "cnfy-copy-btn",
|
|
1057
|
+
title: "Copy to clipboard",
|
|
1058
|
+
children: copiedId === msg.id ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react4.Check, { size: 16, className: "cnfy-copy-icon--copied" }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react4.Copy, { size: 16 })
|
|
1054
1059
|
}
|
|
1055
1060
|
) }),
|
|
1056
|
-
|
|
1057
|
-
|
|
1061
|
+
parsed.blocks.map((block, idx) => {
|
|
1062
|
+
if (block.type === "h1") {
|
|
1063
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1064
|
+
"h1",
|
|
1065
|
+
{
|
|
1066
|
+
className: "cnfy-block-h1",
|
|
1067
|
+
children: block.text
|
|
1068
|
+
},
|
|
1069
|
+
idx
|
|
1070
|
+
);
|
|
1071
|
+
}
|
|
1072
|
+
if (block.type === "h2") {
|
|
1073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1074
|
+
"h2",
|
|
1075
|
+
{
|
|
1076
|
+
className: "cnfy-block-h2",
|
|
1077
|
+
children: block.text
|
|
1078
|
+
},
|
|
1079
|
+
idx
|
|
1080
|
+
);
|
|
1081
|
+
}
|
|
1082
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "cnfy-block-p", children: block.text }, idx);
|
|
1083
|
+
}),
|
|
1084
|
+
parsed.metaKeywords.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "cnfy-msg-keywords", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "cnfy-msg-keywords-list", children: parsed.metaKeywords.map((tag, i) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1085
|
+
"span",
|
|
1086
|
+
{
|
|
1087
|
+
className: "cnfy-msg-keyword-tag",
|
|
1088
|
+
children: [
|
|
1089
|
+
"#",
|
|
1090
|
+
tag
|
|
1091
|
+
]
|
|
1092
|
+
},
|
|
1093
|
+
i
|
|
1094
|
+
)) }) }),
|
|
1095
|
+
msg.role === "assistant" && (analyzedData == null ? void 0 : analyzedData.messageId) === msg.id && analyzedData.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "cnfy-action-options", children: analyzedData.options.map((option) => {
|
|
1096
|
+
const IconComponent = ACTION_ICONS[option.id] || import_lucide_react4.FileText;
|
|
1097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1058
1098
|
"button",
|
|
1059
1099
|
{
|
|
1060
|
-
onClick: () =>
|
|
1061
|
-
className: "cnfy-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
{
|
|
1081
|
-
className: "cnfy-block-h2",
|
|
1082
|
-
children: block.text
|
|
1083
|
-
},
|
|
1084
|
-
idx
|
|
1085
|
-
);
|
|
1100
|
+
onClick: () => onSelectAction == null ? void 0 : onSelectAction(option.id, analyzedData.url, analyzedData.content),
|
|
1101
|
+
className: "cnfy-action-btn",
|
|
1102
|
+
children: [
|
|
1103
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IconComponent, { size: 16 }),
|
|
1104
|
+
option.name
|
|
1105
|
+
]
|
|
1106
|
+
},
|
|
1107
|
+
option.id
|
|
1108
|
+
);
|
|
1109
|
+
}) }),
|
|
1110
|
+
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__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "cnfy-msg-actions", children: [
|
|
1111
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1112
|
+
"button",
|
|
1113
|
+
{
|
|
1114
|
+
onClick: () => handleEdit(parsed.blocks, parsed.metaKeywords, msg.id),
|
|
1115
|
+
className: "cnfy-btn-edit",
|
|
1116
|
+
children: [
|
|
1117
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react4.Edit3, { size: 16 }),
|
|
1118
|
+
"Edit"
|
|
1119
|
+
]
|
|
1086
1120
|
}
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
"span",
|
|
1121
|
+
),
|
|
1122
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1123
|
+
"button",
|
|
1091
1124
|
{
|
|
1092
|
-
|
|
1125
|
+
onClick: () => handlePost(msg.content, parsed.metaKeywords),
|
|
1126
|
+
className: "cnfy-btn-post",
|
|
1127
|
+
style: { backgroundColor: primaryColor, color: "#fff" },
|
|
1093
1128
|
children: [
|
|
1094
|
-
|
|
1095
|
-
|
|
1129
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react4.Send, { size: 16 }),
|
|
1130
|
+
"Post"
|
|
1096
1131
|
]
|
|
1097
|
-
}
|
|
1098
|
-
|
|
1099
|
-
)) }) }),
|
|
1100
|
-
msg.role === "assistant" && (analyzedData == null ? void 0 : analyzedData.messageId) === msg.id && analyzedData.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "cnfy-action-options", children: analyzedData.options.map((option) => {
|
|
1101
|
-
const IconComponent = ACTION_ICONS[option.id] || import_lucide_react4.FileText;
|
|
1102
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1103
|
-
"button",
|
|
1104
|
-
{
|
|
1105
|
-
onClick: () => onSelectAction == null ? void 0 : onSelectAction(option.id, analyzedData.url, analyzedData.content),
|
|
1106
|
-
className: "cnfy-action-btn",
|
|
1107
|
-
children: [
|
|
1108
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IconComponent, { size: 16 }),
|
|
1109
|
-
option.name
|
|
1110
|
-
]
|
|
1111
|
-
},
|
|
1112
|
-
option.id
|
|
1113
|
-
);
|
|
1114
|
-
}) }),
|
|
1115
|
-
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__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "cnfy-msg-actions", children: [
|
|
1116
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1117
|
-
"button",
|
|
1118
|
-
{
|
|
1119
|
-
onClick: () => handleEdit(parsed.blocks, parsed.metaKeywords, msg.id),
|
|
1120
|
-
className: "cnfy-btn-edit",
|
|
1121
|
-
children: [
|
|
1122
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react4.Edit3, { size: 16 }),
|
|
1123
|
-
"Edit"
|
|
1124
|
-
]
|
|
1125
|
-
}
|
|
1126
|
-
),
|
|
1127
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1128
|
-
"button",
|
|
1129
|
-
{
|
|
1130
|
-
onClick: () => handlePost(msg.content, parsed.metaKeywords),
|
|
1131
|
-
className: "cnfy-btn-post",
|
|
1132
|
-
style: { backgroundColor: primaryColor, color: "#fff" },
|
|
1133
|
-
children: [
|
|
1134
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react4.Send, { size: 16 }),
|
|
1135
|
-
"Post"
|
|
1136
|
-
]
|
|
1137
|
-
}
|
|
1138
|
-
)
|
|
1139
|
-
] })
|
|
1132
|
+
}
|
|
1133
|
+
)
|
|
1140
1134
|
] })
|
|
1141
|
-
] }, msg.id);
|
|
1135
|
+
] }) }, msg.id);
|
|
1142
1136
|
}),
|
|
1143
1137
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { ref: bottomRef })
|
|
1144
1138
|
] }) }),
|
|
@@ -1378,14 +1372,14 @@ var triggerScrape = async ({
|
|
|
1378
1372
|
state,
|
|
1379
1373
|
cities
|
|
1380
1374
|
}) => {
|
|
1381
|
-
const { data } = await api_default.post("/scrape/trigger", {
|
|
1375
|
+
const { data } = await api_default.post("/chatboat/scrape/trigger", {
|
|
1382
1376
|
state,
|
|
1383
1377
|
cities
|
|
1384
1378
|
});
|
|
1385
1379
|
return data;
|
|
1386
1380
|
};
|
|
1387
1381
|
var getScrapeStatus = async () => {
|
|
1388
|
-
const { data } = await api_default.get("/scrape/status");
|
|
1382
|
+
const { data } = await api_default.get("/chatboat/scrape/status");
|
|
1389
1383
|
return data.data;
|
|
1390
1384
|
};
|
|
1391
1385
|
|
|
@@ -1441,23 +1435,6 @@ var LANGUAGE_OPTIONS = [
|
|
|
1441
1435
|
{ value: "en", label: "English" },
|
|
1442
1436
|
{ value: "hi", label: "Hindi" }
|
|
1443
1437
|
];
|
|
1444
|
-
var TONE_OPTIONS = [
|
|
1445
|
-
{ value: "formal", label: "Formal" },
|
|
1446
|
-
{ value: "casual", label: "Casual" },
|
|
1447
|
-
{ value: "engaging", label: "Engaging" },
|
|
1448
|
-
{ value: "professional", label: "Professional" }
|
|
1449
|
-
];
|
|
1450
|
-
var STYLE_OPTIONS = [
|
|
1451
|
-
{ value: "news", label: "News Article" },
|
|
1452
|
-
{ value: "blog", label: "Blog Post" },
|
|
1453
|
-
{ value: "editorial", label: "Editorial" },
|
|
1454
|
-
{ value: "summary", label: "Summary" }
|
|
1455
|
-
];
|
|
1456
|
-
var WORD_COUNT_OPTIONS = [
|
|
1457
|
-
{ value: "short", label: "Short (~300 words)" },
|
|
1458
|
-
{ value: "medium", label: "Medium (~600 words)" },
|
|
1459
|
-
{ value: "long", label: "Long (~1000+ words)" }
|
|
1460
|
-
];
|
|
1461
1438
|
function PreferencesPage() {
|
|
1462
1439
|
var _a, _b, _c;
|
|
1463
1440
|
const { preferences, loading, refreshPreferences, updatePreferences } = usePreferences();
|
|
@@ -1468,12 +1445,6 @@ function PreferencesPage() {
|
|
|
1468
1445
|
const [state, setState] = (0, import_react9.useState)(null);
|
|
1469
1446
|
const [cities, setCities] = (0, import_react9.useState)([]);
|
|
1470
1447
|
const [language, setLanguage] = (0, import_react9.useState)(null);
|
|
1471
|
-
const [tone, setTone] = (0, import_react9.useState)(null);
|
|
1472
|
-
const [style, setStyle] = (0, import_react9.useState)(null);
|
|
1473
|
-
const [wordCount, setWordCount] = (0, import_react9.useState)(null);
|
|
1474
|
-
const [includeQuotes, setIncludeQuotes] = (0, import_react9.useState)(true);
|
|
1475
|
-
const [includeFAQ, setIncludeFAQ] = (0, import_react9.useState)(false);
|
|
1476
|
-
const [targetAudience, setTargetAudience] = (0, import_react9.useState)("");
|
|
1477
1448
|
const [saving, setSaving] = (0, import_react9.useState)(false);
|
|
1478
1449
|
const [success, setSuccess] = (0, import_react9.useState)(false);
|
|
1479
1450
|
const [scraping, setScraping] = (0, import_react9.useState)(false);
|
|
@@ -1483,13 +1454,7 @@ function PreferencesPage() {
|
|
|
1483
1454
|
botName: "",
|
|
1484
1455
|
state: void 0,
|
|
1485
1456
|
cities: [],
|
|
1486
|
-
language: void 0
|
|
1487
|
-
tone: void 0,
|
|
1488
|
-
style: void 0,
|
|
1489
|
-
wordCount: void 0,
|
|
1490
|
-
includeQuotes: true,
|
|
1491
|
-
includeFAQ: false,
|
|
1492
|
-
targetAudience: ""
|
|
1457
|
+
language: void 0
|
|
1493
1458
|
});
|
|
1494
1459
|
(0, import_react9.useEffect)(() => {
|
|
1495
1460
|
const fetchScrapeStatus = async () => {
|
|
@@ -1529,7 +1494,7 @@ function PreferencesPage() {
|
|
|
1529
1494
|
}
|
|
1530
1495
|
};
|
|
1531
1496
|
(0, import_react9.useEffect)(() => {
|
|
1532
|
-
var _a2, _b2, _c2, _d, _e
|
|
1497
|
+
var _a2, _b2, _c2, _d, _e;
|
|
1533
1498
|
if (preferences) {
|
|
1534
1499
|
const name = ((_a2 = preferences.chatbot) == null ? void 0 : _a2.name) || "";
|
|
1535
1500
|
const pState = (_b2 = preferences.localization) == null ? void 0 : _b2.state;
|
|
@@ -1547,38 +1512,11 @@ function PreferencesPage() {
|
|
|
1547
1512
|
const langOption = LANGUAGE_OPTIONS.find((opt) => opt.value === pLanguage);
|
|
1548
1513
|
setLanguage(langOption || null);
|
|
1549
1514
|
}
|
|
1550
|
-
const pTone = (_f = preferences.content) == null ? void 0 : _f.tone;
|
|
1551
|
-
const pStyle = (_g = preferences.content) == null ? void 0 : _g.style;
|
|
1552
|
-
const pWordCount = (_h = preferences.content) == null ? void 0 : _h.wordCount;
|
|
1553
|
-
const pIncludeQuotes = (_j = (_i = preferences.content) == null ? void 0 : _i.includeQuotes) != null ? _j : true;
|
|
1554
|
-
const pIncludeFAQ = (_l = (_k = preferences.content) == null ? void 0 : _k.includeFAQ) != null ? _l : false;
|
|
1555
|
-
const pTargetAudience = ((_m = preferences.content) == null ? void 0 : _m.targetAudience) || "";
|
|
1556
|
-
if (pTone) {
|
|
1557
|
-
const toneOption = TONE_OPTIONS.find((opt) => opt.value === pTone);
|
|
1558
|
-
setTone(toneOption || null);
|
|
1559
|
-
}
|
|
1560
|
-
if (pStyle) {
|
|
1561
|
-
const styleOption = STYLE_OPTIONS.find((opt) => opt.value === pStyle);
|
|
1562
|
-
setStyle(styleOption || null);
|
|
1563
|
-
}
|
|
1564
|
-
if (pWordCount) {
|
|
1565
|
-
const wordCountOption = WORD_COUNT_OPTIONS.find((opt) => opt.value === pWordCount);
|
|
1566
|
-
setWordCount(wordCountOption || null);
|
|
1567
|
-
}
|
|
1568
|
-
setIncludeQuotes(pIncludeQuotes);
|
|
1569
|
-
setIncludeFAQ(pIncludeFAQ);
|
|
1570
|
-
setTargetAudience(pTargetAudience);
|
|
1571
1515
|
setOriginalValues({
|
|
1572
1516
|
botName: name,
|
|
1573
1517
|
state: pState,
|
|
1574
1518
|
cities: pCities,
|
|
1575
|
-
language: pLanguage
|
|
1576
|
-
tone: pTone,
|
|
1577
|
-
style: pStyle,
|
|
1578
|
-
wordCount: pWordCount,
|
|
1579
|
-
includeQuotes: pIncludeQuotes,
|
|
1580
|
-
includeFAQ: pIncludeFAQ,
|
|
1581
|
-
targetAudience: pTargetAudience
|
|
1519
|
+
language: pLanguage
|
|
1582
1520
|
});
|
|
1583
1521
|
}
|
|
1584
1522
|
}, [preferences]);
|
|
@@ -1610,27 +1548,6 @@ function PreferencesPage() {
|
|
|
1610
1548
|
if (currentLanguage !== originalValues.language) {
|
|
1611
1549
|
payload.language = currentLanguage;
|
|
1612
1550
|
}
|
|
1613
|
-
const currentTone = tone == null ? void 0 : tone.value;
|
|
1614
|
-
if (currentTone !== originalValues.tone) {
|
|
1615
|
-
payload.tone = currentTone;
|
|
1616
|
-
}
|
|
1617
|
-
const currentStyle = style == null ? void 0 : style.value;
|
|
1618
|
-
if (currentStyle !== originalValues.style) {
|
|
1619
|
-
payload.style = currentStyle;
|
|
1620
|
-
}
|
|
1621
|
-
const currentWordCount = wordCount == null ? void 0 : wordCount.value;
|
|
1622
|
-
if (currentWordCount !== originalValues.wordCount) {
|
|
1623
|
-
payload.wordCount = currentWordCount;
|
|
1624
|
-
}
|
|
1625
|
-
if (includeQuotes !== originalValues.includeQuotes) {
|
|
1626
|
-
payload.includeQuotes = includeQuotes;
|
|
1627
|
-
}
|
|
1628
|
-
if (includeFAQ !== originalValues.includeFAQ) {
|
|
1629
|
-
payload.includeFAQ = includeFAQ;
|
|
1630
|
-
}
|
|
1631
|
-
if (targetAudience !== originalValues.targetAudience) {
|
|
1632
|
-
payload.targetAudience = targetAudience;
|
|
1633
|
-
}
|
|
1634
1551
|
if (Object.keys(payload).length === 0) {
|
|
1635
1552
|
import_react_hot_toast.default.error("No changes to save");
|
|
1636
1553
|
setSaving(false);
|
|
@@ -1703,150 +1620,6 @@ function PreferencesPage() {
|
|
|
1703
1620
|
] })
|
|
1704
1621
|
] })
|
|
1705
1622
|
] }),
|
|
1706
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-dash-card", children: [
|
|
1707
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h2", { className: "cnfy-dash-card-title", children: "Localization Settings" }),
|
|
1708
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-dash-field", children: [
|
|
1709
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "cnfy-dash-label", children: "State" }),
|
|
1710
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1711
|
-
ClientSelect_default,
|
|
1712
|
-
{
|
|
1713
|
-
options: STATE_OPTIONS,
|
|
1714
|
-
value: state,
|
|
1715
|
-
onChange: (option) => setState(option),
|
|
1716
|
-
placeholder: "Select state"
|
|
1717
|
-
}
|
|
1718
|
-
)
|
|
1719
|
-
] }),
|
|
1720
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-dash-field", children: [
|
|
1721
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "cnfy-dash-label", children: "Cities" }),
|
|
1722
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1723
|
-
ClientSelect_default,
|
|
1724
|
-
{
|
|
1725
|
-
isMulti: true,
|
|
1726
|
-
options: CITY_OPTIONS,
|
|
1727
|
-
value: cities,
|
|
1728
|
-
onChange: (options) => setCities(options),
|
|
1729
|
-
placeholder: "Select cities",
|
|
1730
|
-
isDisabled: !state
|
|
1731
|
-
}
|
|
1732
|
-
)
|
|
1733
|
-
] }),
|
|
1734
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-dash-field", children: [
|
|
1735
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "cnfy-dash-label", children: "Language" }),
|
|
1736
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1737
|
-
ClientSelect_default,
|
|
1738
|
-
{
|
|
1739
|
-
options: LANGUAGE_OPTIONS,
|
|
1740
|
-
value: language,
|
|
1741
|
-
onChange: (option) => setLanguage(option),
|
|
1742
|
-
placeholder: "Select language"
|
|
1743
|
-
}
|
|
1744
|
-
)
|
|
1745
|
-
] })
|
|
1746
|
-
] }),
|
|
1747
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-dash-card", children: [
|
|
1748
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h2", { className: "cnfy-dash-card-title", children: "Content Generation Settings" }),
|
|
1749
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-dash-field", children: [
|
|
1750
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "cnfy-dash-label", children: "Tone" }),
|
|
1751
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1752
|
-
ClientSelect_default,
|
|
1753
|
-
{
|
|
1754
|
-
options: TONE_OPTIONS,
|
|
1755
|
-
value: tone,
|
|
1756
|
-
onChange: (option) => setTone(option),
|
|
1757
|
-
placeholder: "Select tone"
|
|
1758
|
-
}
|
|
1759
|
-
),
|
|
1760
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "cnfy-dash-hint", children: "The writing tone for generated content" })
|
|
1761
|
-
] }),
|
|
1762
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-dash-field", children: [
|
|
1763
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "cnfy-dash-label", children: "Style" }),
|
|
1764
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1765
|
-
ClientSelect_default,
|
|
1766
|
-
{
|
|
1767
|
-
options: STYLE_OPTIONS,
|
|
1768
|
-
value: style,
|
|
1769
|
-
onChange: (option) => setStyle(option),
|
|
1770
|
-
placeholder: "Select style"
|
|
1771
|
-
}
|
|
1772
|
-
),
|
|
1773
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "cnfy-dash-hint", children: "The format/style of generated articles" })
|
|
1774
|
-
] }),
|
|
1775
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-dash-field", children: [
|
|
1776
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "cnfy-dash-label", children: "Word Count" }),
|
|
1777
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1778
|
-
ClientSelect_default,
|
|
1779
|
-
{
|
|
1780
|
-
options: WORD_COUNT_OPTIONS,
|
|
1781
|
-
value: wordCount,
|
|
1782
|
-
onChange: (option) => setWordCount(option),
|
|
1783
|
-
placeholder: "Select word count"
|
|
1784
|
-
}
|
|
1785
|
-
),
|
|
1786
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "cnfy-dash-hint", children: "Target length for generated content" })
|
|
1787
|
-
] }),
|
|
1788
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-dash-field", children: [
|
|
1789
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "cnfy-dash-label", children: "Target Audience" }),
|
|
1790
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1791
|
-
"input",
|
|
1792
|
-
{
|
|
1793
|
-
value: targetAudience,
|
|
1794
|
-
onChange: (e) => setTargetAudience(e.target.value),
|
|
1795
|
-
className: "cnfy-dash-input",
|
|
1796
|
-
placeholder: "e.g. tech-savvy millennials, business professionals"
|
|
1797
|
-
}
|
|
1798
|
-
),
|
|
1799
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "cnfy-dash-hint", children: "Describe your target audience for personalized content" })
|
|
1800
|
-
] }),
|
|
1801
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-toggle-group", children: [
|
|
1802
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-toggle-row", children: [
|
|
1803
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
|
|
1804
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "cnfy-toggle-label", children: "Include Quotes" }),
|
|
1805
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "cnfy-toggle-desc", children: "Add relevant quotes to generated articles" })
|
|
1806
|
-
] }),
|
|
1807
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1808
|
-
"button",
|
|
1809
|
-
{
|
|
1810
|
-
type: "button",
|
|
1811
|
-
role: "switch",
|
|
1812
|
-
"aria-checked": includeQuotes,
|
|
1813
|
-
onClick: () => setIncludeQuotes(!includeQuotes),
|
|
1814
|
-
className: "cnfy-toggle",
|
|
1815
|
-
style: { backgroundColor: includeQuotes ? primaryColor : "#d1d5db" },
|
|
1816
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1817
|
-
"span",
|
|
1818
|
-
{
|
|
1819
|
-
className: `cnfy-toggle-thumb ${includeQuotes ? "cnfy-toggle-thumb--on" : ""}`
|
|
1820
|
-
}
|
|
1821
|
-
)
|
|
1822
|
-
}
|
|
1823
|
-
)
|
|
1824
|
-
] }),
|
|
1825
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-toggle-row", children: [
|
|
1826
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
|
|
1827
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "cnfy-toggle-label", children: "Include FAQ Section" }),
|
|
1828
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "cnfy-toggle-desc", children: "Add FAQ section at the end of articles" })
|
|
1829
|
-
] }),
|
|
1830
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1831
|
-
"button",
|
|
1832
|
-
{
|
|
1833
|
-
type: "button",
|
|
1834
|
-
role: "switch",
|
|
1835
|
-
"aria-checked": includeFAQ,
|
|
1836
|
-
onClick: () => setIncludeFAQ(!includeFAQ),
|
|
1837
|
-
className: "cnfy-toggle",
|
|
1838
|
-
style: { backgroundColor: includeFAQ ? primaryColor : "#d1d5db" },
|
|
1839
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1840
|
-
"span",
|
|
1841
|
-
{
|
|
1842
|
-
className: `cnfy-toggle-thumb ${includeFAQ ? "cnfy-toggle-thumb--on" : ""}`
|
|
1843
|
-
}
|
|
1844
|
-
)
|
|
1845
|
-
}
|
|
1846
|
-
)
|
|
1847
|
-
] })
|
|
1848
|
-
] })
|
|
1849
|
-
] }),
|
|
1850
1623
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-dash-card", children: [
|
|
1851
1624
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-dash-card-header", children: [
|
|
1852
1625
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h2", { className: "cnfy-dash-card-title-inline", children: "News Scraping" }),
|
|
@@ -1884,25 +1657,63 @@ function PreferencesPage() {
|
|
|
1884
1657
|
onClick: handleScrape,
|
|
1885
1658
|
disabled: scraping || (scrapeStatus == null ? void 0 : scrapeStatus.isRunning),
|
|
1886
1659
|
className: "cnfy-dash-btn-save",
|
|
1887
|
-
style: { backgroundColor: primaryColor },
|
|
1660
|
+
style: { backgroundColor: hexToRgba(primaryColor, 0.8) },
|
|
1888
1661
|
children: scraping ? "Starting Scrape..." : (scrapeStatus == null ? void 0 : scrapeStatus.isRunning) ? "Scraping in Progress..." : "Start Scraping"
|
|
1889
1662
|
}
|
|
1890
1663
|
)
|
|
1891
1664
|
] })
|
|
1892
1665
|
] }),
|
|
1893
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-dash-
|
|
1894
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1895
|
-
|
|
1896
|
-
{
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1666
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-dash-card", children: [
|
|
1667
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h2", { className: "cnfy-dash-card-title", children: "Localization Settings" }),
|
|
1668
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-dash-field", children: [
|
|
1669
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "cnfy-dash-label", children: "State" }),
|
|
1670
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1671
|
+
ClientSelect_default,
|
|
1672
|
+
{
|
|
1673
|
+
options: STATE_OPTIONS,
|
|
1674
|
+
value: state,
|
|
1675
|
+
onChange: (option) => setState(option),
|
|
1676
|
+
placeholder: "Select state"
|
|
1677
|
+
}
|
|
1678
|
+
)
|
|
1679
|
+
] }),
|
|
1680
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-dash-field", children: [
|
|
1681
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "cnfy-dash-label", children: "Cities" }),
|
|
1682
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1683
|
+
ClientSelect_default,
|
|
1684
|
+
{
|
|
1685
|
+
isMulti: true,
|
|
1686
|
+
options: CITY_OPTIONS,
|
|
1687
|
+
value: cities,
|
|
1688
|
+
onChange: (options) => setCities(options),
|
|
1689
|
+
placeholder: "Select cities",
|
|
1690
|
+
isDisabled: !state
|
|
1691
|
+
}
|
|
1692
|
+
)
|
|
1693
|
+
] }),
|
|
1694
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-dash-field", children: [
|
|
1695
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "cnfy-dash-label", children: "Language" }),
|
|
1696
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1697
|
+
ClientSelect_default,
|
|
1698
|
+
{
|
|
1699
|
+
options: LANGUAGE_OPTIONS,
|
|
1700
|
+
value: language,
|
|
1701
|
+
onChange: (option) => setLanguage(option),
|
|
1702
|
+
placeholder: "Select language"
|
|
1703
|
+
}
|
|
1704
|
+
)
|
|
1705
|
+
] })
|
|
1706
|
+
] }),
|
|
1707
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "cnfy-dash-actions", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1708
|
+
"button",
|
|
1709
|
+
{
|
|
1710
|
+
onClick: handleSave,
|
|
1711
|
+
disabled: saving,
|
|
1712
|
+
className: "cnfy-dash-btn-save",
|
|
1713
|
+
style: { backgroundColor: primaryColor },
|
|
1714
|
+
children: saving ? "Saving..." : "Save Preferences"
|
|
1715
|
+
}
|
|
1716
|
+
) })
|
|
1906
1717
|
] });
|
|
1907
1718
|
}
|
|
1908
1719
|
|
|
@@ -2020,19 +1831,16 @@ var rewriteNewsStreamApi = async ({
|
|
|
2020
1831
|
try {
|
|
2021
1832
|
const API_BASE_URL = getApiBaseUrl();
|
|
2022
1833
|
const apiKey = getApiKey();
|
|
2023
|
-
console.log("\u{1F680} Starting stream request to:", `${API_BASE_URL}/chat/rewrite/stream`);
|
|
2024
|
-
console.log("\u{1F4E6} Payload:", payload);
|
|
2025
1834
|
const headers = {
|
|
2026
1835
|
"Content-Type": "application/json"
|
|
2027
1836
|
};
|
|
2028
1837
|
if (apiKey) {
|
|
2029
1838
|
headers["x-api-key"] = apiKey;
|
|
2030
1839
|
}
|
|
2031
|
-
const response = await fetch(`${API_BASE_URL}/
|
|
1840
|
+
const response = await fetch(`${API_BASE_URL}/chatboat/rewrite/stream`, {
|
|
2032
1841
|
method: "POST",
|
|
2033
1842
|
headers,
|
|
2034
1843
|
credentials: "include",
|
|
2035
|
-
// Include cookies for authentication
|
|
2036
1844
|
body: JSON.stringify(payload)
|
|
2037
1845
|
});
|
|
2038
1846
|
console.log("\u{1F4E1} Response status:", response.status);
|