@retrivora-ai/rag-engine 0.1.7 → 0.1.9
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-QNI7UCX4.mjs → ChromaDBProvider-T7TK3ONZ.mjs} +2 -2
- package/dist/{MilvusProvider-OO6QGZDZ.mjs → MilvusProvider-Y5FV5EAE.mjs} +2 -2
- package/dist/{MongoDBProvider-WWVJG3WT.mjs → MongoDBProvider-QHMGD2LZ.mjs} +2 -2
- package/dist/{PineconeProvider-ZRAFNFEC.mjs → PineconeProvider-A47MRRYJ.mjs} +2 -2
- package/dist/{PostgreSQLProvider-ZNXA67IM.mjs → PostgreSQLProvider-PJ5ER5Z4.mjs} +1 -1
- package/dist/{QdrantProvider-VAED5VA7.mjs → QdrantProvider-OLPJK7CY.mjs} +2 -2
- package/dist/{RagConfig-hBGXJmSx.d.mts → RagConfig-D_rSf8ep.d.mts} +1 -1
- package/dist/{RagConfig-hBGXJmSx.d.ts → RagConfig-D_rSf8ep.d.ts} +1 -1
- package/dist/{RedisProvider-ASONNYBI.mjs → RedisProvider-ANEJ3BHR.mjs} +2 -2
- package/dist/UniversalVectorProvider-QJIV2AJJ.mjs +9 -0
- package/dist/{WeaviateProvider-PSDCUGC7.mjs → WeaviateProvider-WIK2QN23.mjs} +2 -2
- package/dist/{chunk-7YQWGERZ.mjs → chunk-2VR5ZMXV.mjs} +740 -193
- package/dist/{chunk-QEYVWVT5.mjs → chunk-5HXNKSCR.mjs} +1 -1
- package/dist/{chunk-ZM6TYIDH.mjs → chunk-BMHJTWSU.mjs} +4 -2
- package/dist/{chunk-UKDXCXW7.mjs → chunk-EDLTMSNY.mjs} +1 -1
- package/dist/{chunk-I4E63NIC.mjs → chunk-FWCSY2DS.mjs} +14 -1
- package/dist/{chunk-VPNRDXIA.mjs → chunk-HOMXEE3M.mjs} +17 -11
- package/dist/{chunk-V75V7BT2.mjs → chunk-RUKZC3ON.mjs} +3 -3
- package/dist/{chunk-7NXI6ZWX.mjs → chunk-VEJNRS4B.mjs} +9 -6
- package/dist/{chunk-HUGLYKD6.mjs → chunk-VKE5ZW7Y.mjs} +28 -10
- package/dist/chunk-VV2ML6TM.mjs +156 -0
- package/dist/{chunk-CWQQHAF6.mjs → chunk-W2PQR3UK.mjs} +4 -6
- package/dist/handlers/index.d.mts +2 -2
- package/dist/handlers/index.d.ts +2 -2
- package/dist/handlers/index.js +877 -625
- package/dist/handlers/index.mjs +3 -4
- package/dist/index-BJ8CUArE.d.mts +114 -0
- package/dist/index-DtNprGGj.d.ts +114 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +67 -58
- package/dist/index.mjs +74 -47
- package/dist/server.d.mts +601 -17
- package/dist/server.d.ts +601 -17
- package/dist/server.js +1426 -708
- package/dist/server.mjs +429 -18
- package/package.json +11 -2
- 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/config/ConfigBuilder.ts +373 -0
- package/src/config/EmbeddingStrategy.ts +147 -0
- package/src/config/serverConfig.ts +51 -18
- package/src/core/ConfigValidator.ts +67 -50
- package/src/core/Pipeline.ts +28 -26
- package/src/core/PluginManager.ts +277 -0
- package/src/core/ProviderHealthCheck.ts +75 -139
- package/src/core/ProviderRegistry.ts +38 -15
- package/src/providers/vectordb/ChromaDBProvider.ts +37 -12
- package/src/providers/vectordb/MilvusProvider.ts +25 -10
- package/src/providers/vectordb/MultiTablePostgresProvider.ts +164 -0
- package/src/providers/vectordb/PineconeProvider.ts +17 -2
- package/src/providers/vectordb/QdrantProvider.ts +3 -6
- package/src/providers/vectordb/RedisProvider.ts +34 -11
- package/src/providers/vectordb/UniversalVectorProvider.ts +220 -0
- package/src/providers/vectordb/WeaviateProvider.ts +17 -10
- package/src/server.ts +29 -10
- package/dist/LLMFactory-JFOY2V4X.mjs +0 -8
- package/dist/chunk-JI6VD5TJ.mjs +0 -387
- package/dist/index-Bx182KKn.d.ts +0 -64
- package/dist/index-Ck2pt7-8.d.mts +0 -64
- package/src/test-refactor.ts +0 -59
package/dist/index.mjs
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
mergeDefined
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EDLTMSNY.mjs";
|
|
4
4
|
import {
|
|
5
5
|
__spreadValues
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-FWCSY2DS.mjs";
|
|
7
7
|
|
|
8
8
|
// src/components/ChatWidget.tsx
|
|
9
9
|
import { useState as useState4 } from "react";
|
|
10
|
-
import { MessageSquare, X as X2 } from "lucide-react";
|
|
10
|
+
import { MessageSquare as MessageSquare2, X as X2 } from "lucide-react";
|
|
11
11
|
|
|
12
12
|
// src/components/ChatWindow.tsx
|
|
13
13
|
import { useState as useState3, useRef as useRef2, useEffect as useEffect3, useCallback as useCallback2 } from "react";
|
|
14
14
|
import {
|
|
15
|
-
Bot as
|
|
15
|
+
Bot as Bot3,
|
|
16
16
|
Trash2,
|
|
17
17
|
X,
|
|
18
|
-
Sparkles,
|
|
18
|
+
Sparkles as Sparkles2,
|
|
19
19
|
ArrowUp,
|
|
20
20
|
TriangleAlert
|
|
21
21
|
} from "lucide-react";
|
|
@@ -277,8 +277,43 @@ function useRagChat(projectId, options = {}) {
|
|
|
277
277
|
};
|
|
278
278
|
}
|
|
279
279
|
|
|
280
|
+
// src/app/constants.tsx
|
|
281
|
+
import {
|
|
282
|
+
Zap,
|
|
283
|
+
Database,
|
|
284
|
+
Layers,
|
|
285
|
+
Search,
|
|
286
|
+
Box,
|
|
287
|
+
Package,
|
|
288
|
+
Activity,
|
|
289
|
+
Hexagon,
|
|
290
|
+
Sparkles,
|
|
291
|
+
Bot as Bot2,
|
|
292
|
+
Brain,
|
|
293
|
+
Rabbit,
|
|
294
|
+
Code,
|
|
295
|
+
Terminal,
|
|
296
|
+
FileText,
|
|
297
|
+
Puzzle,
|
|
298
|
+
MessageSquare
|
|
299
|
+
} from "lucide-react";
|
|
300
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
301
|
+
var CHAT_SUGGESTIONS = [
|
|
302
|
+
"What can you help me with?",
|
|
303
|
+
"Summarise the key topics",
|
|
304
|
+
"Show me an example"
|
|
305
|
+
];
|
|
306
|
+
var BORDER_RADIUS_MAP = {
|
|
307
|
+
none: "rounded-none",
|
|
308
|
+
sm: "rounded-sm",
|
|
309
|
+
md: "rounded-md",
|
|
310
|
+
lg: "rounded-lg",
|
|
311
|
+
xl: "rounded-xl",
|
|
312
|
+
full: "rounded-3xl"
|
|
313
|
+
};
|
|
314
|
+
|
|
280
315
|
// src/components/ChatWindow.tsx
|
|
281
|
-
import { jsx as
|
|
316
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
282
317
|
function ChatWindow({ className = "", style, onClose, showClose = false }) {
|
|
283
318
|
const { ui, projectId } = useConfig();
|
|
284
319
|
const [input, setInput] = useState3("");
|
|
@@ -317,15 +352,7 @@ function ChatWindow({ className = "", style, onClose, showClose = false }) {
|
|
|
317
352
|
clear();
|
|
318
353
|
};
|
|
319
354
|
const isEmpty = messages.length === 0;
|
|
320
|
-
const
|
|
321
|
-
none: "rounded-none",
|
|
322
|
-
sm: "rounded-sm",
|
|
323
|
-
md: "rounded-md",
|
|
324
|
-
lg: "rounded-lg",
|
|
325
|
-
xl: "rounded-xl",
|
|
326
|
-
full: "rounded-3xl"
|
|
327
|
-
};
|
|
328
|
-
const currentRadius = borderRadiusMap[ui.borderRadius || "xl"];
|
|
355
|
+
const currentRadius = BORDER_RADIUS_MAP[ui.borderRadius || "xl"];
|
|
329
356
|
const isGlass = ui.visualStyle !== "solid";
|
|
330
357
|
return /* @__PURE__ */ jsxs3(
|
|
331
358
|
"div",
|
|
@@ -342,41 +369,41 @@ function ChatWindow({ className = "", style, onClose, showClose = false }) {
|
|
|
342
369
|
/* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-3", children: [
|
|
343
370
|
ui.logoUrl ? (
|
|
344
371
|
// eslint-disable-next-line @next/next/no-img-element
|
|
345
|
-
/* @__PURE__ */
|
|
346
|
-
) : /* @__PURE__ */
|
|
372
|
+
/* @__PURE__ */ jsx5("img", { src: ui.logoUrl, alt: "logo", className: "w-8 h-8 rounded-lg object-cover" })
|
|
373
|
+
) : /* @__PURE__ */ jsx5(
|
|
347
374
|
"div",
|
|
348
375
|
{
|
|
349
376
|
className: `w-9 h-9 flex items-center justify-center shadow-md ${ui.borderRadius === "full" ? "rounded-full" : "rounded-xl"}`,
|
|
350
377
|
style: { background: `linear-gradient(135deg, ${ui.primaryColor}, ${ui.accentColor})` },
|
|
351
|
-
children: /* @__PURE__ */
|
|
378
|
+
children: /* @__PURE__ */ jsx5(Bot3, { className: "w-5 h-5 text-white" })
|
|
352
379
|
}
|
|
353
380
|
),
|
|
354
381
|
/* @__PURE__ */ jsxs3("div", { children: [
|
|
355
|
-
/* @__PURE__ */
|
|
356
|
-
ui.poweredBy && /* @__PURE__ */
|
|
382
|
+
/* @__PURE__ */ jsx5("h2", { className: "text-slate-900 dark:text-white font-semibold text-sm leading-tight", children: ui.title }),
|
|
383
|
+
ui.poweredBy && /* @__PURE__ */ jsx5("p", { className: "text-slate-500 dark:text-white/40 text-[11px] leading-tight", children: `Powered by ${ui.poweredBy}` })
|
|
357
384
|
] })
|
|
358
385
|
] }),
|
|
359
386
|
/* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2", children: [
|
|
360
387
|
/* @__PURE__ */ jsxs3("span", { className: "flex items-center gap-1 text-[10px] text-emerald-500 dark:text-emerald-400", children: [
|
|
361
|
-
/* @__PURE__ */
|
|
388
|
+
/* @__PURE__ */ jsx5("span", { className: "w-1.5 h-1.5 rounded-full bg-emerald-500 dark:bg-emerald-400 animate-pulse" }),
|
|
362
389
|
"Online"
|
|
363
390
|
] }),
|
|
364
|
-
mounted && messages.length > 0 && /* @__PURE__ */
|
|
391
|
+
mounted && messages.length > 0 && /* @__PURE__ */ jsx5(
|
|
365
392
|
"button",
|
|
366
393
|
{
|
|
367
394
|
onClick: clearHistory,
|
|
368
395
|
title: "Clear conversation",
|
|
369
396
|
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",
|
|
370
|
-
children: /* @__PURE__ */
|
|
397
|
+
children: /* @__PURE__ */ jsx5(Trash2, { className: "w-3.5 h-3.5" })
|
|
371
398
|
}
|
|
372
399
|
),
|
|
373
|
-
showClose && onClose && /* @__PURE__ */
|
|
400
|
+
showClose && onClose && /* @__PURE__ */ jsx5(
|
|
374
401
|
"button",
|
|
375
402
|
{
|
|
376
403
|
onClick: onClose,
|
|
377
404
|
title: "Close chat",
|
|
378
405
|
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",
|
|
379
|
-
children: /* @__PURE__ */
|
|
406
|
+
children: /* @__PURE__ */ jsx5(X, { className: "w-4 h-4" })
|
|
380
407
|
}
|
|
381
408
|
)
|
|
382
409
|
] })
|
|
@@ -387,20 +414,20 @@ function ChatWindow({ className = "", style, onClose, showClose = false }) {
|
|
|
387
414
|
!mounted || isEmpty ? (
|
|
388
415
|
/* Welcome state */
|
|
389
416
|
/* @__PURE__ */ jsxs3("div", { className: "h-full flex flex-col items-center justify-center text-center gap-4 px-6 py-12", children: [
|
|
390
|
-
/* @__PURE__ */
|
|
417
|
+
/* @__PURE__ */ jsx5(
|
|
391
418
|
"div",
|
|
392
419
|
{
|
|
393
420
|
className: `w-16 h-16 flex items-center justify-center shadow-lg ${ui.borderRadius === "full" ? "rounded-full" : "rounded-2xl"}`,
|
|
394
421
|
style: { background: `linear-gradient(135deg, ${ui.primaryColor}, ${ui.accentColor})` },
|
|
395
|
-
children: /* @__PURE__ */
|
|
422
|
+
children: /* @__PURE__ */ jsx5(Sparkles2, { className: "w-8 h-8 text-white" })
|
|
396
423
|
}
|
|
397
424
|
),
|
|
398
425
|
/* @__PURE__ */ jsxs3("div", { children: [
|
|
399
|
-
/* @__PURE__ */
|
|
400
|
-
/* @__PURE__ */
|
|
426
|
+
/* @__PURE__ */ jsx5("p", { className: "text-slate-800 dark:text-white/80 font-medium leading-relaxed", children: ui.welcomeMessage }),
|
|
427
|
+
/* @__PURE__ */ jsx5("p", { className: "text-slate-500 dark:text-white/30 text-sm mt-2", children: "Ask a question to get started" })
|
|
401
428
|
] }),
|
|
402
|
-
/* @__PURE__ */
|
|
403
|
-
(suggestion) => /* @__PURE__ */
|
|
429
|
+
/* @__PURE__ */ jsx5("div", { className: "flex flex-wrap gap-2 justify-center mt-2", children: CHAT_SUGGESTIONS.map(
|
|
430
|
+
(suggestion) => /* @__PURE__ */ jsx5(
|
|
404
431
|
"button",
|
|
405
432
|
{
|
|
406
433
|
onClick: () => {
|
|
@@ -415,7 +442,7 @@ function ChatWindow({ className = "", style, onClose, showClose = false }) {
|
|
|
415
442
|
)
|
|
416
443
|
) })
|
|
417
444
|
] })
|
|
418
|
-
) : messages.map((msg) => /* @__PURE__ */
|
|
445
|
+
) : messages.map((msg) => /* @__PURE__ */ jsx5(
|
|
419
446
|
MessageBubble,
|
|
420
447
|
{
|
|
421
448
|
message: msg,
|
|
@@ -425,7 +452,7 @@ function ChatWindow({ className = "", style, onClose, showClose = false }) {
|
|
|
425
452
|
},
|
|
426
453
|
msg.id
|
|
427
454
|
)),
|
|
428
|
-
isLoading && /* @__PURE__ */
|
|
455
|
+
isLoading && /* @__PURE__ */ jsx5(
|
|
429
456
|
MessageBubble,
|
|
430
457
|
{
|
|
431
458
|
message: { role: "assistant", content: "" },
|
|
@@ -435,14 +462,14 @@ function ChatWindow({ className = "", style, onClose, showClose = false }) {
|
|
|
435
462
|
}
|
|
436
463
|
),
|
|
437
464
|
error && /* @__PURE__ */ jsxs3("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: [
|
|
438
|
-
/* @__PURE__ */
|
|
439
|
-
/* @__PURE__ */
|
|
465
|
+
/* @__PURE__ */ jsx5(TriangleAlert, { className: "w-4 h-4 flex-shrink-0" }),
|
|
466
|
+
/* @__PURE__ */ jsx5("span", { children: error })
|
|
440
467
|
] }),
|
|
441
|
-
/* @__PURE__ */
|
|
468
|
+
/* @__PURE__ */ jsx5("div", { ref: bottomRef })
|
|
442
469
|
] }),
|
|
443
470
|
/* @__PURE__ */ jsxs3("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: [
|
|
444
471
|
/* @__PURE__ */ jsxs3("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: [
|
|
445
|
-
/* @__PURE__ */
|
|
472
|
+
/* @__PURE__ */ jsx5(
|
|
446
473
|
"textarea",
|
|
447
474
|
{
|
|
448
475
|
ref: inputRef,
|
|
@@ -456,7 +483,7 @@ function ChatWindow({ className = "", style, onClose, showClose = false }) {
|
|
|
456
483
|
style: { scrollbarWidth: "none" }
|
|
457
484
|
}
|
|
458
485
|
),
|
|
459
|
-
/* @__PURE__ */
|
|
486
|
+
/* @__PURE__ */ jsx5(
|
|
460
487
|
"button",
|
|
461
488
|
{
|
|
462
489
|
onClick: sendMessage,
|
|
@@ -466,11 +493,11 @@ function ChatWindow({ className = "", style, onClose, showClose = false }) {
|
|
|
466
493
|
background: input.trim() && !isLoading ? `linear-gradient(135deg, ${ui.primaryColor}, ${ui.accentColor})` : "rgba(148, 163, 184, 0.2)"
|
|
467
494
|
// slate-400/20 for light mode disabled
|
|
468
495
|
},
|
|
469
|
-
children: /* @__PURE__ */
|
|
496
|
+
children: /* @__PURE__ */ jsx5(ArrowUp, { className: "w-4 h-4 text-white" })
|
|
470
497
|
}
|
|
471
498
|
)
|
|
472
499
|
] }),
|
|
473
|
-
/* @__PURE__ */
|
|
500
|
+
/* @__PURE__ */ jsx5("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" })
|
|
474
501
|
] })
|
|
475
502
|
]
|
|
476
503
|
}
|
|
@@ -478,7 +505,7 @@ function ChatWindow({ className = "", style, onClose, showClose = false }) {
|
|
|
478
505
|
}
|
|
479
506
|
|
|
480
507
|
// src/components/ChatWidget.tsx
|
|
481
|
-
import { Fragment as Fragment2, jsx as
|
|
508
|
+
import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
482
509
|
function ChatWidget({ position = "bottom-right" }) {
|
|
483
510
|
const { ui } = useConfig();
|
|
484
511
|
const [isOpen, setIsOpen] = useState4(false);
|
|
@@ -498,7 +525,7 @@ function ChatWidget({ position = "bottom-right" }) {
|
|
|
498
525
|
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"}`,
|
|
499
526
|
style: { height: "600px", maxHeight: "calc(100vh - 6rem)" },
|
|
500
527
|
children: [
|
|
501
|
-
/* @__PURE__ */
|
|
528
|
+
/* @__PURE__ */ jsx6(
|
|
502
529
|
ChatWindow,
|
|
503
530
|
{
|
|
504
531
|
className: "h-full relative z-10",
|
|
@@ -506,7 +533,7 @@ function ChatWidget({ position = "bottom-right" }) {
|
|
|
506
533
|
onClose: () => setIsOpen(false)
|
|
507
534
|
}
|
|
508
535
|
),
|
|
509
|
-
/* @__PURE__ */
|
|
536
|
+
/* @__PURE__ */ jsx6(
|
|
510
537
|
"div",
|
|
511
538
|
{
|
|
512
539
|
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"}`
|
|
@@ -523,21 +550,21 @@ function ChatWidget({ position = "bottom-right" }) {
|
|
|
523
550
|
style: { background: `linear-gradient(135deg, ${ui.primaryColor}, ${ui.accentColor})` },
|
|
524
551
|
"aria-label": "Open chat",
|
|
525
552
|
children: [
|
|
526
|
-
/* @__PURE__ */
|
|
553
|
+
/* @__PURE__ */ jsx6(
|
|
527
554
|
"span",
|
|
528
555
|
{
|
|
529
556
|
className: "absolute inset-0 rounded-full animate-ping opacity-20",
|
|
530
557
|
style: { background: ui.primaryColor }
|
|
531
558
|
}
|
|
532
559
|
),
|
|
533
|
-
/* @__PURE__ */
|
|
560
|
+
/* @__PURE__ */ jsx6(
|
|
534
561
|
"span",
|
|
535
562
|
{
|
|
536
563
|
className: `transition-transform duration-300 ${isOpen ? "rotate-90 scale-90" : "rotate-0 scale-100"}`,
|
|
537
|
-
children: isOpen ? /* @__PURE__ */
|
|
564
|
+
children: isOpen ? /* @__PURE__ */ jsx6(X2, { className: "w-6 h-6 text-white" }) : /* @__PURE__ */ jsx6(MessageSquare2, { className: "w-6 h-6 text-white" })
|
|
538
565
|
}
|
|
539
566
|
),
|
|
540
|
-
hasUnread && !isOpen && /* @__PURE__ */
|
|
567
|
+
hasUnread && !isOpen && /* @__PURE__ */ jsx6("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" })
|
|
541
568
|
]
|
|
542
569
|
}
|
|
543
570
|
)
|