@retrivora-ai/rag-engine 1.7.0 → 1.7.1
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 +14 -8
- package/dist/index.mjs +14 -8
- package/package.json +1 -1
- package/src/components/MessageBubble.tsx +25 -11
package/dist/index.js
CHANGED
|
@@ -828,20 +828,26 @@ function MessageBubble({
|
|
|
828
828
|
return { productsFromContent: products, cleanContent: content.trim() };
|
|
829
829
|
}, [message.content, isUser, structuredContent]);
|
|
830
830
|
const allProducts = import_react5.default.useMemo(() => {
|
|
831
|
-
if (productsFromContent.length > 0) return productsFromContent;
|
|
832
831
|
const seen = /* @__PURE__ */ new Set();
|
|
832
|
+
const merged = [];
|
|
833
|
+
for (const p of productsFromContent) {
|
|
834
|
+
const id = String(p.id || p.name);
|
|
835
|
+
if (!seen.has(id)) {
|
|
836
|
+
seen.add(id);
|
|
837
|
+
merged.push(p);
|
|
838
|
+
}
|
|
839
|
+
}
|
|
833
840
|
const contentLower = message.content.toLowerCase();
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
if (seen.has(id)) return false;
|
|
841
|
+
for (const p of productsFromSources) {
|
|
842
|
+
const id = String(p.id || p.name);
|
|
843
|
+
if (seen.has(id)) continue;
|
|
838
844
|
const mentioned = contentLower.includes(p.name.toLowerCase()) || (p.brand ? contentLower.includes(p.brand.toLowerCase()) : false);
|
|
839
845
|
if (mentioned) {
|
|
840
846
|
seen.add(id);
|
|
841
|
-
|
|
847
|
+
merged.push(p);
|
|
842
848
|
}
|
|
843
|
-
|
|
844
|
-
|
|
849
|
+
}
|
|
850
|
+
return merged;
|
|
845
851
|
}, [productsFromSources, productsFromContent, message.content]);
|
|
846
852
|
const processedMarkdown = import_react5.default.useMemo(() => {
|
|
847
853
|
let raw = structuredContent.payload ? structuredContent.text : cleanContent || message.content;
|
package/dist/index.mjs
CHANGED
|
@@ -791,20 +791,26 @@ function MessageBubble({
|
|
|
791
791
|
return { productsFromContent: products, cleanContent: content.trim() };
|
|
792
792
|
}, [message.content, isUser, structuredContent]);
|
|
793
793
|
const allProducts = React5.useMemo(() => {
|
|
794
|
-
if (productsFromContent.length > 0) return productsFromContent;
|
|
795
794
|
const seen = /* @__PURE__ */ new Set();
|
|
795
|
+
const merged = [];
|
|
796
|
+
for (const p of productsFromContent) {
|
|
797
|
+
const id = String(p.id || p.name);
|
|
798
|
+
if (!seen.has(id)) {
|
|
799
|
+
seen.add(id);
|
|
800
|
+
merged.push(p);
|
|
801
|
+
}
|
|
802
|
+
}
|
|
796
803
|
const contentLower = message.content.toLowerCase();
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
if (seen.has(id)) return false;
|
|
804
|
+
for (const p of productsFromSources) {
|
|
805
|
+
const id = String(p.id || p.name);
|
|
806
|
+
if (seen.has(id)) continue;
|
|
801
807
|
const mentioned = contentLower.includes(p.name.toLowerCase()) || (p.brand ? contentLower.includes(p.brand.toLowerCase()) : false);
|
|
802
808
|
if (mentioned) {
|
|
803
809
|
seen.add(id);
|
|
804
|
-
|
|
810
|
+
merged.push(p);
|
|
805
811
|
}
|
|
806
|
-
|
|
807
|
-
|
|
812
|
+
}
|
|
813
|
+
return merged;
|
|
808
814
|
}, [productsFromSources, productsFromContent, message.content]);
|
|
809
815
|
const processedMarkdown = React5.useMemo(() => {
|
|
810
816
|
let raw = structuredContent.payload ? structuredContent.text : cleanContent || message.content;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@retrivora-ai/rag-engine",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.1",
|
|
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",
|
|
@@ -703,20 +703,34 @@ export function MessageBubble({
|
|
|
703
703
|
|
|
704
704
|
// ── Merge & deduplicate products ───────────────────────────────────────────
|
|
705
705
|
const allProducts = React.useMemo<Product[]>(() => {
|
|
706
|
-
if (productsFromContent.length > 0) return productsFromContent;
|
|
707
|
-
|
|
708
706
|
const seen = new Set<string>();
|
|
707
|
+
const merged: Product[] = [];
|
|
708
|
+
|
|
709
|
+
// 1. Add products extracted from the LLM content (highest priority)
|
|
710
|
+
for (const p of productsFromContent) {
|
|
711
|
+
const id = String(p.id || p.name);
|
|
712
|
+
if (!seen.has(id)) {
|
|
713
|
+
seen.add(id);
|
|
714
|
+
merged.push(p);
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
// 2. Add products from sources that were mentioned in the text
|
|
709
719
|
const contentLower = message.content.toLowerCase();
|
|
720
|
+
for (const p of productsFromSources) {
|
|
721
|
+
const id = String(p.id || p.name);
|
|
722
|
+
if (seen.has(id)) continue;
|
|
723
|
+
|
|
724
|
+
const mentioned = contentLower.includes(p.name.toLowerCase()) ||
|
|
725
|
+
(p.brand ? contentLower.includes(p.brand.toLowerCase()) : false);
|
|
726
|
+
|
|
727
|
+
if (mentioned) {
|
|
728
|
+
seen.add(id);
|
|
729
|
+
merged.push(p);
|
|
730
|
+
}
|
|
731
|
+
}
|
|
710
732
|
|
|
711
|
-
return
|
|
712
|
-
const id = String(p.id ?? p.name);
|
|
713
|
-
if (seen.has(id)) return false;
|
|
714
|
-
const mentioned =
|
|
715
|
-
contentLower.includes(p.name.toLowerCase()) ||
|
|
716
|
-
(p.brand ? contentLower.includes(p.brand.toLowerCase()) : false);
|
|
717
|
-
if (mentioned) { seen.add(id); return true; }
|
|
718
|
-
return false;
|
|
719
|
-
});
|
|
733
|
+
return merged;
|
|
720
734
|
}, [productsFromSources, productsFromContent, message.content]);
|
|
721
735
|
|
|
722
736
|
const processedMarkdown = React.useMemo(() => {
|