@retrivora-ai/rag-engine 1.4.1 → 1.4.3
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 +4 -1
- package/dist/index.mjs +4 -1
- package/package.json +1 -1
- package/src/components/MessageBubble.tsx +27 -11
package/dist/index.js
CHANGED
|
@@ -539,7 +539,7 @@ function MessageBubble({
|
|
|
539
539
|
}, [productsFromSources, productsFromContent, message.content]);
|
|
540
540
|
const processedMarkdown = import_react5.default.useMemo(() => {
|
|
541
541
|
const raw = cleanContent || message.content;
|
|
542
|
-
return raw.replace(/([^\n])\n\|/g, "$1\n\n|");
|
|
542
|
+
return raw.replace(/([^\n])\n\|/g, "$1\n\n|").replace(/(\|[^\n]*\|)\n\n+(?=\|)/g, "$1\n");
|
|
543
543
|
}, [cleanContent, message.content]);
|
|
544
544
|
const markdownComponents = import_react5.default.useMemo(
|
|
545
545
|
() => ({
|
|
@@ -547,6 +547,9 @@ function MessageBubble({
|
|
|
547
547
|
// prose applies display:block and padding:0 to table/th/td — not-prose opts out.
|
|
548
548
|
table: (_a) => {
|
|
549
549
|
var props = __objRest(_a, []);
|
|
550
|
+
if (isStreaming) {
|
|
551
|
+
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..."));
|
|
552
|
+
}
|
|
550
553
|
return /* @__PURE__ */ import_react5.default.createElement("div", { className: "not-prose overflow-hidden my-5 rounded-xl border border-slate-200 dark:border-white/10 shadow-sm bg-white dark:bg-slate-900/50" }, /* @__PURE__ */ import_react5.default.createElement("div", { className: "overflow-x-auto" }, /* @__PURE__ */ import_react5.default.createElement(
|
|
551
554
|
"table",
|
|
552
555
|
__spreadValues({
|
package/dist/index.mjs
CHANGED
|
@@ -502,7 +502,7 @@ function MessageBubble({
|
|
|
502
502
|
}, [productsFromSources, productsFromContent, message.content]);
|
|
503
503
|
const processedMarkdown = React5.useMemo(() => {
|
|
504
504
|
const raw = cleanContent || message.content;
|
|
505
|
-
return raw.replace(/([^\n])\n\|/g, "$1\n\n|");
|
|
505
|
+
return raw.replace(/([^\n])\n\|/g, "$1\n\n|").replace(/(\|[^\n]*\|)\n\n+(?=\|)/g, "$1\n");
|
|
506
506
|
}, [cleanContent, message.content]);
|
|
507
507
|
const markdownComponents = React5.useMemo(
|
|
508
508
|
() => ({
|
|
@@ -510,6 +510,9 @@ function MessageBubble({
|
|
|
510
510
|
// prose applies display:block and padding:0 to table/th/td — not-prose opts out.
|
|
511
511
|
table: (_a) => {
|
|
512
512
|
var props = __objRest(_a, []);
|
|
513
|
+
if (isStreaming) {
|
|
514
|
+
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..."));
|
|
515
|
+
}
|
|
513
516
|
return /* @__PURE__ */ React5.createElement("div", { className: "not-prose overflow-hidden my-5 rounded-xl border border-slate-200 dark:border-white/10 shadow-sm bg-white dark:bg-slate-900/50" }, /* @__PURE__ */ React5.createElement("div", { className: "overflow-x-auto" }, /* @__PURE__ */ React5.createElement(
|
|
514
517
|
"table",
|
|
515
518
|
__spreadValues({
|
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.3",
|
|
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",
|
|
@@ -358,10 +358,13 @@ export function MessageBubble({
|
|
|
358
358
|
}, [productsFromSources, productsFromContent, message.content]);
|
|
359
359
|
|
|
360
360
|
// ── Markdown source fixer ──────────────────────────────────────────────────
|
|
361
|
-
// GFM tables require a blank line before the | row when preceded by text
|
|
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.
|
|
362
363
|
const processedMarkdown = React.useMemo(() => {
|
|
363
364
|
const raw = cleanContent || message.content;
|
|
364
|
-
return raw
|
|
365
|
+
return raw
|
|
366
|
+
.replace(/([^\n])\n\|/g, '$1\n\n|') // Ensure blank line before table
|
|
367
|
+
.replace(/(\|[^\n]*\|)\n\n+(?=\|)/g, '$1\n'); // Remove blank lines between rows
|
|
365
368
|
}, [cleanContent, message.content]);
|
|
366
369
|
|
|
367
370
|
// ── Markdown component overrides ───────────────────────────────────────────
|
|
@@ -369,16 +372,29 @@ export function MessageBubble({
|
|
|
369
372
|
() => ({
|
|
370
373
|
// Wrap in not-prose so Tailwind Typography resets don't clobber our styles.
|
|
371
374
|
// prose applies display:block and padding:0 to table/th/td — not-prose opts out.
|
|
372
|
-
table: ({ ...props }: React.HTMLAttributes<HTMLTableElement>) =>
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
<
|
|
376
|
-
className="
|
|
377
|
-
|
|
378
|
-
|
|
375
|
+
table: ({ ...props }: React.HTMLAttributes<HTMLTableElement>) => {
|
|
376
|
+
if (isStreaming) {
|
|
377
|
+
return (
|
|
378
|
+
<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">
|
|
379
|
+
<div className="w-4 h-4 border-2 border-indigo-500 border-t-transparent rounded-full animate-spin" />
|
|
380
|
+
<p className="text-xs text-slate-500 font-medium italic animate-pulse">
|
|
381
|
+
Generating data table...
|
|
382
|
+
</p>
|
|
383
|
+
</div>
|
|
384
|
+
);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
return (
|
|
388
|
+
<div className="not-prose overflow-hidden my-5 rounded-xl border border-slate-200 dark:border-white/10 shadow-sm bg-white dark:bg-slate-900/50">
|
|
389
|
+
<div className="overflow-x-auto">
|
|
390
|
+
<table
|
|
391
|
+
className="!table w-full text-left border-collapse min-w-[400px] text-sm"
|
|
392
|
+
{...props}
|
|
393
|
+
/>
|
|
394
|
+
</div>
|
|
379
395
|
</div>
|
|
380
|
-
|
|
381
|
-
|
|
396
|
+
);
|
|
397
|
+
},
|
|
382
398
|
thead: ({ ...props }: React.HTMLAttributes<HTMLTableSectionElement>) => (
|
|
383
399
|
<thead
|
|
384
400
|
className="!table-header-group bg-slate-50 dark:bg-white/5 border-b border-slate-200 dark:border-white/10"
|