@retrivora-ai/rag-engine 1.4.3 → 1.4.4
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 +18 -3
- package/dist/index.mjs +18 -3
- package/package.json +1 -1
- package/src/components/MessageBubble.tsx +26 -8
package/dist/index.js
CHANGED
|
@@ -538,9 +538,21 @@ function MessageBubble({
|
|
|
538
538
|
});
|
|
539
539
|
}, [productsFromSources, productsFromContent, message.content]);
|
|
540
540
|
const processedMarkdown = import_react5.default.useMemo(() => {
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
541
|
+
let raw = cleanContent || message.content;
|
|
542
|
+
raw = raw.replace(/([^\n])\n\|/g, "$1\n\n|").replace(/(\|[^\n]*\|)\n\n+(?=\|)/g, "$1\n");
|
|
543
|
+
if (isStreaming) {
|
|
544
|
+
raw = raw.replace(/((?:^|\n)\|.*)+/g, (match) => {
|
|
545
|
+
return `
|
|
546
|
+
|
|
547
|
+
\`\`\`table-loading
|
|
548
|
+
${match.trim()}
|
|
549
|
+
\`\`\`
|
|
550
|
+
|
|
551
|
+
`;
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
return raw;
|
|
555
|
+
}, [cleanContent, message.content, isStreaming]);
|
|
544
556
|
const markdownComponents = import_react5.default.useMemo(
|
|
545
557
|
() => ({
|
|
546
558
|
// Wrap in not-prose so Tailwind Typography resets don't clobber our styles.
|
|
@@ -622,6 +634,9 @@ function MessageBubble({
|
|
|
622
634
|
}
|
|
623
635
|
);
|
|
624
636
|
}
|
|
637
|
+
if (!inline && lang === "table-loading") {
|
|
638
|
+
return /* @__PURE__ */ import_react5.default.createElement("div", { className: "my-5 p-6 bg-slate-50 dark:bg-white/5 rounded-xl border border-dashed border-slate-300 dark:border-white/10 flex items-center justify-center gap-3 select-none" }, /* @__PURE__ */ import_react5.default.createElement("div", { className: "w-4 h-4 border-2 border-indigo-500 border-t-transparent rounded-full animate-spin" }), /* @__PURE__ */ import_react5.default.createElement("p", { className: "text-xs text-slate-500 font-medium italic animate-pulse" }, "Generating data table..."));
|
|
639
|
+
}
|
|
625
640
|
return /* @__PURE__ */ import_react5.default.createElement("code", __spreadValues({ className }, props), typeof children === "string" || typeof children === "number" ? children : JSON.stringify(children));
|
|
626
641
|
}
|
|
627
642
|
}),
|
package/dist/index.mjs
CHANGED
|
@@ -501,9 +501,21 @@ function MessageBubble({
|
|
|
501
501
|
});
|
|
502
502
|
}, [productsFromSources, productsFromContent, message.content]);
|
|
503
503
|
const processedMarkdown = React5.useMemo(() => {
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
504
|
+
let raw = cleanContent || message.content;
|
|
505
|
+
raw = raw.replace(/([^\n])\n\|/g, "$1\n\n|").replace(/(\|[^\n]*\|)\n\n+(?=\|)/g, "$1\n");
|
|
506
|
+
if (isStreaming) {
|
|
507
|
+
raw = raw.replace(/((?:^|\n)\|.*)+/g, (match) => {
|
|
508
|
+
return `
|
|
509
|
+
|
|
510
|
+
\`\`\`table-loading
|
|
511
|
+
${match.trim()}
|
|
512
|
+
\`\`\`
|
|
513
|
+
|
|
514
|
+
`;
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
return raw;
|
|
518
|
+
}, [cleanContent, message.content, isStreaming]);
|
|
507
519
|
const markdownComponents = React5.useMemo(
|
|
508
520
|
() => ({
|
|
509
521
|
// Wrap in not-prose so Tailwind Typography resets don't clobber our styles.
|
|
@@ -585,6 +597,9 @@ function MessageBubble({
|
|
|
585
597
|
}
|
|
586
598
|
);
|
|
587
599
|
}
|
|
600
|
+
if (!inline && lang === "table-loading") {
|
|
601
|
+
return /* @__PURE__ */ React5.createElement("div", { className: "my-5 p-6 bg-slate-50 dark:bg-white/5 rounded-xl border border-dashed border-slate-300 dark:border-white/10 flex items-center justify-center gap-3 select-none" }, /* @__PURE__ */ React5.createElement("div", { className: "w-4 h-4 border-2 border-indigo-500 border-t-transparent rounded-full animate-spin" }), /* @__PURE__ */ React5.createElement("p", { className: "text-xs text-slate-500 font-medium italic animate-pulse" }, "Generating data table..."));
|
|
602
|
+
}
|
|
588
603
|
return /* @__PURE__ */ React5.createElement("code", __spreadValues({ className }, props), typeof children === "string" || typeof children === "number" ? children : JSON.stringify(children));
|
|
589
604
|
}
|
|
590
605
|
}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@retrivora-ai/rag-engine",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.4",
|
|
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",
|
|
@@ -357,15 +357,22 @@ export function MessageBubble({
|
|
|
357
357
|
});
|
|
358
358
|
}, [productsFromSources, productsFromContent, message.content]);
|
|
359
359
|
|
|
360
|
-
// ── Markdown source fixer ──────────────────────────────────────────────────
|
|
361
|
-
// GFM tables require a blank line before the | row when preceded by text,
|
|
362
|
-
// but MUST NOT have blank lines between rows. LLMs often add extra newlines.
|
|
363
360
|
const processedMarkdown = React.useMemo(() => {
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
361
|
+
let raw = cleanContent || message.content;
|
|
362
|
+
|
|
363
|
+
// 1. Structural fixes
|
|
364
|
+
raw = raw.replace(/([^\n])\n\|/g, '$1\n\n|') // Ensure blank line before table
|
|
365
|
+
.replace(/(\|[^\n]*\|)\n\n+(?=\|)/g, '$1\n'); // Remove blank lines between rows
|
|
366
|
+
|
|
367
|
+
// 2. HIJACKING: If streaming, hide table-like content to prevent raw markdown flashing.
|
|
368
|
+
if (isStreaming) {
|
|
369
|
+
raw = raw.replace(/((?:^|\n)\|.*)+/g, (match) => {
|
|
370
|
+
return `\n\n\`\`\`table-loading\n${match.trim()}\n\`\`\`\n\n`;
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
return raw;
|
|
375
|
+
}, [cleanContent, message.content, isStreaming]);
|
|
369
376
|
|
|
370
377
|
// ── Markdown component overrides ───────────────────────────────────────────
|
|
371
378
|
const markdownComponents = React.useMemo(
|
|
@@ -445,6 +452,17 @@ export function MessageBubble({
|
|
|
445
452
|
);
|
|
446
453
|
}
|
|
447
454
|
|
|
455
|
+
if (!inline && lang === 'table-loading') {
|
|
456
|
+
return (
|
|
457
|
+
<div className="my-5 p-6 bg-slate-50 dark:bg-white/5 rounded-xl border border-dashed border-slate-300 dark:border-white/10 flex items-center justify-center gap-3 select-none">
|
|
458
|
+
<div className="w-4 h-4 border-2 border-indigo-500 border-t-transparent rounded-full animate-spin" />
|
|
459
|
+
<p className="text-xs text-slate-500 font-medium italic animate-pulse">
|
|
460
|
+
Generating data table...
|
|
461
|
+
</p>
|
|
462
|
+
</div>
|
|
463
|
+
);
|
|
464
|
+
}
|
|
465
|
+
|
|
448
466
|
return (
|
|
449
467
|
<code className={className} {...props}>
|
|
450
468
|
{typeof children === 'string' || typeof children === 'number'
|