@copilotkit/react-ui 1.10.4-next.2 → 1.10.4

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 (60) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/{chunk-KCRWXHWT.mjs → chunk-DII7M2HW.mjs} +2 -2
  3. package/dist/{chunk-FJFWH5AF.mjs → chunk-GKIR7J5D.mjs} +7 -7
  4. package/dist/{chunk-PHH6DYUW.mjs → chunk-NGA4T3VT.mjs} +3 -3
  5. package/dist/chunk-NGA4T3VT.mjs.map +1 -0
  6. package/dist/{chunk-Z66Y3KRE.mjs → chunk-NJY6RHHQ.mjs} +8 -11
  7. package/dist/chunk-NJY6RHHQ.mjs.map +1 -0
  8. package/dist/{chunk-YO63WHVQ.mjs → chunk-SP2PFXCH.mjs} +2 -2
  9. package/dist/{chunk-QQDCZRPA.mjs → chunk-TNN2ZGO6.mjs} +2 -2
  10. package/dist/{chunk-GDSZGYCE.mjs → chunk-V6DDX4LH.mjs} +2 -2
  11. package/dist/{chunk-FFJHOZX6.mjs → chunk-WBPBTTQD.mjs} +4 -4
  12. package/dist/{chunk-LJAYSRCB.mjs → chunk-WRQST6DJ.mjs} +4 -4
  13. package/dist/components/chat/Chat.js +47 -99
  14. package/dist/components/chat/Chat.js.map +1 -1
  15. package/dist/components/chat/Chat.mjs +5 -6
  16. package/dist/components/chat/Header.mjs +4 -4
  17. package/dist/components/chat/Messages.js +1 -1
  18. package/dist/components/chat/Messages.js.map +1 -1
  19. package/dist/components/chat/Messages.mjs +4 -4
  20. package/dist/components/chat/Modal.js +61 -113
  21. package/dist/components/chat/Modal.js.map +1 -1
  22. package/dist/components/chat/Modal.mjs +10 -11
  23. package/dist/components/chat/Popup.js +63 -115
  24. package/dist/components/chat/Popup.js.map +1 -1
  25. package/dist/components/chat/Popup.mjs +11 -12
  26. package/dist/components/chat/Sidebar.js +65 -117
  27. package/dist/components/chat/Sidebar.js.map +1 -1
  28. package/dist/components/chat/Sidebar.mjs +11 -12
  29. package/dist/components/chat/index.js +67 -119
  30. package/dist/components/chat/index.js.map +1 -1
  31. package/dist/components/chat/index.mjs +14 -15
  32. package/dist/components/chat/messages/ErrorMessage.mjs +57 -4
  33. package/dist/components/chat/messages/ErrorMessage.mjs.map +1 -1
  34. package/dist/components/chat/messages/LegacyRenderMessage.mjs +3 -3
  35. package/dist/components/chat/messages/RenderMessage.mjs +2 -2
  36. package/dist/components/chat/props.d.ts +1 -1
  37. package/dist/components/chat/props.js.map +1 -1
  38. package/dist/components/dev-console/console.mjs +3 -3
  39. package/dist/components/dev-console/index.mjs +4 -4
  40. package/dist/components/index.js +67 -119
  41. package/dist/components/index.js.map +1 -1
  42. package/dist/components/index.mjs +15 -16
  43. package/dist/index.js +69 -121
  44. package/dist/index.js.map +1 -1
  45. package/dist/index.mjs +15 -16
  46. package/package.json +4 -4
  47. package/src/components/chat/Chat.tsx +1 -2
  48. package/src/components/chat/Messages.tsx +1 -1
  49. package/src/components/chat/props.ts +1 -1
  50. package/dist/chunk-PHH6DYUW.mjs.map +0 -1
  51. package/dist/chunk-SRY5COHG.mjs +0 -63
  52. package/dist/chunk-SRY5COHG.mjs.map +0 -1
  53. package/dist/chunk-Z66Y3KRE.mjs.map +0 -1
  54. /package/dist/{chunk-KCRWXHWT.mjs.map → chunk-DII7M2HW.mjs.map} +0 -0
  55. /package/dist/{chunk-FJFWH5AF.mjs.map → chunk-GKIR7J5D.mjs.map} +0 -0
  56. /package/dist/{chunk-YO63WHVQ.mjs.map → chunk-SP2PFXCH.mjs.map} +0 -0
  57. /package/dist/{chunk-QQDCZRPA.mjs.map → chunk-TNN2ZGO6.mjs.map} +0 -0
  58. /package/dist/{chunk-GDSZGYCE.mjs.map → chunk-V6DDX4LH.mjs.map} +0 -0
  59. /package/dist/{chunk-FFJHOZX6.mjs.map → chunk-WBPBTTQD.mjs.map} +0 -0
  60. /package/dist/{chunk-LJAYSRCB.mjs.map → chunk-WRQST6DJ.mjs.map} +0 -0
