@retrivora-ai/rag-engine 0.1.8 → 0.1.10
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/{ChromaDBProvider-2JZSBOQX.mjs → ChromaDBProvider-T7TK3ONZ.mjs} +2 -2
- package/dist/{MilvusProvider-CJDBCBVI.mjs → MilvusProvider-Y5FV5EAE.mjs} +2 -2
- package/dist/{MongoDBProvider-WWVJG3WT.mjs → MongoDBProvider-QHMGD2LZ.mjs} +2 -2
- package/dist/{PineconeProvider-E6L5Z2FO.mjs → PineconeProvider-A47MRRYJ.mjs} +2 -2
- package/dist/{PostgreSQLProvider-ZNXA67IM.mjs → PostgreSQLProvider-PJ5ER5Z4.mjs} +1 -1
- package/dist/{QdrantProvider-JITRNJQN.mjs → QdrantProvider-OLPJK7CY.mjs} +2 -2
- package/dist/{RedisProvider-3VKFQXXD.mjs → RedisProvider-ANEJ3BHR.mjs} +2 -2
- package/dist/{UniversalVectorProvider-E6L4U4OX.mjs → UniversalVectorProvider-QJIV2AJJ.mjs} +3 -3
- package/dist/{WeaviateProvider-MXIPP44J.mjs → WeaviateProvider-WIK2QN23.mjs} +2 -2
- package/dist/{chunk-YIYDJQJM.mjs → chunk-2VR5ZMXV.mjs} +11 -11
- package/dist/{chunk-QEYVWVT5.mjs → chunk-5HXNKSCR.mjs} +1 -1
- package/dist/{chunk-MFWJZVF3.mjs → chunk-BMHJTWSU.mjs} +1 -1
- package/dist/{chunk-UKDXCXW7.mjs → chunk-EDLTMSNY.mjs} +1 -1
- package/dist/{chunk-I4E63NIC.mjs → chunk-FWCSY2DS.mjs} +14 -1
- package/dist/{chunk-7BQI4A5J.mjs → chunk-HOMXEE3M.mjs} +1 -1
- package/dist/{chunk-TSX6DQXX.mjs → chunk-RUKZC3ON.mjs} +1 -1
- package/dist/{chunk-YST6KYBJ.mjs → chunk-VEJNRS4B.mjs} +1 -1
- package/dist/{chunk-XZPVJS2B.mjs → chunk-VKE5ZW7Y.mjs} +1 -1
- package/dist/{chunk-Y6HQZDCJ.mjs → chunk-VV2ML6TM.mjs} +2 -2
- package/dist/{chunk-26EMHLIN.mjs → chunk-W2PQR3UK.mjs} +1 -1
- package/dist/handlers/index.mjs +3 -3
- package/dist/index.js +67 -58
- package/dist/index.mjs +74 -47
- package/dist/server.d.mts +36 -1
- package/dist/server.d.ts +36 -1
- package/dist/server.js +127 -0
- package/dist/server.mjs +124 -11
- package/package.json +1 -1
- package/src/app/constants.tsx +220 -0
- package/src/app/page.tsx +193 -363
- package/src/app/types.ts +30 -0
- package/src/components/ChatWindow.tsx +3 -11
- package/src/providers/vectordb/MultiTablePostgresProvider.ts +164 -0
- package/src/server.ts +1 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
UniversalVectorProvider
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-VV2ML6TM.mjs";
|
|
4
|
+
import "./chunk-EDLTMSNY.mjs";
|
|
5
5
|
import "./chunk-VOIWNO5O.mjs";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-FWCSY2DS.mjs";
|
|
7
7
|
export {
|
|
8
8
|
UniversalVectorProvider
|
|
9
9
|
};
|
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
buildPayload,
|
|
3
3
|
mergeDefined,
|
|
4
4
|
resolvePath
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-EDLTMSNY.mjs";
|
|
6
6
|
import {
|
|
7
7
|
__spreadProps,
|
|
8
8
|
__spreadValues
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-FWCSY2DS.mjs";
|
|
10
10
|
|
|
11
11
|
// src/handlers/index.ts
|
|
12
12
|
import { NextResponse } from "next/server";
|
|
@@ -1179,41 +1179,41 @@ var ProviderRegistry = class {
|
|
|
1179
1179
|
}
|
|
1180
1180
|
switch (provider) {
|
|
1181
1181
|
case "pinecone": {
|
|
1182
|
-
const { PineconeProvider } = await import("./PineconeProvider-
|
|
1182
|
+
const { PineconeProvider } = await import("./PineconeProvider-A47MRRYJ.mjs");
|
|
1183
1183
|
return new PineconeProvider(config);
|
|
1184
1184
|
}
|
|
1185
1185
|
case "pgvector":
|
|
1186
1186
|
case "postgresql": {
|
|
1187
|
-
const { PostgreSQLProvider } = await import("./PostgreSQLProvider-
|
|
1187
|
+
const { PostgreSQLProvider } = await import("./PostgreSQLProvider-PJ5ER5Z4.mjs");
|
|
1188
1188
|
return new PostgreSQLProvider(config);
|
|
1189
1189
|
}
|
|
1190
1190
|
case "mongodb": {
|
|
1191
|
-
const { MongoDBProvider } = await import("./MongoDBProvider-
|
|
1191
|
+
const { MongoDBProvider } = await import("./MongoDBProvider-QHMGD2LZ.mjs");
|
|
1192
1192
|
return new MongoDBProvider(config);
|
|
1193
1193
|
}
|
|
1194
1194
|
case "milvus": {
|
|
1195
|
-
const { MilvusProvider } = await import("./MilvusProvider-
|
|
1195
|
+
const { MilvusProvider } = await import("./MilvusProvider-Y5FV5EAE.mjs");
|
|
1196
1196
|
return new MilvusProvider(config);
|
|
1197
1197
|
}
|
|
1198
1198
|
case "qdrant": {
|
|
1199
|
-
const { QdrantProvider } = await import("./QdrantProvider-
|
|
1199
|
+
const { QdrantProvider } = await import("./QdrantProvider-OLPJK7CY.mjs");
|
|
1200
1200
|
return new QdrantProvider(config);
|
|
1201
1201
|
}
|
|
1202
1202
|
case "chromadb": {
|
|
1203
|
-
const { ChromaDBProvider } = await import("./ChromaDBProvider-
|
|
1203
|
+
const { ChromaDBProvider } = await import("./ChromaDBProvider-T7TK3ONZ.mjs");
|
|
1204
1204
|
return new ChromaDBProvider(config);
|
|
1205
1205
|
}
|
|
1206
1206
|
case "redis": {
|
|
1207
|
-
const { RedisProvider } = await import("./RedisProvider-
|
|
1207
|
+
const { RedisProvider } = await import("./RedisProvider-ANEJ3BHR.mjs");
|
|
1208
1208
|
return new RedisProvider(config);
|
|
1209
1209
|
}
|
|
1210
1210
|
case "weaviate": {
|
|
1211
|
-
const { WeaviateProvider } = await import("./WeaviateProvider-
|
|
1211
|
+
const { WeaviateProvider } = await import("./WeaviateProvider-WIK2QN23.mjs");
|
|
1212
1212
|
return new WeaviateProvider(config);
|
|
1213
1213
|
}
|
|
1214
1214
|
case "universal_rest":
|
|
1215
1215
|
case "rest": {
|
|
1216
|
-
const { UniversalVectorProvider } = await import("./UniversalVectorProvider-
|
|
1216
|
+
const { UniversalVectorProvider } = await import("./UniversalVectorProvider-QJIV2AJJ.mjs");
|
|
1217
1217
|
return new UniversalVectorProvider(config);
|
|
1218
1218
|
}
|
|
1219
1219
|
default:
|
|
@@ -17,8 +17,21 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
20
32
|
|
|
21
33
|
export {
|
|
22
34
|
__spreadValues,
|
|
23
|
-
__spreadProps
|
|
35
|
+
__spreadProps,
|
|
36
|
+
__objRest
|
|
24
37
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildPayload,
|
|
3
3
|
resolvePath
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-EDLTMSNY.mjs";
|
|
5
5
|
import {
|
|
6
6
|
BaseVectorProvider
|
|
7
7
|
} from "./chunk-VOIWNO5O.mjs";
|
|
8
8
|
import {
|
|
9
9
|
__spreadValues
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-FWCSY2DS.mjs";
|
|
11
11
|
|
|
12
12
|
// src/providers/vectordb/UniversalVectorProvider.ts
|
|
13
13
|
import axios from "axios";
|
package/dist/handlers/index.mjs
CHANGED
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
createHealthHandler,
|
|
4
4
|
createIngestHandler,
|
|
5
5
|
createUploadHandler
|
|
6
|
-
} from "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
6
|
+
} from "../chunk-2VR5ZMXV.mjs";
|
|
7
|
+
import "../chunk-EDLTMSNY.mjs";
|
|
8
|
+
import "../chunk-FWCSY2DS.mjs";
|
|
9
9
|
export {
|
|
10
10
|
createChatHandler,
|
|
11
11
|
createHealthHandler,
|
package/dist/index.js
CHANGED
|
@@ -56,11 +56,11 @@ module.exports = __toCommonJS(index_exports);
|
|
|
56
56
|
|
|
57
57
|
// src/components/ChatWidget.tsx
|
|
58
58
|
var import_react6 = require("react");
|
|
59
|
-
var
|
|
59
|
+
var import_lucide_react5 = require("lucide-react");
|
|
60
60
|
|
|
61
61
|
// src/components/ChatWindow.tsx
|
|
62
62
|
var import_react5 = require("react");
|
|
63
|
-
var
|
|
63
|
+
var import_lucide_react4 = require("lucide-react");
|
|
64
64
|
|
|
65
65
|
// src/components/MessageBubble.tsx
|
|
66
66
|
var import_react2 = __toESM(require("react"));
|
|
@@ -335,8 +335,25 @@ function useRagChat(projectId, options = {}) {
|
|
|
335
335
|
};
|
|
336
336
|
}
|
|
337
337
|
|
|
338
|
+
// src/app/constants.tsx
|
|
339
|
+
var import_lucide_react3 = require("lucide-react");
|
|
340
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
341
|
+
var CHAT_SUGGESTIONS = [
|
|
342
|
+
"What can you help me with?",
|
|
343
|
+
"Summarise the key topics",
|
|
344
|
+
"Show me an example"
|
|
345
|
+
];
|
|
346
|
+
var BORDER_RADIUS_MAP = {
|
|
347
|
+
none: "rounded-none",
|
|
348
|
+
sm: "rounded-sm",
|
|
349
|
+
md: "rounded-md",
|
|
350
|
+
lg: "rounded-lg",
|
|
351
|
+
xl: "rounded-xl",
|
|
352
|
+
full: "rounded-3xl"
|
|
353
|
+
};
|
|
354
|
+
|
|
338
355
|
// src/components/ChatWindow.tsx
|
|
339
|
-
var
|
|
356
|
+
var import_jsx_runtime5 = (
|
|
340
357
|
// eslint-disable-next-line @next/next/no-img-element
|
|
341
358
|
require("react/jsx-runtime")
|
|
342
359
|
);
|
|
@@ -378,87 +395,79 @@ function ChatWindow({ className = "", style, onClose, showClose = false }) {
|
|
|
378
395
|
clear();
|
|
379
396
|
};
|
|
380
397
|
const isEmpty = messages.length === 0;
|
|
381
|
-
const
|
|
382
|
-
none: "rounded-none",
|
|
383
|
-
sm: "rounded-sm",
|
|
384
|
-
md: "rounded-md",
|
|
385
|
-
lg: "rounded-lg",
|
|
386
|
-
xl: "rounded-xl",
|
|
387
|
-
full: "rounded-3xl"
|
|
388
|
-
};
|
|
389
|
-
const currentRadius = borderRadiusMap[ui.borderRadius || "xl"];
|
|
398
|
+
const currentRadius = BORDER_RADIUS_MAP[ui.borderRadius || "xl"];
|
|
390
399
|
const isGlass = ui.visualStyle !== "solid";
|
|
391
|
-
return /* @__PURE__ */ (0,
|
|
400
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
392
401
|
"div",
|
|
393
402
|
{
|
|
394
403
|
className: `flex flex-col border border-slate-200 dark:border-white/10 shadow-2xl transition-all duration-300 ${currentRadius} ${isGlass ? "bg-white/90 dark:bg-[#0f0f1a]/90 backdrop-blur-xl" : "bg-white dark:bg-[#0f0f1a]"} ${className}`,
|
|
395
404
|
style: __spreadValues({ "--primary": ui.primaryColor, "--accent": ui.accentColor }, style),
|
|
396
405
|
children: [
|
|
397
|
-
/* @__PURE__ */ (0,
|
|
406
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
398
407
|
"div",
|
|
399
408
|
{
|
|
400
409
|
className: "flex items-center justify-between px-5 py-4 border-b border-slate-200 dark:border-white/10",
|
|
401
410
|
style: { background: `linear-gradient(135deg, ${ui.primaryColor}15, ${ui.accentColor}10)` },
|
|
402
411
|
children: [
|
|
403
|
-
/* @__PURE__ */ (0,
|
|
404
|
-
ui.logoUrl ? /* @__PURE__ */ (0,
|
|
412
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
413
|
+
ui.logoUrl ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("img", { src: ui.logoUrl, alt: "logo", className: "w-8 h-8 rounded-lg object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
405
414
|
"div",
|
|
406
415
|
{
|
|
407
416
|
className: `w-9 h-9 flex items-center justify-center shadow-md ${ui.borderRadius === "full" ? "rounded-full" : "rounded-xl"}`,
|
|
408
417
|
style: { background: `linear-gradient(135deg, ${ui.primaryColor}, ${ui.accentColor})` },
|
|
409
|
-
children: /* @__PURE__ */ (0,
|
|
418
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react4.Bot, { className: "w-5 h-5 text-white" })
|
|
410
419
|
}
|
|
411
420
|
),
|
|
412
|
-
/* @__PURE__ */ (0,
|
|
413
|
-
/* @__PURE__ */ (0,
|
|
414
|
-
ui.poweredBy && /* @__PURE__ */ (0,
|
|
421
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
422
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", { className: "text-slate-900 dark:text-white font-semibold text-sm leading-tight", children: ui.title }),
|
|
423
|
+
ui.poweredBy && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-slate-500 dark:text-white/40 text-[11px] leading-tight", children: `Powered by ${ui.poweredBy}` })
|
|
415
424
|
] })
|
|
416
425
|
] }),
|
|
417
|
-
/* @__PURE__ */ (0,
|
|
418
|
-
/* @__PURE__ */ (0,
|
|
419
|
-
/* @__PURE__ */ (0,
|
|
426
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
427
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "flex items-center gap-1 text-[10px] text-emerald-500 dark:text-emerald-400", children: [
|
|
428
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "w-1.5 h-1.5 rounded-full bg-emerald-500 dark:bg-emerald-400 animate-pulse" }),
|
|
420
429
|
"Online"
|
|
421
430
|
] }),
|
|
422
|
-
mounted && messages.length > 0 && /* @__PURE__ */ (0,
|
|
431
|
+
mounted && messages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
423
432
|
"button",
|
|
424
433
|
{
|
|
425
434
|
onClick: clearHistory,
|
|
426
435
|
title: "Clear conversation",
|
|
427
436
|
className: "w-7 h-7 rounded-lg flex items-center justify-center text-slate-400 hover:text-slate-600 dark:text-white/40 dark:hover:text-white/70 hover:bg-slate-100 dark:hover:bg-white/10 transition-all cursor-pointer",
|
|
428
|
-
children: /* @__PURE__ */ (0,
|
|
437
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react4.Trash2, { className: "w-3.5 h-3.5" })
|
|
429
438
|
}
|
|
430
439
|
),
|
|
431
|
-
showClose && onClose && /* @__PURE__ */ (0,
|
|
440
|
+
showClose && onClose && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
432
441
|
"button",
|
|
433
442
|
{
|
|
434
443
|
onClick: onClose,
|
|
435
444
|
title: "Close chat",
|
|
436
445
|
className: "w-7 h-7 rounded-lg flex items-center justify-center text-slate-400 hover:text-slate-600 dark:text-white/40 dark:hover:text-white/70 hover:bg-slate-100 dark:hover:bg-white/10 transition-all cursor-pointer",
|
|
437
|
-
children: /* @__PURE__ */ (0,
|
|
446
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react4.X, { className: "w-4 h-4" })
|
|
438
447
|
}
|
|
439
448
|
)
|
|
440
449
|
] })
|
|
441
450
|
]
|
|
442
451
|
}
|
|
443
452
|
),
|
|
444
|
-
/* @__PURE__ */ (0,
|
|
453
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex-1 overflow-y-auto px-4 py-4 space-y-5 scrollbar-thin scrollbar-thumb-slate-200 dark:scrollbar-thumb-white/10 scrollbar-track-transparent min-h-0 bg-slate-50 dark:bg-transparent", children: [
|
|
445
454
|
!mounted || isEmpty ? (
|
|
446
455
|
/* Welcome state */
|
|
447
|
-
/* @__PURE__ */ (0,
|
|
448
|
-
/* @__PURE__ */ (0,
|
|
456
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "h-full flex flex-col items-center justify-center text-center gap-4 px-6 py-12", children: [
|
|
457
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
449
458
|
"div",
|
|
450
459
|
{
|
|
451
460
|
className: `w-16 h-16 flex items-center justify-center shadow-lg ${ui.borderRadius === "full" ? "rounded-full" : "rounded-2xl"}`,
|
|
452
461
|
style: { background: `linear-gradient(135deg, ${ui.primaryColor}, ${ui.accentColor})` },
|
|
453
|
-
children: /* @__PURE__ */ (0,
|
|
462
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react4.Sparkles, { className: "w-8 h-8 text-white" })
|
|
454
463
|
}
|
|
455
464
|
),
|
|
456
|
-
/* @__PURE__ */ (0,
|
|
457
|
-
/* @__PURE__ */ (0,
|
|
458
|
-
/* @__PURE__ */ (0,
|
|
465
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
466
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-slate-800 dark:text-white/80 font-medium leading-relaxed", children: ui.welcomeMessage }),
|
|
467
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-slate-500 dark:text-white/30 text-sm mt-2", children: "Ask a question to get started" })
|
|
459
468
|
] }),
|
|
460
|
-
/* @__PURE__ */ (0,
|
|
461
|
-
(suggestion) => /* @__PURE__ */ (0,
|
|
469
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex flex-wrap gap-2 justify-center mt-2", children: CHAT_SUGGESTIONS.map(
|
|
470
|
+
(suggestion) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
462
471
|
"button",
|
|
463
472
|
{
|
|
464
473
|
onClick: () => {
|
|
@@ -473,7 +482,7 @@ function ChatWindow({ className = "", style, onClose, showClose = false }) {
|
|
|
473
482
|
)
|
|
474
483
|
) })
|
|
475
484
|
] })
|
|
476
|
-
) : messages.map((msg) => /* @__PURE__ */ (0,
|
|
485
|
+
) : messages.map((msg) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
477
486
|
MessageBubble,
|
|
478
487
|
{
|
|
479
488
|
message: msg,
|
|
@@ -483,7 +492,7 @@ function ChatWindow({ className = "", style, onClose, showClose = false }) {
|
|
|
483
492
|
},
|
|
484
493
|
msg.id
|
|
485
494
|
)),
|
|
486
|
-
isLoading && /* @__PURE__ */ (0,
|
|
495
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
487
496
|
MessageBubble,
|
|
488
497
|
{
|
|
489
498
|
message: { role: "assistant", content: "" },
|
|
@@ -492,15 +501,15 @@ function ChatWindow({ className = "", style, onClose, showClose = false }) {
|
|
|
492
501
|
accentColor: ui.accentColor
|
|
493
502
|
}
|
|
494
503
|
),
|
|
495
|
-
error && /* @__PURE__ */ (0,
|
|
496
|
-
/* @__PURE__ */ (0,
|
|
497
|
-
/* @__PURE__ */ (0,
|
|
504
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-2 text-rose-500 dark:text-rose-400 text-sm bg-rose-50 dark:bg-rose-400/10 border border-rose-200 dark:border-rose-400/20 rounded-xl px-4 py-3", children: [
|
|
505
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react4.TriangleAlert, { className: "w-4 h-4 flex-shrink-0" }),
|
|
506
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: error })
|
|
498
507
|
] }),
|
|
499
|
-
/* @__PURE__ */ (0,
|
|
508
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { ref: bottomRef })
|
|
500
509
|
] }),
|
|
501
|
-
/* @__PURE__ */ (0,
|
|
502
|
-
/* @__PURE__ */ (0,
|
|
503
|
-
/* @__PURE__ */ (0,
|
|
510
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: `px-4 pb-4 pt-2 border-t border-slate-200 dark:border-white/10 ${isGlass ? "bg-transparent" : "bg-white dark:bg-[#0f0f1a]"}`, children: [
|
|
511
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: `flex items-end gap-2 bg-slate-50 dark:bg-white/5 border border-slate-200 dark:border-white/10 p-2 focus-within:border-slate-300 dark:focus-within:border-white/20 transition-all ${ui.borderRadius === "full" ? "rounded-3xl" : "rounded-2xl"}`, children: [
|
|
512
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
504
513
|
"textarea",
|
|
505
514
|
{
|
|
506
515
|
ref: inputRef,
|
|
@@ -514,7 +523,7 @@ function ChatWindow({ className = "", style, onClose, showClose = false }) {
|
|
|
514
523
|
style: { scrollbarWidth: "none" }
|
|
515
524
|
}
|
|
516
525
|
),
|
|
517
|
-
/* @__PURE__ */ (0,
|
|
526
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
518
527
|
"button",
|
|
519
528
|
{
|
|
520
529
|
onClick: sendMessage,
|
|
@@ -524,11 +533,11 @@ function ChatWindow({ className = "", style, onClose, showClose = false }) {
|
|
|
524
533
|
background: input.trim() && !isLoading ? `linear-gradient(135deg, ${ui.primaryColor}, ${ui.accentColor})` : "rgba(148, 163, 184, 0.2)"
|
|
525
534
|
// slate-400/20 for light mode disabled
|
|
526
535
|
},
|
|
527
|
-
children: /* @__PURE__ */ (0,
|
|
536
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react4.ArrowUp, { className: "w-4 h-4 text-white" })
|
|
528
537
|
}
|
|
529
538
|
)
|
|
530
539
|
] }),
|
|
531
|
-
/* @__PURE__ */ (0,
|
|
540
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-center text-[10px] text-slate-400 dark:text-white/20 mt-2", children: "Press Enter to send \xB7 Shift+Enter for new line" })
|
|
532
541
|
] })
|
|
533
542
|
]
|
|
534
543
|
}
|
|
@@ -536,7 +545,7 @@ function ChatWindow({ className = "", style, onClose, showClose = false }) {
|
|
|
536
545
|
}
|
|
537
546
|
|
|
538
547
|
// src/components/ChatWidget.tsx
|
|
539
|
-
var
|
|
548
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
540
549
|
function ChatWidget({ position = "bottom-right" }) {
|
|
541
550
|
const { ui } = useConfig();
|
|
542
551
|
const [isOpen, setIsOpen] = (0, import_react6.useState)(false);
|
|
@@ -549,14 +558,14 @@ function ChatWidget({ position = "bottom-right" }) {
|
|
|
549
558
|
setIsOpen(true);
|
|
550
559
|
setHasUnread(false);
|
|
551
560
|
};
|
|
552
|
-
return /* @__PURE__ */ (0,
|
|
553
|
-
/* @__PURE__ */ (0,
|
|
561
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
562
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
554
563
|
"div",
|
|
555
564
|
{
|
|
556
565
|
className: `fixed z-[9998] w-[380px] max-w-[calc(100vw-3rem)] transition-all duration-300 ease-in-out ${windowPositionClass} ${isOpen ? "opacity-100 translate-y-0 pointer-events-auto" : "opacity-0 translate-y-4 pointer-events-none"}`,
|
|
557
566
|
style: { height: "600px", maxHeight: "calc(100vh - 6rem)" },
|
|
558
567
|
children: [
|
|
559
|
-
/* @__PURE__ */ (0,
|
|
568
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
560
569
|
ChatWindow,
|
|
561
570
|
{
|
|
562
571
|
className: "h-full relative z-10",
|
|
@@ -564,7 +573,7 @@ function ChatWidget({ position = "bottom-right" }) {
|
|
|
564
573
|
onClose: () => setIsOpen(false)
|
|
565
574
|
}
|
|
566
575
|
),
|
|
567
|
-
/* @__PURE__ */ (0,
|
|
576
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
568
577
|
"div",
|
|
569
578
|
{
|
|
570
579
|
className: `absolute -bottom-1.5 w-4 h-4 rotate-45 border-r border-b border-slate-200 dark:border-white/10 z-0 ${ui.visualStyle === "solid" ? "bg-white dark:bg-[#0f0f1a]" : "bg-white/90 dark:bg-[#0f0f1a]/90 backdrop-blur-xl"} ${position === "bottom-left" ? "left-5" : "right-5"}`
|
|
@@ -573,7 +582,7 @@ function ChatWidget({ position = "bottom-right" }) {
|
|
|
573
582
|
]
|
|
574
583
|
}
|
|
575
584
|
),
|
|
576
|
-
/* @__PURE__ */ (0,
|
|
585
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
577
586
|
"button",
|
|
578
587
|
{
|
|
579
588
|
onClick: isOpen ? () => setIsOpen(false) : handleOpen,
|
|
@@ -581,21 +590,21 @@ function ChatWidget({ position = "bottom-right" }) {
|
|
|
581
590
|
style: { background: `linear-gradient(135deg, ${ui.primaryColor}, ${ui.accentColor})` },
|
|
582
591
|
"aria-label": "Open chat",
|
|
583
592
|
children: [
|
|
584
|
-
/* @__PURE__ */ (0,
|
|
593
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
585
594
|
"span",
|
|
586
595
|
{
|
|
587
596
|
className: "absolute inset-0 rounded-full animate-ping opacity-20",
|
|
588
597
|
style: { background: ui.primaryColor }
|
|
589
598
|
}
|
|
590
599
|
),
|
|
591
|
-
/* @__PURE__ */ (0,
|
|
600
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
592
601
|
"span",
|
|
593
602
|
{
|
|
594
603
|
className: `transition-transform duration-300 ${isOpen ? "rotate-90 scale-90" : "rotate-0 scale-100"}`,
|
|
595
|
-
children: isOpen ? /* @__PURE__ */ (0,
|
|
604
|
+
children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react5.X, { className: "w-6 h-6 text-white" }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react5.MessageSquare, { className: "w-6 h-6 text-white" })
|
|
596
605
|
}
|
|
597
606
|
),
|
|
598
|
-
hasUnread && !isOpen && /* @__PURE__ */ (0,
|
|
607
|
+
hasUnread && !isOpen && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "absolute top-0 right-0 w-4 h-4 bg-rose-500 rounded-full border-2 border-white flex items-center justify-center text-[9px] font-bold text-white", children: "1" })
|
|
599
608
|
]
|
|
600
609
|
}
|
|
601
610
|
)
|