@aigentyc/chat-sdk 0.5.0 → 0.5.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.
Files changed (81) hide show
  1. package/dist/{ChatInterface-BnVyOUG5.d.cts → ChatInterface-DrzYAWnG.d.cts} +1 -1
  2. package/dist/{ChatInterface-2MN5cpYB.d.ts → ChatInterface-qiVhkmx3.d.ts} +1 -1
  3. package/dist/{SlotsContext-BZBi51ZT.d.ts → SlotsContext-B_087V7B.d.ts} +11 -2
  4. package/dist/{SlotsContext-D_C7zlUA.d.cts → SlotsContext-DAQiASVu.d.cts} +11 -2
  5. package/dist/ai-elements.cjs +27 -27
  6. package/dist/ai-elements.js +2 -2
  7. package/dist/{chunk-KTYYLZN7.cjs → chunk-6CVBJ4EI.cjs} +4 -4
  8. package/dist/{chunk-KTYYLZN7.cjs.map → chunk-6CVBJ4EI.cjs.map} +1 -1
  9. package/dist/{chunk-3MP2EGEJ.cjs → chunk-72QJ2ORD.cjs} +4 -2
  10. package/dist/chunk-72QJ2ORD.cjs.map +1 -0
  11. package/dist/{chunk-P3RPAI4F.cjs → chunk-BYX6IOGX.cjs} +4 -4
  12. package/dist/{chunk-P3RPAI4F.cjs.map → chunk-BYX6IOGX.cjs.map} +1 -1
  13. package/dist/{chunk-5XF3NEFB.js → chunk-CNGIOCLR.js} +3 -3
  14. package/dist/{chunk-5XF3NEFB.js.map → chunk-CNGIOCLR.js.map} +1 -1
  15. package/dist/chunk-CNPYBLLT.js +81 -0
  16. package/dist/chunk-CNPYBLLT.js.map +1 -0
  17. package/dist/{chunk-FJZL33KP.js → chunk-CW6LCVNC.js} +3 -3
  18. package/dist/{chunk-FJZL33KP.js.map → chunk-CW6LCVNC.js.map} +1 -1
  19. package/dist/{chunk-7ESWDFF5.cjs → chunk-DTOOWY2S.cjs} +122 -46
  20. package/dist/chunk-DTOOWY2S.cjs.map +1 -0
  21. package/dist/{chunk-D75TDRBH.js → chunk-JAEXKKSE.js} +41 -35
  22. package/dist/chunk-JAEXKKSE.js.map +1 -0
  23. package/dist/{chunk-Q3UJEIBN.cjs → chunk-JEK2V5I3.cjs} +6 -6
  24. package/dist/{chunk-Q3UJEIBN.cjs.map → chunk-JEK2V5I3.cjs.map} +1 -1
  25. package/dist/{chunk-QYCEHFAB.js → chunk-LDQVDUUJ.js} +4 -2
  26. package/dist/chunk-LDQVDUUJ.js.map +1 -0
  27. package/dist/{chunk-BWWN5LSE.js → chunk-UTEGHMBN.js} +85 -10
  28. package/dist/chunk-UTEGHMBN.js.map +1 -0
  29. package/dist/{chunk-52ZHMTAA.cjs → chunk-UXVOUC2A.cjs} +41 -35
  30. package/dist/chunk-UXVOUC2A.cjs.map +1 -0
  31. package/dist/{chunk-IU7Q7O5G.js → chunk-VQPOUMBC.js} +3 -3
  32. package/dist/{chunk-IU7Q7O5G.js.map → chunk-VQPOUMBC.js.map} +1 -1
  33. package/dist/chunk-VYBHYFG3.cjs +87 -0
  34. package/dist/chunk-VYBHYFG3.cjs.map +1 -0
  35. package/dist/components.cjs +20 -19
  36. package/dist/components.cjs.map +1 -1
  37. package/dist/components.d.cts +2 -2
  38. package/dist/components.d.ts +2 -2
  39. package/dist/components.js +8 -7
  40. package/dist/components.js.map +1 -1
  41. package/dist/core.cjs +21 -82
  42. package/dist/core.cjs.map +1 -1
  43. package/dist/core.d.cts +2 -2
  44. package/dist/core.d.ts +2 -2
  45. package/dist/core.js +2 -78
  46. package/dist/core.js.map +1 -1
  47. package/dist/hooks.cjs +9 -8
  48. package/dist/hooks.cjs.map +1 -1
  49. package/dist/hooks.d.cts +2 -2
  50. package/dist/hooks.d.ts +2 -2
  51. package/dist/hooks.js +4 -3
  52. package/dist/hooks.js.map +1 -1
  53. package/dist/i18n.cjs +5 -5
  54. package/dist/i18n.d.cts +2 -2
  55. package/dist/i18n.d.ts +2 -2
  56. package/dist/i18n.js +1 -1
  57. package/dist/index.cjs +29 -24
  58. package/dist/index.cjs.map +1 -1
  59. package/dist/index.d.cts +15 -5
  60. package/dist/index.d.ts +15 -5
  61. package/dist/index.js +11 -10
  62. package/dist/index.js.map +1 -1
  63. package/dist/llms-full.txt +10 -10
  64. package/dist/styles.css +1 -1
  65. package/dist/theme.cjs +4 -4
  66. package/dist/theme.d.cts +1 -1
  67. package/dist/theme.d.ts +1 -1
  68. package/dist/theme.js +2 -2
  69. package/dist/tools.cjs +6 -5
  70. package/dist/tools.d.cts +2 -2
  71. package/dist/tools.d.ts +2 -2
  72. package/dist/tools.js +3 -2
  73. package/dist/{types-bsR_-fq8.d.cts → types-DRa1zFlN.d.cts} +10 -1
  74. package/dist/{types-bsR_-fq8.d.ts → types-DRa1zFlN.d.ts} +10 -1
  75. package/package.json +2 -2
  76. package/dist/chunk-3MP2EGEJ.cjs.map +0 -1
  77. package/dist/chunk-52ZHMTAA.cjs.map +0 -1
  78. package/dist/chunk-7ESWDFF5.cjs.map +0 -1
  79. package/dist/chunk-BWWN5LSE.js.map +0 -1
  80. package/dist/chunk-D75TDRBH.js.map +0 -1
  81. package/dist/chunk-QYCEHFAB.js.map +0 -1
