@retrivora-ai/rag-engine 1.9.6 → 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 (44) hide show
  1. package/README.md +32 -7
  2. package/dist/{ILLMProvider-DNhyOYoK.d.mts → ILLMProvider-Bhk6zJOK.d.mts} +2 -6
  3. package/dist/{ILLMProvider-DNhyOYoK.d.ts → ILLMProvider-Bhk6zJOK.d.ts} +2 -6
  4. package/dist/handlers/index.d.mts +2 -2
  5. package/dist/handlers/index.d.ts +2 -2
  6. package/dist/handlers/index.js +213 -67
  7. package/dist/handlers/index.mjs +212 -67
  8. package/dist/{index-CjQdL0cX.d.ts → index-B9J_XEh0.d.ts} +6 -2
  9. package/dist/{index-C9v7-tWd.d.mts → index-BJ4cd-t5.d.mts} +6 -2
  10. package/dist/{index-Hgbwl9X4.d.ts → index-Bu7T6xgr.d.ts} +20 -3
  11. package/dist/{index-CHL1jdYm.d.mts → index-C3SVtPYg.d.mts} +20 -3
  12. package/dist/index.css +197 -10
  13. package/dist/index.d.mts +13 -5
  14. package/dist/index.d.ts +13 -5
  15. package/dist/index.js +39 -6
  16. package/dist/index.mjs +38 -7
  17. package/dist/server.d.mts +5 -5
  18. package/dist/server.d.ts +5 -5
  19. package/dist/server.js +310 -113
  20. package/dist/server.mjs +307 -112
  21. package/package.json +2 -4
  22. package/src/app/constants.tsx +183 -218
  23. package/src/app/layout.tsx +4 -28
  24. package/src/app/types.ts +17 -17
  25. package/src/components/ChatWidget.tsx +3 -1
  26. package/src/components/ChatWindow.tsx +5 -1
  27. package/src/components/DocViewer.tsx +71 -5
  28. package/src/components/Documentation.tsx +74 -11
  29. package/src/components/constants.tsx +275 -0
  30. package/src/config/RagConfig.ts +10 -10
  31. package/src/config/constants.ts +1 -0
  32. package/src/core/ConfigResolver.ts +24 -25
  33. package/src/core/Pipeline.ts +2 -1
  34. package/src/core/ProviderRegistry.ts +5 -5
  35. package/src/core/Retrivora.ts +46 -6
  36. package/src/core/VectorPlugin.ts +62 -8
  37. package/src/exceptions/index.ts +52 -0
  38. package/src/handlers/index.ts +71 -0
  39. package/src/hooks/useRagChat.ts +4 -1
  40. package/src/index.ts +2 -0
  41. package/src/llm/LLMFactory.ts +6 -5
  42. package/src/server.ts +16 -13
  43. package/src/types/chat.ts +2 -0
  44. package/src/types/props.ts +38 -1
