@retrivora-ai/rag-engine 1.9.6 → 1.9.8
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/README.md +130 -113
- package/dist/{ILLMProvider-DNhyOYoK.d.mts → ILLMProvider-B8ROITYK.d.mts} +59 -8
- package/dist/{ILLMProvider-DNhyOYoK.d.ts → ILLMProvider-B8ROITYK.d.ts} +59 -8
- package/dist/handlers/index.d.mts +2 -2
- package/dist/handlers/index.d.ts +2 -2
- package/dist/handlers/index.js +2376 -489
- package/dist/handlers/index.mjs +2372 -489
- package/dist/{index-CjQdL0cX.d.ts → index-B8PbEFSY.d.mts} +17 -3
- package/dist/{index-CHL1jdYm.d.mts → index-BCPKUAVL.d.ts} +33 -41
- package/dist/{index-Hgbwl9X4.d.ts → index-CrxCy36A.d.mts} +33 -41
- package/dist/{index-C9v7-tWd.d.mts → index-DNvoi-sV.d.ts} +17 -3
- package/dist/index.css +695 -203
- package/dist/index.d.mts +37 -7
- package/dist/index.d.ts +37 -7
- package/dist/index.js +1197 -286
- package/dist/index.mjs +1221 -297
- package/dist/server.d.mts +62 -6
- package/dist/server.d.ts +62 -6
- package/dist/server.js +2526 -574
- package/dist/server.mjs +2517 -573
- package/package.json +12 -10
- package/src/app/constants.tsx +207 -212
- package/src/app/layout.tsx +4 -28
- package/src/app/types.ts +17 -17
- package/src/components/AmbientBackground.tsx +10 -10
- package/src/components/ArchitectureCard.tsx +43 -7
- package/src/components/ArchitectureCardsSection.tsx +37 -4
- package/src/components/ChatWidget.tsx +4 -1
- package/src/components/ChatWindow.tsx +9 -2
- package/src/components/CodeViewer.tsx +19 -14
- package/src/components/DocViewer.tsx +75 -15
- package/src/components/Documentation.tsx +111 -28
- package/src/components/Hero.tsx +103 -20
- package/src/components/Lifecycle.tsx +65 -25
- package/src/components/MarkdownComponents.tsx +44 -1
- package/src/components/MessageBubble.tsx +162 -50
- package/src/components/constants.tsx +279 -0
- package/src/config/RagConfig.ts +56 -10
- package/src/config/constants.ts +5 -0
- package/src/config/serverConfig.ts +15 -0
- package/src/core/ConfigResolver.ts +30 -25
- package/src/core/DatabaseStorage.ts +469 -0
- package/src/core/LicenseVerifier.ts +154 -0
- package/src/core/MultiAgentCoordinator.ts +239 -0
- package/src/core/Pipeline.ts +148 -16
- package/src/core/ProviderRegistry.ts +5 -5
- package/src/core/Retrivora.ts +52 -6
- package/src/core/VectorPlugin.ts +74 -11
- package/src/core/mcp.ts +261 -0
- package/src/exceptions/index.ts +52 -0
- package/src/handlers/index.ts +504 -47
- package/src/hooks/useRagChat.ts +100 -43
- package/src/hooks/useStoredMessages.ts +15 -4
- package/src/index.ts +7 -0
- package/src/llm/LLMFactory.ts +15 -6
- package/src/llm/providers/GroqProvider.ts +176 -0
- package/src/llm/providers/QwenProvider.ts +191 -0
- package/src/server.ts +23 -13
- package/src/types/chat.ts +16 -0
- package/src/types/props.ts +50 -1
- package/.env.example +0 -80
- package/LICENSE.txt +0 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@retrivora-ai/rag-engine",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.8",
|
|
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",
|
|
@@ -72,16 +72,21 @@
|
|
|
72
72
|
"README.md"
|
|
73
73
|
],
|
|
74
74
|
"scripts": {
|
|
75
|
-
"dev": "next
|
|
76
|
-
"build": "
|
|
77
|
-
"build:pkg": "tsup src/index.ts src/handlers/index.ts src/server.ts --format cjs,esm --dts --clean --no-splitting --tsconfig tsconfig.build.json --external react,react-dom,next,mongodb,pg,openai,@anthropic-ai/sdk,@pinecone-database/pinecone,axios,lucide-react,mammoth,pdf-parse,react-markdown,remark-gfm,next-themes,langchain,@langchain/core,@langchain/openai,llamaindex
|
|
78
|
-
"start": "next start",
|
|
75
|
+
"dev": "npx @tailwindcss/cli -i src/tailwind.css -o src/index.css && tsup src/index.ts src/handlers/index.ts src/server.ts --format cjs,esm --watch --tsconfig tsconfig.build.json --external react,react-dom,next,mongodb,pg,openai,@anthropic-ai/sdk,@pinecone-database/pinecone,axios,lucide-react,mammoth,pdf-parse,react-markdown,remark-gfm,next-themes,langchain,@langchain/core,@langchain/openai,llamaindex --inject-style",
|
|
76
|
+
"build": "npm run build:pkg",
|
|
77
|
+
"build:pkg": "npx @tailwindcss/cli -i src/tailwind.css -o src/index.css && tsup src/index.ts src/handlers/index.ts src/server.ts --format cjs,esm --dts --clean --no-splitting --tsconfig tsconfig.build.json --external react,react-dom,next,mongodb,pg,openai,@anthropic-ai/sdk,@pinecone-database/pinecone,axios,lucide-react,mammoth,pdf-parse,react-markdown,remark-gfm,next-themes,langchain,@langchain/core,@langchain/openai,llamaindex --inject-style && npx @tailwindcss/cli -i src/tailwind.css -o dist/index.css && rm src/index.css",
|
|
79
78
|
"lint": "eslint",
|
|
80
|
-
"
|
|
79
|
+
"clean": "rm -rf dist"
|
|
81
80
|
},
|
|
82
81
|
"peerDependencies": {
|
|
83
82
|
"react": ">=18.0.0",
|
|
84
|
-
"react-dom": ">=18.0.0"
|
|
83
|
+
"react-dom": ">=18.0.0",
|
|
84
|
+
"next": ">=15.0.0"
|
|
85
|
+
},
|
|
86
|
+
"peerDependenciesMeta": {
|
|
87
|
+
"next": {
|
|
88
|
+
"optional": true
|
|
89
|
+
}
|
|
85
90
|
},
|
|
86
91
|
"dependencies": {
|
|
87
92
|
"@anthropic-ai/sdk": "^0.95.1",
|
|
@@ -91,12 +96,9 @@
|
|
|
91
96
|
"@types/papaparse": "^5.5.2",
|
|
92
97
|
"axios": "^1.15.0",
|
|
93
98
|
"lucide-react": "^1.8.0",
|
|
94
|
-
"next": "^16.2.6",
|
|
95
99
|
"next-themes": "^0.4.6",
|
|
96
100
|
"openai": "^6.34.0",
|
|
97
101
|
"papaparse": "^5.5.3",
|
|
98
|
-
"react": ">=18.0.0",
|
|
99
|
-
"react-dom": ">=18.0.0",
|
|
100
102
|
"react-is": "^18.3.1",
|
|
101
103
|
"react-markdown": "^10.1.0",
|
|
102
104
|
"recharts": "^3.8.1",
|
package/src/app/constants.tsx
CHANGED
|
@@ -1,217 +1,207 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
3
|
+
Zap,
|
|
4
|
+
Database,
|
|
5
|
+
Layers,
|
|
6
|
+
Search,
|
|
7
|
+
Box,
|
|
8
|
+
Package,
|
|
9
|
+
Activity,
|
|
10
|
+
Hexagon,
|
|
11
|
+
Sparkles,
|
|
12
|
+
Bot,
|
|
13
|
+
Brain,
|
|
14
|
+
Rabbit,
|
|
15
|
+
Code,
|
|
16
|
+
Terminal,
|
|
17
|
+
FileText,
|
|
18
|
+
Puzzle,
|
|
19
|
+
MessageSquare,
|
|
20
|
+
Cpu,
|
|
21
|
+
Cloud,
|
|
20
22
|
} from 'lucide-react';
|
|
21
23
|
import { ArchitectureCardProps, Snippet, PipelineStep, ProviderPill } from './types';
|
|
22
24
|
|
|
23
25
|
export const LANDING_PAGE_CONTENT = {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
26
|
+
hero: {
|
|
27
|
+
badge: 'Dynamic & Universal Retrivora AI',
|
|
28
|
+
title: 'The Universal Bridge for Generative AI',
|
|
29
|
+
subtitle: 'Retrivora AI is a vendor-agnostic RAG engine that connects any Document to any LLM and Vector Database in minutes.',
|
|
30
|
+
},
|
|
31
|
+
lifecycle: {
|
|
32
|
+
title: 'The RAG Lifecycle',
|
|
33
|
+
},
|
|
34
|
+
guide: {
|
|
35
|
+
title: 'Interactive Guide',
|
|
36
|
+
subtitle: 'Universal RAG integration for your Next.js applications in minutes.',
|
|
37
|
+
}
|
|
36
38
|
};
|
|
37
39
|
|
|
38
40
|
export const VECTOR_DATABASES: ProviderPill[] = [
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
{ Icon: Zap, label: 'Pinecone' },
|
|
42
|
+
{ Icon: Database, label: 'PostgreSQL' },
|
|
43
|
+
{ Icon: Layers, label: 'MongoDB' },
|
|
44
|
+
{ Icon: Box, label: 'Qdrant' },
|
|
45
|
+
{ Icon: Search, label: 'Milvus' },
|
|
46
|
+
{ Icon: Package, label: 'ChromaDB' },
|
|
47
|
+
{ Icon: Activity, label: 'Redis' },
|
|
48
|
+
{ Icon: Hexagon, label: 'Weaviate' },
|
|
47
49
|
];
|
|
48
50
|
|
|
49
51
|
export const AI_MODELS: ProviderPill[] = [
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
{ Icon: Rabbit, label: 'Ollama' },
|
|
53
|
+
{ Icon: Sparkles, label: 'OpenAI' },
|
|
54
|
+
{ Icon: Bot, label: 'Anthropic' },
|
|
55
|
+
{ Icon: Brain, label: 'Gemini' },
|
|
56
|
+
{ Icon: Cpu, label: 'Groq' },
|
|
57
|
+
{ Icon: Cloud, label: 'Qwen' },
|
|
58
|
+
{ Icon: Code, label: 'Copilot' },
|
|
59
|
+
{ Icon: Terminal, label: 'LiteLLM' },
|
|
56
60
|
];
|
|
57
61
|
|
|
58
62
|
export const PIPELINE_STEPS: PipelineStep[] = [
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
63
|
+
{
|
|
64
|
+
step: '01',
|
|
65
|
+
Icon: FileText,
|
|
66
|
+
title: 'Ingest',
|
|
67
|
+
desc: 'Universal support for PDF, DOCX, CSV, and JSON. Documents are parsed, chunked, and embedded.',
|
|
68
|
+
colors: { from: '#10b981', to: '#14b8a6' },
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
step: '02',
|
|
72
|
+
Icon: Search,
|
|
73
|
+
title: 'Retrieve',
|
|
74
|
+
desc: 'Queries are converted to vectors. Semantic search finds context across any configured Vector DB.',
|
|
75
|
+
colors: { from: '#14b8a6', to: '#06b6d4' },
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
step: '03',
|
|
79
|
+
Icon: Puzzle,
|
|
80
|
+
title: 'Augment',
|
|
81
|
+
desc: 'Retrieved context is injected into the LLM prompt with namespaced project isolation.',
|
|
82
|
+
colors: { from: '#06b6d4', to: '#3b82f6' },
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
step: '04',
|
|
86
|
+
Icon: MessageSquare,
|
|
87
|
+
title: 'Generate',
|
|
88
|
+
desc: 'Providers like OpenAI, Anthropic, or Gemini produce grounded, source-cited responses.',
|
|
89
|
+
colors: { from: '#3b82f6', to: '#6366f1' },
|
|
90
|
+
},
|
|
87
91
|
];
|
|
88
92
|
|
|
89
93
|
export const SNIPPETS: Snippet[] = [
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
{
|
|
95
|
+
id: 'npm-setup',
|
|
96
|
+
title: 'NPM Setup',
|
|
97
|
+
language: 'typescript',
|
|
98
|
+
description: 'How to install and import the client vs server components correctly in your application.',
|
|
99
|
+
code: `// ─── TERMINAL / BASH ───
|
|
100
|
+
// Run this command to install the package in your project:
|
|
101
|
+
// npm install @retrivora-ai/rag-engine
|
|
96
102
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
});
|
|
103
|
+
// ─── SERVER API ROUTER (src/app/api/retrivora/[[...retrivora]]/route.ts) ───
|
|
104
|
+
// Create a single catch-all file to handle all server endpoints dynamically:
|
|
105
|
+
import { createRagHandler } from '@retrivora-ai/rag-engine/handlers';
|
|
106
|
+
|
|
107
|
+
export const { GET, POST } = createRagHandler();
|
|
108
|
+
|
|
109
|
+
// ─── CLIENT WIDGET (src/app/layout.tsx) ───
|
|
110
|
+
// Import the React widget and config context (styles are auto-injected!):
|
|
111
|
+
import { ConfigProvider, ChatWidget } from '@retrivora-ai/rag-engine';`,
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
id: 'pipeline',
|
|
115
|
+
title: 'Pipeline API',
|
|
116
|
+
language: 'typescript',
|
|
117
|
+
description: 'Orchestrate the full RAG flow programmatically with the Pipeline class.',
|
|
118
|
+
code: `import { Pipeline, getRagConfig } from '@retrivora-ai/rag-engine/server';
|
|
119
|
+
|
|
120
|
+
const config = getRagConfig();
|
|
121
|
+
const pipeline = new Pipeline(config);
|
|
117
122
|
|
|
118
|
-
|
|
123
|
+
// Ingest documents
|
|
124
|
+
await pipeline.ingest([{
|
|
119
125
|
docId: 'doc-1',
|
|
120
126
|
content: 'Retrivora AI simplifies RAG...',
|
|
121
127
|
metadata: { source: 'docs' }
|
|
122
128
|
}]);
|
|
123
129
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
// Ask a question
|
|
131
|
+
const { reply, sources } = await pipeline.ask('How does Retrivora work?');`,
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
id: 'handlers',
|
|
135
|
+
title: 'Route Handlers',
|
|
136
|
+
language: 'typescript',
|
|
137
|
+
description: 'Mount pre-built API endpoints. Configuration is automatically read from environment variables, or can be passed explicitly.',
|
|
138
|
+
code: `// ─── OPTION A: ZERO CONFIG (Reads from environment variables) ───
|
|
139
|
+
// src/app/api/chat/route.ts
|
|
140
|
+
import { createStreamHandler } from '@retrivora-ai/rag-engine/handlers';
|
|
141
|
+
export const POST = createStreamHandler();
|
|
133
142
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
embedding: { provider: 'openai', model: 'text-embedding-3-small', apiKey: process.env.OPENAI_API_KEY },
|
|
138
|
-
vectorDatabase: {
|
|
139
|
-
provider: 'pinecone',
|
|
140
|
-
indexName: 'support-docs',
|
|
141
|
-
options: { apiKey: process.env.PINECONE_API_KEY },
|
|
142
|
-
},
|
|
143
|
-
});
|
|
143
|
+
// ─── OPTION B: EXPLICIT CONFIGURATION ───
|
|
144
|
+
// src/app/api/chat/route.ts
|
|
145
|
+
import { createStreamHandler } from '@retrivora-ai/rag-engine/handlers';
|
|
144
146
|
|
|
145
|
-
export const POST = createStreamHandler(
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
export const POST = createStreamHandler({
|
|
148
|
+
vectorDb: {
|
|
149
|
+
provider: 'pinecone',
|
|
150
|
+
apiKey: process.env.CUSTOM_PINECONE_KEY,
|
|
151
|
+
indexName: 'docs-index',
|
|
149
152
|
},
|
|
150
|
-
{
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
153
|
+
llm: {
|
|
154
|
+
provider: 'openai',
|
|
155
|
+
apiKey: process.env.CUSTOM_OPENAI_KEY,
|
|
156
|
+
model: 'gpt-4o',
|
|
157
|
+
}
|
|
158
|
+
});`,
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
id: 'ui',
|
|
162
|
+
title: 'React Components',
|
|
163
|
+
language: 'typescript',
|
|
164
|
+
description: 'Configure and embed themeable UI widgets using the ConfigProvider context.',
|
|
165
|
+
code: `import { ConfigProvider, ChatWidget } from '@retrivora-ai/rag-engine';
|
|
158
166
|
|
|
159
167
|
export default function Layout({ children }) {
|
|
160
168
|
return (
|
|
161
|
-
<ConfigProvider
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
<ConfigProvider config={{
|
|
170
|
+
projectId: 'my-project-id',
|
|
171
|
+
ui: {
|
|
172
|
+
title: 'Retrivora Assistant',
|
|
173
|
+
welcomeMessage: 'Hi! Ask me anything about our software.',
|
|
174
|
+
primaryColor: '#4f46e5', // Custom primary brand color
|
|
175
|
+
accentColor: '#8b5cf6', // Custom accent gradient color
|
|
176
|
+
borderRadius: 'lg', // 'none' | 'sm' | 'md' | 'lg' | 'xl'
|
|
177
|
+
allowUpload: true, // Toggle custom file uploading
|
|
178
|
+
}
|
|
179
|
+
}}>
|
|
171
180
|
{children}
|
|
172
181
|
<ChatWidget position="bottom-right" />
|
|
173
182
|
</ConfigProvider>
|
|
174
183
|
);
|
|
175
184
|
}`,
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
id: 'config',
|
|
188
|
+
title: 'Config Builder',
|
|
189
|
+
language: 'typescript',
|
|
190
|
+
description: 'Fluent, type-safe configuration builder for granular control over providers.',
|
|
191
|
+
code: `import { ConfigBuilder } from '@retrivora-ai/rag-engine/server';
|
|
183
192
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
send(input);
|
|
197
|
-
setInput('');
|
|
198
|
-
}}>
|
|
199
|
-
<input value={input} onChange={(event) => setInput(event.target.value)} />
|
|
200
|
-
<button disabled={isLoading}>Ask</button>
|
|
201
|
-
|
|
202
|
-
{messages.map((message) => (
|
|
203
|
-
<p key={message.id}>{message.content}</p>
|
|
204
|
-
))}
|
|
205
|
-
</form>
|
|
206
|
-
);
|
|
207
|
-
}`,
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
id: 'env',
|
|
211
|
-
title: 'Environment',
|
|
212
|
-
language: 'bash',
|
|
213
|
-
description: 'The exact environment variable structure required for auto-configuration.',
|
|
214
|
-
code: `# Project Identity
|
|
193
|
+
const config = new ConfigBuilder()
|
|
194
|
+
.vectorDb('pinecone', { apiKey: '...', indexName: 'docs' })
|
|
195
|
+
.llm('ollama', 'llama3.2')
|
|
196
|
+
.embedding('ollama', 'nomic-embed-text')
|
|
197
|
+
.build();`,
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
id: 'env',
|
|
201
|
+
title: 'Environment',
|
|
202
|
+
language: 'bash',
|
|
203
|
+
description: 'The exact environment variable structure required for auto-configuration.',
|
|
204
|
+
code: `# Project Identity
|
|
215
205
|
RAG_PROJECT_ID=my-project
|
|
216
206
|
|
|
217
207
|
# Vector DB
|
|
@@ -223,53 +213,58 @@ VECTOR_DB_INDEX=products
|
|
|
223
213
|
LLM_PROVIDER=openai
|
|
224
214
|
LLM_MODEL=gpt-4o
|
|
225
215
|
OPENAI_API_KEY=sk-...`,
|
|
226
|
-
|
|
216
|
+
},
|
|
227
217
|
];
|
|
228
218
|
|
|
229
219
|
export const ARCHITECTURE_CARDS: ArchitectureCardProps[] = [
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
220
|
+
{
|
|
221
|
+
icon: <Database className="text-indigo-600" />,
|
|
222
|
+
title: 'Vector Store',
|
|
223
|
+
description: 'Universal support for Pinecone, PGVector, MongoDB, Milvus, Qdrant, and more.',
|
|
224
|
+
badge: 'Vector DB',
|
|
225
|
+
badgeColor: 'bg-indigo-50 dark:bg-indigo-500/10 text-indigo-600 dark:text-indigo-400 border-indigo-200 dark:border-indigo-500/20',
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
icon: <Zap className="text-amber-500" />,
|
|
229
|
+
title: 'Embeddings',
|
|
230
|
+
description: 'Seamlessly switch between OpenAI, Ollama, or custom embedding providers.',
|
|
231
|
+
badge: 'Models',
|
|
232
|
+
badgeColor: 'bg-amber-50 dark:bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-200 dark:border-amber-500/20',
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
icon: <Bot className="text-emerald-500" />,
|
|
236
|
+
title: 'LLM Orchestration',
|
|
237
|
+
description: 'Optimized inference across OpenAI, Anthropic, Gemini, and local LLMs.',
|
|
238
|
+
badge: 'Inference',
|
|
239
|
+
badgeColor: 'bg-emerald-50 dark:bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-200 dark:border-emerald-500/20',
|
|
240
|
+
},
|
|
251
241
|
];
|
|
252
242
|
|
|
253
243
|
export const QUICK_START_STEPS = [
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
244
|
+
{ id: 'npm-setup', text: 'Install Package & CSS' },
|
|
245
|
+
{ id: 'env', text: 'Configure .env.local' },
|
|
246
|
+
{ id: 'handlers', text: 'Mount API Handlers' },
|
|
247
|
+
{ id: 'ui', text: 'Drop ChatWidget UI' },
|
|
248
|
+
];
|
|
249
|
+
|
|
250
|
+
export const ADVANCED_STEPS = [
|
|
251
|
+
{ id: 'pipeline', text: 'Programmatic SDK' },
|
|
252
|
+
{ id: 'config', text: 'Fluent Config Builder' },
|
|
258
253
|
];
|
|
259
254
|
|
|
260
255
|
export const API_ENDPOINTS = ['chat', 'health', 'ingest', 'upload'];
|
|
261
256
|
|
|
262
257
|
export const CHAT_SUGGESTIONS = [
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
258
|
+
'What can you help me with?',
|
|
259
|
+
'Summarise the key topics',
|
|
260
|
+
'Show me an example'
|
|
266
261
|
];
|
|
267
262
|
|
|
268
263
|
export const BORDER_RADIUS_MAP: Record<string, string> = {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
264
|
+
none: 'rounded-none',
|
|
265
|
+
sm: 'rounded-sm',
|
|
266
|
+
md: 'rounded-md',
|
|
267
|
+
lg: 'rounded-lg',
|
|
268
|
+
xl: 'rounded-xl',
|
|
269
|
+
full: 'rounded-3xl',
|
|
275
270
|
};
|
package/src/app/layout.tsx
CHANGED
|
@@ -1,44 +1,20 @@
|
|
|
1
1
|
import type { Metadata } from 'next';
|
|
2
2
|
import { Inter } from 'next/font/google';
|
|
3
3
|
import './globals.css';
|
|
4
|
-
import { ConfigProvider } from '@/components/ConfigProvider';
|
|
5
|
-
import { ThemeProvider } from '@/components/ThemeProvider';
|
|
6
|
-
import { getRagConfig } from '@/config/serverConfig';
|
|
7
4
|
|
|
8
5
|
const inter = Inter({ subsets: ['latin'], variable: '--font-inter' });
|
|
9
6
|
|
|
10
|
-
// Build server-side config once — same singleton source as route handlers.
|
|
11
|
-
const ragConfig = getRagConfig();
|
|
12
|
-
|
|
13
7
|
export const metadata: Metadata = {
|
|
14
|
-
title:
|
|
8
|
+
title: 'Retrivora AI — Plug-and-Play RAG Engine',
|
|
15
9
|
description:
|
|
16
|
-
|
|
17
|
-
'A configurable Retrieval-Augmented Generation chatbot — generic across any vector database and LLM provider.',
|
|
10
|
+
'Retrivora AI is the easiest way to add a production-grade RAG chatbot to any React or Next.js application. Plug in your LLM, your vector database, and ship.',
|
|
18
11
|
};
|
|
19
12
|
|
|
20
13
|
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
21
14
|
return (
|
|
22
15
|
<html lang="en" className={inter.variable} suppressHydrationWarning>
|
|
23
|
-
<body className="bg-slate-50 text-slate-900 antialiased
|
|
24
|
-
|
|
25
|
-
<ConfigProvider
|
|
26
|
-
config={{
|
|
27
|
-
projectId: ragConfig.projectId,
|
|
28
|
-
ui: ragConfig.ui,
|
|
29
|
-
// Pass embedding model/dimensions so client-side components
|
|
30
|
-
// (e.g. DocumentUpload) know the vector dimensions in use.
|
|
31
|
-
embedding: ragConfig.embedding
|
|
32
|
-
? {
|
|
33
|
-
model: ragConfig.embedding.model,
|
|
34
|
-
dimensions: ragConfig.embedding.dimensions,
|
|
35
|
-
}
|
|
36
|
-
: undefined,
|
|
37
|
-
}}
|
|
38
|
-
>
|
|
39
|
-
{children}
|
|
40
|
-
</ConfigProvider>
|
|
41
|
-
</ThemeProvider>
|
|
16
|
+
<body className="bg-slate-50 text-slate-900 antialiased" suppressHydrationWarning>
|
|
17
|
+
{children}
|
|
42
18
|
</body>
|
|
43
19
|
</html>
|
|
44
20
|
);
|
package/src/app/types.ts
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
export interface ArchitectureCardProps {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
icon: React.ReactNode;
|
|
5
|
+
title: string;
|
|
6
|
+
description: string;
|
|
7
|
+
badge: string;
|
|
8
|
+
badgeColor: string;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export interface Snippet {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
id: string;
|
|
13
|
+
title: string;
|
|
14
|
+
description: string;
|
|
15
|
+
code: string;
|
|
16
|
+
language: string;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export interface PipelineStep {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
step: string;
|
|
21
|
+
Icon: React.ElementType;
|
|
22
|
+
title: string;
|
|
23
|
+
desc: string;
|
|
24
|
+
colors: { from: string; to: string };
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export interface ProviderPill {
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
Icon: React.ElementType;
|
|
29
|
+
label: string;
|
|
30
30
|
}
|