@retrivora-ai/rag-engine 2.0.7 → 2.0.8

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
@@ -4401,7 +4401,7 @@ ${schemaProfileText}` : ""}`;
4401
4401
  }
4402
4402
  // ─── Transform Helpers ────────────────────────────────────────────────────
4403
4403
  static transformToProductCarousel(data, config, trainedSchema) {
4404
- const products = data.map((item) => this.extractProductInfo(item, config, trainedSchema)).filter((p) => p !== null).slice(0, 15);
4404
+ const products = data.map((item) => this.extractProductInfo(item, config, trainedSchema)).filter((p) => p !== null);
4405
4405
  return {
4406
4406
  type: "product_carousel",
4407
4407
  title: "Recommended Products",
@@ -4781,7 +4781,8 @@ ${schemaProfileText}` : ""}`;
4781
4781
  return fieldCount.size > 2;
4782
4782
  }
4783
4783
  static profileData(data) {
4784
- const records = data.map((item) => {
4784
+ const records = (data || []).filter((item) => Boolean(item && typeof item === "object")).map((item) => {
4785
+ var _a, _b;
4785
4786
  const fields2 = {};
4786
4787
  Object.entries(item.metadata || {}).forEach(([key, value]) => {
4787
4788
  const primitive = this.toPrimitive(value);
@@ -4790,8 +4791,8 @@ ${schemaProfileText}` : ""}`;
4790
4791
  if (!fields2.content && item.content) fields2.content = item.content.substring(0, 500);
4791
4792
  return {
4792
4793
  id: item.id,
4793
- content: item.content,
4794
- score: item.score,
4794
+ content: (_a = item.content) != null ? _a : "",
4795
+ score: (_b = item.score) != null ? _b : 0,
4795
4796
  fields: fields2,
4796
4797
  source: item
4797
4798
  };
package/dist/index.mjs CHANGED
@@ -4403,7 +4403,7 @@ ${schemaProfileText}` : ""}`;
4403
4403
  }
4404
4404
  // ─── Transform Helpers ────────────────────────────────────────────────────
4405
4405
  static transformToProductCarousel(data, config, trainedSchema) {
4406
- const products = data.map((item) => this.extractProductInfo(item, config, trainedSchema)).filter((p) => p !== null).slice(0, 15);
4406
+ const products = data.map((item) => this.extractProductInfo(item, config, trainedSchema)).filter((p) => p !== null);
4407
4407
  return {
4408
4408
  type: "product_carousel",
4409
4409
  title: "Recommended Products",
@@ -4783,7 +4783,8 @@ ${schemaProfileText}` : ""}`;
4783
4783
  return fieldCount.size > 2;
4784
4784
  }
4785
4785
  static profileData(data) {
4786
- const records = data.map((item) => {
4786
+ const records = (data || []).filter((item) => Boolean(item && typeof item === "object")).map((item) => {
4787
+ var _a, _b;
4787
4788
  const fields2 = {};
4788
4789
  Object.entries(item.metadata || {}).forEach(([key, value]) => {
4789
4790
  const primitive = this.toPrimitive(value);
@@ -4792,8 +4793,8 @@ ${schemaProfileText}` : ""}`;
4792
4793
  if (!fields2.content && item.content) fields2.content = item.content.substring(0, 500);
4793
4794
  return {
4794
4795
  id: item.id,
4795
- content: item.content,
4796
- score: item.score,
4796
+ content: (_a = item.content) != null ? _a : "",
4797
+ score: (_b = item.score) != null ? _b : 0,
4797
4798
  fields: fields2,
4798
4799
  source: item
4799
4800
  };