@retrivora-ai/rag-engine 1.3.6 → 1.3.7

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
@@ -320,6 +320,10 @@ function DynamicChart({ config, primaryColor = "#6366f1", accentColor = "#8b5cf6
320
320
  // src/components/MessageBubble.tsx
321
321
  function sanitizeJson(raw) {
322
322
  let s = raw.trim();
323
+ const firstOpener = s.search(/[\{\[]/);
324
+ if (firstOpener !== -1) {
325
+ s = s.substring(firstOpener);
326
+ }
323
327
  s = s.replace(
324
328
  /:\s*(-?\d+(?:\.\d+)?)\s*([+\-*/])\s*(-?\d+(?:\.\d+)?)/g,
325
329
  (_, a, op, b) => {
package/dist/index.mjs CHANGED
@@ -283,6 +283,10 @@ function DynamicChart({ config, primaryColor = "#6366f1", accentColor = "#8b5cf6
283
283
  // src/components/MessageBubble.tsx
284
284
  function sanitizeJson(raw) {
285
285
  let s = raw.trim();
286
+ const firstOpener = s.search(/[\{\[]/);
287
+ if (firstOpener !== -1) {
288
+ s = s.substring(firstOpener);
289
+ }
286
290
  s = s.replace(
287
291
  /:\s*(-?\d+(?:\.\d+)?)\s*([+\-*/])\s*(-?\d+(?:\.\d+)?)/g,
288
292
  (_, a, op, b) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@retrivora-ai/rag-engine",
3
- "version": "1.3.6",
3
+ "version": "1.3.7",
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",
@@ -15,6 +15,12 @@ import { DynamicChart, ChartConfig } from './DynamicChart';
15
15
  function sanitizeJson(raw: string): string {
16
16
  let s = raw.trim();
17
17
 
18
+ // 0. Find the first '{' or '[' and trim everything before it (e.g. markdown fences)
19
+ const firstOpener = s.search(/[\{\[]/);
20
+ if (firstOpener !== -1) {
21
+ s = s.substring(firstOpener);
22
+ }
23
+
18
24
  // 1. Evaluate simple arithmetic expressions in values e.g. "v": 495 / 1000
19
25
  s = s.replace(
20
26
  /:\s*(-?\d+(?:\.\d+)?)\s*([+\-*/])\s*(-?\d+(?:\.\d+)?)/g,