@retrivora-ai/rag-engine 1.8.1 → 1.8.2

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.
Files changed (55) hide show
  1. package/dist/{ILLMProvider-BfRgI1Xh.d.mts → ILLMProvider-BOJFz3Na.d.mts} +47 -1
  2. package/dist/{ILLMProvider-BfRgI1Xh.d.ts → ILLMProvider-BOJFz3Na.d.ts} +47 -1
  3. package/dist/{MultiTablePostgresProvider-YY7LPNJK.mjs → MultiTablePostgresProvider-ZLGSKTJR.mjs} +1 -1
  4. package/dist/chunk-ICKRMZQK.mjs +76 -0
  5. package/dist/{chunk-BFYLQYQU.mjs → chunk-LZVVLSDN.mjs} +192 -100
  6. package/dist/{chunk-R3RGUMHE.mjs → chunk-OZFBG4BA.mjs} +121 -48
  7. package/dist/handlers/index.d.mts +2 -2
  8. package/dist/handlers/index.d.ts +2 -2
  9. package/dist/handlers/index.js +368 -147
  10. package/dist/handlers/index.mjs +4 -1
  11. package/dist/{index-BV0z5mb6.d.mts → index-BwpcaziY.d.ts} +4 -2
  12. package/dist/{index-1Z4GuYBi.d.ts → index-D3V9Et2M.d.mts} +4 -2
  13. package/dist/index.d.mts +23 -3
  14. package/dist/index.d.ts +23 -3
  15. package/dist/index.js +1143 -790
  16. package/dist/index.mjs +1065 -770
  17. package/dist/server.d.mts +15 -25
  18. package/dist/server.d.ts +15 -25
  19. package/dist/server.js +366 -147
  20. package/dist/server.mjs +3 -2
  21. package/package.json +4 -2
  22. package/src/app/api/upload/route.ts +4 -0
  23. package/src/app/constants.tsx +2 -2
  24. package/src/app/page.tsx +12 -321
  25. package/src/components/AmbientBackground.tsx +29 -0
  26. package/src/components/ArchitectureCard.tsx +17 -0
  27. package/src/components/ArchitectureCardsSection.tsx +15 -0
  28. package/src/components/ChatWindow.tsx +32 -0
  29. package/src/components/CodeViewer.tsx +51 -0
  30. package/src/components/ConfigProvider.tsx +1 -0
  31. package/src/components/DocViewer.tsx +37 -0
  32. package/src/components/DocumentUpload.tsx +44 -1
  33. package/src/components/Documentation.tsx +58 -0
  34. package/src/components/DynamicChart.tsx +27 -2
  35. package/src/components/Hero.tsx +59 -0
  36. package/src/components/HourglassLoader.tsx +87 -0
  37. package/src/components/Lifecycle.tsx +37 -0
  38. package/src/components/MarkdownComponents.tsx +140 -0
  39. package/src/components/MessageBubble.tsx +88 -1010
  40. package/src/components/Navbar.tsx +55 -0
  41. package/src/components/ObservabilityPanel.tsx +374 -0
  42. package/src/components/ProductCard.tsx +3 -1
  43. package/src/components/UIDispatcher.tsx +344 -0
  44. package/src/components/VisualizationRenderer.tsx +48 -26
  45. package/src/core/Pipeline.ts +186 -76
  46. package/src/handlers/index.ts +72 -12
  47. package/src/hooks/useRagChat.ts +19 -9
  48. package/src/index.ts +9 -1
  49. package/src/providers/vectordb/MultiTablePostgresProvider.ts +150 -64
  50. package/src/types/chat.ts +2 -0
  51. package/src/types/index.ts +52 -0
  52. package/src/types/props.ts +9 -1
  53. package/src/utils/ProductExtractor.ts +347 -0
  54. package/src/utils/UITransformer.ts +4 -53
  55. package/src/utils/synonyms.ts +78 -0
package/dist/server.mjs CHANGED
@@ -39,14 +39,15 @@ import {
39
39
  sseFrame,
40
40
  sseMetaFrame,
41
41
  sseTextFrame
42
- } from "./chunk-BFYLQYQU.mjs";
42
+ } from "./chunk-LZVVLSDN.mjs";
43
+ import "./chunk-ICKRMZQK.mjs";
43
44
  import "./chunk-YLTMFW4M.mjs";
44
45
  import {
45
46
  PineconeProvider
46
47
  } from "./chunk-VUQJVIJT.mjs";
47
48
  import {
48
49
  MultiTablePostgresProvider
49
- } from "./chunk-R3RGUMHE.mjs";
50
+ } from "./chunk-OZFBG4BA.mjs";
50
51
  import {
51
52
  MongoDBProvider
52
53
  } from "./chunk-5AJ4XHLW.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@retrivora-ai/rag-engine",
3
- "version": "1.8.1",
3
+ "version": "1.8.2",
4
4
  "description": "Retrivora AI is a plug-and-play AI engine for RAG chat experiences — generic vector DB + LLM provider, embeddable or standalone.",
