@retrivora-ai/rag-engine 1.5.6 → 1.5.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/dist/index.js +10 -1
- package/dist/index.mjs +10 -1
- package/package.json +1 -1
- package/src/components/MessageBubble.tsx +19 -2
package/dist/index.js
CHANGED
|
@@ -511,6 +511,14 @@ function normalizeTabularRows(rows, columns) {
|
|
|
511
511
|
return { value: row };
|
|
512
512
|
}).filter((row) => Object.keys(row).length > 0);
|
|
513
513
|
}
|
|
514
|
+
function resolveStructuredRows(config) {
|
|
515
|
+
if (Array.isArray(config.data) && config.data.length > 0) return config.data;
|
|
516
|
+
if (Array.isArray(config.rows) && config.rows.length > 0) return config.rows;
|
|
517
|
+
if (Array.isArray(config.items) && config.items.length > 0) return config.items;
|
|
518
|
+
if (Array.isArray(config.products) && config.products.length > 0) return config.products;
|
|
519
|
+
if (Array.isArray(config.results) && config.results.length > 0) return config.results;
|
|
520
|
+
return [];
|
|
521
|
+
}
|
|
514
522
|
function UIDispatcher({ rawContent, primaryColor, accentColor, isStreaming, onAddToCart, viewportSize = "large" }) {
|
|
515
523
|
var _a;
|
|
516
524
|
const result = import_react5.default.useMemo(() => {
|
|
@@ -533,8 +541,9 @@ function UIDispatcher({ rawContent, primaryColor, accentColor, isStreaming, onAd
|
|
|
533
541
|
config2.data = Array.isArray(config2.data) ? config2.data : Array.isArray(config2) ? config2 : [];
|
|
534
542
|
}
|
|
535
543
|
}
|
|
544
|
+
const resolvedRows = resolveStructuredRows(config2);
|
|
536
545
|
const normalizedConfig = __spreadProps(__spreadValues({}, config2), {
|
|
537
|
-
data: normalizeTabularRows(
|
|
546
|
+
data: normalizeTabularRows(resolvedRows, config2.columns)
|
|
538
547
|
});
|
|
539
548
|
return { config: normalizedConfig };
|
|
540
549
|
} catch (err) {
|
package/dist/index.mjs
CHANGED
|
@@ -474,6 +474,14 @@ function normalizeTabularRows(rows, columns) {
|
|
|
474
474
|
return { value: row };
|
|
475
475
|
}).filter((row) => Object.keys(row).length > 0);
|
|
476
476
|
}
|
|
477
|
+
function resolveStructuredRows(config) {
|
|
478
|
+
if (Array.isArray(config.data) && config.data.length > 0) return config.data;
|
|
479
|
+
if (Array.isArray(config.rows) && config.rows.length > 0) return config.rows;
|
|
480
|
+
if (Array.isArray(config.items) && config.items.length > 0) return config.items;
|
|
481
|
+
if (Array.isArray(config.products) && config.products.length > 0) return config.products;
|
|
482
|
+
if (Array.isArray(config.results) && config.results.length > 0) return config.results;
|
|
483
|
+
return [];
|
|
484
|
+
}
|
|
477
485
|
function UIDispatcher({ rawContent, primaryColor, accentColor, isStreaming, onAddToCart, viewportSize = "large" }) {
|
|
478
486
|
var _a;
|
|
479
487
|
const result = React5.useMemo(() => {
|
|
@@ -496,8 +504,9 @@ function UIDispatcher({ rawContent, primaryColor, accentColor, isStreaming, onAd
|
|
|
496
504
|
config2.data = Array.isArray(config2.data) ? config2.data : Array.isArray(config2) ? config2 : [];
|
|
497
505
|
}
|
|
498
506
|
}
|
|
507
|
+
const resolvedRows = resolveStructuredRows(config2);
|
|
499
508
|
const normalizedConfig = __spreadProps(__spreadValues({}, config2), {
|
|
500
|
-
data: normalizeTabularRows(
|
|
509
|
+
data: normalizeTabularRows(resolvedRows, config2.columns)
|
|
501
510
|
});
|
|
502
511
|
return { config: normalizedConfig };
|
|
503
512
|
} catch (err) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@retrivora-ai/rag-engine",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.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",
|
|
@@ -241,10 +241,17 @@ interface UIConfig {
|
|
|
241
241
|
insights?: string[];
|
|
242
242
|
type?: string;
|
|
243
243
|
items?: Record<string, unknown>[];
|
|
244
|
+
rows?: Record<string, unknown>[];
|
|
245
|
+
products?: Record<string, unknown>[];
|
|
246
|
+
results?: Record<string, unknown>[];
|
|
244
247
|
}
|
|
245
248
|
|
|
246
|
-
interface RawUIConfig extends Omit<UIConfig, 'data'> {
|
|
249
|
+
interface RawUIConfig extends Omit<UIConfig, 'data' | 'items' | 'rows' | 'products' | 'results'> {
|
|
247
250
|
data: Array<Record<string, unknown> | unknown[]>;
|
|
251
|
+
items?: Array<Record<string, unknown> | unknown[]>;
|
|
252
|
+
rows?: Array<Record<string, unknown> | unknown[]>;
|
|
253
|
+
products?: Array<Record<string, unknown> | unknown[]>;
|
|
254
|
+
results?: Array<Record<string, unknown> | unknown[]>;
|
|
248
255
|
}
|
|
249
256
|
|
|
250
257
|
function normalizeTabularRows(
|
|
@@ -275,6 +282,15 @@ function normalizeTabularRows(
|
|
|
275
282
|
.filter((row) => Object.keys(row).length > 0);
|
|
276
283
|
}
|
|
277
284
|
|
|
285
|
+
function resolveStructuredRows(config: Partial<RawUIConfig> & Record<string, unknown>) {
|
|
286
|
+
if (Array.isArray(config.data) && config.data.length > 0) return config.data;
|
|
287
|
+
if (Array.isArray(config.rows) && config.rows.length > 0) return config.rows;
|
|
288
|
+
if (Array.isArray(config.items) && config.items.length > 0) return config.items;
|
|
289
|
+
if (Array.isArray(config.products) && config.products.length > 0) return config.products;
|
|
290
|
+
if (Array.isArray(config.results) && config.results.length > 0) return config.results;
|
|
291
|
+
return [];
|
|
292
|
+
}
|
|
293
|
+
|
|
278
294
|
function UIDispatcher({ rawContent, primaryColor, accentColor, isStreaming, onAddToCart, viewportSize = 'large' }: {
|
|
279
295
|
rawContent: string;
|
|
280
296
|
primaryColor?: string;
|
|
@@ -317,9 +333,10 @@ function UIDispatcher({ rawContent, primaryColor, accentColor, isStreaming, onAd
|
|
|
317
333
|
}
|
|
318
334
|
}
|
|
319
335
|
|
|
336
|
+
const resolvedRows = resolveStructuredRows(config);
|
|
320
337
|
const normalizedConfig: UIConfig = {
|
|
321
338
|
...(config as Omit<UIConfig, 'data'>),
|
|
322
|
-
data: normalizeTabularRows(
|
|
339
|
+
data: normalizeTabularRows(resolvedRows, config.columns),
|
|
323
340
|
};
|
|
324
341
|
|
|
325
342
|
return { config: normalizedConfig };
|