@@ -1242,7 +1242,7 @@ var Messages = ({
1242
1242
  RenderMessage: RenderMessage2,
1243
1243
  AssistantMessage: AssistantMessage2,
1244
1244
  UserMessage: UserMessage2,
1245
- ErrorMessage: ErrorMessage2,
1245
+ ErrorMessage,
1246
1246
  ImageRenderer: ImageRenderer2,
1247
1247
  onRegenerate,
1248
1248
  onCopy,
@@ -1311,7 +1311,7 @@ var Messages = ({
1311
1311
  );
1312
1312
  }),
1313
1313
  interrupt,
1314
- chatError && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ErrorMessage2, { error: chatError, isCurrentMessage: true })
1314
+ chatError && ErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ErrorMessage, { error: chatError, isCurrentMessage: true })
1315
1315
  ] }),
1316
1316
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("footer", { className: "copilotKitMessagesFooter", ref: messagesEndRef, children })
1317
1317
  ] });
@@ -1694,67 +1694,15 @@ var Input = ({
1694
1694
  ] });
1695
1695
  };
1696
1696
 
1697
- // src/components/chat/messages/ErrorMessage.tsx
1698
- var import_react10 = require("react");
1699
- var import_jsx_runtime14 = require("react/jsx-runtime");
1700
- var ErrorMessage = (props) => {
1701
- const { icons, labels } = useChatContext();
1702
- const { error, onRegenerate, onCopy, isCurrentMessage } = props;
1703
- const [copied, setCopied] = (0, import_react10.useState)(false);
1704
- const handleCopy = () => {
1705
- const content = error.message;
1706
- if (content && onCopy) {
1707
- navigator.clipboard.writeText(content);
1708
- setCopied(true);
1709
- onCopy(content);
1710
- setTimeout(() => setCopied(false), 2e3);
1711
- } else if (content) {
1712
- navigator.clipboard.writeText(content);
1713
- setCopied(true);
1714
- setTimeout(() => setCopied(false), 2e3);
1715
- }
1716
- };
1717
- const handleRegenerate = () => {
1718
- if (onRegenerate)
1719
- onRegenerate();
1720
- };
1721
- console.log(error);
1722
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "copilotKitMessage copilotKitAssistantMessage", children: [
1723
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Markdown, { content: error.message }),
1724
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: `copilotKitMessageControls ${isCurrentMessage ? "currentMessage" : ""}`, children: [
1725
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1726
- "button",
1727
- {
1728
- className: "copilotKitMessageControlButton",
1729
- onClick: handleRegenerate,
1730
- "aria-label": labels.regenerateResponse,
1731
- title: labels.regenerateResponse,
1732
- children: icons.regenerateIcon
1733
- }
1734
- ),
1735
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1736
- "button",
1737
- {
1738
- className: "copilotKitMessageControlButton",
1739
- onClick: handleCopy,
1740
- "aria-label": labels.copyToClipboard,
1741
- title: labels.copyToClipboard,
1742
- children: copied ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { fontSize: "10px", fontWeight: "bold" }, children: "\u2713" }) : icons.copyIcon
1743
- }
1744
- )
1745
- ] })
1746
- ] });
1747
- };
1748
-
1749
1697
  // src/components/chat/Chat.tsx