5
5
  "author": "Abhinav Alkuchi",
6
6
  "license": "MIT",
@@ -85,17 +85,19 @@
85
85
  },
86
86
  "dependencies": {
87
87
  "@anthropic-ai/sdk": "^0.90.0",
88
+ "@google/genai": "^0.8.0",
88
89
  "@google/generative-ai": "^0.24.1",
89
90
  "@pinecone-database/pinecone": "^7.2.0",
91
+ "@types/papaparse": "^5.5.2",
90
92
  "axios": "^1.15.0",
91
93
  "lucide-react": "^1.8.0",
92
94
  "next": ">=14.0.0",
93
95
  "next-themes": "^0.4.6",
94
96
  "openai": "^6.34.0",
97
+ "papaparse": "^5.5.3",
95
98
  "react": ">=18.0.0",
96
99
  "react-dom": ">=18.0.0",
97
100
  "react-is": "^18.3.1",
98
- "@google/genai": "^0.8.0",
99
101
  "react-markdown": "^10.1.0",
100
102
  "recharts": "^3.8.1",
101
103
  "remark-gfm": "^4.0.1"
@@ -0,0 +1,4 @@
1
+ import { createUploadHandler } from '@/handlers';
2
+ import { getRagConfig } from '@/config/serverConfig';
3
+
4
+ export const POST = createUploadHandler(getRagConfig());
@@ -112,12 +112,12 @@ const { reply, sources } = await pipeline.ask('How does Retrivora work?');`,
112
112
  title: 'Route Handlers',
113
113
  language: 'typescript',
114
114
  description: 'Deploy production-ready API endpoints in seconds using pre-built factories.',
115
- code: `import { createChatHandler, createUploadHandler, getRagConfig } from '@retrivora-ai/rag-engine/server';
115
+ code: `import { createChatStreamHandler, createUploadHandler, getRagConfig } from '@retrivora-ai/rag-engine/server';
116
116
 
117
117
  const config = getRagConfig();
118
118
 
119
119
  // src/app/api/chat/route.ts
120
- export const POST = createChatHandler(config);
120
+ export const POST = createChatStreamHandler(config);
121
121
 
122
122
  // src/app/api/upload/route.ts
123
123
  export const POST = createUploadHandler(config);`,
package/src/app/page.tsx CHANGED
@@ -1,334 +1,25 @@
1
1
  'use client';
2
2
 
3
3
  import React from 'react';
4
- import {
5
- Zap,
6
- GitBranch,
7
- HeartPulse,
8
- FileText,
9
- ExternalLink,
10
- Package,
11
- Check,
12
- Copy,
13
- } from 'lucide-react';
14
- import { ChatWindow } from '@/components/ChatWindow';
4
+ import { AmbientBackground } from '@/components/AmbientBackground';
5
+ import { Navbar } from '@/components/Navbar';
6
+ import { Hero } from '@/components/Hero';
7
+ import { Lifecycle } from '@/components/Lifecycle';
8
+ import { ArchitectureCardsSection } from '@/components/ArchitectureCardsSection';
9
+ import { Documentation } from '@/components/Documentation';
15
10
  import { ChatWidget } from '@/components/ChatWidget';
16
- import { useConfig } from '@/components/ConfigProvider';
17
- import { ThemeToggle } from '@/components/ThemeToggle';
18
- import { Snippet, ArchitectureCardProps } from './types';
19
- import {
20
- LANDING_PAGE_CONTENT,
21
- VECTOR_DATABASES,
22
- AI_MODELS,
23
- PIPELINE_STEPS,
24
- SNIPPETS,
25
- ARCHITECTURE_CARDS,
26
- QUICK_START_STEPS,
27
- API_ENDPOINTS,
28
- } from './constants';
29
-
30
- // ── Components ──────────────────────────────────────────────────────────────
31
-
32
- function ArchitectureCard({ icon, title, description, badge, badgeColor }: ArchitectureCardProps) {
33
- return (
34
- <div className="group rounded-2xl border border-slate-200 dark:border-white/10 bg-white dark:bg-white/5 p-6 shadow-sm transition-all duration-300 hover:border-indigo-500/50 dark:hover:border-indigo-500/30 hover:shadow-xl hover:shadow-indigo-500/5">
35
- <div className="mb-4 flex items-center justify-between">
36
- <div className="text-3xl transition-transform duration-300 group-hover:scale-110">{icon}</div>
37
- <span className={`rounded-full border px-3 py-0.5 text-[10px] font-bold uppercase tracking-wider ${badgeColor}`}>
38
- {badge}
39
- </span>
40
- </div>
41
- <h3 className="mb-2 font-bold text-slate-900 dark:text-white">{title}</h3>
42
- <p className="text-xs text-slate-500 dark:text-white/40 leading-relaxed font-medium">{description}</p>
43
- </div>
44
- );
45
- }
46
-
47
- function CodeViewer({ snippet }: { snippet: Snippet }) {
48
- const [copied, setCopied] = React.useState(false);
49
-
50
- const handleCopy = () => {
51
- navigator.clipboard.writeText(snippet.code);
52
- setCopied(true);
53
- setTimeout(() => setCopied(false), 2000);
54
- };
55
-
56
- return (
57
- <div className="flex flex-col h-full rounded-2xl border border-slate-200 dark:border-white/10 bg-slate-50 dark:bg-slate-900/50 shadow-lg overflow-hidden min-h-[440px]">
58
- <div className="flex items-center justify-between px-5 py-3 border-b border-slate-200 dark:border-white/10 bg-white dark:bg-slate-900">
59
- <div className="flex items-center gap-3">
60
- <div className="flex gap-1.5">
61
- <div className="w-2.5 h-2.5 rounded-full bg-red-500" />
62
- <div className="w-2.5 h-2.5 rounded-full bg-yellow-500" />
63
- <div className="w-2.5 h-2.5 rounded-full bg-green-500" />
64
- </div>
65
- <span className="text-[10px] font-mono text-slate-400 dark:text-white/30 uppercase tracking-widest ml-2">{snippet.language}</span>
66
- </div>
67
- <button
68
- onClick={handleCopy}
69
- className="flex items-center gap-2 text-[10px] font-bold text-slate-500 dark:text-white/40 hover:text-indigo-600 dark:hover:text-indigo-400 transition-all active:scale-95"
70
- >
71
- {copied ? (
72
- <>
73
- <Check size={14} className="text-emerald-500" />
74
- <span className="text-emerald-500">Copied!</span>
75
- </>
76
- ) : (
77
- <>
78
- <Copy size={14} />
79
- <span>Copy Code</span>
80
- </>
81
- )}
82
- </button>
83
- </div>
84
- <div className="p-8 font-mono text-[12px] leading-relaxed overflow-auto custom-scrollbar flex-grow bg-[#0f172a] text-indigo-50">
85
- <pre className="whitespace-pre">
86
- <code>{snippet.code}</code>
87
- </pre>
88
- </div>
89
- </div>
90
- );
91
- }
92
-
93
-
94
-
95
- // Data moved to constants.tsx
96
-
97
- // ── Page ────────────────────────────────────────────────────────────────────
98
-
99
- function DocViewer({ activeSnippet, setActiveSnippet }: { activeSnippet: Snippet, setActiveSnippet: (s: Snippet) => void }) {
100
- return (
101
- <>
102
- <div className="mb-6 flex flex-wrap gap-2 border-b border-slate-100 dark:border-white/5 pb-6">
103
- {SNIPPETS.map((snippet) => (
104
- <button
105
- key={snippet.id}
106
- onClick={() => setActiveSnippet(snippet)}
107
- className={`px-5 py-2 rounded-xl text-[10px] font-bold uppercase tracking-wider transition-all border ${activeSnippet.id === snippet.id
108
- ? 'bg-indigo-600 text-white border-indigo-600 shadow-lg shadow-indigo-200 dark:shadow-indigo-500/20 scale-105'
109
- : 'bg-white dark:bg-white/5 border-slate-200 dark:border-white/10 text-slate-500 dark:text-white/40 hover:text-indigo-600 dark:hover:text-indigo-400 hover:border-indigo-300 dark:hover:border-white/20'
110
- }`}
111
- >
112
- {snippet.title}
113
- </button>
114
- ))}
115
- </div>
116
-
117
- <div className="flex-grow flex flex-col gap-6 animate-in fade-in slide-in-from-bottom-2 duration-500">
118
- <div className="max-w-2xl">
119
- <h3 className="text-xl font-bold text-slate-900 dark:text-white mb-2">{activeSnippet.title}</h3>
120
- <p className="text-sm text-slate-500 dark:text-white/40 leading-relaxed font-medium italic">
121
- {activeSnippet.description}
122
- </p>
123
- </div>
124
- <CodeViewer snippet={activeSnippet} />
125
- </div>
126
- </>
127
- );
128
- }
129
11
 
130
12
  export default function HomePage() {
131
- const { ui } = useConfig();
132
- const [activeSnippet, setActiveSnippet] = React.useState<Snippet>(SNIPPETS[0]);
133
-
134
13
  return (
135
14
  <main className="min-h-screen bg-slate-50 dark:bg-[#080811] relative transition-colors duration-300">
136
- {/* ── Ambient gradient background ── */}
137
- <div className="absolute inset-0 overflow-hidden pointer-events-none">
138
- <div
139
- className="absolute -top-40 -left-40 w-[600px] h-[600px] rounded-full opacity-20 blur-3xl"
140
- style={{ background: ui.primaryColor }}
141
- />
142
- <div
143
- className="absolute -bottom-40 -right-40 w-[600px] h-[600px] rounded-full opacity-15 blur-3xl"
144
- style={{ background: ui.accentColor }}
145
- />
146
- <div
147
- className="absolute inset-0 opacity-[0.05] dark:opacity-[0.03]"
148
- style={{
149
- backgroundImage:
150
- 'linear-gradient(currentColor 1px, transparent 1px), linear-gradient(90deg, currentColor 1px, transparent 1px)',
151
- backgroundSize: '48px 48px',
152
- }}
153
- />
154
- </div>
155
-
156
- {/* ── Navbar ── */}
157
- <nav className="sticky top-0 z-50 flex items-center justify-between px-8 py-5 border-b border-slate-200 dark:border-white/5 bg-white/80 dark:bg-[#080811]/80 backdrop-blur-md">
158
- <div className="flex items-center gap-3 group cursor-default">
159
- <div className="relative">
160
- <div
161
- className="w-10 h-10 rounded-xl flex items-center justify-center shadow-lg relative z-10 overflow-hidden transition-transform group-hover:scale-110 duration-500"
162
- style={{ background: `linear-gradient(135deg, ${ui.primaryColor}, ${ui.accentColor})` }}
163
- >
164
- <Zap className="w-5 h-5 text-white animate-pulse" />
165
- <div className="absolute inset-0 bg-white/20 opacity-0 group-hover:opacity-100 transition-opacity" />
166
- </div>
167
- <div
168
- className="absolute inset-0 blur-lg opacity-40 group-hover:opacity-80 transition-opacity"
169
- style={{ background: ui.primaryColor }}
170
- />
171
- </div>
172
- <div className="flex flex-col -gap-0.5">
173
- <span className="font-black text-transparent bg-clip-text text-xl tracking-tight leading-none"
174
- style={{ backgroundImage: `linear-gradient(to right, ${ui.primaryColor}, ${ui.accentColor})` }}
175
- >
176
- Retrivora&nbsp;AI
177
- </span>
178
- <div className="flex items-center gap-1.5">
179
- <span className="font-bold text-slate-900 dark:text-white text-[10px] tracking-[0.15em] uppercase opacity-70">Accelerator</span>
180
- <span className="text-[9px] px-1.5 py-0.5 rounded-full bg-slate-100 dark:bg-white/5 text-slate-500 dark:text-white/40 font-mono border border-slate-200/50 dark:border-white/10">v1.8.0</span>
181
- </div>
182
- </div>
183
- </div>
184
-
185
- <div className="flex items-center gap-3">
186
- <ThemeToggle />
187
- <a href="https://www.npmjs.com/package/@retrivora-ai/rag-engine" target="_blank" rel="noreferrer" className="text-slate-500 hover:text-[#CB3837] dark:text-white/40 dark:hover:text-[#CB3837] text-sm transition-colors flex items-center gap-1.5">
188
- <Package className="w-4 h-4" /> NPM
189
- </a>
190
- <a href="https://github.com/abhinav1201/ai-accelerator" target="_blank" rel="noreferrer" className="text-slate-500 hover:text-slate-900 dark:text-white/40 dark:hover:text-white/70 text-sm transition-colors flex items-center gap-1.5">
191
- <GitBranch className="w-4 h-4" /> GitHub
192
- </a>
193
- <a href="/api/health" target="_blank" rel="noreferrer" className="px-3 py-1.5 rounded-lg text-xs border border-slate-200 dark:border-white/10 text-slate-600 dark:text-white/50 hover:text-slate-900 dark:hover:text-white/80 hover:bg-slate-100 dark:hover:bg-white/5 transition-all flex items-center gap-1.5">
194
- <HeartPulse className="w-3.5 h-3.5" /> Health
195
- </a>
196
- </div>
197
- </nav>
198
-
199
- {/* ── Hero + Chat ── */}
15
+ <AmbientBackground />
16
+ <Navbar />
200
17
  <div className="relative z-10 container mx-auto px-6 py-12">
201
- <div className="grid lg:grid-cols-2 gap-12 items-start">
202
- <div className="flex flex-col gap-6 pt-4">
203
- <div
204
- className="inline-flex items-center gap-2 px-4 py-1.5 rounded-full text-xs font-medium border w-fit"
205
- style={{ borderColor: `${ui.primaryColor}40`, color: ui.primaryColor, background: `${ui.primaryColor}10` }}
206
- >
207
- <span className="w-1.5 h-1.5 rounded-full animate-pulse" style={{ background: ui.primaryColor }} />
208
- {LANDING_PAGE_CONTENT.hero.badge}
209
- </div>
210
- <h1 className="text-5xl md:text-7xl font-black text-slate-900 dark:text-white mb-6 tracking-tight">
211
- {LANDING_PAGE_CONTENT.hero.title.split('for')[0]} <br />
212
- <span className="text-transparent bg-clip-text" style={{ backgroundImage: `linear-gradient(to right, ${ui.primaryColor}, ${ui.accentColor})` }}>
213
- for {LANDING_PAGE_CONTENT.hero.title.split('for')[1]}
214
- </span>
215
- </h1>
216
- <p className="text-lg md:text-xl text-slate-600 dark:text-white/40 max-w-2xl leading-relaxed">
217
- {LANDING_PAGE_CONTENT.hero.subtitle}
218
- </p>
219
- <div className="flex flex-col gap-4 mt-4">
220
- <div className="flex flex-col gap-2">
221
- <span className="text-[10px] font-black text-slate-400 dark:text-white/30 uppercase tracking-[0.2em] ml-1">Vector Ecosystem</span>
222
- <div className="flex flex-wrap gap-2">
223
- {VECTOR_DATABASES.map(({ Icon, label }) => (
224
- <span key={label} className="flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-white dark:bg-white/5 border border-slate-200 dark:border-white/10 text-slate-600 dark:text-white/60 text-[11px] font-semibold hover:bg-slate-50 dark:hover:bg-white/8 transition-all shadow-sm group">
225
- <Icon className="w-3 h-3 transition-transform group-hover:scale-110" style={{ color: ui.primaryColor }} /> {label}
226
- </span>
227
- ))}
228
- </div>
229
- </div>
230
-
231
- <div className="flex flex-col gap-2">
232
- <span className="text-[10px] font-black text-slate-400 dark:text-white/30 uppercase tracking-[0.2em] ml-1">AI Model Garden</span>
233
- <div className="flex flex-wrap gap-2">
234
- {AI_MODELS.map(({ Icon, label }) => (
235
- <span key={label} className="flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-white dark:bg-white/5 border border-slate-200 dark:border-white/10 text-slate-600 dark:text-white/60 text-[11px] font-semibold hover:bg-slate-50 dark:hover:bg-white/8 transition-all shadow-sm group">
236
- <Icon className="w-3 h-3 transition-transform group-hover:scale-110" style={{ color: ui.accentColor }} /> {label}
237
- </span>
238
- ))}
239
- </div>
240
- </div>
241
- </div>
242
- </div>
243
- <div className="lg:sticky lg:top-6">
244
- <ChatWindow className="w-full" style={{ height: '620px' } as React.CSSProperties} />
245
- </div>
246
- </div>
247
-
248
- {/* ── Lifecycle ── */}
249
- <div className="mt-24 mb-12">
250
- <h2 className="text-2xl font-bold text-slate-900 dark:text-white text-center mb-2">{LANDING_PAGE_CONTENT.lifecycle.title}</h2>
251
- <div className="relative max-w-5xl mx-auto py-12">
252
- <div className="absolute left-1/2 top-0 bottom-0 w-0.5 bg-slate-200 dark:bg-white/10 -translate-x-1/2 hidden md:block" />
253
- <div className="space-y-12 md:space-y-0">
254
- {PIPELINE_STEPS.map(({ step, Icon, title, desc, colors }, index) => {
255
- const isLeft = index % 2 === 0;
256
- return (
257
- <div key={step} className={`relative flex flex-col md:flex-row items-center gap-8 ${isLeft ? 'md:flex-row' : 'md:flex-row-reverse'}`}>
258
- <div className={`w-full md:w-1/2 relative flex ${isLeft ? 'justify-end' : 'justify-start'}`}>
259
- <div className="relative p-6 rounded-2xl border border-slate-200 dark:border-white/10 bg-white dark:bg-white/3 max-w-md text-left overflow-hidden group">
260
- <div className="absolute -right-2 -bottom-4 text-7xl font-bold opacity-[0.1] italic" style={{ color: colors.from }}>{step}</div>
261
- <h3 className="font-semibold text-slate-900 dark:text-white mb-2 text-lg flex items-center gap-2">
262
- <Icon className="w-5 h-5" style={{ color: colors.from }} /> {title}
263
- </h3>
264
- <p className="text-slate-600 dark:text-white/40 text-sm leading-relaxed">{desc}</p>
265
- </div>
266
- </div>
267
- <div className="relative z-10 w-12 h-12 rounded-2xl flex items-center justify-center shadow-xl border-4 border-slate-50 dark:border-[#080811]" style={{ background: `linear-gradient(135deg, ${colors.from}, ${colors.to})` }}>
268
- <Icon className="w-6 h-6 text-white" />
269
- </div>
270
- <div className="hidden md:block md:w-1/2" />
271
- </div>
272
- );
273
- })}
274
- </div>
275
- </div>
276
- </div>
277
-
278
- {/* ── Architecture Cards ── */}
279
- <div className="relative z-10 mt-24 mb-32 grid gap-6 sm:grid-cols-3 max-w-5xl mx-auto">
280
- {ARCHITECTURE_CARDS.map((card, i) => (
281
- <ArchitectureCard key={i} {...card} />
282
- ))}
283
- </div>
284
-
285
- {/* ── Documentation ── */}
286
- <div className="mt-32 max-w-6xl mx-auto mb-24 relative">
287
- <div className="text-center mb-16">
288
- <h2 className="text-3xl font-bold text-slate-900 dark:text-white mb-4">{LANDING_PAGE_CONTENT.guide.title}</h2>
289
- <p className="text-slate-600 dark:text-white/40 max-w-2xl mx-auto">{LANDING_PAGE_CONTENT.guide.subtitle}</p>
290
- </div>
291
- <div className="relative z-10 w-full grid gap-16 lg:grid-cols-[280px_1fr] items-start">
292
- <aside className="flex flex-col gap-10">
293
- <section>
294
- <h2 className="mb-6 text-[10px] font-black text-slate-400 dark:text-white/30 uppercase tracking-[0.3em] flex items-center gap-3">
295
- <FileText size={14} className="text-indigo-500" /> Quick Start
296
- </h2>
297
- <ol className="space-y-6">
298
- {QUICK_START_STEPS.map((step, i) => (
299
- <li key={i} className="group flex items-start gap-4">
300
- <span className="flex h-6 w-6 shrink-0 items-center justify-center rounded-lg bg-white dark:bg-white/5 text-slate-600 dark:text-white/40 font-mono text-[10px] border border-slate-200 dark:border-white/10 shadow-sm">{i + 1}</span>
301
- <span className="text-xs text-slate-500 dark:text-white/50 font-medium leading-relaxed pt-1">{step}</span>
302
- </li>
303
- ))}
304
- </ol>
305
- </section>
306
- <section className="rounded-2xl border border-slate-200 dark:border-white/10 bg-white dark:bg-white/3 p-6 shadow-sm">
307
- <h2 className="mb-6 text-[10px] font-black text-slate-400 dark:text-white/30 uppercase tracking-[0.3em] flex items-center gap-3">
308
- <Zap size={14} className="text-indigo-500" /> API Endpoints
309
- </h2>
310
- <div className="grid gap-2.5">
311
- {API_ENDPOINTS.map((slug) => (
312
- <div key={slug} className="group flex items-center justify-between p-2 rounded-lg bg-slate-50 dark:bg-white/5 border border-slate-100 dark:border-white/5 hover:border-indigo-200 dark:hover:border-indigo-500/30">
313
- <span className="text-[10px] font-mono text-slate-500 dark:text-white/30 group-hover:text-indigo-600">/api/{slug}</span>
314
- <span className="text-[8px] font-bold text-indigo-600 dark:text-indigo-400 bg-indigo-50 dark:bg-indigo-500/10 px-1.5 py-0.5 rounded border border-indigo-100 dark:border-indigo-500/20">POST</span>
315
- </div>
316
- ))}
317
- </div>
318
- </section>
319
- </aside>
320
- <section className="flex flex-col h-full min-h-[560px]">
321
- <DocViewer activeSnippet={activeSnippet} setActiveSnippet={setActiveSnippet} />
322
- </section>
323
- </div>
324
- <div className="mt-16 text-center">
325
- <a href="https://www.npmjs.com/package/@retrivora-ai/rag-engine" className="inline-flex items-center gap-3 px-8 py-4 rounded-2xl bg-slate-900 dark:bg-white text-white dark:text-slate-900 font-bold shadow-xl shadow-indigo-500/20">
326
- <Package className="w-5 h-5" /> Get Started on NPM <ExternalLink className="w-4 h-4" />
327
- </a>
328
- </div>
329
- </div>
18
+ <Hero />
19
+ <Lifecycle />
20
+ <ArchitectureCardsSection />
21
+ <Documentation />
330
22
  </div>
331
-
332
23
  <ChatWidget position="bottom-right" />
333
24
  </main>
334
25
  );
@@ -0,0 +1,29 @@
1
+ 'use client';
2
+
3
+ import React from 'react';
4
+ import { useConfig } from '@/components/ConfigProvider';
5
+
6
+ export function AmbientBackground() {
7
+ const { ui } = useConfig();
8
+
9
+ return (
10
+ <div className="absolute inset-0 overflow-hidden pointer-events-none">
11
+ <div
12
+ className="absolute -top-40 -left-40 w-[600px] h-[600px] rounded-full opacity-20 blur-3xl"
13
+ style={{ background: ui.primaryColor }}
14
+ />
15
+ <div
16
+ className="absolute -bottom-40 -right-40 w-[600px] h-[600px] rounded-full opacity-15 blur-3xl"
17
+ style={{ background: ui.accentColor }}
18
+ />
19
+ <div
20
+ className="absolute inset-0 opacity-[0.05] dark:opacity-[0.03]"
21
+ style={{
22
+ backgroundImage:
23
+ 'linear-gradient(currentColor 1px, transparent 1px), linear-gradient(90deg, currentColor 1px, transparent 1px)',
24
+ backgroundSize: '48px 48px',
25
+ }}
26
+ />
27
+ </div>
28
+ );
29
+ }
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { ArchitectureCardProps } from '@/app/types';
3
+
4
+ export function ArchitectureCard({ icon, title, description, badge, badgeColor }: ArchitectureCardProps) {
5
+ return (
6
+ <div className="group rounded-2xl border border-slate-200 dark:border-white/10 bg-white dark:bg-white/5 p-6 shadow-sm transition-all duration-300 hover:border-indigo-500/50 dark:hover:border-indigo-500/30 hover:shadow-xl hover:shadow-indigo-500/5">
7
+ <div className="mb-4 flex items-center justify-between">
8
+ <div className="text-3xl transition-transform duration-300 group-hover:scale-110">{icon}</div>
9
+ <span className={`rounded-full border px-3 py-0.5 text-[10px] font-bold uppercase tracking-wider ${badgeColor}`}>
10
+ {badge}
11
+ </span>
12
+ </div>
13
+ <h3 className="mb-2 font-bold text-slate-900 dark:text-white">{title}</h3>
14
+ <p className="text-xs text-slate-500 dark:text-white/40 leading-relaxed font-medium">{description}</p>
15
+ </div>
16
+ );
17
+ }
@@ -0,0 +1,15 @@
1
+ 'use client';
2
+
3
+ import React from 'react';
4
+ import { ArchitectureCard } from '@/components/ArchitectureCard';
5
+ import { ARCHITECTURE_CARDS } from '@/app/constants';
6
+
7
+ export function ArchitectureCardsSection() {
8
+ return (
9
+ <div className="relative z-10 mt-24 mb-32 grid gap-6 sm:grid-cols-3 max-w-5xl mx-auto">
10
+ {ARCHITECTURE_CARDS.map((card, i) => (
11
+ <ArchitectureCard key={i} {...card} />
12
+ ))}
13
+ </div>
14
+ );
15
+ }
@@ -13,7 +13,9 @@ import {
13
13
  Minimize2,
14
14
  Mic,
15
15
  MicOff,
16
+ Paperclip,
16
17
  } from 'lucide-react';
18
+ import { DocumentUpload } from './DocumentUpload';
17
19
  import { MessageBubble } from './MessageBubble';
18
20
  import { useConfig } from './ConfigProvider';
19
21
  import { useRagChat } from '../hooks/useRagChat';
@@ -77,6 +79,7 @@ export function ChatWindow({
77
79
  const [isSuggesting, setIsSuggesting] = useState(false);
78
80
 
79
81
  const [isListening, setIsListening] = useState(false);
82
+ const [isUploadModalOpen, setIsUploadModalOpen] = useState(false);
80
83
  const recognitionRef = useRef<ISpeechRecognition | null>(null);
81
84
 
82
85
  // Initialize SpeechRecognition
@@ -396,6 +399,24 @@ export function ChatWindow({
396
399
  <div ref={bottomRef} />
397
400
  </div>
398
401
 
402
+ {/* Upload Modal Overlay */}
403
+ {isUploadModalOpen && (
404
+ <div className="absolute inset-0 z-50 flex items-center justify-center p-4 bg-slate-900/50 backdrop-blur-sm rounded-inherit">
405
+ <div className="relative w-full max-w-md bg-white dark:bg-[#0f0f1a] rounded-2xl shadow-2xl overflow-hidden animate-in zoom-in-95 duration-200">
406
+ <button
407
+ onClick={() => setIsUploadModalOpen(false)}
408
+ className="absolute top-4 right-4 p-1.5 rounded-lg text-slate-400 hover:text-slate-600 hover:bg-slate-100 dark:hover:text-white/80 dark:hover:bg-white/10 transition-colors z-10"
409
+ >
410
+ <X className="w-5 h-5" />
411
+ </button>
412
+ <DocumentUpload
413
+ namespace={projectId}
414
+ onUploadComplete={() => setIsUploadModalOpen(false)}
415
+ />
416
+ </div>
417
+ </div>
418
+ )}
419
+
399
420
  {/* ── Input ── */}
400
421
  <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]'}`}>
401
422
 
@@ -460,6 +481,17 @@ export function ChatWindow({
460
481
  </button>
461
482
  )}
462
483
 
484
+ {ui.allowUpload !== false && (
485
+ <button
486
+ type="button"
487
+ onClick={() => setIsUploadModalOpen(true)}
488
+ className="flex-shrink-0 w-9 h-9 rounded-xl flex items-center justify-center transition-all hover:scale-105 active:scale-95 text-slate-400 dark:text-white/40 hover:bg-slate-200 dark:hover:bg-white/10"
489
+ title="Upload Document"
490
+ >
491
+ <Paperclip className="w-4 h-4" />
492
+ </button>
493
+ )}
494
+
463
495
  <button
464
496
  onClick={sendMessage}
465
497
  disabled={!input.trim() || isLoading}
@@ -0,0 +1,51 @@
1
+ 'use client';
2
+
3
+ import React from 'react';
4
+ import { Check, Copy } from 'lucide-react';
5
+ import { Snippet } from '@/app/types';
6
+
7
+ export function CodeViewer({ snippet }: { snippet: Snippet }) {
8
+ const [copied, setCopied] = React.useState(false);
9
+
10
+ const handleCopy = () => {
11
+ navigator.clipboard.writeText(snippet.code);
12
+ setCopied(true);
13
+ setTimeout(() => setCopied(false), 2000);
14
+ };
15
+
16
+ return (
17
+ <div className="flex flex-col h-full rounded-2xl border border-slate-200 dark:border-white/10 bg-slate-50 dark:bg-slate-900/50 shadow-lg overflow-hidden min-h-[440px]">
18
+ <div className="flex items-center justify-between px-5 py-3 border-b border-slate-200 dark:border-white/10 bg-white dark:bg-slate-900">
19
+ <div className="flex items-center gap-3">
20
+ <div className="flex gap-1.5">
21
+ <div className="w-2.5 h-2.5 rounded-full bg-red-500" />
22
+ <div className="w-2.5 h-2.5 rounded-full bg-yellow-500" />
23
+ <div className="w-2.5 h-2.5 rounded-full bg-green-500" />
24
+ </div>
25
+ <span className="text-[10px] font-mono text-slate-400 dark:text-white/30 uppercase tracking-widest ml-2">{snippet.language}</span>
26
+ </div>
27
+ <button
28
+ onClick={handleCopy}
29
+ className="flex items-center gap-2 text-[10px] font-bold text-slate-500 dark:text-white/40 hover:text-indigo-600 dark:hover:text-indigo-400 transition-all active:scale-95"
30
+ >
31
+ {copied ? (
32
+ <>
33
+ <Check size={14} className="text-emerald-500" />
34
+ <span className="text-emerald-500">Copied!</span>
35
+ </>
36
+ ) : (
37
+ <>
38
+ <Copy size={14} />
39
+ <span>Copy Code</span>
40
+ </>
41
+ )}
42
+ </button>
43
+ </div>
44
+ <div className="p-8 font-mono text-[12px] leading-relaxed overflow-auto custom-scrollbar flex-grow bg-[#0f172a] text-indigo-50">
45
+ <pre className="whitespace-pre">
46
+ <code>{snippet.code}</code>
47
+ </pre>
48
+ </div>
49
+ </div>
50
+ );
51
+ }
@@ -22,6 +22,7 @@ export function ConfigProvider({
22
22
  const merged: ClientConfig = {
23
23
  projectId: config?.projectId || DEFAULT_CONFIG.projectId,
24
24
  ui: mergeDefined(DEFAULT_CONFIG.ui, config?.ui) as Required<UIConfig>,
25
+ embedding: config?.embedding,
25
26
  };
26
27
 
27
28
  return <ConfigContext.Provider value={merged}>{children}</ConfigContext.Provider>;
@@ -0,0 +1,37 @@
1
+ 'use client';
2
+
3
+ import React from 'react';
4
+ import { Snippet } from '@/app/types';
5
+ import { SNIPPETS } from '@/app/constants';
6
+ import { CodeViewer } from './CodeViewer';
7
+
8
+ export function DocViewer({ activeSnippet, setActiveSnippet }: { activeSnippet: Snippet, setActiveSnippet: (s: Snippet) => void }) {
9
+ return (
10
+ <>
11
+ <div className="mb-6 flex flex-wrap gap-2 border-b border-slate-100 dark:border-white/5 pb-6">
12
+ {SNIPPETS.map((snippet) => (
13
+ <button
14
+ key={snippet.id}
15
+ onClick={() => setActiveSnippet(snippet)}
16
+ className={`px-5 py-2 rounded-xl text-[10px] font-bold uppercase tracking-wider transition-all border ${activeSnippet.id === snippet.id
17
+ ? 'bg-indigo-600 text-white border-indigo-600 shadow-lg shadow-indigo-200 dark:shadow-indigo-500/20 scale-105'
18
+ : 'bg-white dark:bg-white/5 border-slate-200 dark:border-white/10 text-slate-500 dark:text-white/40 hover:text-indigo-600 dark:hover:text-indigo-400 hover:border-indigo-300 dark:hover:border-white/20'
19
+ }`}
20
+ >
21
+ {snippet.title}
22
+ </button>
23
+ ))}
24
+ </div>
25
+
26
+ <div className="flex-grow flex flex-col gap-6 animate-in fade-in slide-in-from-bottom-2 duration-500">
27
+ <div className="max-w-2xl">
28
+ <h3 className="text-xl font-bold text-slate-900 dark:text-white mb-2">{activeSnippet.title}</h3>
29
+ <p className="text-sm text-slate-500 dark:text-white/40 leading-relaxed font-medium italic">
30
+ {activeSnippet.description}
31
+ </p>
32
+ </div>
33
+ <CodeViewer snippet={activeSnippet} />
34
+ </div>
35
+ </>
36
+ );
37
+ }