@@ -2,11 +2,11 @@
2
2
  'use strict';
3
3
 
4
4
  var chunkDVWX2UGY_cjs = require('./chunk-DVWX2UGY.cjs');
5
- var chunkP3RPAI4F_cjs = require('./chunk-P3RPAI4F.cjs');
6
- var chunkKTYYLZN7_cjs = require('./chunk-KTYYLZN7.cjs');
7
- var chunk3MP2EGEJ_cjs = require('./chunk-3MP2EGEJ.cjs');
8
- var chunkQ3UJEIBN_cjs = require('./chunk-Q3UJEIBN.cjs');
9
- var chunk52ZHMTAA_cjs = require('./chunk-52ZHMTAA.cjs');
5
+ var chunkBYX6IOGX_cjs = require('./chunk-BYX6IOGX.cjs');
6
+ var chunk6CVBJ4EI_cjs = require('./chunk-6CVBJ4EI.cjs');
7
+ var chunk72QJ2ORD_cjs = require('./chunk-72QJ2ORD.cjs');
8
+ var chunkJEK2V5I3_cjs = require('./chunk-JEK2V5I3.cjs');
9
+ var chunkUXVOUC2A_cjs = require('./chunk-UXVOUC2A.cjs');
10
10
  var chunk525KS5HM_cjs = require('./chunk-525KS5HM.cjs');
11
11
  var react = require('react');
12
12
  var lucideReact = require('lucide-react');
