@retrivora-ai/rag-engine 1.9.3 → 1.9.7

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 (69) hide show
  1. package/README.md +59 -7
  2. package/dist/{ILLMProvider-Bw2A28nU.d.mts → ILLMProvider-Bhk6zJOK.d.mts} +43 -7
  3. package/dist/{ILLMProvider-Bw2A28nU.d.ts → ILLMProvider-Bhk6zJOK.d.ts} +43 -7
  4. package/dist/handlers/index.d.mts +2 -2
  5. package/dist/handlers/index.d.ts +2 -2
  6. package/dist/handlers/index.js +737 -237
  7. package/dist/handlers/index.mjs +736 -237
  8. package/dist/index-B9J_XEh0.d.ts +187 -0
  9. package/dist/index-BJ4cd-t5.d.mts +187 -0
  10. package/dist/{index-B70ZLkfG.d.mts → index-Bu7T6xgr.d.ts} +20 -3
  11. package/dist/{index-DVu-mkAM.d.ts → index-C3SVtPYg.d.mts} +20 -3
  12. package/dist/index.css +237 -10
  13. package/dist/index.d.mts +13 -5
  14. package/dist/index.d.ts +13 -5
  15. package/dist/index.js +365 -164
  16. package/dist/index.mjs +350 -158
  17. package/dist/server.d.mts +15 -94
  18. package/dist/server.d.ts +15 -94
  19. package/dist/server.js +850 -239
  20. package/dist/server.mjs +839 -238
  21. package/package.json +2 -4
  22. package/src/app/api/chat/route.ts +2 -2
  23. package/src/app/api/health/route.ts +3 -2
  24. package/src/app/api/ingest/route.ts +3 -2
  25. package/src/app/api/suggestions/route.ts +3 -2
  26. package/src/app/api/upload/route.ts +3 -2
  27. package/src/app/constants.tsx +168 -148
  28. package/src/app/layout.tsx +5 -18
  29. package/src/app/types.ts +17 -17
  30. package/src/components/ChatWidget.tsx +3 -1
  31. package/src/components/ChatWindow.tsx +5 -1
  32. package/src/components/DocViewer.tsx +71 -5
  33. package/src/components/Documentation.tsx +74 -11
  34. package/src/components/MessageBubble.tsx +39 -2
  35. package/src/components/ThinkingBlock.tsx +75 -0
  36. package/src/components/VisualizationRenderer.tsx +27 -1
  37. package/src/components/constants.tsx +275 -0
  38. package/src/config/RagConfig.ts +47 -0
  39. package/src/config/constants.ts +1 -0
  40. package/src/config/serverConfig.ts +25 -0
  41. package/src/core/ConfigResolver.ts +73 -22
  42. package/src/core/ConfigValidator.ts +2 -1
  43. package/src/core/Pipeline.ts +226 -68
  44. package/src/core/ProviderRegistry.ts +16 -7
  45. package/src/core/QueryProcessor.ts +38 -4
  46. package/src/core/Retrivora.ts +91 -0
  47. package/src/core/VectorPlugin.ts +62 -8
  48. package/src/exceptions/index.ts +111 -0
  49. package/src/handlers/index.ts +73 -0
  50. package/src/hooks/useRagChat.ts +30 -5
  51. package/src/index.ts +27 -1
  52. package/src/lib/plugin.ts +24 -0
  53. package/src/llm/LLMFactory.ts +8 -4
  54. package/src/llm/providers/AnthropicProvider.ts +70 -20
  55. package/src/llm/providers/GeminiProvider.ts +14 -15
  56. package/src/llm/providers/OllamaProvider.ts +13 -16
  57. package/src/llm/providers/OpenAIProvider.ts +9 -14
  58. package/src/llm/providers/UniversalLLMAdapter.ts +5 -5
  59. package/src/llm/utils.ts +46 -0
  60. package/src/providers/vectordb/MongoDBProvider.ts +9 -4
  61. package/src/providers/vectordb/MultiTablePostgresProvider.ts +45 -13
  62. package/src/rag/EntityExtractor.ts +2 -2
  63. package/src/rag/Reranker.ts +9 -16
  64. package/src/server.ts +30 -1
  65. package/src/types/chat.ts +9 -0
  66. package/src/types/props.ts +38 -1
  67. package/src/utils/UITransformer.ts +73 -4
  68. package/dist/DocumentChunker-Dh9TvmGG.d.mts +0 -45
  69. package/dist/DocumentChunker-Dh9TvmGG.d.ts +0 -45
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@retrivora-ai/rag-engine",
3
- "version": "1.9.3",
3
+ "version": "1.9.7",
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",
@@ -74,7 +74,7 @@
74
74
  "scripts": {
75
75
  "dev": "next dev",
76
76
  "build": "next 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,./index.css && npx @tailwindcss/cli -i src/tailwind.css -o dist/index.css",
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",
78
78
  "start": "next start",
79
79
  "lint": "eslint",
80
80
  "prepublishOnly": "npm run build:pkg"
@@ -95,8 +95,6 @@
95
95
  "next-themes": "^0.4.6",
96
96
  "openai": "^6.34.0",
97
97
  "papaparse": "^5.5.3",
98
- "react": ">=18.0.0",
99
- "react-dom": ">=18.0.0",
100
98
  "react-is": "^18.3.1",
101
99
  "react-markdown": "^10.1.0",
102
100
  "recharts": "^3.8.1",
@@ -1,4 +1,4 @@
1
1
  import { createStreamHandler } from '@/handlers';
2
- import { getRagConfig } from '@/config/serverConfig';
2
+ import { plugin } from '@/lib/plugin';
3
3
 
4
- export const POST = createStreamHandler(getRagConfig());
4
+ export const POST = createStreamHandler(plugin);
@@ -1,4 +1,5 @@
1
1
  import { createHealthHandler } from '@/handlers';
2
- import { getRagConfig } from '@/config/serverConfig';
2
+ import { plugin } from '@/lib/plugin';
3
+
4
+ export const GET = createHealthHandler(plugin);
3
5
 
4
- export const GET = createHealthHandler(getRagConfig());
@@ -21,6 +21,7 @@
21
21
  */
22
22
 
23
23
  import { createIngestHandler } from '@/handlers';
24
- import { getRagConfig } from '@/config/serverConfig';
24
+ import { plugin } from '@/lib/plugin';
25
+
26
+ export const POST = createIngestHandler(plugin);
25
27
 
26
- export const POST = createIngestHandler(getRagConfig());
@@ -1,4 +1,5 @@
1
1
  import { createSuggestionsHandler } from '@/handlers';
2
- import { getRagConfig } from '@/config/serverConfig';
2
+ import { plugin } from '@/lib/plugin';
3
+
4
+ export const POST = createSuggestionsHandler(plugin);
3
5
 
4
- export const POST = createSuggestionsHandler(getRagConfig());
@@ -1,4 +1,5 @@
1
1
  import { createUploadHandler } from '@/handlers';
2
- import { getRagConfig } from '@/config/serverConfig';
2
+ import { plugin } from '@/lib/plugin';
3
+
4
+ export const POST = createUploadHandler(plugin);
3
5
 
4
- export const POST = createUploadHandler(getRagConfig());
@@ -1,98 +1,117 @@
1
1
  import React from 'react';
2
2
  import {
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,
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
20
  } from 'lucide-react';
21
21
  import { ArchitectureCardProps, Snippet, PipelineStep, ProviderPill } from './types';
22
22
 
23
23
  export const LANDING_PAGE_CONTENT = {
24
- hero: {
25
- badge: 'Dynamic & Universal Retrivora AI',
26
- title: 'The Universal Bridge for Generative AI',
27
- subtitle: 'Retrivora AI is a vendor-agnostic RAG engine that connects any Document to any LLM and Vector Database in minutes.',
28
- },
29
- lifecycle: {
30
- title: 'The RAG Lifecycle',
31
- },
32
- guide: {
33
- title: 'Interactive Guide',
34
- subtitle: 'Universal RAG integration for your Next.js applications in minutes.',
35
- }
24
+ hero: {
25
+ badge: 'Dynamic & Universal Retrivora AI',
26
+ title: 'The Universal Bridge for Generative AI',
27
+ subtitle: 'Retrivora AI is a vendor-agnostic RAG engine that connects any Document to any LLM and Vector Database in minutes.',
28
+ },
29
+ lifecycle: {
30
+ title: 'The RAG Lifecycle',
31
+ },
32
+ guide: {
33
+ title: 'Interactive Guide',
34
+ subtitle: 'Universal RAG integration for your Next.js applications in minutes.',
35
+ }
36
36
  };
37
37
 
38
38
  export const VECTOR_DATABASES: ProviderPill[] = [
39
- { Icon: Zap, label: 'Pinecone' },
40
- { Icon: Database, label: 'PostgreSQL' },
41
- { Icon: Layers, label: 'MongoDB' },
42
- { Icon: Box, label: 'Qdrant' },
43
- { Icon: Search, label: 'Milvus' },
44
- { Icon: Package, label: 'ChromaDB' },
45
- { Icon: Activity, label: 'Redis' },
46
- { Icon: Hexagon, label: 'Weaviate' },
39
+ { Icon: Zap, label: 'Pinecone' },
40
+ { Icon: Database, label: 'PostgreSQL' },
41
+ { Icon: Layers, label: 'MongoDB' },
42
+ { Icon: Box, label: 'Qdrant' },
43
+ { Icon: Search, label: 'Milvus' },
44
+ { Icon: Package, label: 'ChromaDB' },
45
+ { Icon: Activity, label: 'Redis' },
46
+ { Icon: Hexagon, label: 'Weaviate' },
47
47
  ];
48
48
 
49
49
  export const AI_MODELS: ProviderPill[] = [
50
- { Icon: Rabbit, label: 'Ollama' },
51
- { Icon: Sparkles, label: 'OpenAI' },
52
- { Icon: Bot, label: 'Anthropic' },
53
- { Icon: Brain, label: 'Gemini' },
54
- { Icon: Code, label: 'Copilot' },
55
- { Icon: Terminal, label: 'LiteLLM' },
50
+ { Icon: Rabbit, label: 'Ollama' },
51
+ { Icon: Sparkles, label: 'OpenAI' },
52
+ { Icon: Bot, label: 'Anthropic' },
53
+ { Icon: Brain, label: 'Gemini' },
54
+ { Icon: Code, label: 'Copilot' },
55
+ { Icon: Terminal, label: 'LiteLLM' },
56
56
  ];
57
57
 
58
58
  export const PIPELINE_STEPS: PipelineStep[] = [
59
- {
60
- step: '01',
61
- Icon: FileText,
62
- title: 'Ingest',
63
- desc: 'Universal support for PDF, DOCX, CSV, and JSON. Documents are parsed, chunked, and embedded.',
64
- colors: { from: '#10b981', to: '#14b8a6' },
65
- },
66
- {
67
- step: '02',
68
- Icon: Search,
69
- title: 'Retrieve',
70
- desc: 'Queries are converted to vectors. Semantic search finds context across any configured Vector DB.',
71
- colors: { from: '#14b8a6', to: '#06b6d4' },
72
- },
73
- {
74
- step: '03',
75
- Icon: Puzzle,
76
- title: 'Augment',
77
- desc: 'Retrieved context is injected into the LLM prompt with namespaced project isolation.',
78
- colors: { from: '#06b6d4', to: '#3b82f6' },
79
- },
80
- {
81
- step: '04',
82
- Icon: MessageSquare,
83
- title: 'Generate',
84
- desc: 'Providers like OpenAI, Anthropic, or Gemini produce grounded, source-cited responses.',
85
- colors: { from: '#3b82f6', to: '#6366f1' },
86
- },
59
+ {
60
+ step: '01',
61
+ Icon: FileText,
62
+ title: 'Ingest',
63
+ desc: 'Universal support for PDF, DOCX, CSV, and JSON. Documents are parsed, chunked, and embedded.',
64
+ colors: { from: '#10b981', to: '#14b8a6' },
65
+ },
66
+ {
67
+ step: '02',
68
+ Icon: Search,
69
+ title: 'Retrieve',
70
+ desc: 'Queries are converted to vectors. Semantic search finds context across any configured Vector DB.',
71
+ colors: { from: '#14b8a6', to: '#06b6d4' },
72
+ },
73
+ {
74
+ step: '03',
75
+ Icon: Puzzle,
76
+ title: 'Augment',
77
+ desc: 'Retrieved context is injected into the LLM prompt with namespaced project isolation.',
78
+ colors: { from: '#06b6d4', to: '#3b82f6' },
79
+ },
80
+ {
81
+ step: '04',
82
+ Icon: MessageSquare,
83
+ title: 'Generate',
84
+ desc: 'Providers like OpenAI, Anthropic, or Gemini produce grounded, source-cited responses.',
85
+ colors: { from: '#3b82f6', to: '#6366f1' },
86
+ },
87
87
  ];
88
88
 
89
89
  export const SNIPPETS: Snippet[] = [
90
- {
91
- id: 'pipeline',
92
- title: 'Pipeline API',
93
- language: 'typescript',
94
- description: 'Orchestrate the full RAG flow programmatically with the Pipeline class.',
95
- code: `import { Pipeline, getRagConfig } from '@retrivora-ai/rag-engine/server';
90
+ {
91
+ id: 'npm-setup',
92
+ title: 'NPM Setup',
93
+ language: 'typescript',
94
+ description: 'How to install and import the client vs server components correctly in your application.',
95
+ code: `// ─── TERMINAL / BASH ───
96
+ // Run this command to install the package in your project:
97
+ // npm install @retrivora-ai/rag-engine
98
+
99
+ // ─── SERVER API ROUTER (src/app/api/retrivora/[[...retrivora]]/route.ts) ───
100
+ // Create a single catch-all file to handle all server endpoints dynamically:
101
+ import { createRagHandler } from '@retrivora-ai/rag-engine/handlers';
102
+
103
+ export const { GET, POST } = createRagHandler();
104
+
105
+ // ─── CLIENT WIDGET (src/app/layout.tsx) ───
106
+ // Import the React widget and config context (styles are auto-injected!):
107
+ import { ConfigProvider, ChatWidget } from '@retrivora-ai/rag-engine';`,
108
+ },
109
+ {
110
+ id: 'pipeline',
111
+ title: 'Pipeline API',
112
+ language: 'typescript',
113
+ description: 'Orchestrate the full RAG flow programmatically with the Pipeline class.',
114
+ code: `import { Pipeline, getRagConfig } from '@retrivora-ai/rag-engine/server';
96
115
 
97
116
  const config = getRagConfig();
98
117
  const pipeline = new Pipeline(config);
@@ -106,28 +125,24 @@ await pipeline.ingest([{
106
125
 
107
126
  // Ask a question
108
127
  const { reply, sources } = await pipeline.ask('How does Retrivora work?');`,
109
- },
110
- {
111
- id: 'handlers',
112
- title: 'Route Handlers',
113
- language: 'typescript',
114
- description: 'Deploy production-ready API endpoints in seconds using pre-built factories.',
115
- code: `import { createChatStreamHandler, createUploadHandler, getRagConfig } from '@retrivora-ai/rag-engine/server';
116
-
117
- const config = getRagConfig();
118
-
119
- // src/app/api/chat/route.ts
120
- export const POST = createChatStreamHandler(config);
121
-
122
- // src/app/api/upload/route.ts
123
- export const POST = createUploadHandler(config);`,
124
- },
125
- {
126
- id: 'ui',
127
- title: 'React Components',
128
- language: 'typescript',
129
- description: 'Embed beautiful, themeable AI interfaces with headless logic or pre-built widgets.',
130
- code: `import { ConfigProvider, ChatWidget } from '@retrivora-ai/rag-engine';
128
+ },
129
+ {
130
+ id: 'handlers',
131
+ title: 'Route Handlers',
132
+ language: 'typescript',
133
+ description: 'Deploy production-ready API endpoints in seconds using pre-built factories.',
134
+ code: `// src/app/api/retrivora/[[...retrivora]]/route.ts
135
+ import { createRagHandler } from '@retrivora-ai/rag-engine/handlers';
136
+
137
+ // Single catch-all handler for GET /health and POST /chat, upload, suggestions
138
+ export const { GET, POST } = createRagHandler();`,
139
+ },
140
+ {
141
+ id: 'ui',
142
+ title: 'React Components',
143
+ language: 'typescript',
144
+ description: 'Embed beautiful, themeable AI interfaces with headless logic or pre-built widgets.',
145
+ code: `import { ConfigProvider, ChatWidget } from '@retrivora-ai/rag-engine';
131
146
 
132
147
  export default function Layout({ children }) {
133
148
  return (
@@ -137,26 +152,26 @@ export default function Layout({ children }) {
137
152
  </ConfigProvider>
138
153
  );
139
154
  }`,
140
- },
141
- {
142
- id: 'config',
143
- title: 'Config Builder',
144
- language: 'typescript',
145
- description: 'Fluent, type-safe configuration builder for granular control over providers.',
146
- code: `import { ConfigBuilder } from '@retrivora-ai/rag-engine/server';
155
+ },
156
+ {
157
+ id: 'config',
158
+ title: 'Config Builder',
159
+ language: 'typescript',
160
+ description: 'Fluent, type-safe configuration builder for granular control over providers.',
161
+ code: `import { ConfigBuilder } from '@retrivora-ai/rag-engine/server';
147
162
 
148
163
  const config = new ConfigBuilder()
149
164
  .vectorDb('pinecone', { apiKey: '...', indexName: 'docs' })
150
165
  .llm('ollama', 'llama3.2')
151
166
  .embedding('ollama', 'nomic-embed-text')
152
167
  .build();`,
153
- },
154
- {
155
- id: 'env',
156
- title: 'Environment',
157
- language: 'bash',
158
- description: 'The exact environment variable structure required for auto-configuration.',
159
- code: `# Project Identity
168
+ },
169
+ {
170
+ id: 'env',
171
+ title: 'Environment',
172
+ language: 'bash',
173
+ description: 'The exact environment variable structure required for auto-configuration.',
174
+ code: `# Project Identity
160
175
  RAG_PROJECT_ID=my-project
161
176
 
162
177
  # Vector DB
@@ -168,53 +183,58 @@ VECTOR_DB_INDEX=products
168
183
  LLM_PROVIDER=openai
169
184
  LLM_MODEL=gpt-4o
170
185
  OPENAI_API_KEY=sk-...`,
171
- },
186
+ },
172
187
  ];
173
188
 
174
189
  export const ARCHITECTURE_CARDS: ArchitectureCardProps[] = [
175
- {
176
- icon: <Database className="text-indigo-600" />,
177
- title: 'Vector Store',
178
- description: 'Universal support for Pinecone, PGVector, MongoDB, Milvus, Qdrant, and more.',
179
- badge: 'Vector DB',
180
- badgeColor: 'bg-indigo-50 dark:bg-indigo-500/10 text-indigo-600 dark:text-indigo-400 border-indigo-200 dark:border-indigo-500/20',
181
- },
182
- {
183
- icon: <Zap className="text-amber-500" />,
184
- title: 'Embeddings',
185
- description: 'Seamlessly switch between OpenAI, Ollama, or custom embedding providers.',
186
- badge: 'Models',
187
- badgeColor: 'bg-amber-50 dark:bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-200 dark:border-amber-500/20',
188
- },
189
- {
190
- icon: <Bot className="text-emerald-500" />,
191
- title: 'LLM Orchestration',
192
- description: 'Optimized inference across OpenAI, Anthropic, Gemini, and local LLMs.',
193
- badge: 'Inference',
194
- badgeColor: 'bg-emerald-50 dark:bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-200 dark:border-emerald-500/20',
195
- },
190
+ {
191
+ icon: <Database className="text-indigo-600" />,
192
+ title: 'Vector Store',
193
+ description: 'Universal support for Pinecone, PGVector, MongoDB, Milvus, Qdrant, and more.',
194
+ badge: 'Vector DB',
195
+ badgeColor: 'bg-indigo-50 dark:bg-indigo-500/10 text-indigo-600 dark:text-indigo-400 border-indigo-200 dark:border-indigo-500/20',
196
+ },
197
+ {
198
+ icon: <Zap className="text-amber-500" />,
199
+ title: 'Embeddings',
200
+ description: 'Seamlessly switch between OpenAI, Ollama, or custom embedding providers.',
201
+ badge: 'Models',
202
+ badgeColor: 'bg-amber-50 dark:bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-200 dark:border-amber-500/20',
203
+ },
204
+ {
205
+ icon: <Bot className="text-emerald-500" />,
206
+ title: 'LLM Orchestration',
207
+ description: 'Optimized inference across OpenAI, Anthropic, Gemini, and local LLMs.',
208
+ badge: 'Inference',
209
+ badgeColor: 'bg-emerald-50 dark:bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-200 dark:border-emerald-500/20',
210
+ },
196
211
  ];
197
212
 
198
213
  export const QUICK_START_STEPS = [
199
- 'Install @retrivora-ai/rag-engine',
200
- 'Configure your .env.local',
201
- 'Mount the API handlers',
202
- 'Drop the ChatWidget'
214
+ { id: 'npm-setup', text: 'Install Package & CSS' },
215
+ { id: 'env', text: 'Configure .env.local' },
216
+ { id: 'handlers', text: 'Mount API Handlers' },
217
+ { id: 'ui', text: 'Drop ChatWidget UI' },
218
+ ];
219
+
220
+ export const ADVANCED_STEPS = [
221
+ { id: 'pipeline', text: 'Programmatic SDK' },
222
+ { id: 'config', text: 'Fluent Config Builder' },
203
223
  ];
204
224
 
205
225
  export const API_ENDPOINTS = ['chat', 'health', 'ingest', 'upload'];
206
226
 
207
227
  export const CHAT_SUGGESTIONS = [
208
- 'What can you help me with?',
209
- 'Summarise the key topics',
210
- 'Show me an example'
228
+ 'What can you help me with?',
229
+ 'Summarise the key topics',
230
+ 'Show me an example'
211
231
  ];
212
232
 
213
233
  export const BORDER_RADIUS_MAP: Record<string, string> = {
214
- none: 'rounded-none',
215
- sm: 'rounded-sm',
216
- md: 'rounded-md',
217
- lg: 'rounded-lg',
218
- xl: 'rounded-xl',
219
- full: 'rounded-3xl',
234
+ none: 'rounded-none',
235
+ sm: 'rounded-sm',
236
+ md: 'rounded-md',
237
+ lg: 'rounded-lg',
238
+ xl: 'rounded-xl',
239
+ full: 'rounded-3xl',
220
240
  };
@@ -1,35 +1,22 @@
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
7
  export const metadata: Metadata = {
11
- title: 'Retrivora AI',
8
+ title: 'Retrivora AI — Plug-and-Play RAG Engine',
12
9
  description:
13
- '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.',
14
11
  };
15
12
 
16
13
  export default function RootLayout({ children }: { children: React.ReactNode }) {
17
- const clientConfig = getRagConfig();
18
-
19
14
  return (
20
15
  <html lang="en" className={inter.variable} suppressHydrationWarning>
21
- <body className="bg-slate-50 dark:bg-[#080811] text-slate-900 dark:text-white antialiased transition-colors duration-300" suppressHydrationWarning>
22
- <ThemeProvider attribute="class" defaultTheme="dark" enableSystem disableTransitionOnChange>
23
- <ConfigProvider
24
- config={{
25
- projectId: clientConfig.projectId,
26
- ui: clientConfig.ui,
27
- }}
28
- >
29
- {children}
30
- </ConfigProvider>
31
- </ThemeProvider>
16
+ <body className="bg-slate-50 text-slate-900 antialiased" suppressHydrationWarning>
17
+ {children}
32
18
  </body>
33
19
  </html>
34
20
  );
35
21
  }
22
+
package/src/app/types.ts CHANGED
@@ -1,30 +1,30 @@
1
1
  import React from 'react';
2
2
 
3
3
  export interface ArchitectureCardProps {
4
- icon: React.ReactNode;
5
- title: string;
6
- description: string;
7
- badge: string;
8
- badgeColor: string;
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
- id: string;
13
- title: string;
14
- description: string;
15
- code: string;
16
- language: string;
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
- step: string;
21
- Icon: React.ElementType;
22
- title: string;
23
- desc: string;
24
- colors: { from: string; to: string };
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
- Icon: React.ElementType;
29
- label: string;
28
+ Icon: React.ElementType;
29
+ label: string;
30
30
  }
@@ -46,7 +46,7 @@ const GEMINI_STYLES = `
46
46
  }
47
47
  `;
48
48
 
49
- export function ChatWidget({ position = 'bottom-right', onAddToCart }: ChatWidgetProps) {
49
+ export function ChatWidget({ position = 'bottom-right', onAddToCart, apiUrl, headers }: ChatWidgetProps) {
50
50
  const { ui } = useConfig();
51
51
  const [isOpen, setIsOpen] = useState(false);
52
52
  const [hasUnread, setHasUnread] = useState(false);
@@ -146,6 +146,8 @@ export function ChatWidget({ position = 'bottom-right', onAddToCart }: ChatWidge
146
146
  onMaximize={ui.allowResize !== false ? handleMaximize : undefined}
147
147
  isMaximized={isMaximized}
148
148
  onAddToCart={onAddToCart}
149
+ apiUrl={apiUrl}
150
+ headers={headers}
149
151
  />
150
152
  {/* Pointer (Tail) */}
151
153
  <div
@@ -62,7 +62,9 @@ export function ChatWindow({
62
62
  isResized = false,
63
63
  onMaximize,
64
64
  isMaximized = false,
65
- onAddToCart
65
+ onAddToCart,
66
+ apiUrl,
67
+ headers
66
68
  }: ChatWindowProps) {
67
69
  const { ui, projectId } = useConfig();
68
70
  const [input, setInput] = useState('');
@@ -73,6 +75,8 @@ export function ChatWindow({
73
75
  const inputRef = useRef<HTMLTextAreaElement>(null);
74
76
  const { messages, send, clear, isLoading, error, stop } = useRagChat(projectId, {
75
77
  namespace: projectId,
78
+ apiUrl,
79
+ headers,
76
80
  });
77
81
 
78
82
  const [suggestions, setSuggestions] = useState<string[]>([]);