@@ -1,217 +1,177 @@
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: 'Retrivora SDK',
93
- language: 'typescript',
94
- description: 'Create one server-side SDK instance from config; clients never know which providers are used.',
95
- code: `import { Retrivora } from '@retrivora-ai/rag-engine/server';
96
-
97
- const ai = new Retrivora({
98
- projectId: 'support-app',
99
- llm: {
100
- provider: 'openai',
101
- model: 'gpt-5',
102
- apiKey: process.env.OPENAI_API_KEY,
103
- },
104
- embedding: {
105
- provider: 'openai',
106
- model: 'text-embedding-3-small',
107
- apiKey: process.env.OPENAI_API_KEY,
108
- },
109
- vectorDatabase: {
110
- provider: 'pinecone',
111
- indexName: 'support-docs',
112
- options: { apiKey: process.env.PINECONE_API_KEY },
113
- },
114
- retrieval: { strategy: 'hybrid', topK: 5 },
115
- workflow: { type: 'agentic-rag' },
116
- });
117
-
118
- await ai.ingest([{
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';
115
+
116
+ const config = getRagConfig();
117
+ const pipeline = new Pipeline(config);
118
+
119
+ // Ingest documents
120
+ await pipeline.ingest([{
119
121
  docId: 'doc-1',
120
122
  content: 'Retrivora AI simplifies RAG...',
121
123
  metadata: { source: 'docs' }
122
124
  }]);
123
125
 
124
- const { reply, sources } = await ai.ask('How does Retrivora work?');`,
125
- },
126
- {
127
- id: 'handlers',
128
- title: 'Next.js Routes',
129
- language: 'typescript',
130
- description: 'Keep secrets and provider code in App Router handlers, then expose simple API endpoints to React.',
131
- code: `// app/api/chat/route.ts
132
- import { Retrivora, createStreamHandler } from '@retrivora-ai/rag-engine/server';
133
-
134
- const ai = new Retrivora({
135
- projectId: 'support-app',
136
- llm: { provider: 'openai', model: 'gpt-5', apiKey: process.env.OPENAI_API_KEY },
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
- });
144
-
145
- export const POST = createStreamHandler(ai.config);
146
-
147
- // app/api/upload/route.ts
148
- // export const POST = createUploadHandler(ai.config);`,
149
- },
150
- {
151
- id: 'ui',
152
- title: 'React Client UI',
153
- language: 'typescript',
154
- description: 'Import browser-safe components in Client Components; API keys stay on the server.',
155
- code: `'use client';
156
-
157
- import { ConfigProvider, ChatWidget } from '@retrivora-ai/rag-engine';
126
+ // Ask a question
127
+ const { reply, sources } = await pipeline.ask('How does Retrivora work?');`,
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';
158
146
 
159
147
  export default function Layout({ children }) {
160
148
  return (
161
- <ConfigProvider
162
- config={{
163
- projectId: 'support-app',
164
- ui: {
165
- title: 'AI Assistant',
166
- showSources: true,
167
- allowUpload: true,
168
- },
169
- }}
170
- >
149
+ <ConfigProvider config={{ projectId: 'demo' }}>
171
150
  {children}
172
151
  <ChatWidget position="bottom-right" />
173
152
  </ConfigProvider>
174
153
  );
175
154
  }`,
176
- },
177
- {
178
- id: 'config',
179
- title: 'Headless Hook',
180
- language: 'typescript',
181
- description: 'Build your own chat surface with the same server-backed route.',
182
- code: `'use client';
183
-
184
- import React from 'react';
185
- import { useRagChat } from '@retrivora-ai/rag-engine';
186
-
187
- export function AskBox() {
188
- const [input, setInput] = React.useState('');
189
- const { messages, send, isLoading } = useRagChat('support-app', {
190
- apiUrl: '/api/chat',
191
- });
192
-
193
- return (
194
- <form onSubmit={(event) => {
195
- event.preventDefault();
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
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';
162
+
163
+ const config = new ConfigBuilder()
164
+ .vectorDb('pinecone', { apiKey: '...', indexName: 'docs' })
165
+ .llm('ollama', 'llama3.2')
166
+ .embedding('ollama', 'nomic-embed-text')
167
+ .build();`,
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
215
175
  RAG_PROJECT_ID=my-project
216
176
 
217
177
  # Vector DB
@@ -223,53 +183,58 @@ VECTOR_DB_INDEX=products
223
183
  LLM_PROVIDER=openai
224
184
  LLM_MODEL=gpt-4o
225
185
  OPENAI_API_KEY=sk-...`,
226
- },
186
+ },
227
187
  ];
228
188
 
229
189
  export const ARCHITECTURE_CARDS: ArchitectureCardProps[] = [
230
- {
231
- icon: <Database className="text-indigo-600" />,
232
- title: 'Vector Store',
233
- description: 'Universal support for Pinecone, PGVector, MongoDB, Milvus, Qdrant, and more.',
234
- badge: 'Vector DB',
235
- badgeColor: 'bg-indigo-50 dark:bg-indigo-500/10 text-indigo-600 dark:text-indigo-400 border-indigo-200 dark:border-indigo-500/20',
236
- },
237
- {
238
- icon: <Zap className="text-amber-500" />,
239
- title: 'Embeddings',
240
- description: 'Seamlessly switch between OpenAI, Ollama, or custom embedding providers.',
241
- badge: 'Models',
242
- badgeColor: 'bg-amber-50 dark:bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-200 dark:border-amber-500/20',
243
- },
244
- {
245
- icon: <Bot className="text-emerald-500" />,
246
- title: 'LLM Orchestration',
247
- description: 'Optimized inference across OpenAI, Anthropic, Gemini, and local LLMs.',
248
- badge: 'Inference',
249
- badgeColor: 'bg-emerald-50 dark:bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-200 dark:border-emerald-500/20',
250
- },
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
+ },
251
211
  ];
252
212
 
253
213
  export const QUICK_START_STEPS = [
254
- 'Install @retrivora-ai/rag-engine',
255
- 'Configure your .env.local',
256
- 'Mount the API handlers',
257
- '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' },
258
223
  ];
259
224
 
260
225
  export const API_ENDPOINTS = ['chat', 'health', 'ingest', 'upload'];
261
226
 
262
227
  export const CHAT_SUGGESTIONS = [
263
- 'What can you help me with?',
264
- 'Summarise the key topics',
265
- 'Show me an example'
228
+ 'What can you help me with?',
229
+ 'Summarise the key topics',
230
+ 'Show me an example'
266
231
  ];
267
232
 
268
233
  export const BORDER_RADIUS_MAP: Record<string, string> = {
269
- none: 'rounded-none',
270
- sm: 'rounded-sm',
271
- md: 'rounded-md',
272
- lg: 'rounded-lg',
273
- xl: 'rounded-xl',
274
- 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',
275
240
  };
@@ -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: ragConfig.ui?.title ?? 'Retrivora AI',
8
+ title: 'Retrivora AI — Plug-and-Play RAG Engine',
15
9
  description:
16
- ragConfig.ui?.subtitle ??
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 transition-colors duration-300" suppressHydrationWarning>
24
- <ThemeProvider attribute="class" defaultTheme="light" disableTransitionOnChange>
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
- 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[]>([]);