@retrivora-ai/rag-engine 1.6.5 → 1.6.6

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 CHANGED
@@ -782,7 +782,7 @@ function MessageBubble({
782
782
  for (const candidate of payloadCandidates) {
783
783
  try {
784
784
  const data = JSON.parse(sanitizeJson(candidate));
785
- const itemSet = Array.isArray(data.items) ? data.items : Array.isArray(data.products) ? data.products : null;
785
+ const itemSet = Array.isArray(data.data) ? data.data : Array.isArray(data.items) ? data.items : Array.isArray(data.products) ? data.products : null;
786
786
  if ((data.type === "products" || data.view === "carousel" || data.view === "table" || Array.isArray(data.products)) && itemSet) {
787
787
  products.push(
788
788
  ...itemSet.map((item) => {
package/dist/index.mjs CHANGED
@@ -745,7 +745,7 @@ function MessageBubble({
745
745
  for (const candidate of payloadCandidates) {
746
746
  try {
747
747
  const data = JSON.parse(sanitizeJson(candidate));
748
- const itemSet = Array.isArray(data.items) ? data.items : Array.isArray(data.products) ? data.products : null;
748
+ const itemSet = Array.isArray(data.data) ? data.data : Array.isArray(data.items) ? data.items : Array.isArray(data.products) ? data.products : null;
749
749
  if ((data.type === "products" || data.view === "carousel" || data.view === "table" || Array.isArray(data.products)) && itemSet) {
750
750
  products.push(
751
751
  ...itemSet.map((item) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@retrivora-ai/rag-engine",
3
- "version": "1.6.5",
3
+ "version": "1.6.6",
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",
@@ -629,9 +629,10 @@ export function MessageBubble({
629
629
  try {
630
630
  const data = JSON.parse(sanitizeJson(candidate));
631
631
  const itemSet =
632
- Array.isArray(data.items) ? data.items
633
- : Array.isArray(data.products) ? data.products
634
- : null;
632
+ Array.isArray(data.data) ? data.data
633
+ : Array.isArray(data.items) ? data.items
634
+ : Array.isArray(data.products) ? data.products
635
+ : null;
635
636
 
636
637
  if (
637
638
  (data.type === 'products' || data.view === 'carousel' || data.view === 'table' || Array.isArray(data.products)) &&
@@ -698,7 +699,8 @@ export function MessageBubble({
698
699
  .replace(/(\|[^\n]*\|)\n\n+(?=\|)/g, '$1\n'); // Remove blank lines between rows
699
700
 
700
701
  // 2. HEALING: Detect naked JSON charts/products and wrap them if markers are missing
701
- // This handles models (like Llama 3.2) that often omit the ```ui markers.
702
+ // CRITICAL: DO NOT REVERT THIS REGEX. It must remain non-greedy and position-independent
703
+ // to catch JSON that is not preceded by a newline (common in many LLM outputs).
702
704
  if (!isStreaming) {
703
705
  // Find potential JSON objects that are not already wrapped in code blocks
704
706
  raw = raw.replace(/(\{[\s\S]+?\})(?!\s*```)/g, (match) => {