@akropolys/kiku 1.6.0 → 1.6.2

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.mjs CHANGED
@@ -1323,8 +1323,8 @@ function SourcesCarousel({ sources, defaultCurrency, onSelectSource, referencedI
1323
1323
  const scrollNext = () => {
1324
1324
  railRef.current?.scrollBy({ left: 170, behavior: "smooth" });
1325
1325
  };
1326
- const referenced = sources.filter((s) => s.id && referencedIds.includes(s.id));
1327
- const display = referencedIds.length > 0 ? referenced : sources;
1326
+ const display = sources.filter((s) => s.id && referencedIds.includes(s.id));
1327
+ if (display.length === 0) return null;
1328
1328
  return /* @__PURE__ */ jsxs6("div", { className: "hsk-cb-sources-wrap", children: [
1329
1329
  /* @__PURE__ */ jsx7("div", { className: "hsk-cb-sources", ref: railRef, children: display.map((src, si) => {
1330
1330
  const isReferenced = !!(src.id && referencedIds.includes(src.id));
@@ -1499,6 +1499,9 @@ var getFriendlyError = (err) => {
1499
1499
  if (lower.includes("token limit")) {
1500
1500
  return "You've reached your usage limit. Please update your billing limits in your dashboard to continue.";
1501
1501
  }
1502
+ if (lower.includes("failed to fetch") || lower.includes("networkerror") || lower.includes("request failed")) {
1503
+ return "The assistant couldn't respond just now \u2014 please try again in a moment.";
1504
+ }
1502
1505
  try {
1503
1506
  const parsed = JSON.parse(str);
1504
1507
  return parsed.error || parsed.message || str;
@@ -1956,7 +1959,7 @@ function ChatModal({
1956
1959
  ] });
1957
1960
  })(),
1958
1961
  isLast && lastIntent === "compare" && sources.length >= 2 && !replayMessages && /* @__PURE__ */ jsx7(ComparisonMatrix, { sources, defaultCurrency }),
1959
- isLast && sources.length > 0 && lastIntent !== "compare" && lastAction?.type !== "request_phone" && lastAction?.type !== "awaiting_payment" && lastAction?.type !== "checkout" && !msg.cartSnapshot && /* @__PURE__ */ jsx7(
1962
+ isLast && referencedIds.length > 0 && lastIntent !== "compare" && lastAction?.type !== "request_phone" && lastAction?.type !== "awaiting_payment" && lastAction?.type !== "checkout" && !msg.cartSnapshot && /* @__PURE__ */ jsx7(
1960
1963
  SourcesCarousel,
1961
1964
  {
1962
1965
  sources,
@@ -1985,7 +1988,7 @@ function ChatModal({
1985
1988
  SmartContextPills,
1986
1989
  {
1987
1990
  intent: lastIntent,
1988
- sources,
1991
+ sources: sources.filter((s) => s.id && referencedIds.includes(s.id)),
1989
1992
  onSend: handleSend,
1990
1993
  loading
1991
1994
  }