@retrivora-ai/rag-engine 1.5.2 → 1.5.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 CHANGED
@@ -445,12 +445,11 @@ function ChartBlock({ rawContent, primaryColor, accentColor, isStreaming }) {
445
445
  if (isStreaming) return { loading: true };
446
446
  if (!rawContent || rawContent === "undefined") return { error: "Empty visualization config." };
447
447
  try {
448
- const sanitized = sanitizeJson(rawContent);
449
- const config2 = JSON.parse(sanitized);
448
+ const clean = rawContent.replace(/^```[a-z]*\s*/i, "").replace(/```\s*$/, "").trim();
449
+ const config2 = JSON.parse(sanitizeJson(clean));
450
450
  return { config: config2 };
451
451
  } catch (err) {
452
- const sanitized = sanitizeJson(rawContent);
453
- console.error("[ChartBlock] Parsing failed.\nError:", err, "\nSanitized:\n", sanitized);
452
+ console.error("[ChartBlock] Parsing failed.\nError:", err);
454
453
  return { error: String(err) };
455
454
  }
456
455
  }, [rawContent, isStreaming]);
package/dist/index.mjs CHANGED
@@ -408,12 +408,11 @@ function ChartBlock({ rawContent, primaryColor, accentColor, isStreaming }) {
408
408
  if (isStreaming) return { loading: true };
409
409
  if (!rawContent || rawContent === "undefined") return { error: "Empty visualization config." };
410
410
  try {
411
- const sanitized = sanitizeJson(rawContent);
412
- const config2 = JSON.parse(sanitized);
411
+ const clean = rawContent.replace(/^```[a-z]*\s*/i, "").replace(/```\s*$/, "").trim();
412
+ const config2 = JSON.parse(sanitizeJson(clean));
413
413
  return { config: config2 };
414
414
  } catch (err) {
415
- const sanitized = sanitizeJson(rawContent);
416
- console.error("[ChartBlock] Parsing failed.\nError:", err, "\nSanitized:\n", sanitized);
415
+ console.error("[ChartBlock] Parsing failed.\nError:", err);
417
416
  return { error: String(err) };
418
417
  }
419
418
  }, [rawContent, isStreaming]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@retrivora-ai/rag-engine",
3
- "version": "1.5.2",
3
+ "version": "1.5.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",
@@ -228,12 +228,14 @@ function ChartBlock({ rawContent, primaryColor, accentColor, isStreaming }: Char
228
228
  if (isStreaming) return { loading: true };
229
229
  if (!rawContent || rawContent === 'undefined') return { error: 'Empty visualization config.' };
230
230
  try {
231
- const sanitized = sanitizeJson(rawContent);
232
- const config = JSON.parse(sanitized) as ParsedConfig;
231
+ const clean = rawContent
232
+ .replace(/^```[a-z]*\s*/i, '')
233
+ .replace(/```\s*$/, '')
234
+ .trim();
235
+ const config = JSON.parse(sanitizeJson(clean)) as ParsedConfig;
233
236
  return { config };
234
237
  } catch (err) {
235
- const sanitized = sanitizeJson(rawContent);
236
- console.error('[ChartBlock] Parsing failed.\nError:', err, '\nSanitized:\n', sanitized);
238
+ console.error('[ChartBlock] Parsing failed.\nError:', err);
237
239
  return { error: String(err) };
238
240
  }
239
241
  }, [rawContent, isStreaming]);