@retrivora-ai/rag-engine 1.4.3 → 1.4.5

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.
@@ -1704,11 +1704,13 @@ When presenting structured data, statistics, or comparisons, decide if it is bes
1704
1704
  2. NO math expressions (e.g., use 100, NOT 50+50).
1705
1705
  3. dataKeys MUST exactly match the property names in the data objects.
1706
1706
  4. data objects MUST be FLAT (no nested objects or arrays).
1707
- 5. DO NOT output naked JSON; it MUST be wrapped in \`\`\`chart ... \`\`\`.
1707
+ 5. DO NOT output naked JSON or markdown tables for visualizations.
1708
+ 6. ALWAYS wrap your visualization data in a \`\`\`chart ... \`\`\` code block.
1708
1709
  \`\`\`chart
1709
1710
  {
1710
1711
  "type": "bar" | "line" | "pie",
1711
1712
  "xAxisKey": "name",
1713
+ "name": "Distribution Chart",
1712
1714
  "dataKeys": ["value"],
1713
1715
  "data": [{"name": "A", "value": 10}]
1714
1716
  }
@@ -2267,7 +2269,8 @@ When presenting structured data, statistics, or comparisons, decide if it is bes
2267
2269
  2. NO math expressions (e.g., use 100, NOT 50+50).
2268
2270
  3. dataKeys MUST exactly match the property names in the data objects.
2269
2271
  4. data objects MUST be FLAT (no nested objects or arrays).
2270
- 5. DO NOT output naked JSON; it MUST be wrapped in \`\`\`chart ... \`\`\`.
2272
+ 5. DO NOT output naked JSON or markdown tables for visualizations.
2273
+ 6. ALWAYS wrap your visualization data in a \`\`\`chart ... \`\`\` code block.
2271
2274
  \`\`\`chart
2272
2275
  {
2273
2276
  "type": "bar" | "line" | "pie",
@@ -3273,11 +3273,13 @@ When presenting structured data, statistics, or comparisons, decide if it is bes
3273
3273
  2. NO math expressions (e.g., use 100, NOT 50+50).
3274
3274
  3. dataKeys MUST exactly match the property names in the data objects.
3275
3275
  4. data objects MUST be FLAT (no nested objects or arrays).
3276
- 5. DO NOT output naked JSON; it MUST be wrapped in \`\`\`chart ... \`\`\`.
3276
+ 5. DO NOT output naked JSON or markdown tables for visualizations.
3277
+ 6. ALWAYS wrap your visualization data in a \`\`\`chart ... \`\`\` code block.
3277
3278
  \`\`\`chart
3278
3279
  {
3279
3280
  "type": "bar" | "line" | "pie",
3280
3281
  "xAxisKey": "name",
3282
+ "name": "Distribution Chart",
3281
3283
  "dataKeys": ["value"],
3282
3284
  "data": [{"name": "A", "value": 10}]
3283
3285
  }
@@ -3830,7 +3832,8 @@ When presenting structured data, statistics, or comparisons, decide if it is bes
3830
3832
  2. NO math expressions (e.g., use 100, NOT 50+50).
3831
3833
  3. dataKeys MUST exactly match the property names in the data objects.
3832
3834
  4. data objects MUST be FLAT (no nested objects or arrays).
3833
- 5. DO NOT output naked JSON; it MUST be wrapped in \`\`\`chart ... \`\`\`.
3835
+ 5. DO NOT output naked JSON or markdown tables for visualizations.
3836
+ 6. ALWAYS wrap your visualization data in a \`\`\`chart ... \`\`\` code block.
3834
3837
  \`\`\`chart
3835
3838
  {
3836
3839
  "type": "bar" | "line" | "pie",
@@ -9,7 +9,7 @@ import {
9
9
  sseFrame,
10
10
  sseMetaFrame,
11
11
  sseTextFrame
12
- } from "../chunk-FQ7OYZLF.mjs";
12
+ } from "../chunk-GYT3LWD6.mjs";
13
13
  import "../chunk-YLTMFW4M.mjs";
14
14
  import "../chunk-X4TOT24V.mjs";
15
15
  export {
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
- const raw = cleanContent || message.content;
542
- return raw.replace(/([^\n])\n\|/g, "$1\n\n|").replace(/(\|[^\n]*\|)\n\n+(?=\|)/g, "$1\n");
543
- }, [cleanContent, message.content]);
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
- const raw = cleanContent || message.content;
505
- return raw.replace(/([^\n])\n\|/g, "$1\n\n|").replace(/(\|[^\n]*\|)\n\n+(?=\|)/g, "$1\n");
506
- }, [cleanContent, message.content]);
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/dist/server.js CHANGED
@@ -3358,11 +3358,13 @@ When presenting structured data, statistics, or comparisons, decide if it is bes
3358
3358
  2. NO math expressions (e.g., use 100, NOT 50+50).
3359
3359
  3. dataKeys MUST exactly match the property names in the data objects.
3360
3360
  4. data objects MUST be FLAT (no nested objects or arrays).
3361
- 5. DO NOT output naked JSON; it MUST be wrapped in \`\`\`chart ... \`\`\`.
3361
+ 5. DO NOT output naked JSON or markdown tables for visualizations.
3362
+ 6. ALWAYS wrap your visualization data in a \`\`\`chart ... \`\`\` code block.
3362
3363
  \`\`\`chart
3363
3364
  {
3364
3365
  "type": "bar" | "line" | "pie",
3365
3366
  "xAxisKey": "name",
3367
+ "name": "Distribution Chart",
3366
3368
  "dataKeys": ["value"],
3367
3369
  "data": [{"name": "A", "value": 10}]
3368
3370
  }
@@ -3921,7 +3923,8 @@ When presenting structured data, statistics, or comparisons, decide if it is bes
3921
3923
  2. NO math expressions (e.g., use 100, NOT 50+50).
3922
3924
  3. dataKeys MUST exactly match the property names in the data objects.
3923
3925
  4. data objects MUST be FLAT (no nested objects or arrays).
3924
- 5. DO NOT output naked JSON; it MUST be wrapped in \`\`\`chart ... \`\`\`.
3926
+ 5. DO NOT output naked JSON or markdown tables for visualizations.
3927
+ 6. ALWAYS wrap your visualization data in a \`\`\`chart ... \`\`\` code block.
3925
3928
  \`\`\`chart
3926
3929
  {
3927
3930
  "type": "bar" | "line" | "pie",
package/dist/server.mjs CHANGED
@@ -39,7 +39,7 @@ import {
39
39
  sseFrame,
40
40
  sseMetaFrame,
41
41
  sseTextFrame
42
- } from "./chunk-FQ7OYZLF.mjs";
42
+ } from "./chunk-GYT3LWD6.mjs";
43
43
  import "./chunk-YLTMFW4M.mjs";
44
44
  import {
45
45
  PineconeProvider
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@retrivora-ai/rag-engine",
3
- "version": "1.4.3",
3
+ "version": "1.4.5",
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
- const raw = cleanContent || message.content;
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
368
- }, [cleanContent, message.content]);
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'
@@ -58,11 +58,13 @@ export class LangChainAgent {
58
58
  2. NO math expressions (e.g., use 100, NOT 50+50).
59
59
  3. dataKeys MUST exactly match the property names in the data objects.
60
60
  4. data objects MUST be FLAT (no nested objects or arrays).
61
- 5. DO NOT output naked JSON; it MUST be wrapped in \`\`\`chart ... \`\`\`.
61
+ 5. DO NOT output naked JSON or markdown tables for visualizations.
62
+ 6. ALWAYS wrap your visualization data in a \`\`\`chart ... \`\`\` code block.
62
63
  \`\`\`chart
63
64
  {
64
65
  "type": "bar" | "line" | "pie",
65
66
  "xAxisKey": "name",
67
+ "name": "Distribution Chart",
66
68
  "dataKeys": ["value"],
67
69
  "data": [{"name": "A", "value": 10}]
68
70
  }
@@ -108,7 +108,8 @@ export class Pipeline {
108
108
  2. NO math expressions (e.g., use 100, NOT 50+50).
109
109
  3. dataKeys MUST exactly match the property names in the data objects.
110
110
  4. data objects MUST be FLAT (no nested objects or arrays).
111
- 5. DO NOT output naked JSON; it MUST be wrapped in \`\`\`chart ... \`\`\`.
111
+ 5. DO NOT output naked JSON or markdown tables for visualizations.
112
+ 6. ALWAYS wrap your visualization data in a \`\`\`chart ... \`\`\` code block.
112
113
  \`\`\`chart
113
114
  {
114
115
  "type": "bar" | "line" | "pie",