@akropolys/kiku 1.6.1 → 1.6.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/index.js +291 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +291 -7
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +174 -0
- package/dist/styles.css.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1199,6 +1199,25 @@ var ShoppingBagIcon = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg",
|
|
|
1199
1199
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("line", { x1: "3", y1: "6", x2: "21", y2: "6" }),
|
|
1200
1200
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M16 10a4 4 0 0 1-8 0" })
|
|
1201
1201
|
] });
|
|
1202
|
+
var SecureShieldIcon = ({ className, size = 18 }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1203
|
+
"svg",
|
|
1204
|
+
{
|
|
1205
|
+
className,
|
|
1206
|
+
width: size,
|
|
1207
|
+
height: size,
|
|
1208
|
+
viewBox: "0 0 24 24",
|
|
1209
|
+
fill: "none",
|
|
1210
|
+
stroke: "currentColor",
|
|
1211
|
+
strokeWidth: "2.5",
|
|
1212
|
+
strokeLinecap: "round",
|
|
1213
|
+
strokeLinejoin: "round",
|
|
1214
|
+
children: [
|
|
1215
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" }),
|
|
1216
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M12 11a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5z" }),
|
|
1217
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M12 11v4" })
|
|
1218
|
+
]
|
|
1219
|
+
}
|
|
1220
|
+
);
|
|
1202
1221
|
var PaperclipIcon = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48" }) });
|
|
1203
1222
|
var MicIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1204
1223
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3z" }),
|
|
@@ -1221,6 +1240,173 @@ var DEFAULT_CHIPS = [
|
|
|
1221
1240
|
];
|
|
1222
1241
|
var SESSIONS_KEY = "akropolys_chat_sessions";
|
|
1223
1242
|
var MAX_SESSIONS = 20;
|
|
1243
|
+
function parseAtKiku(raw) {
|
|
1244
|
+
const trimmed = raw.trim();
|
|
1245
|
+
if (!/^@kiku\b/i.test(trimmed)) return null;
|
|
1246
|
+
const rest = trimmed.slice(5).trim();
|
|
1247
|
+
if (rest === "" || /^(capture|save)\b/i.test(rest)) {
|
|
1248
|
+
return {
|
|
1249
|
+
intent: "capture",
|
|
1250
|
+
cleanQuery: rest.replace(/^(capture|save)\s*/i, "").trim() || trimmed
|
|
1251
|
+
};
|
|
1252
|
+
}
|
|
1253
|
+
if (/^(history|what have you|show my|my items|what did you|saved|captures|recall)\b/i.test(rest)) {
|
|
1254
|
+
return { intent: "view_history", cleanQuery: "show my saved items" };
|
|
1255
|
+
}
|
|
1256
|
+
if (/^(delete|forget|remove|unsave)\b/i.test(rest)) {
|
|
1257
|
+
return {
|
|
1258
|
+
intent: "delete",
|
|
1259
|
+
cleanQuery: rest.replace(/^(delete|forget|remove|unsave)\s*/i, "").trim() || trimmed
|
|
1260
|
+
};
|
|
1261
|
+
}
|
|
1262
|
+
return { intent: "capture", cleanQuery: rest || trimmed };
|
|
1263
|
+
}
|
|
1264
|
+
function KikuPickerMenu({
|
|
1265
|
+
sources,
|
|
1266
|
+
referencedIds,
|
|
1267
|
+
defaultCurrency,
|
|
1268
|
+
onCapture,
|
|
1269
|
+
onCaptureAll,
|
|
1270
|
+
onViewHistory,
|
|
1271
|
+
onDelete,
|
|
1272
|
+
onDismiss
|
|
1273
|
+
}) {
|
|
1274
|
+
const discussed = sources.filter((s) => s.id && referencedIds.includes(s.id));
|
|
1275
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1276
|
+
"div",
|
|
1277
|
+
{
|
|
1278
|
+
className: "hsk-kiku-picker",
|
|
1279
|
+
role: "menu",
|
|
1280
|
+
"aria-label": "@kiku commands",
|
|
1281
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
1282
|
+
children: [
|
|
1283
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "hsk-kiku-picker-header", children: [
|
|
1284
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-kiku-picker-at", children: "@kiku" }),
|
|
1285
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-kiku-picker-hint", children: "What would you like to do?" }),
|
|
1286
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { className: "hsk-kiku-picker-close", onClick: onDismiss, "aria-label": "Close", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CloseIcon, {}) })
|
|
1287
|
+
] }),
|
|
1288
|
+
discussed.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
1289
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "hsk-kiku-picker-section", children: "Discussed in this chat" }),
|
|
1290
|
+
discussed.map((src, i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1291
|
+
"button",
|
|
1292
|
+
{
|
|
1293
|
+
className: "hsk-kiku-picker-item",
|
|
1294
|
+
role: "menuitem",
|
|
1295
|
+
onClick: () => {
|
|
1296
|
+
onCapture(src);
|
|
1297
|
+
onDismiss();
|
|
1298
|
+
},
|
|
1299
|
+
children: [
|
|
1300
|
+
src.image ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("img", { src: src.image, alt: src.name, className: "hsk-kiku-picker-img" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-kiku-picker-img-placeholder", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SecureShieldIcon, { size: 14 }) }),
|
|
1301
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "hsk-kiku-picker-item-body", children: [
|
|
1302
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "hsk-kiku-picker-item-name", children: [
|
|
1303
|
+
"\u{1F4CC} ",
|
|
1304
|
+
src.name
|
|
1305
|
+
] }),
|
|
1306
|
+
src.price && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "hsk-kiku-picker-item-price", children: [
|
|
1307
|
+
src.currency ?? defaultCurrency,
|
|
1308
|
+
" ",
|
|
1309
|
+
parseFloat(String(src.price).replace(/[^0-9.]/g, "") || "0").toLocaleString()
|
|
1310
|
+
] })
|
|
1311
|
+
] })
|
|
1312
|
+
]
|
|
1313
|
+
},
|
|
1314
|
+
src.id ?? i
|
|
1315
|
+
)),
|
|
1316
|
+
discussed.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1317
|
+
"button",
|
|
1318
|
+
{
|
|
1319
|
+
className: "hsk-kiku-picker-item hsk-kiku-picker-item--all",
|
|
1320
|
+
role: "menuitem",
|
|
1321
|
+
onClick: () => {
|
|
1322
|
+
onCaptureAll(discussed);
|
|
1323
|
+
onDismiss();
|
|
1324
|
+
},
|
|
1325
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-kiku-picker-item-body", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "hsk-kiku-picker-item-name", children: [
|
|
1326
|
+
"\u{1F4CC} Capture all (",
|
|
1327
|
+
discussed.length,
|
|
1328
|
+
" items)"
|
|
1329
|
+
] }) })
|
|
1330
|
+
}
|
|
1331
|
+
),
|
|
1332
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "hsk-kiku-picker-divider" })
|
|
1333
|
+
] }),
|
|
1334
|
+
discussed.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
1335
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1336
|
+
"button",
|
|
1337
|
+
{
|
|
1338
|
+
className: "hsk-kiku-picker-item",
|
|
1339
|
+
role: "menuitem",
|
|
1340
|
+
onClick: () => {
|
|
1341
|
+
onCapture({ name: "current page", id: void 0 });
|
|
1342
|
+
onDismiss();
|
|
1343
|
+
},
|
|
1344
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-kiku-picker-item-body", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-kiku-picker-item-name", children: "\u{1F4CC} Capture current page" }) })
|
|
1345
|
+
}
|
|
1346
|
+
),
|
|
1347
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "hsk-kiku-picker-divider" })
|
|
1348
|
+
] }),
|
|
1349
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1350
|
+
"button",
|
|
1351
|
+
{
|
|
1352
|
+
className: "hsk-kiku-picker-item",
|
|
1353
|
+
role: "menuitem",
|
|
1354
|
+
onClick: () => {
|
|
1355
|
+
onViewHistory();
|
|
1356
|
+
onDismiss();
|
|
1357
|
+
},
|
|
1358
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-kiku-picker-item-body", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-kiku-picker-item-name", children: "\u{1F4CB} What have you saved?" }) })
|
|
1359
|
+
}
|
|
1360
|
+
),
|
|
1361
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1362
|
+
"button",
|
|
1363
|
+
{
|
|
1364
|
+
className: "hsk-kiku-picker-item",
|
|
1365
|
+
role: "menuitem",
|
|
1366
|
+
onClick: () => {
|
|
1367
|
+
onDelete();
|
|
1368
|
+
onDismiss();
|
|
1369
|
+
},
|
|
1370
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-kiku-picker-item-body", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-kiku-picker-item-name", children: "\u{1F5D1}\uFE0F Delete this" }) })
|
|
1371
|
+
}
|
|
1372
|
+
)
|
|
1373
|
+
]
|
|
1374
|
+
}
|
|
1375
|
+
);
|
|
1376
|
+
}
|
|
1377
|
+
function AtPickerMenu({ onSelect, onDismiss }) {
|
|
1378
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1379
|
+
"div",
|
|
1380
|
+
{
|
|
1381
|
+
className: "hsk-kiku-picker",
|
|
1382
|
+
role: "menu",
|
|
1383
|
+
"aria-label": "Extensions",
|
|
1384
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
1385
|
+
children: [
|
|
1386
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "hsk-kiku-picker-header", children: [
|
|
1387
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-kiku-picker-at", children: "@" }),
|
|
1388
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-kiku-picker-hint", children: "Use an extension" }),
|
|
1389
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { className: "hsk-kiku-picker-close", onClick: onDismiss, "aria-label": "Close", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CloseIcon, {}) })
|
|
1390
|
+
] }),
|
|
1391
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1392
|
+
"button",
|
|
1393
|
+
{
|
|
1394
|
+
className: "hsk-kiku-picker-item",
|
|
1395
|
+
role: "menuitem",
|
|
1396
|
+
onClick: () => onSelect("@kiku"),
|
|
1397
|
+
children: [
|
|
1398
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-kiku-picker-img-placeholder", style: { background: "color-mix(in srgb, var(--hsk-primary, #7c5cfc) 15%, transparent)", color: "var(--hsk-primary, #7c5cfc)" }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SparkleIcon2, {}) }),
|
|
1399
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "hsk-kiku-picker-item-body", children: [
|
|
1400
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-kiku-picker-item-name", children: "@kiku" }),
|
|
1401
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-kiku-picker-item-price", style: { fontSize: "11px", whiteSpace: "normal", lineHeight: "1.3" }, children: "Ask Kiku to capture pages, remember items, or show your history" })
|
|
1402
|
+
] })
|
|
1403
|
+
]
|
|
1404
|
+
}
|
|
1405
|
+
)
|
|
1406
|
+
]
|
|
1407
|
+
}
|
|
1408
|
+
);
|
|
1409
|
+
}
|
|
1224
1410
|
function loadSessions() {
|
|
1225
1411
|
try {
|
|
1226
1412
|
if (typeof window === "undefined") return [];
|
|
@@ -1531,6 +1717,9 @@ var getFriendlyError = (err) => {
|
|
|
1531
1717
|
if (lower.includes("token limit")) {
|
|
1532
1718
|
return "You've reached your usage limit. Please update your billing limits in your dashboard to continue.";
|
|
1533
1719
|
}
|
|
1720
|
+
if (lower.includes("failed to fetch") || lower.includes("networkerror") || lower.includes("request failed")) {
|
|
1721
|
+
return "The assistant couldn't respond just now \u2014 please try again in a moment.";
|
|
1722
|
+
}
|
|
1534
1723
|
try {
|
|
1535
1724
|
const parsed = JSON.parse(str);
|
|
1536
1725
|
return parsed.error || parsed.message || str;
|
|
@@ -1746,6 +1935,8 @@ function ChatModal({
|
|
|
1746
1935
|
});
|
|
1747
1936
|
const [paymentPhase, setPaymentPhase] = (0, import_react5.useState)("idle");
|
|
1748
1937
|
const [memoryKey, setMemoryKey] = (0, import_react5.useState)(null);
|
|
1938
|
+
const [showKikuPicker, setShowKikuPicker] = (0, import_react5.useState)(false);
|
|
1939
|
+
const [showAtPicker, setShowAtPicker] = (0, import_react5.useState)(false);
|
|
1749
1940
|
const [sessions, setSessions] = (0, import_react5.useState)(() => loadSessions());
|
|
1750
1941
|
const [sidebarOpen, setSidebarOpen] = (0, import_react5.useState)(false);
|
|
1751
1942
|
const [replayMessages, setReplayMessages] = (0, import_react5.useState)(null);
|
|
@@ -1816,27 +2007,97 @@ function ChatModal({
|
|
|
1816
2007
|
const q = `Tell me more about the ${src.name}${src.price ? ` (${src.currency ?? defaultCurrency} ${src.price})` : ""} \u2014 what are its key specs, who is it best for, and is it worth buying?`;
|
|
1817
2008
|
send(q);
|
|
1818
2009
|
};
|
|
1819
|
-
const handleSend = async (text, extraAttachments) => {
|
|
1820
|
-
const
|
|
1821
|
-
if (!
|
|
2010
|
+
const handleSend = async (text, extraAttachments, forcedIntent, captureTargets) => {
|
|
2011
|
+
const raw = (text ?? input).trim();
|
|
2012
|
+
if (!raw || loading) return;
|
|
2013
|
+
const kiku = parseAtKiku(raw);
|
|
2014
|
+
const q = kiku ? kiku.cleanQuery : raw;
|
|
2015
|
+
const resolvedForcedIntent = forcedIntent ?? kiku?.intent;
|
|
1822
2016
|
setReplayMessages(null);
|
|
1823
2017
|
setSelectedProduct(null);
|
|
2018
|
+
setShowKikuPicker(false);
|
|
2019
|
+
setShowAtPicker(false);
|
|
1824
2020
|
setInput("");
|
|
1825
2021
|
if (textareaRef.current) {
|
|
1826
2022
|
textareaRef.current.style.height = "auto";
|
|
1827
2023
|
}
|
|
1828
2024
|
const toSend = extraAttachments ?? attachments;
|
|
1829
2025
|
setAttachments([]);
|
|
1830
|
-
await send(q,
|
|
2026
|
+
await send(q, raw, toSend.length > 0 ? toSend : void 0, resolvedForcedIntent, captureTargets);
|
|
1831
2027
|
};
|
|
2028
|
+
const handleSelectExtension = (ext) => {
|
|
2029
|
+
setInput(ext + " ");
|
|
2030
|
+
setShowAtPicker(false);
|
|
2031
|
+
setShowKikuPicker(true);
|
|
2032
|
+
if (textareaRef.current) {
|
|
2033
|
+
textareaRef.current.focus();
|
|
2034
|
+
}
|
|
2035
|
+
};
|
|
2036
|
+
const handleKikuCapture = (0, import_react5.useCallback)((product) => {
|
|
2037
|
+
const name = product.name || "";
|
|
2038
|
+
const display = `@kiku capture${name ? " " + name : ""}`;
|
|
2039
|
+
const q = name || "capture current page";
|
|
2040
|
+
setInput("");
|
|
2041
|
+
setReplayMessages(null);
|
|
2042
|
+
setSelectedProduct(null);
|
|
2043
|
+
const toSend = attachments;
|
|
2044
|
+
setAttachments([]);
|
|
2045
|
+
send(q, display, toSend.length > 0 ? toSend : void 0, "capture");
|
|
2046
|
+
}, [attachments, send]);
|
|
2047
|
+
const handleKikuCaptureAll = (0, import_react5.useCallback)((products) => {
|
|
2048
|
+
const targets = products.filter((p) => p.id).map((p) => ({
|
|
2049
|
+
name: p.name || "",
|
|
2050
|
+
url: p.url || "",
|
|
2051
|
+
image: p.image || "",
|
|
2052
|
+
price: p.price ? String(p.price) : "",
|
|
2053
|
+
currency: p.currency || defaultCurrency
|
|
2054
|
+
}));
|
|
2055
|
+
const names = products.map((p) => p.name).filter(Boolean).join(", ");
|
|
2056
|
+
const display = `@kiku capture all (${products.length} items)`;
|
|
2057
|
+
setInput("");
|
|
2058
|
+
setReplayMessages(null);
|
|
2059
|
+
setSelectedProduct(null);
|
|
2060
|
+
setAttachments([]);
|
|
2061
|
+
send(names || "capture all", display, void 0, "capture_all", targets);
|
|
2062
|
+
}, [defaultCurrency, send]);
|
|
2063
|
+
const handleKikuViewHistory = (0, import_react5.useCallback)(() => {
|
|
2064
|
+
const display = "@kiku what have you saved?";
|
|
2065
|
+
setInput("");
|
|
2066
|
+
setReplayMessages(null);
|
|
2067
|
+
setSelectedProduct(null);
|
|
2068
|
+
setAttachments([]);
|
|
2069
|
+
send("show my saved items", display, void 0, "view_history");
|
|
2070
|
+
}, [send]);
|
|
2071
|
+
const handleKikuDelete = (0, import_react5.useCallback)(() => {
|
|
2072
|
+
const display = "@kiku delete this";
|
|
2073
|
+
setInput("");
|
|
2074
|
+
setReplayMessages(null);
|
|
2075
|
+
setSelectedProduct(null);
|
|
2076
|
+
setAttachments([]);
|
|
2077
|
+
send("delete this", display, void 0, "delete");
|
|
2078
|
+
}, [send]);
|
|
1832
2079
|
const handleKeyDown = (e) => {
|
|
2080
|
+
if (e.key === "Escape" && showKikuPicker) {
|
|
2081
|
+
e.preventDefault();
|
|
2082
|
+
setShowKikuPicker(false);
|
|
2083
|
+
return;
|
|
2084
|
+
}
|
|
2085
|
+
if (e.key === "Escape" && showAtPicker) {
|
|
2086
|
+
e.preventDefault();
|
|
2087
|
+
setShowAtPicker(false);
|
|
2088
|
+
return;
|
|
2089
|
+
}
|
|
1833
2090
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
1834
2091
|
e.preventDefault();
|
|
1835
2092
|
handleSend();
|
|
1836
2093
|
}
|
|
1837
2094
|
};
|
|
1838
2095
|
const handleInput = (e) => {
|
|
1839
|
-
|
|
2096
|
+
const val = e.target.value;
|
|
2097
|
+
setInput(val);
|
|
2098
|
+
const trimmed = val.trim();
|
|
2099
|
+
setShowAtPicker(trimmed === "@");
|
|
2100
|
+
setShowKikuPicker(/^@kiku\b/i.test(trimmed));
|
|
1840
2101
|
const t = e.target;
|
|
1841
2102
|
t.style.height = "auto";
|
|
1842
2103
|
t.style.height = `${Math.min(t.scrollHeight, 140)}px`;
|
|
@@ -1973,7 +2234,10 @@ function ChatModal({
|
|
|
1973
2234
|
const displayContent = !isUser && isLast && lastIntent === "compare" && sources.length >= 2 && !replayMessages ? stripMarkdownTables(msg.content) : msg.content;
|
|
1974
2235
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "hsk-cb-msg-group", children: isUser ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "hsk-cb-user-msg", children: [
|
|
1975
2236
|
msg.images && msg.images.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "hsk-cb-user-imgs", children: msg.images.map((img, i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("img", { src: img, alt: `attachment ${i + 1}`, className: "hsk-cb-user-img-thumb" }, i)) }),
|
|
1976
|
-
msg.content && /* @__PURE__ */ (0, import_jsx_runtime7.
|
|
2237
|
+
msg.content && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "hsk-cb-user-bubble", children: [
|
|
2238
|
+
/^@kiku\b/i.test(msg.content) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-kiku-badge", children: "@kiku" }),
|
|
2239
|
+
msg.content
|
|
2240
|
+
] })
|
|
1977
2241
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "hsk-cb-ai-msg", children: [
|
|
1978
2242
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "hsk-cb-ai-icon", style: { display: "flex", alignItems: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SparkleIcon2, {}) }),
|
|
1979
2243
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "hsk-cb-ai-body", children: [
|
|
@@ -1988,7 +2252,7 @@ function ChatModal({
|
|
|
1988
2252
|
] });
|
|
1989
2253
|
})(),
|
|
1990
2254
|
isLast && lastIntent === "compare" && sources.length >= 2 && !replayMessages && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ComparisonMatrix, { sources, defaultCurrency }),
|
|
1991
|
-
isLast && referencedIds.length > 0 && lastIntent !== "compare" && lastAction?.type !== "request_phone" && lastAction?.type !== "awaiting_payment" && lastAction?.type !== "checkout" && !msg.cartSnapshot && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2255
|
+
isLast && referencedIds.length > 0 && lastIntent !== "compare" && lastAction?.type !== "request_phone" && lastAction?.type !== "awaiting_payment" && lastAction?.type !== "checkout" && lastAction?.type !== "capture" && lastAction?.type !== "delete" && lastAction?.type !== "view_history" && !msg.cartSnapshot && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1992
2256
|
SourcesCarousel,
|
|
1993
2257
|
{
|
|
1994
2258
|
sources,
|
|
@@ -2099,6 +2363,26 @@ function ChatModal({
|
|
|
2099
2363
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ref: bottomRef, style: { height: 1 } })
|
|
2100
2364
|
] }),
|
|
2101
2365
|
!replayMessages && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "hsk-cb-input-wrap", children: [
|
|
2366
|
+
showAtPicker && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2367
|
+
AtPickerMenu,
|
|
2368
|
+
{
|
|
2369
|
+
onSelect: handleSelectExtension,
|
|
2370
|
+
onDismiss: () => setShowAtPicker(false)
|
|
2371
|
+
}
|
|
2372
|
+
),
|
|
2373
|
+
showKikuPicker && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2374
|
+
KikuPickerMenu,
|
|
2375
|
+
{
|
|
2376
|
+
sources,
|
|
2377
|
+
referencedIds,
|
|
2378
|
+
defaultCurrency,
|
|
2379
|
+
onCapture: handleKikuCapture,
|
|
2380
|
+
onCaptureAll: handleKikuCaptureAll,
|
|
2381
|
+
onViewHistory: handleKikuViewHistory,
|
|
2382
|
+
onDelete: handleKikuDelete,
|
|
2383
|
+
onDismiss: () => setShowKikuPicker(false)
|
|
2384
|
+
}
|
|
2385
|
+
),
|
|
2102
2386
|
attachments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "hsk-cb-img-strip", children: attachments.map((att, i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "hsk-cb-img-thumb-wrap", children: [
|
|
2103
2387
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("img", { src: att.data, alt: `attachment ${i + 1}`, className: "hsk-cb-img-thumb" }),
|
|
2104
2388
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|