1750
- var import_react11 = __toESM(require("react"));
1698
+ var import_react10 = __toESM(require("react"));
1751
1699
  var import_react_core5 = require("@copilotkit/react-core");
1752
1700
  var import_shared = require("@copilotkit/shared");
1753
1701
  var import_shared2 = require("@copilotkit/shared");
1754
1702
  var import_react_core6 = require("@copilotkit/react-core");
1755
1703
 
1756
1704
  // src/components/chat/ImageUploadQueue.tsx
1757
- var import_jsx_runtime15 = require("react/jsx-runtime");
1705
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1758
1706
  var ImageUploadQueue = ({
1759
1707
  images,
1760
1708
  onRemoveImage,
@@ -1762,7 +1710,7 @@ var ImageUploadQueue = ({
1762
1710
  }) => {
1763
1711
  if (images.length === 0)
1764
1712
  return null;
1765
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1713
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1766
1714
  "div",
1767
1715
  {
1768
1716
  className: `copilotKitImageUploadQueue ${className}`,
@@ -1773,7 +1721,7 @@ var ImageUploadQueue = ({
1773
1721
  margin: "8px",
1774
1722
  padding: "8px"
1775
1723
  },
1776
- children: images.map((image, index) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
1724
+ children: images.map((image, index) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
1777
1725
  "div",
1778
1726
  {
1779
1727
  className: "copilotKitImageUploadQueueItem",
@@ -1786,7 +1734,7 @@ var ImageUploadQueue = ({
1786
1734
  overflow: "hidden"
1787
1735
  },
1788
1736
  children: [
1789
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1737
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1790
1738
  "img",
1791
1739
  {
1792
1740
  src: `data:${image.contentType};base64,${image.bytes}`,
@@ -1798,7 +1746,7 @@ var ImageUploadQueue = ({
1798
1746
  }
1799
1747
  }
1800
1748
  ),
1801
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1749
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1802
1750
  "button",
1803
1751
  {
1804
1752
  onClick: () => onRemoveImage(index),
@@ -1833,12 +1781,12 @@ var ImageUploadQueue = ({
1833
1781
 
1834
1782
  // src/components/chat/Suggestion.tsx
1835
1783
  var import_react_core4 = require("@copilotkit/react-core");
1836
- var import_jsx_runtime16 = require("react/jsx-runtime");
1784
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1837
1785
  function Suggestion({ title, onClick, partial, className }) {
1838
1786
  if (!title)
1839
1787
  return null;
1840
1788
  const { isLoading } = (0, import_react_core4.useCopilotChatInternal)();
1841
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1789
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1842
1790
  "button",
1843
1791
  {
1844
1792
  disabled: partial || isLoading,
@@ -1848,15 +1796,15 @@ function Suggestion({ title, onClick, partial, className }) {
1848
1796
  },
1849
1797
  className: className || (partial ? "suggestion loading" : "suggestion"),
1850
1798
  "data-test-id": "suggestion",
1851
- children: partial ? SmallSpinnerIcon : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: title })
1799
+ children: partial ? SmallSpinnerIcon : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: title })
1852
1800
  }
1853
1801
  );
1854
1802
  }
1855
1803
 
1856
1804
  // src/components/chat/Suggestions.tsx
1857
- var import_jsx_runtime17 = require("react/jsx-runtime");
1805
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1858
1806
  function Suggestions({ suggestions, onSuggestionClick }) {
1859
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "suggestions", children: suggestions.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1807
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "suggestions", children: suggestions.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1860
1808
  Suggestion,
1861
1809
  {
1862
1810
  title: suggestion.title,
@@ -1870,7 +1818,7 @@ function Suggestions({ suggestions, onSuggestionClick }) {
1870
1818
  }
1871
1819
 
1872
1820
  // src/components/chat/Chat.tsx
1873
- var import_jsx_runtime18 = require("react/jsx-runtime");
1821
+ var import_jsx_runtime17 = require("react/jsx-runtime");
1874
1822
  function CopilotChat({
1875
1823
  instructions,
1876
1824
  suggestions = "auto",
@@ -1895,7 +1843,7 @@ function CopilotChat({
1895
1843
  AssistantMessage: AssistantMessage2 = AssistantMessage,
1896
1844
  UserMessage: UserMessage2 = UserMessage,
1897
1845
  ImageRenderer: ImageRenderer2 = ImageRenderer,
1898
- ErrorMessage: ErrorMessage2 = ErrorMessage,
1846
+ ErrorMessage,
1899
1847
  imageUploadsEnabled,
1900
1848
  inputFileAccept = "image/*",
1901
1849
  hideStopButton,
@@ -1918,10 +1866,10 @@ function CopilotChat({
1918
1866
  removeInternalErrorHandler
1919
1867
  } = (0, import_react_core5.useCopilotContext)();
1920
1868
  const { publicApiKey, chatApiEndpoint } = copilotApiConfig;
1921
- const [selectedImages, setSelectedImages] = (0, import_react11.useState)([]);
1922
- const [chatError, setChatError] = (0, import_react11.useState)(null);
1923
- const fileInputRef = (0, import_react11.useRef)(null);
1924
- const triggerObservabilityHook = (0, import_react11.useCallback)(
1869
+ const [selectedImages, setSelectedImages] = (0, import_react10.useState)([]);
1870
+ const [chatError, setChatError] = (0, import_react10.useState)(null);
1871
+ const fileInputRef = (0, import_react10.useRef)(null);
1872
+ const triggerObservabilityHook = (0, import_react10.useCallback)(
1925
1873
  (hookName, ...args) => {
1926
1874
  if (publicApiKey && (observabilityHooks == null ? void 0 : observabilityHooks[hookName])) {
1927
1875
  observabilityHooks[hookName](...args);
@@ -1940,7 +1888,7 @@ function CopilotChat({
1940
1888
  },
1941
1889
  [publicApiKey, observabilityHooks, setBannerError]
1942
1890
  );
1943
- const triggerChatError = (0, import_react11.useCallback)(
1891
+ const triggerChatError = (0, import_react10.useCallback)(
1944
1892
  (error, operation, originalError) => {
1945
1893
  const errorMessage = (error == null ? void 0 : error.message) || (error == null ? void 0 : error.toString()) || "An error occurred";
1946
1894
  setChatError({
@@ -1986,7 +1934,7 @@ function CopilotChat({
1986
1934
  },
1987
1935
  [publicApiKey, chatApiEndpoint, observabilityHooks, setBannerError]
1988
1936
  );
1989
- (0, import_react11.useEffect)(() => {
1937
+ (0, import_react10.useEffect)(() => {
1990
1938
  const id = "chat-component";
1991
1939
  setInternalErrorHandler({
1992
1940
  [id]: (error) => {
@@ -1999,7 +1947,7 @@ function CopilotChat({
1999
1947
  removeInternalErrorHandler == null ? void 0 : removeInternalErrorHandler(id);
2000
1948
  };
2001
1949
  }, [triggerChatError, setInternalErrorHandler, removeInternalErrorHandler]);
2002
- (0, import_react11.useEffect)(() => {
1950
+ (0, import_react10.useEffect)(() => {
2003
1951
  if (!imageUploadsEnabled)
2004
1952
  return;
2005
1953
  const handlePaste = (e) => __async(this, null, function* () {
@@ -2045,7 +1993,7 @@ function CopilotChat({
2045
1993
  document.addEventListener("paste", handlePaste);
2046
1994
  return () => document.removeEventListener("paste", handlePaste);
2047
1995
  }, [imageUploadsEnabled, triggerChatError]);
2048
- (0, import_react11.useEffect)(() => {
1996
+ (0, import_react10.useEffect)(() => {
2049
1997
  if (!(additionalInstructions == null ? void 0 : additionalInstructions.length)) {
2050
1998
  setChatInstructions(instructions || "");
2051
1999
  return;
@@ -2073,8 +2021,8 @@ function CopilotChat({
2073
2021
  onStopGeneration,
2074
2022
  onReloadMessages
2075
2023
  );
2076
- const prevIsLoading = (0, import_react11.useRef)(isLoading);
2077
- (0, import_react11.useEffect)(() => {
2024
+ const prevIsLoading = (0, import_react10.useRef)(isLoading);
2025
+ (0, import_react10.useEffect)(() => {
2078
2026
  if (prevIsLoading.current !== isLoading) {
2079
2027
  if (isLoading) {
2080
2028
  triggerObservabilityHook("onChatStarted");
@@ -2093,7 +2041,7 @@ function CopilotChat({
2093
2041
  triggerObservabilityHook("onMessageSent", text);
2094
2042
  return sendMessage(text, images);
2095
2043
  };
2096
- const chatContext = import_react11.default.useContext(ChatContext);
2044
+ const chatContext = import_react10.default.useContext(ChatContext);
2097
2045
  const isVisible = chatContext ? chatContext.open : true;
2098
2046
  const handleRegenerate = (messageId) => {
2099
2047
  if (onRegenerate) {
@@ -2155,14 +2103,14 @@ function CopilotChat({
2155
2103
  }
2156
2104
  triggerObservabilityHook("onFeedbackGiven", message.id, "thumbsDown");
2157
2105
  };
2158
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
2106
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
2159
2107
  chatError && renderError && renderError(__spreadProps(__spreadValues({}, chatError), {
2160
2108
  onDismiss: () => setChatError(null),
2161
2109
  onRetry: () => {
2162
2110
  setChatError(null);
2163
2111
  }
2164
2112
  })),
2165
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2113
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2166
2114
  Messages2,
2167
2115
  {
2168
2116
  AssistantMessage: AssistantMessage2,
@@ -2176,14 +2124,14 @@ function CopilotChat({
2176
2124
  onThumbsDown: handleThumbsDown,
2177
2125
  markdownTagRenderers,
2178
2126
  ImageRenderer: ImageRenderer2,
2179
- ErrorMessage: ErrorMessage2,
2127
+ ErrorMessage,
2180
2128
  chatError,
2181
2129
  RenderTextMessage,
2182
2130
  RenderActionExecutionMessage,
2183
2131
  RenderAgentStateMessage,
2184
2132
  RenderResultMessage,
2185
2133
  RenderImageMessage,
2186
- children: currentSuggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2134
+ children: currentSuggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2187
2135
  RenderSuggestionsList,
2188
2136
  {
2189
2137
  onSuggestionClick: handleSendMessage,
@@ -2192,9 +2140,9 @@ function CopilotChat({
2192
2140
  )
2193
2141
  }
2194
2142
  ),
2195
- imageUploadsEnabled && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
2196
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ImageUploadQueue, { images: selectedImages, onRemoveImage: removeSelectedImage }),
2197
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2143
+ imageUploadsEnabled && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
2144
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ImageUploadQueue, { images: selectedImages, onRemoveImage: removeSelectedImage }),
2145
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2198
2146
  "input",
2199
2147
  {
2200
2148
  type: "file",
@@ -2206,7 +2154,7 @@ function CopilotChat({
2206
2154
  }
2207
2155
  )
2208
2156
  ] }),
2209
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2157
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2210
2158
  Input2,
2211
2159
  {
2212
2160
  inProgress: isLoading,
@@ -2228,12 +2176,12 @@ function WrappedCopilotChat({
2228
2176
  labels,
2229
2177
  className
2230
2178
  }) {
2231
- const chatContext = import_react11.default.useContext(ChatContext);
2179
+ const chatContext = import_react10.default.useContext(ChatContext);
2232
2180
  if (!chatContext) {
2233
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChatContextProvider, { icons, labels, open: true, setOpen: () => {
2234
- }, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: `copilotKitChat ${className != null ? className : ""}`, children }) });
2181
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChatContextProvider, { icons, labels, open: true, setOpen: () => {
2182
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: `copilotKitChat ${className != null ? className : ""}`, children }) });
2235
2183
  }
2236
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jsx_runtime18.Fragment, { children });
2184
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_jsx_runtime17.Fragment, { children });
2237
2185
  }
2238
2186
  var useCopilotChatLogic = (chatSuggestions, makeSystemMessage, disableSystemMessage, onInProgress, onSubmitMessage, onStopGeneration, onReloadMessages) => {
2239
2187
  var _a;
@@ -2257,15 +2205,15 @@ var useCopilotChatLogic = (chatSuggestions, makeSystemMessage, disableSystemMess
2257
2205
  const generalContext = (0, import_react_core5.useCopilotContext)();
2258
2206
  const messagesContext = (0, import_react_core5.useCopilotMessagesContext)();
2259
2207
  const { actions } = generalContext;
2260
- const [suggestionsFailed, setSuggestionsFailed] = (0, import_react11.useState)(false);
2261
- const hasGeneratedInitialSuggestions = (0, import_react11.useRef)(false);
2262
- (0, import_react11.useEffect)(() => {
2208
+ const [suggestionsFailed, setSuggestionsFailed] = (0, import_react10.useState)(false);
2209
+ const hasGeneratedInitialSuggestions = (0, import_react10.useRef)(false);
2210
+ (0, import_react10.useEffect)(() => {
2263
2211
  if (Array.isArray(chatSuggestions)) {
2264
2212
  setSuggestions(chatSuggestions);
2265
2213
  hasGeneratedInitialSuggestions.current = true;
2266
2214
  }
2267
2215
  }, [JSON.stringify(chatSuggestions), setSuggestions]);
2268
- const generateSuggestionsWithErrorHandling = (0, import_react11.useCallback)(
2216
+ const generateSuggestionsWithErrorHandling = (0, import_react10.useCallback)(
2269
2217
  (context) => __async(void 0, null, function* () {
2270
2218
  try {
2271
2219
  yield generateSuggestions();
@@ -2276,7 +2224,7 @@ var useCopilotChatLogic = (chatSuggestions, makeSystemMessage, disableSystemMess
2276
2224
  }),
2277
2225
  [generateSuggestions]
2278
2226
  );
2279
- (0, import_react11.useEffect)(() => {
2227
+ (0, import_react10.useEffect)(() => {
2280
2228
  if (chatSuggestions !== "auto" || isLoadingSuggestions || suggestionsFailed) {
2281
2229
  return;
2282
2230
  }
@@ -2306,13 +2254,13 @@ var useCopilotChatLogic = (chatSuggestions, makeSystemMessage, disableSystemMess
2306
2254
  // Use stable string instead of object reference
2307
2255
  generateSuggestionsWithErrorHandling
2308
2256
  ]);
2309
- (0, import_react11.useEffect)(() => {
2257
+ (0, import_react10.useEffect)(() => {
2310
2258
  if (chatSuggestions !== "auto") {
2311
2259
  hasGeneratedInitialSuggestions.current = false;
2312
2260
  setSuggestionsFailed(false);
2313
2261
  }
2314
2262
  }, [chatSuggestions]);
2315
- const stableContext = (0, import_react11.useMemo)(
2263
+ const stableContext = (0, import_react10.useMemo)(
2316
2264
  () => __spreadValues(__spreadValues({}, generalContext), messagesContext),
2317
2265
  [
2318
2266
  // Only include stable dependencies
@@ -2321,12 +2269,12 @@ var useCopilotChatLogic = (chatSuggestions, makeSystemMessage, disableSystemMess
2321
2269
  generalContext.isLoading
2322
2270
  ]
2323
2271
  );
2324
- const resetSuggestions = (0, import_react11.useCallback)(() => {
2272
+ const resetSuggestions = (0, import_react10.useCallback)(() => {
2325
2273
  resetSuggestionsFromHook();
2326
2274
  setSuggestionsFailed(false);
2327
2275
  hasGeneratedInitialSuggestions.current = false;
2328
2276
  }, [resetSuggestionsFromHook]);
2329
- (0, import_react11.useEffect)(() => {
2277
+ (0, import_react10.useEffect)(() => {
2330
2278
  onInProgress == null ? void 0 : onInProgress(isLoading);
2331
2279
  }, [onInProgress, isLoading]);
2332
2280
  const safelySendMessage = (messageContent, imagesToUse) => __async(void 0, null, function* () {