@retrivora-ai/rag-engine 1.2.3 → 1.2.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.
- package/dist/{chunk-WGPNEAK3.mjs → chunk-6WBJNJ5M.mjs} +10 -2
- package/dist/handlers/index.js +10 -2
- package/dist/handlers/index.mjs +1 -1
- package/dist/index.js +7 -5
- package/dist/index.mjs +7 -5
- package/dist/server.js +10 -2
- package/dist/server.mjs +1 -1
- package/package.json +1 -1
- package/src/components/DynamicChart.tsx +4 -4
- package/src/components/MessageBubble.tsx +8 -4
- package/src/core/LangChainAgent.ts +5 -1
- package/src/core/Pipeline.ts +5 -1
|
@@ -1698,7 +1698,11 @@ Sources Used: ${JSON.stringify(
|
|
|
1698
1698
|
|
|
1699
1699
|
When presenting structured data, statistics, or comparisons, decide if it is best presented as a table or a chart.
|
|
1700
1700
|
- For tables: use standard Markdown tables.
|
|
1701
|
-
- For charts (bar, line, pie): Output a JSON code block with language 'chart'
|
|
1701
|
+
- For charts (bar, line, pie): Output a JSON code block with language 'chart'.
|
|
1702
|
+
- CRITICAL RULES:
|
|
1703
|
+
1. Use ONLY valid JSON (double quotes, no trailing commas).
|
|
1704
|
+
2. NO math expressions (e.g., use 100, NOT 50+50).
|
|
1705
|
+
3. dataKeys MUST exactly match the property names in the data objects.
|
|
1702
1706
|
\`\`\`chart
|
|
1703
1707
|
{
|
|
1704
1708
|
"type": "bar" | "line" | "pie",
|
|
@@ -2255,7 +2259,11 @@ var Pipeline = class {
|
|
|
2255
2259
|
|
|
2256
2260
|
When presenting structured data, statistics, or comparisons, decide if it is best presented as a table or a chart.
|
|
2257
2261
|
- For tables: use standard Markdown tables.
|
|
2258
|
-
- For charts (bar, line, pie): Output a JSON code block with language 'chart'
|
|
2262
|
+
- For charts (bar, line, pie): Output a JSON code block with language 'chart'.
|
|
2263
|
+
- CRITICAL RULES:
|
|
2264
|
+
1. Use ONLY valid JSON (double quotes, no trailing commas).
|
|
2265
|
+
2. NO math expressions (e.g., use 100, NOT 50+50).
|
|
2266
|
+
3. dataKeys MUST exactly match the property names in the data objects.
|
|
2259
2267
|
\`\`\`chart
|
|
2260
2268
|
{
|
|
2261
2269
|
"type": "bar" | "line" | "pie",
|
package/dist/handlers/index.js
CHANGED
|
@@ -3267,7 +3267,11 @@ Sources Used: ${JSON.stringify(
|
|
|
3267
3267
|
|
|
3268
3268
|
When presenting structured data, statistics, or comparisons, decide if it is best presented as a table or a chart.
|
|
3269
3269
|
- For tables: use standard Markdown tables.
|
|
3270
|
-
- For charts (bar, line, pie): Output a JSON code block with language 'chart'
|
|
3270
|
+
- For charts (bar, line, pie): Output a JSON code block with language 'chart'.
|
|
3271
|
+
- CRITICAL RULES:
|
|
3272
|
+
1. Use ONLY valid JSON (double quotes, no trailing commas).
|
|
3273
|
+
2. NO math expressions (e.g., use 100, NOT 50+50).
|
|
3274
|
+
3. dataKeys MUST exactly match the property names in the data objects.
|
|
3271
3275
|
\`\`\`chart
|
|
3272
3276
|
{
|
|
3273
3277
|
"type": "bar" | "line" | "pie",
|
|
@@ -3818,7 +3822,11 @@ var Pipeline = class {
|
|
|
3818
3822
|
|
|
3819
3823
|
When presenting structured data, statistics, or comparisons, decide if it is best presented as a table or a chart.
|
|
3820
3824
|
- For tables: use standard Markdown tables.
|
|
3821
|
-
- For charts (bar, line, pie): Output a JSON code block with language 'chart'
|
|
3825
|
+
- For charts (bar, line, pie): Output a JSON code block with language 'chart'.
|
|
3826
|
+
- CRITICAL RULES:
|
|
3827
|
+
1. Use ONLY valid JSON (double quotes, no trailing commas).
|
|
3828
|
+
2. NO math expressions (e.g., use 100, NOT 50+50).
|
|
3829
|
+
3. dataKeys MUST exactly match the property names in the data objects.
|
|
3822
3830
|
\`\`\`chart
|
|
3823
3831
|
{
|
|
3824
3832
|
"type": "bar" | "line" | "pie",
|
package/dist/handlers/index.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -228,7 +228,7 @@ function DynamicChart({ config, primaryColor = "#6366f1", accentColor = "#8b5cf6
|
|
|
228
228
|
}
|
|
229
229
|
if (type === "pie") {
|
|
230
230
|
const pieDataKey = dataKeys[0] || Object.keys(data[0]).find((k) => k !== xAxisKey) || "value";
|
|
231
|
-
return /* @__PURE__ */ import_react4.default.createElement("div", { className: "w-full h-
|
|
231
|
+
return /* @__PURE__ */ import_react4.default.createElement("div", { className: "w-full h-72 min-h-[280px] mt-4 mb-2 select-none overflow-hidden" }, /* @__PURE__ */ import_react4.default.createElement(import_recharts.ResponsiveContainer, { width: "99%", height: "100%" }, /* @__PURE__ */ import_react4.default.createElement(import_recharts.PieChart, null, /* @__PURE__ */ import_react4.default.createElement(
|
|
232
232
|
import_recharts.Pie,
|
|
233
233
|
{
|
|
234
234
|
data,
|
|
@@ -247,7 +247,7 @@ function DynamicChart({ config, primaryColor = "#6366f1", accentColor = "#8b5cf6
|
|
|
247
247
|
}
|
|
248
248
|
), /* @__PURE__ */ import_react4.default.createElement(import_recharts.Legend, null))));
|
|
249
249
|
}
|
|
250
|
-
return /* @__PURE__ */ import_react4.default.createElement("div", { className: "w-full h-
|
|
250
|
+
return /* @__PURE__ */ import_react4.default.createElement("div", { className: "w-full h-72 min-h-[280px] mt-4 mb-2 select-none overflow-hidden" }, /* @__PURE__ */ import_react4.default.createElement(import_recharts.ResponsiveContainer, { width: "99%", height: "100%" }, type === "bar" ? /* @__PURE__ */ import_react4.default.createElement(import_recharts.BarChart, { data, margin: { top: 10, right: 10, left: -20, bottom: 0 } }, /* @__PURE__ */ import_react4.default.createElement(import_recharts.CartesianGrid, { strokeDasharray: "3 3", vertical: false, stroke: "#e2e8f0" }), /* @__PURE__ */ import_react4.default.createElement(import_recharts.XAxis, { dataKey: xAxisKey, tick: { fontSize: 12, fill: "#64748b" }, tickLine: false, axisLine: { stroke: "#cbd5e1" } }), /* @__PURE__ */ import_react4.default.createElement(import_recharts.YAxis, { tick: { fontSize: 12, fill: "#64748b" }, tickLine: false, axisLine: false }), /* @__PURE__ */ import_react4.default.createElement(
|
|
251
251
|
import_recharts.Tooltip,
|
|
252
252
|
{
|
|
253
253
|
contentStyle: { borderRadius: "8px", border: "none", boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1)" },
|
|
@@ -402,8 +402,9 @@ function MessageBubble({
|
|
|
402
402
|
const match = /language-(\w+)/.exec(className || "");
|
|
403
403
|
const isChart = match && match[1] === "chart";
|
|
404
404
|
if (!inline && isChart) {
|
|
405
|
+
const rawContent = String(children).trim();
|
|
405
406
|
try {
|
|
406
|
-
const config = JSON.parse(
|
|
407
|
+
const config = JSON.parse(rawContent);
|
|
407
408
|
return /* @__PURE__ */ import_react5.default.createElement("div", { className: "my-4 p-4 bg-white dark:bg-slate-900 rounded-xl border border-slate-200 dark:border-white/10 shadow-sm" }, /* @__PURE__ */ import_react5.default.createElement(
|
|
408
409
|
DynamicChart,
|
|
409
410
|
{
|
|
@@ -412,8 +413,9 @@ function MessageBubble({
|
|
|
412
413
|
accentColor
|
|
413
414
|
}
|
|
414
415
|
));
|
|
415
|
-
} catch (
|
|
416
|
-
|
|
416
|
+
} catch (err) {
|
|
417
|
+
console.error("[MessageBubble] Chart parsing failed:", err, "\nRaw content:", rawContent);
|
|
418
|
+
return /* @__PURE__ */ import_react5.default.createElement("div", { className: "p-4 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 rounded-lg text-sm border border-red-100 dark:border-red-900/30" }, /* @__PURE__ */ import_react5.default.createElement("p", { className: "font-medium mb-1" }, "Failed to render chart"), /* @__PURE__ */ import_react5.default.createElement("p", { className: "opacity-70 text-xs" }, "The generated configuration is invalid. Check console for details."));
|
|
417
419
|
}
|
|
418
420
|
}
|
|
419
421
|
return /* @__PURE__ */ import_react5.default.createElement("code", __spreadValues({ className }, props), children);
|
package/dist/index.mjs
CHANGED
|
@@ -191,7 +191,7 @@ function DynamicChart({ config, primaryColor = "#6366f1", accentColor = "#8b5cf6
|
|
|
191
191
|
}
|
|
192
192
|
if (type === "pie") {
|
|
193
193
|
const pieDataKey = dataKeys[0] || Object.keys(data[0]).find((k) => k !== xAxisKey) || "value";
|
|
194
|
-
return /* @__PURE__ */ React4.createElement("div", { className: "w-full h-
|
|
194
|
+
return /* @__PURE__ */ React4.createElement("div", { className: "w-full h-72 min-h-[280px] mt-4 mb-2 select-none overflow-hidden" }, /* @__PURE__ */ React4.createElement(ResponsiveContainer, { width: "99%", height: "100%" }, /* @__PURE__ */ React4.createElement(PieChart, null, /* @__PURE__ */ React4.createElement(
|
|
195
195
|
Pie,
|
|
196
196
|
{
|
|
197
197
|
data,
|
|
@@ -210,7 +210,7 @@ function DynamicChart({ config, primaryColor = "#6366f1", accentColor = "#8b5cf6
|
|
|
210
210
|
}
|
|
211
211
|
), /* @__PURE__ */ React4.createElement(Legend, null))));
|
|
212
212
|
}
|
|
213
|
-
return /* @__PURE__ */ React4.createElement("div", { className: "w-full h-
|
|
213
|
+
return /* @__PURE__ */ React4.createElement("div", { className: "w-full h-72 min-h-[280px] mt-4 mb-2 select-none overflow-hidden" }, /* @__PURE__ */ React4.createElement(ResponsiveContainer, { width: "99%", height: "100%" }, type === "bar" ? /* @__PURE__ */ React4.createElement(BarChart, { data, margin: { top: 10, right: 10, left: -20, bottom: 0 } }, /* @__PURE__ */ React4.createElement(CartesianGrid, { strokeDasharray: "3 3", vertical: false, stroke: "#e2e8f0" }), /* @__PURE__ */ React4.createElement(XAxis, { dataKey: xAxisKey, tick: { fontSize: 12, fill: "#64748b" }, tickLine: false, axisLine: { stroke: "#cbd5e1" } }), /* @__PURE__ */ React4.createElement(YAxis, { tick: { fontSize: 12, fill: "#64748b" }, tickLine: false, axisLine: false }), /* @__PURE__ */ React4.createElement(
|
|
214
214
|
Tooltip,
|
|
215
215
|
{
|
|
216
216
|
contentStyle: { borderRadius: "8px", border: "none", boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1)" },
|
|
@@ -365,8 +365,9 @@ function MessageBubble({
|
|
|
365
365
|
const match = /language-(\w+)/.exec(className || "");
|
|
366
366
|
const isChart = match && match[1] === "chart";
|
|
367
367
|
if (!inline && isChart) {
|
|
368
|
+
const rawContent = String(children).trim();
|
|
368
369
|
try {
|
|
369
|
-
const config = JSON.parse(
|
|
370
|
+
const config = JSON.parse(rawContent);
|
|
370
371
|
return /* @__PURE__ */ React5.createElement("div", { className: "my-4 p-4 bg-white dark:bg-slate-900 rounded-xl border border-slate-200 dark:border-white/10 shadow-sm" }, /* @__PURE__ */ React5.createElement(
|
|
371
372
|
DynamicChart,
|
|
372
373
|
{
|
|
@@ -375,8 +376,9 @@ function MessageBubble({
|
|
|
375
376
|
accentColor
|
|
376
377
|
}
|
|
377
378
|
));
|
|
378
|
-
} catch (
|
|
379
|
-
|
|
379
|
+
} catch (err) {
|
|
380
|
+
console.error("[MessageBubble] Chart parsing failed:", err, "\nRaw content:", rawContent);
|
|
381
|
+
return /* @__PURE__ */ React5.createElement("div", { className: "p-4 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 rounded-lg text-sm border border-red-100 dark:border-red-900/30" }, /* @__PURE__ */ React5.createElement("p", { className: "font-medium mb-1" }, "Failed to render chart"), /* @__PURE__ */ React5.createElement("p", { className: "opacity-70 text-xs" }, "The generated configuration is invalid. Check console for details."));
|
|
380
382
|
}
|
|
381
383
|
}
|
|
382
384
|
return /* @__PURE__ */ React5.createElement("code", __spreadValues({ className }, props), children);
|
package/dist/server.js
CHANGED
|
@@ -3352,7 +3352,11 @@ Sources Used: ${JSON.stringify(
|
|
|
3352
3352
|
|
|
3353
3353
|
When presenting structured data, statistics, or comparisons, decide if it is best presented as a table or a chart.
|
|
3354
3354
|
- For tables: use standard Markdown tables.
|
|
3355
|
-
- For charts (bar, line, pie): Output a JSON code block with language 'chart'
|
|
3355
|
+
- For charts (bar, line, pie): Output a JSON code block with language 'chart'.
|
|
3356
|
+
- CRITICAL RULES:
|
|
3357
|
+
1. Use ONLY valid JSON (double quotes, no trailing commas).
|
|
3358
|
+
2. NO math expressions (e.g., use 100, NOT 50+50).
|
|
3359
|
+
3. dataKeys MUST exactly match the property names in the data objects.
|
|
3356
3360
|
\`\`\`chart
|
|
3357
3361
|
{
|
|
3358
3362
|
"type": "bar" | "line" | "pie",
|
|
@@ -3909,7 +3913,11 @@ var Pipeline = class {
|
|
|
3909
3913
|
|
|
3910
3914
|
When presenting structured data, statistics, or comparisons, decide if it is best presented as a table or a chart.
|
|
3911
3915
|
- For tables: use standard Markdown tables.
|
|
3912
|
-
- For charts (bar, line, pie): Output a JSON code block with language 'chart'
|
|
3916
|
+
- For charts (bar, line, pie): Output a JSON code block with language 'chart'.
|
|
3917
|
+
- CRITICAL RULES:
|
|
3918
|
+
1. Use ONLY valid JSON (double quotes, no trailing commas).
|
|
3919
|
+
2. NO math expressions (e.g., use 100, NOT 50+50).
|
|
3920
|
+
3. dataKeys MUST exactly match the property names in the data objects.
|
|
3913
3921
|
\`\`\`chart
|
|
3914
3922
|
{
|
|
3915
3923
|
"type": "bar" | "line" | "pie",
|
package/dist/server.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@retrivora-ai/rag-engine",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.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",
|
|
@@ -35,8 +35,8 @@ export function DynamicChart({ config, primaryColor = '#6366f1', accentColor = '
|
|
|
35
35
|
const pieDataKey = dataKeys[0] || Object.keys(data[0]).find(k => k !== xAxisKey) || 'value';
|
|
36
36
|
|
|
37
37
|
return (
|
|
38
|
-
<div className="w-full h-
|
|
39
|
-
<ResponsiveContainer width="
|
|
38
|
+
<div className="w-full h-72 min-h-[280px] mt-4 mb-2 select-none overflow-hidden">
|
|
39
|
+
<ResponsiveContainer width="99%" height="100%">
|
|
40
40
|
<PieChart>
|
|
41
41
|
<Pie
|
|
42
42
|
data={data}
|
|
@@ -63,8 +63,8 @@ export function DynamicChart({ config, primaryColor = '#6366f1', accentColor = '
|
|
|
63
63
|
|
|
64
64
|
// Bar and Line charts
|
|
65
65
|
return (
|
|
66
|
-
<div className="w-full h-
|
|
67
|
-
<ResponsiveContainer width="
|
|
66
|
+
<div className="w-full h-72 min-h-[280px] mt-4 mb-2 select-none overflow-hidden">
|
|
67
|
+
<ResponsiveContainer width="99%" height="100%">
|
|
68
68
|
{type === 'bar' ? (
|
|
69
69
|
<BarChart data={data} margin={{ top: 10, right: 10, left: -20, bottom: 0 }}>
|
|
70
70
|
<CartesianGrid strokeDasharray="3 3" vertical={false} stroke="#e2e8f0" />
|
|
@@ -178,8 +178,10 @@ export function MessageBubble({
|
|
|
178
178
|
const isChart = match && match[1] === 'chart';
|
|
179
179
|
|
|
180
180
|
if (!inline && isChart) {
|
|
181
|
+
const rawContent = String(children).trim();
|
|
181
182
|
try {
|
|
182
|
-
|
|
183
|
+
// Attempt to parse the JSON
|
|
184
|
+
const config = JSON.parse(rawContent) as ChartConfig;
|
|
183
185
|
return (
|
|
184
186
|
<div className="my-4 p-4 bg-white dark:bg-slate-900 rounded-xl border border-slate-200 dark:border-white/10 shadow-sm">
|
|
185
187
|
<DynamicChart
|
|
@@ -189,10 +191,12 @@ export function MessageBubble({
|
|
|
189
191
|
/>
|
|
190
192
|
</div>
|
|
191
193
|
);
|
|
192
|
-
} catch {
|
|
194
|
+
} catch (err) {
|
|
195
|
+
console.error('[MessageBubble] Chart parsing failed:', err, '\nRaw content:', rawContent);
|
|
193
196
|
return (
|
|
194
|
-
<div className="p-4 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 rounded-lg text-sm">
|
|
195
|
-
Failed to render chart
|
|
197
|
+
<div className="p-4 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 rounded-lg text-sm border border-red-100 dark:border-red-900/30">
|
|
198
|
+
<p className="font-medium mb-1">Failed to render chart</p>
|
|
199
|
+
<p className="opacity-70 text-xs">The generated configuration is invalid. Check console for details.</p>
|
|
196
200
|
</div>
|
|
197
201
|
);
|
|
198
202
|
}
|
|
@@ -52,7 +52,11 @@ export class LangChainAgent {
|
|
|
52
52
|
|
|
53
53
|
const chartInstruction = `\n\nWhen presenting structured data, statistics, or comparisons, decide if it is best presented as a table or a chart.
|
|
54
54
|
- For tables: use standard Markdown tables.
|
|
55
|
-
- For charts (bar, line, pie): Output a JSON code block with language 'chart'
|
|
55
|
+
- For charts (bar, line, pie): Output a JSON code block with language 'chart'.
|
|
56
|
+
- CRITICAL RULES:
|
|
57
|
+
1. Use ONLY valid JSON (double quotes, no trailing commas).
|
|
58
|
+
2. NO math expressions (e.g., use 100, NOT 50+50).
|
|
59
|
+
3. dataKeys MUST exactly match the property names in the data objects.
|
|
56
60
|
\`\`\`chart
|
|
57
61
|
{
|
|
58
62
|
"type": "bar" | "line" | "pie",
|
package/src/core/Pipeline.ts
CHANGED
|
@@ -102,7 +102,11 @@ export class Pipeline {
|
|
|
102
102
|
// Augment system prompt with Chart/Table instructions if not already present
|
|
103
103
|
const chartInstruction = `\n\nWhen presenting structured data, statistics, or comparisons, decide if it is best presented as a table or a chart.
|
|
104
104
|
- For tables: use standard Markdown tables.
|
|
105
|
-
- For charts (bar, line, pie): Output a JSON code block with language 'chart'
|
|
105
|
+
- For charts (bar, line, pie): Output a JSON code block with language 'chart'.
|
|
106
|
+
- CRITICAL RULES:
|
|
107
|
+
1. Use ONLY valid JSON (double quotes, no trailing commas).
|
|
108
|
+
2. NO math expressions (e.g., use 100, NOT 50+50).
|
|
109
|
+
3. dataKeys MUST exactly match the property names in the data objects.
|
|
106
110
|
\`\`\`chart
|
|
107
111
|
{
|
|
108
112
|
"type": "bar" | "line" | "pie",
|