@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.
- package/README.md +32 -7
- package/dist/{ILLMProvider-DNhyOYoK.d.mts → ILLMProvider-Bhk6zJOK.d.mts} +2 -6
- package/dist/{ILLMProvider-DNhyOYoK.d.ts → ILLMProvider-Bhk6zJOK.d.ts} +2 -6
- package/dist/handlers/index.d.mts +2 -2
- package/dist/handlers/index.d.ts +2 -2
- package/dist/handlers/index.js +213 -67
- package/dist/handlers/index.mjs +212 -67
- package/dist/{index-CjQdL0cX.d.ts → index-B9J_XEh0.d.ts} +6 -2
- package/dist/{index-C9v7-tWd.d.mts → index-BJ4cd-t5.d.mts} +6 -2
- package/dist/{index-Hgbwl9X4.d.ts → index-Bu7T6xgr.d.ts} +20 -3
- package/dist/{index-CHL1jdYm.d.mts → index-C3SVtPYg.d.mts} +20 -3
- package/dist/index.css +197 -10
- package/dist/index.d.mts +13 -5
- package/dist/index.d.ts +13 -5
- package/dist/index.js +39 -6
- package/dist/index.mjs +38 -7
- package/dist/server.d.mts +5 -5
- package/dist/server.d.ts +5 -5
- package/dist/server.js +310 -113
- package/dist/server.mjs +307 -112
- package/package.json +2 -4
- package/src/app/constants.tsx +183 -218
- package/src/app/layout.tsx +4 -28
- package/src/app/types.ts +17 -17
- package/src/components/ChatWidget.tsx +3 -1
- package/src/components/ChatWindow.tsx +5 -1
- package/src/components/DocViewer.tsx +71 -5
- package/src/components/Documentation.tsx +74 -11
- package/src/components/constants.tsx +275 -0
- package/src/config/RagConfig.ts +10 -10
- package/src/config/constants.ts +1 -0
- package/src/core/ConfigResolver.ts +24 -25
- package/src/core/Pipeline.ts +2 -1
- package/src/core/ProviderRegistry.ts +5 -5
- package/src/core/Retrivora.ts +46 -6
- package/src/core/VectorPlugin.ts +62 -8
- package/src/exceptions/index.ts +52 -0
- package/src/handlers/index.ts +71 -0
- package/src/hooks/useRagChat.ts +4 -1
- package/src/index.ts +2 -0
- package/src/llm/LLMFactory.ts +6 -5
- package/src/server.ts +16 -13
- package/src/types/chat.ts +2 -0
- package/src/types/props.ts +38 -1
package/src/app/constants.tsx
CHANGED
|
@@ -1,217 +1,177 @@
|
|
|
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
20
|
} from 'lucide-react';
|
|
21
21
|
import { ArchitectureCardProps, Snippet, PipelineStep, ProviderPill } from './types';
|
|
22
22
|
|
|
23
23
|
export const LANDING_PAGE_CONTENT = {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
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
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
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
|
|
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
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
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
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
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
|
-
|
|
264
|
-
|
|
265
|
-
|
|
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
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
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
|
};
|
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
|
}
|
|
@@ -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[]>([]);
|