@@ -30,8 +30,8 @@ var ChatHeader = react.memo(function ChatHeader2({
30
30
  cartCount,
31
31
  onCartClick
32
32
  }) {
33
- const { t, direction } = chunk3MP2EGEJ_cjs.useI18n();
34
- const ctx = chunk52ZHMTAA_cjs.useChatContext();
33
+ const { t, direction } = chunk72QJ2ORD_cjs.useI18n();
34
+ const ctx = chunkUXVOUC2A_cjs.useChatContext();
35
35
  const displayName = clientName || ctx.config.clientName || "AI Assistant";
36
36
  const LogoOrIcon = () => {
37
37
  if (logoUrl) {
@@ -164,7 +164,7 @@ var ChatInput = react.memo(function ChatInput2({
164
164
  }) {
165
165
  const [isFocused, setIsFocused] = react.useState(false);
166
166
  const [isComposing, setIsComposing] = react.useState(false);
167
- const { t, direction } = chunk3MP2EGEJ_cjs.useI18n();
167
+ const { t, direction } = chunk72QJ2ORD_cjs.useI18n();
168
168
  const { ref: textareaRef } = chunkDVWX2UGY_cjs.useAutoResize(value, {
169
169
  minHeight: 24,
170
170
  maxHeight: 160
@@ -265,7 +265,7 @@ var ChatInput = react.memo(function ChatInput2({
265
265
  );
266
266
  });
267
267
  function ChatFooter({ footerText }) {
268
- const { t } = chunk3MP2EGEJ_cjs.useI18n();
268
+ const { t } = chunk72QJ2ORD_cjs.useI18n();
269
269
  return /* @__PURE__ */ jsxRuntime.jsxs(
270
270
  "div",
271
271
  {
@@ -331,7 +331,7 @@ function WelcomePage({
331
331
  questionsLayoutMobile
332
332
  }) {
333
333
  const isMobile = chunkDVWX2UGY_cjs.useIsMobile();
334
- const { t } = chunk3MP2EGEJ_cjs.useI18n();
334
+ const { t } = chunk72QJ2ORD_cjs.useI18n();
335
335
  const layout = isMobile && questionsLayoutMobile ? questionsLayoutMobile : questionsLayout;
336
336
  const isHorizontal = layout === "horizontal";
337
337
  const [shouldAnimate, setShouldAnimate] = react.useState(false);
@@ -495,7 +495,7 @@ function QuickQuestions({ questions, onSelect, isProcessing = false, pageKey })
495
495
  const [dismissed, setDismissed] = react.useState(false);
496
496
  const prevPageKeyRef = react.useRef(pageKey);
497
497
  const scrollRef = react.useRef(null);
498
- const { direction } = chunk3MP2EGEJ_cjs.useI18n();
498
+ const { direction } = chunk72QJ2ORD_cjs.useI18n();
499
499
  react.useEffect(() => {
500
500
  if (prevPageKeyRef.current !== pageKey) {
501
501
  setDismissed(false);
@@ -592,7 +592,7 @@ function decodeHtmlEntities(text) {
592
592
  return text.replace(/&#(\d+);/g, (_, code) => String.fromCharCode(Number(code))).replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&ndash;/g, "\u2013").replace(/&mdash;/g, "\u2014").replace(/&laquo;/g, "\xAB").replace(/&raquo;/g, "\xBB");
593
593
  }
594
594
  function CartDrawer({ storeOrigin, isOpen, onClose, onCartUpdate }) {
595
- const { t } = chunk3MP2EGEJ_cjs.useI18n();
595
+ const { t } = chunk72QJ2ORD_cjs.useI18n();
596
596
  const [cart, setCart] = react.useState(null);
597
597
  const [loading, setLoading] = react.useState(false);
598
598
  const [updatingKeys, setUpdatingKeys] = react.useState(/* @__PURE__ */ new Set());
@@ -795,6 +795,71 @@ function SystemMessage({ message, type }) {
795
795
  const displayMessage = translateMessage(message, type);
796
796
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center my-3", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] text-muted-foreground bg-muted px-4 py-1.5 rounded-full border border-border/50", children: displayMessage }) });
797
797
  }
798
+ function serverMessage(error) {
799
+ const raw = error?.message?.trim();
800
+ if (!raw || !raw.startsWith("{")) return null;
801
+ try {
802
+ const parsed = JSON.parse(raw);
803
+ const message = typeof parsed.error === "string" ? parsed.error.trim() : "";
804
+ return message || null;
805
+ } catch {
806
+ return null;
807
+ }
808
+ }
809
+ function isTerminal(error) {
810
+ const raw = error?.message ?? "";
811
+ if (/too_many_messages|message_too_long|request_too_large/.test(raw)) {
812
+ return true;
813
+ }
814
+ return /conversation too long|request too large|message too long/i.test(raw);
815
+ }
816
+ function ChatError({ error, onRetry, onNewConversation }) {
817
+ const { t, direction } = chunk72QJ2ORD_cjs.useI18n();
818
+ const terminal = isTerminal(error);
819
+ const detail = serverMessage(error);
820
+ return /* @__PURE__ */ jsxRuntime.jsxs(
821
+ "div",
822
+ {
823
+ role: "alert",
824
+ dir: direction,
825
+ className: "mx-auto w-full max-w-[520px] rounded-xl border px-4 py-3 text-sm",
826
+ style: {
827
+ borderColor: "var(--ac-error-border, rgba(220, 38, 38, 0.25))",
828
+ backgroundColor: "var(--ac-error-background, rgba(220, 38, 38, 0.06))",
829
+ color: "var(--ac-foreground, inherit)"
830
+ },
831
+ children: [
832
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-medium", children: terminal ? t("conversationTooLong") : t("somethingWentWrong") }),
833
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 opacity-80", children: detail ?? (terminal ? t("conversationTooLongDesc") : t("somethingWentWrongDesc")) }),
834
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-3 flex flex-wrap gap-2", children: [
835
+ onRetry && !terminal && /* @__PURE__ */ jsxRuntime.jsx(
836
+ "button",
837
+ {
838
+ type: "button",
839
+ onClick: onRetry,
840
+ className: "rounded-lg px-3 py-1.5 text-sm font-medium",
841
+ style: {
842
+ backgroundColor: "var(--ac-primary, #111827)",
843
+ color: "var(--ac-primary-foreground, #ffffff)"
844
+ },
845
+ children: t("tryAgain")
846
+ }
847
+ ),
848
+ /* @__PURE__ */ jsxRuntime.jsx(
849
+ "button",
850
+ {
851
+ type: "button",
852
+ onClick: onNewConversation,
853
+ className: "rounded-lg border px-3 py-1.5 text-sm font-medium",
854
+ style: { borderColor: "var(--ac-border, rgba(0, 0, 0, 0.15))" },
855
+ children: t("startNewConversation")
856
+ }
857
+ )
858
+ ] })
859
+ ]
860
+ }
861
+ );
862
+ }
798
863
  var ChatErrorBoundary = class extends react.Component {
799
864
  state = { error: null };
800
865
  static getDerivedStateFromError(error) {
@@ -905,10 +970,10 @@ function DefaultUserMessage({ text }) {
905
970
  }
906
971
  function ChatInterface(props) {
907
972
  const { showSources = false } = props;
908
- const { messages, status, sendMessage, sessionId, config, newConversation: ctxNewConversation } = chunk52ZHMTAA_cjs.useChatContext();
909
- const { t, direction } = chunk3MP2EGEJ_cjs.useI18n();
910
- chunkP3RPAI4F_cjs.useTheme();
911
- const slots = chunk52ZHMTAA_cjs.useSlots();
973
+ const { messages, status, error, sendMessage, sessionId, config, retryLastTurn, newConversation: ctxNewConversation } = chunkUXVOUC2A_cjs.useChatContext();
974
+ const { t, direction } = chunk72QJ2ORD_cjs.useI18n();
975
+ chunkBYX6IOGX_cjs.useTheme();
976
+ const slots = chunkUXVOUC2A_cjs.useSlots();
912
977
  let liveChat = null;
913
978
  try {
914
979
  liveChat = chunkDVWX2UGY_cjs.useLiveChat();
@@ -982,8 +1047,8 @@ function ChatInterface(props) {
982
1047
  );
983
1048
  if (showWelcome && messages.length === 0) {
984
1049
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full flex-col", dir: direction, style: { backgroundColor: "var(--ac-background)" }, children: [
985
- !props.hideHeader && chunk52ZHMTAA_cjs.renderSlot("header", headerProps, ChatHeader, slots),
986
- chunk52ZHMTAA_cjs.renderSlot(
1050
+ !props.hideHeader && chunkUXVOUC2A_cjs.renderSlot("header", headerProps, ChatHeader, slots),
1051
+ chunkUXVOUC2A_cjs.renderSlot(
987
1052
  "welcomePage",
988
1053
  {
989
1054
  onSelectCategory: handleSelectCategory,
@@ -1002,18 +1067,18 @@ function ChatInterface(props) {
1002
1067
  slots
1003
1068
  ),
1004
1069
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "shrink-0 px-[15px] md:px-[40px]", style: { backgroundColor: "var(--ac-background)" }, children: [
1005
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-auto z-40 w-full", children: chunk52ZHMTAA_cjs.renderSlot(
1070
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-auto z-40 w-full", children: chunkUXVOUC2A_cjs.renderSlot(
1006
1071
  "input",
1007
1072
  { value: input, onChange: setInput, onSubmit: handleSubmit, isProcessing },
1008
1073
  ChatInput,
1009
1074
  slots
1010
1075
  ) }),
1011
- chunk52ZHMTAA_cjs.renderSlot("footer", { footerText: props.footerText }, ChatFooter, slots)
1076
+ chunkUXVOUC2A_cjs.renderSlot("footer", { footerText: props.footerText }, ChatFooter, slots)
1012
1077
  ] })
1013
1078
  ] });
1014
1079
  }
1015
1080
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full flex-col", dir: direction, style: { backgroundColor: "var(--ac-background)" }, children: [
1016
- !props.hideHeader && chunk52ZHMTAA_cjs.renderSlot("header", headerProps, ChatHeader, slots),
1081
+ !props.hideHeader && chunkUXVOUC2A_cjs.renderSlot("header", headerProps, ChatHeader, slots),
1017
1082
  storeOrigin && /* @__PURE__ */ jsxRuntime.jsx(
1018
1083
  CartDrawer,
1019
1084
  {
@@ -1023,12 +1088,12 @@ function ChatInterface(props) {
1023
1088
  onCartUpdate: (count) => setCartCount(count)
1024
1089
  }
1025
1090
  ),
1026
- /* @__PURE__ */ jsxRuntime.jsx(chunkKTYYLZN7_cjs.Conversation, { className: "flex-1", children: /* @__PURE__ */ jsxRuntime.jsxs(chunkKTYYLZN7_cjs.ConversationContent, { className: "px-[15px] md:px-[40px] py-6 sm:py-8 w-full space-y-6", children: [
1027
- messages.length === 0 && chunk52ZHMTAA_cjs.renderSlot("emptyState", {}, chunkKTYYLZN7_cjs.ConversationEmptyState, slots),
1091
+ /* @__PURE__ */ jsxRuntime.jsx(chunk6CVBJ4EI_cjs.Conversation, { className: "flex-1", children: /* @__PURE__ */ jsxRuntime.jsxs(chunk6CVBJ4EI_cjs.ConversationContent, { className: "px-[15px] md:px-[40px] py-6 sm:py-8 w-full space-y-6", children: [
1092
+ messages.length === 0 && chunkUXVOUC2A_cjs.renderSlot("emptyState", {}, chunk6CVBJ4EI_cjs.ConversationEmptyState, slots),
1028
1093
  messages.map((message, messageIndex) => {
1029
1094
  if (hideFirstUserMessage && messageIndex === 0 && message.role === "user") return null;
1030
1095
  if (message.role === "system") {
1031
- return /* @__PURE__ */ jsxRuntime.jsx("div", { children: chunk52ZHMTAA_cjs.renderSlot("systemMessage", { message: message.content }, SystemMessage, slots) }, message.id);
1096
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { children: chunkUXVOUC2A_cjs.renderSlot("systemMessage", { message: message.content }, SystemMessage, slots) }, message.id);
1032
1097
  }
1033
1098
  return /* @__PURE__ */ jsxRuntime.jsxs(
1034
1099
  "div",
@@ -1036,11 +1101,11 @@ function ChatInterface(props) {
1036
1101
  className: `group ${message.role === "assistant" ? "is-assistant" : "is-user"}`,
1037
1102
  children: [
1038
1103
  /* @__PURE__ */ jsxRuntime.jsx(
1039
- chunkKTYYLZN7_cjs.MessageAttachments,
1104
+ chunk6CVBJ4EI_cjs.MessageAttachments,
1040
1105
  {
1041
1106
  className: message.role === "user" ? "mb-2" : "mr-auto ml-0 mb-2",
1042
1107
  children: (message.parts || []).filter((p) => p.type === "file" && p.url).map((p, i) => /* @__PURE__ */ jsxRuntime.jsx(
1043
- chunkKTYYLZN7_cjs.MessageAttachment,
1108
+ chunk6CVBJ4EI_cjs.MessageAttachment,
1044
1109
  {
1045
1110
  className: "size-32",
1046
1111
  data: {
@@ -1067,9 +1132,9 @@ function ChatInterface(props) {
1067
1132
  })().map((part, i) => {
1068
1133
  if (part.type === "text") {
1069
1134
  if (message.role === "assistant") {
1070
- return /* @__PURE__ */ jsxRuntime.jsx("div", { children: chunk52ZHMTAA_cjs.renderSlot("assistantMessage", { message, partIndex: i, text: part.text || "" }, DefaultAssistantMessage, slots) }, `${message.id}-${i}`);
1135
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { children: chunkUXVOUC2A_cjs.renderSlot("assistantMessage", { message, partIndex: i, text: part.text || "" }, DefaultAssistantMessage, slots) }, `${message.id}-${i}`);
1071
1136
  }
1072
- return /* @__PURE__ */ jsxRuntime.jsx("div", { children: chunk52ZHMTAA_cjs.renderSlot("userMessage", { message, partIndex: i, text: part.text || "" }, DefaultUserMessage, slots) }, `${message.id}-${i}`);
1137
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { children: chunkUXVOUC2A_cjs.renderSlot("userMessage", { message, partIndex: i, text: part.text || "" }, DefaultUserMessage, slots) }, `${message.id}-${i}`);
1073
1138
  }
1074
1139
  if (part.type.startsWith("tool-")) {
1075
1140
  const toolName = part.type.replace("tool-", "");
@@ -1087,7 +1152,7 @@ function ChatInterface(props) {
1087
1152
  {
1088
1153
  label: `tool "${toolName}"`,
1089
1154
  children: /* @__PURE__ */ jsxRuntime.jsx(
1090
- chunkQ3UJEIBN_cjs.ToolRenderer,
1155
+ chunkJEK2V5I3_cjs.ToolRenderer,
1091
1156
  {
1092
1157
  toolName,
1093
1158
  state: part.state ?? "output-available",
@@ -1106,10 +1171,10 @@ function ChatInterface(props) {
1106
1171
  showSources && message.role === "assistant" && (() => {
1107
1172
  const kbSources = extractKbSources(message.parts);
1108
1173
  if (kbSources.length === 0) return null;
1109
- return /* @__PURE__ */ jsxRuntime.jsxs(chunkKTYYLZN7_cjs.Sources, { children: [
1110
- /* @__PURE__ */ jsxRuntime.jsx(chunkKTYYLZN7_cjs.SourcesTrigger, { count: kbSources.length }),
1111
- /* @__PURE__ */ jsxRuntime.jsx(chunkKTYYLZN7_cjs.SourcesContent, { children: kbSources.map((s, idx) => /* @__PURE__ */ jsxRuntime.jsx(
1112
- chunkKTYYLZN7_cjs.Source,
1174
+ return /* @__PURE__ */ jsxRuntime.jsxs(chunk6CVBJ4EI_cjs.Sources, { children: [
1175
+ /* @__PURE__ */ jsxRuntime.jsx(chunk6CVBJ4EI_cjs.SourcesTrigger, { count: kbSources.length }),
1176
+ /* @__PURE__ */ jsxRuntime.jsx(chunk6CVBJ4EI_cjs.SourcesContent, { children: kbSources.map((s, idx) => /* @__PURE__ */ jsxRuntime.jsx(
1177
+ chunk6CVBJ4EI_cjs.Source,
1113
1178
  {
1114
1179
  href: s.sourceUrl ?? "#",
1115
1180
  title: s.documentName || s.pageTitle || `Source ${idx + 1}`
@@ -1118,14 +1183,14 @@ function ChatInterface(props) {
1118
1183
  )) })
1119
1184
  ] });
1120
1185
  })(),
1121
- message.role === "assistant" && chunk52ZHMTAA_cjs.renderSlot("feedback", {
1186
+ message.role === "assistant" && chunkUXVOUC2A_cjs.renderSlot("feedback", {
1122
1187
  messageId: message.id,
1123
1188
  projectId: config.projectId,
1124
1189
  sessionId,
1125
1190
  apiKey: config.apiKey,
1126
1191
  apiEndpoint: config.apiEndpoint,
1127
1192
  textContent: (message.parts || []).filter((p) => p.type === "text").map((p) => p.text || "").join("\n") || (typeof message.content === "string" ? message.content : "")
1128
- }, chunkKTYYLZN7_cjs.MessageFeedback, slots)
1193
+ }, chunk6CVBJ4EI_cjs.MessageFeedback, slots)
1129
1194
  ]
1130
1195
  },
1131
1196
  message.id
@@ -1139,7 +1204,17 @@ function ChatInterface(props) {
1139
1204
  );
1140
1205
  const allToolsComplete = (lastMessage.parts || []).filter((p) => p.type.startsWith("tool-")).every((p) => p.state === "output-available");
1141
1206
  return allToolsComplete && !hasText;
1142
- })() && /* @__PURE__ */ jsxRuntime.jsx(chunkKTYYLZN7_cjs.Loader, { text: t("thinking") })
1207
+ })() && /* @__PURE__ */ jsxRuntime.jsx(chunk6CVBJ4EI_cjs.Loader, { text: t("thinking") }),
1208
+ status === "error" && chunkUXVOUC2A_cjs.renderSlot(
1209
+ "error",
1210
+ {
1211
+ error,
1212
+ onRetry: retryLastTurn,
1213
+ onNewConversation: handleNewConversation
1214
+ },
1215
+ ChatError,
1216
+ slots
1217
+ )
1143
1218
  ] }) }),
1144
1219
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "shrink-0 px-[15px] md:px-[40px] pb-2", style: { backgroundColor: "var(--ac-background)" }, children: [
1145
1220
  props.pageQuestions && props.pageQuestions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
@@ -1152,7 +1227,7 @@ function ChatInterface(props) {
1152
1227
  }
1153
1228
  ),
1154
1229
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mx-auto z-40 w-full flex items-end gap-2", children: [
1155
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1", children: chunk52ZHMTAA_cjs.renderSlot(
1230
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1", children: chunkUXVOUC2A_cjs.renderSlot(
1156
1231
  "input",
1157
1232
  { value: input, onChange: setInput, onSubmit: handleSubmit, isProcessing },
1158
1233
  ChatInput,
@@ -1169,7 +1244,7 @@ function ChatInterface(props) {
1169
1244
  }
1170
1245
  )
1171
1246
  ] }),
1172
- chunk52ZHMTAA_cjs.renderSlot("footer", { footerText: props.footerText }, ChatFooter, slots)
1247
+ chunkUXVOUC2A_cjs.renderSlot("footer", { footerText: props.footerText }, ChatFooter, slots)
1173
1248
  ] }),
1174
1249
  /* @__PURE__ */ jsxRuntime.jsx("span", { "data-session-id": sessionId, className: "hidden" })
1175
1250
  ] });
@@ -1202,7 +1277,7 @@ function FloatingButton({
1202
1277
  hideGreeting = false
1203
1278
  }) {
1204
1279
  const [showGreeting, setShowGreeting] = react.useState(false);
1205
- const { t, direction } = chunk3MP2EGEJ_cjs.useI18n();
1280
+ const { t, direction } = chunk72QJ2ORD_cjs.useI18n();
1206
1281
  const isRtl = direction === "rtl";
1207
1282
  const effectiveGreeting = greeting || t("greeting");
1208
1283
  const [greetingDismissed, setGreetingDismissed] = react.useState(false);
@@ -1375,7 +1450,7 @@ function LiveChatPanel({ isWidgetOpen, isRightSide, zIndex }) {
1375
1450
  }
1376
1451
  function MobileLiveChatDrawer() {
1377
1452
  const lc = chunkDVWX2UGY_cjs.useLiveChat();
1378
- const { t } = chunk3MP2EGEJ_cjs.useI18n();
1453
+ const { t } = chunk72QJ2ORD_cjs.useI18n();
1379
1454
  if (!lc) return null;
1380
1455
  const isActive = lc.state !== "ai" || lc.showIdentityForm;
1381
1456
  const [minimized, setMinimized] = react.useState(false);
@@ -1456,7 +1531,7 @@ function isValidEmail(email) {
1456
1531
  }
1457
1532
  function IdentityView() {
1458
1533
  const lc = useLiveChatOrThrow();
1459
- const { t, direction } = chunk3MP2EGEJ_cjs.useI18n();
1534
+ const { t, direction } = chunk72QJ2ORD_cjs.useI18n();
1460
1535
  const userInfo = lc.userInfo;
1461
1536
  const [name, setName] = react.useState(userInfo?.name || "");
1462
1537
  const [email, setEmail] = react.useState(userInfo?.email || "");
@@ -1534,7 +1609,7 @@ function IdentityView() {
1534
1609
  }
1535
1610
  function QueueView() {
1536
1611
  const lc = useLiveChatOrThrow();
1537
- const { t, direction } = chunk3MP2EGEJ_cjs.useI18n();
1612
+ const { t, direction } = chunk72QJ2ORD_cjs.useI18n();
1538
1613
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 flex flex-col items-center justify-center p-8 text-center", dir: direction, children: [
1539
1614
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-16 w-16 rounded-2xl bg-blue-50 flex items-center justify-center mb-4", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Headset, { className: "h-8 w-8 text-blue-500" }) }),
1540
1615
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-2 w-2 rounded-full bg-blue-500 animate-pulse mb-4" }),
@@ -1553,7 +1628,7 @@ function QueueView() {
1553
1628
  }
1554
1629
  function ChatView() {
1555
1630
  const lc = useLiveChatOrThrow();
1556
- const { t, language, direction } = chunk3MP2EGEJ_cjs.useI18n();
1631
+ const { t, language, direction } = chunk72QJ2ORD_cjs.useI18n();
1557
1632
  const [input, setInput] = react.useState("");
1558
1633
  const messagesEndRef = react.useRef(null);
1559
1634
  const isRTL = direction === "rtl";
@@ -1660,7 +1735,7 @@ function ChatView() {
1660
1735
  }
1661
1736
  function EndedView() {
1662
1737
  const lc = useLiveChatOrThrow();
1663
- const { t, direction } = chunk3MP2EGEJ_cjs.useI18n();
1738
+ const { t, direction } = chunk72QJ2ORD_cjs.useI18n();
1664
1739
  const [selected, setSelected] = react.useState(null);
1665
1740
  const [comment, setComment] = react.useState("");
1666
1741
  const [submitted, setSubmitted] = react.useState(false);
@@ -1808,6 +1883,7 @@ function PreviewEmbedPanel({ isOpen, isRightSide, zIndex }) {
1808
1883
  }
1809
1884
 
1810
1885
  exports.CartDrawer = CartDrawer;
1886
+ exports.ChatError = ChatError;
1811
1887
  exports.ChatErrorBoundary = ChatErrorBoundary;
1812
1888
  exports.ChatFooter = ChatFooter;
1813
1889
  exports.ChatHeader = ChatHeader;
@@ -1820,5 +1896,5 @@ exports.PreviewEmbedPanel = PreviewEmbedPanel;
1820
1896
  exports.QuickQuestions = QuickQuestions;
1821
1897
  exports.SystemMessage = SystemMessage;
1822
1898
  exports.WelcomePage = WelcomePage;
1823
- //# sourceMappingURL=chunk-7ESWDFF5.cjs.map
1824
- //# sourceMappingURL=chunk-7ESWDFF5.cjs.map
1899
+ //# sourceMappingURL=chunk-DTOOWY2S.cjs.map
1900
+ //# sourceMappingURL=chunk-DTOOWY2S.cjs.map