@retrivora-ai/rag-engine 1.8.0 → 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.
- package/dist/DocumentChunker-Dh9TvmGG.d.mts +45 -0
- package/dist/DocumentChunker-Dh9TvmGG.d.ts +45 -0
- package/dist/{index-DPsQodME.d.mts → ILLMProvider-BOJFz3Na.d.mts} +104 -1
- package/dist/{index-DPsQodME.d.ts → ILLMProvider-BOJFz3Na.d.ts} +104 -1
- package/dist/MultiTablePostgresProvider-ZLGSKTJR.mjs +8 -0
- package/dist/chunk-ICKRMZQK.mjs +76 -0
- package/dist/{chunk-PV3MFHWU.mjs → chunk-LZVVLSDN.mjs} +977 -516
- package/dist/chunk-OZFBG4BA.mjs +291 -0
- package/dist/handlers/index.d.mts +2 -2
- package/dist/handlers/index.d.ts +2 -2
- package/dist/handlers/index.js +1269 -656
- package/dist/handlers/index.mjs +4 -1
- package/dist/{index-Bb2yEopi.d.mts → index-BwpcaziY.d.ts} +10 -2
- package/dist/{index-CkbTzj9J.d.ts → index-D3V9Et2M.d.mts} +10 -2
- package/dist/index.d.mts +24 -4
- package/dist/index.d.ts +24 -4
- package/dist/index.js +1354 -826
- package/dist/index.mjs +1284 -795
- package/dist/server.d.mts +47 -27
- package/dist/server.d.ts +47 -27
- package/dist/server.js +1417 -829
- package/dist/server.mjs +164 -176
- package/package.json +6 -2
- package/src/app/api/upload/route.ts +4 -0
- package/src/app/constants.tsx +2 -2
- package/src/app/page.tsx +12 -322
- package/src/components/AmbientBackground.tsx +29 -0
- package/src/components/ArchitectureCard.tsx +17 -0
- package/src/components/ArchitectureCardsSection.tsx +15 -0
- package/src/components/ChatWindow.tsx +32 -0
- package/src/components/CodeViewer.tsx +51 -0
- package/src/components/ConfigProvider.tsx +1 -0
- package/src/components/DocViewer.tsx +37 -0
- package/src/components/DocumentUpload.tsx +44 -1
- package/src/components/Documentation.tsx +58 -0
- package/src/components/DynamicChart.tsx +27 -2
- package/src/components/Hero.tsx +59 -0
- package/src/components/HourglassLoader.tsx +87 -0
- package/src/components/Lifecycle.tsx +37 -0
- package/src/components/MarkdownComponents.tsx +140 -0
- package/src/components/MessageBubble.tsx +124 -904
- package/src/components/Navbar.tsx +55 -0
- package/src/components/ObservabilityPanel.tsx +374 -0
- package/src/components/ProductCard.tsx +5 -3
- package/src/components/UIDispatcher.tsx +344 -0
- package/src/components/VisualizationRenderer.tsx +372 -250
- package/src/config/RagConfig.ts +5 -0
- package/src/config/serverConfig.ts +3 -1
- package/src/core/Pipeline.ts +240 -271
- package/src/core/ProviderRegistry.ts +2 -2
- package/src/core/VectorPlugin.ts +9 -0
- package/src/handlers/index.ts +91 -15
- package/src/hooks/useRagChat.ts +21 -11
- package/src/index.ts +9 -1
- package/src/llm/LLMFactory.ts +54 -2
- package/src/llm/providers/AnthropicProvider.ts +12 -8
- package/src/llm/providers/GeminiProvider.ts +188 -143
- package/src/llm/providers/OllamaProvider.ts +7 -3
- package/src/llm/providers/OpenAIProvider.ts +12 -8
- package/src/providers/vectordb/MultiTablePostgresProvider.ts +150 -64
- package/src/types/chat.ts +8 -0
- package/src/types/index.ts +132 -0
- package/src/types/props.ts +9 -1
- package/src/utils/ProductExtractor.ts +347 -0
- package/src/utils/SchemaMapper.ts +129 -0
- package/src/utils/UITransformer.ts +470 -209
- package/src/utils/synonyms.ts +78 -0
- package/dist/DocumentChunker-C1GEEosY.d.ts +0 -93
- package/dist/DocumentChunker-CFEiRopR.d.mts +0 -93
- package/dist/PostgreSQLProvider-BMOETDZA.mjs +0 -8
- package/dist/chunk-FLOSGE6A.mjs +0 -202
package/src/app/page.tsx
CHANGED
|
@@ -1,335 +1,25 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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 pkg from '../../package.json';
|
|
19
|
-
import { Snippet, ArchitectureCardProps } from './types';
|
|
20
|
-
import {
|
|
21
|
-
LANDING_PAGE_CONTENT,
|
|
22
|
-
VECTOR_DATABASES,
|
|
23
|
-
AI_MODELS,
|
|
24
|
-
PIPELINE_STEPS,
|
|
25
|
-
SNIPPETS,
|
|
26
|
-
ARCHITECTURE_CARDS,
|
|
27
|
-
QUICK_START_STEPS,
|
|
28
|
-
API_ENDPOINTS,
|
|
29
|
-
} from './constants';
|
|
30
|
-
|
|
31
|
-
// ── Components ──────────────────────────────────────────────────────────────
|
|
32
|
-
|
|
33
|
-
function ArchitectureCard({ icon, title, description, badge, badgeColor }: ArchitectureCardProps) {
|
|
34
|
-
return (
|
|
35
|
-
<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">
|
|
36
|
-
<div className="mb-4 flex items-center justify-between">
|
|
37
|
-
<div className="text-3xl transition-transform duration-300 group-hover:scale-110">{icon}</div>
|
|
38
|
-
<span className={`rounded-full border px-3 py-0.5 text-[10px] font-bold uppercase tracking-wider ${badgeColor}`}>
|
|
39
|
-
{badge}
|
|
40
|
-
</span>
|
|
41
|
-
</div>
|
|
42
|
-
<h3 className="mb-2 font-bold text-slate-900 dark:text-white">{title}</h3>
|
|
43
|
-
<p className="text-xs text-slate-500 dark:text-white/40 leading-relaxed font-medium">{description}</p>
|
|
44
|
-
</div>
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function CodeViewer({ snippet }: { snippet: Snippet }) {
|
|
49
|
-
const [copied, setCopied] = React.useState(false);
|
|
50
|
-
|
|
51
|
-
const handleCopy = () => {
|
|
52
|
-
navigator.clipboard.writeText(snippet.code);
|
|
53
|
-
setCopied(true);
|
|
54
|
-
setTimeout(() => setCopied(false), 2000);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<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]">
|
|
59
|
-
<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">
|
|
60
|
-
<div className="flex items-center gap-3">
|
|
61
|
-
<div className="flex gap-1.5">
|
|
62
|
-
<div className="w-2.5 h-2.5 rounded-full bg-red-500" />
|
|
63
|
-
<div className="w-2.5 h-2.5 rounded-full bg-yellow-500" />
|
|
64
|
-
<div className="w-2.5 h-2.5 rounded-full bg-green-500" />
|
|
65
|
-
</div>
|
|
66
|
-
<span className="text-[10px] font-mono text-slate-400 dark:text-white/30 uppercase tracking-widest ml-2">{snippet.language}</span>
|
|
67
|
-
</div>
|
|
68
|
-
<button
|
|
69
|
-
onClick={handleCopy}
|
|
70
|
-
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"
|
|
71
|
-
>
|
|
72
|
-
{copied ? (
|
|
73
|
-
<>
|
|
74
|
-
<Check size={14} className="text-emerald-500" />
|
|
75
|
-
<span className="text-emerald-500">Copied!</span>
|
|
76
|
-
</>
|
|
77
|
-
) : (
|
|
78
|
-
<>
|
|
79
|
-
<Copy size={14} />
|
|
80
|
-
<span>Copy Code</span>
|
|
81
|
-
</>
|
|
82
|
-
)}
|
|
83
|
-
</button>
|
|
84
|
-
</div>
|
|
85
|
-
<div className="p-8 font-mono text-[12px] leading-relaxed overflow-auto custom-scrollbar flex-grow bg-[#0f172a] text-indigo-50">
|
|
86
|
-
<pre className="whitespace-pre">
|
|
87
|
-
<code>{snippet.code}</code>
|
|
88
|
-
</pre>
|
|
89
|
-
</div>
|
|
90
|
-
</div>
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
// Data moved to constants.tsx
|
|
97
|
-
|
|
98
|
-
// ── Page ────────────────────────────────────────────────────────────────────
|
|
99
|
-
|
|
100
|
-
function DocViewer({ activeSnippet, setActiveSnippet }: { activeSnippet: Snippet, setActiveSnippet: (s: Snippet) => void }) {
|
|
101
|
-
return (
|
|
102
|
-
<>
|
|
103
|
-
<div className="mb-6 flex flex-wrap gap-2 border-b border-slate-100 dark:border-white/5 pb-6">
|
|
104
|
-
{SNIPPETS.map((snippet) => (
|
|
105
|
-
<button
|
|
106
|
-
key={snippet.id}
|
|
107
|
-
onClick={() => setActiveSnippet(snippet)}
|
|
108
|
-
className={`px-5 py-2 rounded-xl text-[10px] font-bold uppercase tracking-wider transition-all border ${activeSnippet.id === snippet.id
|
|
109
|
-
? 'bg-indigo-600 text-white border-indigo-600 shadow-lg shadow-indigo-200 dark:shadow-indigo-500/20 scale-105'
|
|
110
|
-
: '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'
|
|
111
|
-
}`}
|
|
112
|
-
>
|
|
113
|
-
{snippet.title}
|
|
114
|
-
</button>
|
|
115
|
-
))}
|
|
116
|
-
</div>
|
|
117
|
-
|
|
118
|
-
<div className="flex-grow flex flex-col gap-6 animate-in fade-in slide-in-from-bottom-2 duration-500">
|
|
119
|
-
<div className="max-w-2xl">
|
|
120
|
-
<h3 className="text-xl font-bold text-slate-900 dark:text-white mb-2">{activeSnippet.title}</h3>
|
|
121
|
-
<p className="text-sm text-slate-500 dark:text-white/40 leading-relaxed font-medium italic">
|
|
122
|
-
{activeSnippet.description}
|
|
123
|
-
</p>
|
|
124
|
-
</div>
|
|
125
|
-
<CodeViewer snippet={activeSnippet} />
|
|
126
|
-
</div>
|
|
127
|
-
</>
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
11
|
|
|
131
12
|
export default function HomePage() {
|
|
132
|
-
const { ui } = useConfig();
|
|
133
|
-
const [activeSnippet, setActiveSnippet] = React.useState<Snippet>(SNIPPETS[0]);
|
|
134
|
-
|
|
135
13
|
return (
|
|
136
14
|
<main className="min-h-screen bg-slate-50 dark:bg-[#080811] relative transition-colors duration-300">
|
|
137
|
-
|
|
138
|
-
<
|
|
139
|
-
<div
|
|
140
|
-
className="absolute -top-40 -left-40 w-[600px] h-[600px] rounded-full opacity-20 blur-3xl"
|
|
141
|
-
style={{ background: ui.primaryColor }}
|
|
142
|
-
/>
|
|
143
|
-
<div
|
|
144
|
-
className="absolute -bottom-40 -right-40 w-[600px] h-[600px] rounded-full opacity-15 blur-3xl"
|
|
145
|
-
style={{ background: ui.accentColor }}
|
|
146
|
-
/>
|
|
147
|
-
<div
|
|
148
|
-
className="absolute inset-0 opacity-[0.05] dark:opacity-[0.03]"
|
|
149
|
-
style={{
|
|
150
|
-
backgroundImage:
|
|
151
|
-
'linear-gradient(currentColor 1px, transparent 1px), linear-gradient(90deg, currentColor 1px, transparent 1px)',
|
|
152
|
-
backgroundSize: '48px 48px',
|
|
153
|
-
}}
|
|
154
|
-
/>
|
|
155
|
-
</div>
|
|
156
|
-
|
|
157
|
-
{/* ── Navbar ── */}
|
|
158
|
-
<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">
|
|
159
|
-
<div className="flex items-center gap-3 group cursor-default">
|
|
160
|
-
<div className="relative">
|
|
161
|
-
<div
|
|
162
|
-
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"
|
|
163
|
-
style={{ background: `linear-gradient(135deg, ${ui.primaryColor}, ${ui.accentColor})` }}
|
|
164
|
-
>
|
|
165
|
-
<Zap className="w-5 h-5 text-white animate-pulse" />
|
|
166
|
-
<div className="absolute inset-0 bg-white/20 opacity-0 group-hover:opacity-100 transition-opacity" />
|
|
167
|
-
</div>
|
|
168
|
-
<div
|
|
169
|
-
className="absolute inset-0 blur-lg opacity-40 group-hover:opacity-80 transition-opacity"
|
|
170
|
-
style={{ background: ui.primaryColor }}
|
|
171
|
-
/>
|
|
172
|
-
</div>
|
|
173
|
-
<div className="flex flex-col -gap-0.5">
|
|
174
|
-
<span className="font-black text-transparent bg-clip-text text-xl tracking-tight leading-none"
|
|
175
|
-
style={{ backgroundImage: `linear-gradient(to right, ${ui.primaryColor}, ${ui.accentColor})` }}
|
|
176
|
-
>
|
|
177
|
-
Retrivora AI
|
|
178
|
-
</span>
|
|
179
|
-
<div className="flex items-center gap-1.5">
|
|
180
|
-
<span className="font-bold text-slate-900 dark:text-white text-[10px] tracking-[0.15em] uppercase opacity-70">Accelerator</span>
|
|
181
|
-
<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">v{pkg.version}</span>
|
|
182
|
-
</div>
|
|
183
|
-
</div>
|
|
184
|
-
</div>
|
|
185
|
-
|
|
186
|
-
<div className="flex items-center gap-3">
|
|
187
|
-
<ThemeToggle />
|
|
188
|
-
<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">
|
|
189
|
-
<Package className="w-4 h-4" /> NPM
|
|
190
|
-
</a>
|
|
191
|
-
<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">
|
|
192
|
-
<GitBranch className="w-4 h-4" /> GitHub
|
|
193
|
-
</a>
|
|
194
|
-
<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">
|
|
195
|
-
<HeartPulse className="w-3.5 h-3.5" /> Health
|
|
196
|
-
</a>
|
|
197
|
-
</div>
|
|
198
|
-
</nav>
|
|
199
|
-
|
|
200
|
-
{/* ── Hero + Chat ── */}
|
|
15
|
+
<AmbientBackground />
|
|
16
|
+
<Navbar />
|
|
201
17
|
<div className="relative z-10 container mx-auto px-6 py-12">
|
|
202
|
-
<
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
style={{ borderColor: `${ui.primaryColor}40`, color: ui.primaryColor, background: `${ui.primaryColor}10` }}
|
|
207
|
-
>
|
|
208
|
-
<span className="w-1.5 h-1.5 rounded-full animate-pulse" style={{ background: ui.primaryColor }} />
|
|
209
|
-
{LANDING_PAGE_CONTENT.hero.badge}
|
|
210
|
-
</div>
|
|
211
|
-
<h1 className="text-5xl md:text-7xl font-black text-slate-900 dark:text-white mb-6 tracking-tight">
|
|
212
|
-
{LANDING_PAGE_CONTENT.hero.title.split('for')[0]} <br />
|
|
213
|
-
<span className="text-transparent bg-clip-text" style={{ backgroundImage: `linear-gradient(to right, ${ui.primaryColor}, ${ui.accentColor})` }}>
|
|
214
|
-
for {LANDING_PAGE_CONTENT.hero.title.split('for')[1]}
|
|
215
|
-
</span>
|
|
216
|
-
</h1>
|
|
217
|
-
<p className="text-lg md:text-xl text-slate-600 dark:text-white/40 max-w-2xl leading-relaxed">
|
|
218
|
-
{LANDING_PAGE_CONTENT.hero.subtitle}
|
|
219
|
-
</p>
|
|
220
|
-
<div className="flex flex-col gap-4 mt-4">
|
|
221
|
-
<div className="flex flex-col gap-2">
|
|
222
|
-
<span className="text-[10px] font-black text-slate-400 dark:text-white/30 uppercase tracking-[0.2em] ml-1">Vector Ecosystem</span>
|
|
223
|
-
<div className="flex flex-wrap gap-2">
|
|
224
|
-
{VECTOR_DATABASES.map(({ Icon, label }) => (
|
|
225
|
-
<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">
|
|
226
|
-
<Icon className="w-3 h-3 transition-transform group-hover:scale-110" style={{ color: ui.primaryColor }} /> {label}
|
|
227
|
-
</span>
|
|
228
|
-
))}
|
|
229
|
-
</div>
|
|
230
|
-
</div>
|
|
231
|
-
|
|
232
|
-
<div className="flex flex-col gap-2">
|
|
233
|
-
<span className="text-[10px] font-black text-slate-400 dark:text-white/30 uppercase tracking-[0.2em] ml-1">AI Model Garden</span>
|
|
234
|
-
<div className="flex flex-wrap gap-2">
|
|
235
|
-
{AI_MODELS.map(({ Icon, label }) => (
|
|
236
|
-
<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">
|
|
237
|
-
<Icon className="w-3 h-3 transition-transform group-hover:scale-110" style={{ color: ui.accentColor }} /> {label}
|
|
238
|
-
</span>
|
|
239
|
-
))}
|
|
240
|
-
</div>
|
|
241
|
-
</div>
|
|
242
|
-
</div>
|
|
243
|
-
</div>
|
|
244
|
-
<div className="lg:sticky lg:top-6">
|
|
245
|
-
<ChatWindow className="w-full" style={{ height: '620px' } as React.CSSProperties} />
|
|
246
|
-
</div>
|
|
247
|
-
</div>
|
|
248
|
-
|
|
249
|
-
{/* ── Lifecycle ── */}
|
|
250
|
-
<div className="mt-24 mb-12">
|
|
251
|
-
<h2 className="text-2xl font-bold text-slate-900 dark:text-white text-center mb-2">{LANDING_PAGE_CONTENT.lifecycle.title}</h2>
|
|
252
|
-
<div className="relative max-w-5xl mx-auto py-12">
|
|
253
|
-
<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" />
|
|
254
|
-
<div className="space-y-12 md:space-y-0">
|
|
255
|
-
{PIPELINE_STEPS.map(({ step, Icon, title, desc, colors }, index) => {
|
|
256
|
-
const isLeft = index % 2 === 0;
|
|
257
|
-
return (
|
|
258
|
-
<div key={step} className={`relative flex flex-col md:flex-row items-center gap-8 ${isLeft ? 'md:flex-row' : 'md:flex-row-reverse'}`}>
|
|
259
|
-
<div className={`w-full md:w-1/2 relative flex ${isLeft ? 'justify-end' : 'justify-start'}`}>
|
|
260
|
-
<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">
|
|
261
|
-
<div className="absolute -right-2 -bottom-4 text-7xl font-bold opacity-[0.1] italic" style={{ color: colors.from }}>{step}</div>
|
|
262
|
-
<h3 className="font-semibold text-slate-900 dark:text-white mb-2 text-lg flex items-center gap-2">
|
|
263
|
-
<Icon className="w-5 h-5" style={{ color: colors.from }} /> {title}
|
|
264
|
-
</h3>
|
|
265
|
-
<p className="text-slate-600 dark:text-white/40 text-sm leading-relaxed">{desc}</p>
|
|
266
|
-
</div>
|
|
267
|
-
</div>
|
|
268
|
-
<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})` }}>
|
|
269
|
-
<Icon className="w-6 h-6 text-white" />
|
|
270
|
-
</div>
|
|
271
|
-
<div className="hidden md:block md:w-1/2" />
|
|
272
|
-
</div>
|
|
273
|
-
);
|
|
274
|
-
})}
|
|
275
|
-
</div>
|
|
276
|
-
</div>
|
|
277
|
-
</div>
|
|
278
|
-
|
|
279
|
-
{/* ── Architecture Cards ── */}
|
|
280
|
-
<div className="relative z-10 mt-24 mb-32 grid gap-6 sm:grid-cols-3 max-w-5xl mx-auto">
|
|
281
|
-
{ARCHITECTURE_CARDS.map((card, i) => (
|
|
282
|
-
<ArchitectureCard key={i} {...card} />
|
|
283
|
-
))}
|
|
284
|
-
</div>
|
|
285
|
-
|
|
286
|
-
{/* ── Documentation ── */}
|
|
287
|
-
<div className="mt-32 max-w-6xl mx-auto mb-24 relative">
|
|
288
|
-
<div className="text-center mb-16">
|
|
289
|
-
<h2 className="text-3xl font-bold text-slate-900 dark:text-white mb-4">{LANDING_PAGE_CONTENT.guide.title}</h2>
|
|
290
|
-
<p className="text-slate-600 dark:text-white/40 max-w-2xl mx-auto">{LANDING_PAGE_CONTENT.guide.subtitle}</p>
|
|
291
|
-
</div>
|
|
292
|
-
<div className="relative z-10 w-full grid gap-16 lg:grid-cols-[280px_1fr] items-start">
|
|
293
|
-
<aside className="flex flex-col gap-10">
|
|
294
|
-
<section>
|
|
295
|
-
<h2 className="mb-6 text-[10px] font-black text-slate-400 dark:text-white/30 uppercase tracking-[0.3em] flex items-center gap-3">
|
|
296
|
-
<FileText size={14} className="text-indigo-500" /> Quick Start
|
|
297
|
-
</h2>
|
|
298
|
-
<ol className="space-y-6">
|
|
299
|
-
{QUICK_START_STEPS.map((step, i) => (
|
|
300
|
-
<li key={i} className="group flex items-start gap-4">
|
|
301
|
-
<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>
|
|
302
|
-
<span className="text-xs text-slate-500 dark:text-white/50 font-medium leading-relaxed pt-1">{step}</span>
|
|
303
|
-
</li>
|
|
304
|
-
))}
|
|
305
|
-
</ol>
|
|
306
|
-
</section>
|
|
307
|
-
<section className="rounded-2xl border border-slate-200 dark:border-white/10 bg-white dark:bg-white/3 p-6 shadow-sm">
|
|
308
|
-
<h2 className="mb-6 text-[10px] font-black text-slate-400 dark:text-white/30 uppercase tracking-[0.3em] flex items-center gap-3">
|
|
309
|
-
<Zap size={14} className="text-indigo-500" /> API Endpoints
|
|
310
|
-
</h2>
|
|
311
|
-
<div className="grid gap-2.5">
|
|
312
|
-
{API_ENDPOINTS.map((slug) => (
|
|
313
|
-
<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">
|
|
314
|
-
<span className="text-[10px] font-mono text-slate-500 dark:text-white/30 group-hover:text-indigo-600">/api/{slug}</span>
|
|
315
|
-
<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>
|
|
316
|
-
</div>
|
|
317
|
-
))}
|
|
318
|
-
</div>
|
|
319
|
-
</section>
|
|
320
|
-
</aside>
|
|
321
|
-
<section className="flex flex-col h-full min-h-[560px]">
|
|
322
|
-
<DocViewer activeSnippet={activeSnippet} setActiveSnippet={setActiveSnippet} />
|
|
323
|
-
</section>
|
|
324
|
-
</div>
|
|
325
|
-
<div className="mt-16 text-center">
|
|
326
|
-
<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">
|
|
327
|
-
<Package className="w-5 h-5" /> Get Started on NPM <ExternalLink className="w-4 h-4" />
|
|
328
|
-
</a>
|
|
329
|
-
</div>
|
|
330
|
-
</div>
|
|
18
|
+
<Hero />
|
|
19
|
+
<Lifecycle />
|
|
20
|
+
<ArchitectureCardsSection />
|
|
21
|
+
<Documentation />
|
|
331
22
|
</div>
|
|
332
|
-
|
|
333
23
|
<ChatWidget position="bottom-right" />
|
|
334
24
|
</main>
|
|
335
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
|
+
}
|
|
@@ -13,11 +13,33 @@ interface FileState {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export function DocumentUpload({ namespace, onUploadComplete, className = '' }: DocumentUploadProps) {
|
|
16
|
-
const { ui } = useConfig();
|
|
16
|
+
const { ui, embedding } = useConfig();
|
|
17
17
|
const [fileStates, setFileStates] = useState<FileState[]>([]);
|
|
18
18
|
const [isDragging, setIsDragging] = useState(false);
|
|
19
19
|
const fileInputRef = useRef<HTMLInputElement>(null);
|
|
20
20
|
|
|
21
|
+
const MULTI_DIMENSION_MODELS: Record<string, number[]> = {
|
|
22
|
+
'text-embedding-3-small': [512, 1536],
|
|
23
|
+
'text-embedding-3-large': [256, 1024, 3072],
|
|
24
|
+
'nomic-embed-text': [64, 128, 256, 512, 768]
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const COMMON_DIMENSIONS = [64, 128, 256, 384, 512, 768, 1024, 1536, 3072];
|
|
28
|
+
const currentModel = embedding?.model || 'unknown';
|
|
29
|
+
const defaultDimension = embedding?.dimensions || 1536;
|
|
30
|
+
|
|
31
|
+
// Provide specific dimensions for known models, otherwise provide common ones
|
|
32
|
+
let availableDimensions = Object.entries(MULTI_DIMENSION_MODELS).find(([k]) => currentModel.includes(k))?.[1];
|
|
33
|
+
if (!availableDimensions) {
|
|
34
|
+
availableDimensions = COMMON_DIMENSIONS.includes(defaultDimension)
|
|
35
|
+
? COMMON_DIMENSIONS
|
|
36
|
+
: [...COMMON_DIMENSIONS, defaultDimension].sort((a, b) => a - b);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const isChangeable = true; // Always allow the user to select the dimension
|
|
40
|
+
|
|
41
|
+
const [dimension, setDimension] = useState(defaultDimension);
|
|
42
|
+
|
|
21
43
|
const addFiles = (files: File[]) => {
|
|
22
44
|
const newStates = files.map(file => ({ file, status: 'idle' as const }));
|
|
23
45
|
setFileStates(prev => [...prev, ...newStates]);
|
|
@@ -60,6 +82,7 @@ export function DocumentUpload({ namespace, onUploadComplete, className = '' }:
|
|
|
60
82
|
const formData = new FormData();
|
|
61
83
|
idleFiles.forEach(s => formData.append('files', s.file));
|
|
62
84
|
if (namespace) formData.append('namespace', namespace);
|
|
85
|
+
formData.append('dimension', dimension.toString());
|
|
63
86
|
|
|
64
87
|
try {
|
|
65
88
|
const response = await fetch('/api/upload', {
|
|
@@ -125,6 +148,26 @@ export function DocumentUpload({ namespace, onUploadComplete, className = '' }:
|
|
|
125
148
|
className="hidden"
|
|
126
149
|
accept=".pdf,.docx,.txt,.md,.json,.csv"
|
|
127
150
|
/>
|
|
151
|
+
|
|
152
|
+
<div className="mt-6 flex flex-col items-center gap-2 text-sm">
|
|
153
|
+
<label className="text-slate-600 dark:text-white/60 font-medium">Embedding Dimension</label>
|
|
154
|
+
{isChangeable ? (
|
|
155
|
+
<select
|
|
156
|
+
value={dimension}
|
|
157
|
+
onChange={(e) => setDimension(Number(e.target.value))}
|
|
158
|
+
disabled={isUploading}
|
|
159
|
+
className="px-3 py-1.5 rounded-lg bg-slate-50 dark:bg-white/5 border border-slate-200 dark:border-white/10 text-slate-800 dark:text-white/90 outline-none focus:border-emerald-500 transition-colors"
|
|
160
|
+
>
|
|
161
|
+
{availableDimensions.map(dim => (
|
|
162
|
+
<option key={dim} value={dim} className="bg-white dark:bg-slate-900">{dim}</option>
|
|
163
|
+
))}
|
|
164
|
+
</select>
|
|
165
|
+
) : (
|
|
166
|
+
<div className="px-3 py-1.5 rounded-lg bg-slate-100 dark:bg-white/10 border border-slate-200 dark:border-white/10 text-slate-500 dark:text-white/50 cursor-not-allowed text-xs">
|
|
167
|
+
{dimension} (Fixed for {currentModel})
|
|
168
|
+
</div>
|
|
169
|
+
)}
|
|
170
|
+
</div>
|
|
128
171
|
</div>
|
|
129
172
|
|
|
130
173
|
{fileStates.length > 0 && (
|