@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
@@ -1,31 +1,30 @@
1
1
  import {
2
2
  CopilotSidebar
3
- } from "../../chunk-KCRWXHWT.mjs";
4
- import "../../chunk-FJFWH5AF.mjs";
3
+ } from "../../chunk-DII7M2HW.mjs";
4
+ import "../../chunk-GKIR7J5D.mjs";
5
5
  import "../../chunk-C3GSYRC3.mjs";
6
- import "../../chunk-GDSZGYCE.mjs";
6
+ import "../../chunk-V6DDX4LH.mjs";
7
7
  import "../../chunk-V7W6IM2V.mjs";
8
- import "../../chunk-FFJHOZX6.mjs";
9
- import "../../chunk-Q5V6S67N.mjs";
10
- import "../../chunk-JY2CSDKN.mjs";
8
+ import "../../chunk-WBPBTTQD.mjs";
11
9
  import "../../chunk-KXE2JCUH.mjs";
12
10
  import "../../chunk-NRA3CFEE.mjs";
13
11
  import "../../chunk-BH6PCAAL.mjs";
12
+ import "../../chunk-Q5V6S67N.mjs";
13
+ import "../../chunk-JY2CSDKN.mjs";
14
14
  import "../../chunk-UFN2VWSR.mjs";
15
- import "../../chunk-Z66Y3KRE.mjs";
16
- import "../../chunk-SRY5COHG.mjs";
15
+ import "../../chunk-NJY6RHHQ.mjs";
17
16
  import "../../chunk-226ZMOE3.mjs";
18
17
  import "../../chunk-W26XFBEG.mjs";
19
18
  import "../../chunk-PLHTVHUW.mjs";
20
19
  import "../../chunk-DTRPPNSA.mjs";
21
20
  import "../../chunk-CGEAG65D.mjs";
22
21
  import "../../chunk-QIOJXTIQ.mjs";
23
- import "../../chunk-PHH6DYUW.mjs";
24
- import "../../chunk-YO63WHVQ.mjs";
25
- import "../../chunk-LJAYSRCB.mjs";
22
+ import "../../chunk-NGA4T3VT.mjs";
23
+ import "../../chunk-SP2PFXCH.mjs";
24
+ import "../../chunk-WRQST6DJ.mjs";
25
+ import "../../chunk-VVL6JFCJ.mjs";
26
26
  import "../../chunk-X477GDGZ.mjs";
27
27
  import "../../chunk-DBKRAOH7.mjs";
28
- import "../../chunk-VVL6JFCJ.mjs";
29
28
  import "../../chunk-SNFHUE5S.mjs";
30
29
  import "../../chunk-IEMQ2SQW.mjs";
31
30
  import "../../chunk-B5IFB5YJ.mjs";
@@ -93,7 +93,7 @@ __export(chat_exports, {
93
93
  module.exports = __toCommonJS(chat_exports);
94
94
 
95
95
  // src/components/chat/Modal.tsx
96
- var import_react16 = __toESM(require("react"));
96
+ var import_react15 = __toESM(require("react"));
97
97
 
98
98
  // src/components/chat/ChatContext.tsx
99
99
  var import_react = __toESM(require("react"));
@@ -1881,7 +1881,7 @@ var Messages = ({
1881
1881
  RenderMessage: RenderMessage2,
1882
1882
  AssistantMessage: AssistantMessage2,
1883
1883
  UserMessage: UserMessage2,
1884
- ErrorMessage: ErrorMessage2,
1884
+ ErrorMessage,
1885
1885
  ImageRenderer: ImageRenderer2,
1886
1886
  onRegenerate,
1887
1887
  onCopy,
@@ -1950,7 +1950,7 @@ var Messages = ({
1950
1950
  );
1951
1951
  }),
1952
1952
  interrupt,
1953
- chatError && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ErrorMessage2, { error: chatError, isCurrentMessage: true })
1953
+ chatError && ErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ErrorMessage, { error: chatError, isCurrentMessage: true })
1954
1954
  ] }),
1955
1955
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("footer", { className: "copilotKitMessagesFooter", ref: messagesEndRef, children })
1956
1956
  ] });
@@ -2333,67 +2333,15 @@ var Input = ({
2333
2333
  ] });
2334
2334
  };
2335
2335
 
2336
- // src/components/chat/messages/ErrorMessage.tsx
2337
- var import_react14 = require("react");
2338
- var import_jsx_runtime21 = require("react/jsx-runtime");
2339
- var ErrorMessage = (props) => {
2340
- const { icons, labels } = useChatContext();
2341
- const { error, onRegenerate, onCopy, isCurrentMessage } = props;
2342
- const [copied, setCopied] = (0, import_react14.useState)(false);
2343
- const handleCopy = () => {
2344
- const content = error.message;
2345
- if (content && onCopy) {
2346
- navigator.clipboard.writeText(content);
2347
- setCopied(true);
2348
- onCopy(content);
2349
- setTimeout(() => setCopied(false), 2e3);
2350
- } else if (content) {
2351
- navigator.clipboard.writeText(content);
2352
- setCopied(true);
2353
- setTimeout(() => setCopied(false), 2e3);
2354
- }
2355
- };
2356
- const handleRegenerate = () => {
2357
- if (onRegenerate)
2358
- onRegenerate();
2359
- };
2360
- console.log(error);
2361
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "copilotKitMessage copilotKitAssistantMessage", children: [
2362
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Markdown, { content: error.message }),
2363
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `copilotKitMessageControls ${isCurrentMessage ? "currentMessage" : ""}`, children: [
2364
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2365
- "button",
2366
- {
2367
- className: "copilotKitMessageControlButton",
2368
- onClick: handleRegenerate,
2369
- "aria-label": labels.regenerateResponse,
2370
- title: labels.regenerateResponse,
2371
- children: icons.regenerateIcon
2372
- }
2373
- ),
2374
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2375
- "button",
2376
- {
2377
- className: "copilotKitMessageControlButton",
2378
- onClick: handleCopy,
2379
- "aria-label": labels.copyToClipboard,
2380
- title: labels.copyToClipboard,
2381
- children: copied ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: { fontSize: "10px", fontWeight: "bold" }, children: "\u2713" }) : icons.copyIcon
2382
- }
2383
- )
2384
- ] })
2385
- ] });
2386
- };
2387
-
2388
2336
  // src/components/chat/Chat.tsx
2389
- var import_react15 = __toESM(require("react"));
2337
+ var import_react14 = __toESM(require("react"));
2390
2338
  var import_react_core9 = require("@copilotkit/react-core");
2391
2339
  var import_shared3 = require("@copilotkit/shared");
2392
2340
  var import_shared4 = require("@copilotkit/shared");
2393
2341
  var import_react_core10 = require("@copilotkit/react-core");
2394
2342
 
2395
2343
  // src/components/chat/ImageUploadQueue.tsx
2396
- var import_jsx_runtime22 = require("react/jsx-runtime");
2344
+ var import_jsx_runtime21 = require("react/jsx-runtime");
2397
2345
  var ImageUploadQueue = ({
2398
2346
  images,
2399
2347
  onRemoveImage,
@@ -2401,7 +2349,7 @@ var ImageUploadQueue = ({
2401
2349
  }) => {
2402
2350
  if (images.length === 0)
2403
2351
  return null;
2404
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2352
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2405
2353
  "div",
2406
2354
  {
2407
2355
  className: `copilotKitImageUploadQueue ${className}`,
@@ -2412,7 +2360,7 @@ var ImageUploadQueue = ({
2412
2360
  margin: "8px",
2413
2361
  padding: "8px"
2414
2362
  },
2415
- children: images.map((image, index) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2363
+ children: images.map((image, index) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2416
2364
  "div",
2417
2365
  {
2418
2366
  className: "copilotKitImageUploadQueueItem",
@@ -2425,7 +2373,7 @@ var ImageUploadQueue = ({
2425
2373
  overflow: "hidden"
2426
2374
  },
2427
2375
  children: [
2428
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2376
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2429
2377
  "img",
2430
2378
  {
2431
2379
  src: `data:${image.contentType};base64,${image.bytes}`,
@@ -2437,7 +2385,7 @@ var ImageUploadQueue = ({
2437
2385
  }
2438
2386
  }
2439
2387
  ),
2440
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2388
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2441
2389
  "button",
2442
2390
  {
2443
2391
  onClick: () => onRemoveImage(index),
@@ -2472,12 +2420,12 @@ var ImageUploadQueue = ({
2472
2420
 
2473
2421
  // src/components/chat/Suggestion.tsx
2474
2422
  var import_react_core8 = require("@copilotkit/react-core");
2475
- var import_jsx_runtime23 = require("react/jsx-runtime");
2423
+ var import_jsx_runtime22 = require("react/jsx-runtime");
2476
2424
  function Suggestion({ title, onClick, partial, className }) {
2477
2425
  if (!title)
2478
2426
  return null;
2479
2427
  const { isLoading } = (0, import_react_core8.useCopilotChatInternal)();
2480
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2428
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2481
2429
  "button",
2482
2430
  {
2483
2431
  disabled: partial || isLoading,
@@ -2487,15 +2435,15 @@ function Suggestion({ title, onClick, partial, className }) {
2487
2435
  },
2488
2436
  className: className || (partial ? "suggestion loading" : "suggestion"),
2489
2437
  "data-test-id": "suggestion",
2490
- children: partial ? SmallSpinnerIcon : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: title })
2438
+ children: partial ? SmallSpinnerIcon : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: title })
2491
2439
  }
2492
2440
  );
2493
2441
  }
2494
2442
 
2495
2443
  // src/components/chat/Suggestions.tsx
2496
- var import_jsx_runtime24 = require("react/jsx-runtime");
2444
+ var import_jsx_runtime23 = require("react/jsx-runtime");
2497
2445
  function Suggestions({ suggestions, onSuggestionClick }) {
2498
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "suggestions", children: suggestions.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2446
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "suggestions", children: suggestions.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2499
2447
  Suggestion,
2500
2448
  {
2501
2449
  title: suggestion.title,
@@ -2509,7 +2457,7 @@ function Suggestions({ suggestions, onSuggestionClick }) {
2509
2457
  }
2510
2458
 
2511
2459
  // src/components/chat/Chat.tsx
2512
- var import_jsx_runtime25 = require("react/jsx-runtime");
2460
+ var import_jsx_runtime24 = require("react/jsx-runtime");
2513
2461
  function CopilotChat({
2514
2462
  instructions,
2515
2463
  suggestions = "auto",
@@ -2534,7 +2482,7 @@ function CopilotChat({
2534
2482
  AssistantMessage: AssistantMessage2 = AssistantMessage,
2535
2483
  UserMessage: UserMessage2 = UserMessage,
2536
2484
  ImageRenderer: ImageRenderer2 = ImageRenderer,
2537
- ErrorMessage: ErrorMessage2 = ErrorMessage,
2485
+ ErrorMessage,
2538
2486
  imageUploadsEnabled,
2539
2487
  inputFileAccept = "image/*",
2540
2488
  hideStopButton,
@@ -2557,10 +2505,10 @@ function CopilotChat({
2557
2505
  removeInternalErrorHandler
2558
2506
  } = (0, import_react_core9.useCopilotContext)();
2559
2507
  const { publicApiKey, chatApiEndpoint } = copilotApiConfig;
2560
- const [selectedImages, setSelectedImages] = (0, import_react15.useState)([]);
2561
- const [chatError, setChatError] = (0, import_react15.useState)(null);
2562
- const fileInputRef = (0, import_react15.useRef)(null);
2563
- const triggerObservabilityHook = (0, import_react15.useCallback)(
2508
+ const [selectedImages, setSelectedImages] = (0, import_react14.useState)([]);
2509
+ const [chatError, setChatError] = (0, import_react14.useState)(null);
2510
+ const fileInputRef = (0, import_react14.useRef)(null);
2511
+ const triggerObservabilityHook = (0, import_react14.useCallback)(
2564
2512
  (hookName, ...args) => {
2565
2513
  if (publicApiKey && (observabilityHooks == null ? void 0 : observabilityHooks[hookName])) {
2566
2514
  observabilityHooks[hookName](...args);
@@ -2579,7 +2527,7 @@ function CopilotChat({
2579
2527
  },
2580
2528
  [publicApiKey, observabilityHooks, setBannerError]
2581
2529
  );
2582
- const triggerChatError = (0, import_react15.useCallback)(
2530
+ const triggerChatError = (0, import_react14.useCallback)(
2583
2531
  (error, operation, originalError) => {
2584
2532
  const errorMessage = (error == null ? void 0 : error.message) || (error == null ? void 0 : error.toString()) || "An error occurred";
2585
2533
  setChatError({
@@ -2625,7 +2573,7 @@ function CopilotChat({
2625
2573
  },
2626
2574
  [publicApiKey, chatApiEndpoint, observabilityHooks, setBannerError]
2627
2575
  );
2628
- (0, import_react15.useEffect)(() => {
2576
+ (0, import_react14.useEffect)(() => {
2629
2577
  const id = "chat-component";
2630
2578
  setInternalErrorHandler({
2631
2579
  [id]: (error) => {
@@ -2638,7 +2586,7 @@ function CopilotChat({
2638
2586
  removeInternalErrorHandler == null ? void 0 : removeInternalErrorHandler(id);
2639
2587
  };
2640
2588
  }, [triggerChatError, setInternalErrorHandler, removeInternalErrorHandler]);
2641
- (0, import_react15.useEffect)(() => {
2589
+ (0, import_react14.useEffect)(() => {
2642
2590
  if (!imageUploadsEnabled)
2643
2591
  return;
2644
2592
  const handlePaste = (e) => __async(this, null, function* () {
@@ -2684,7 +2632,7 @@ function CopilotChat({
2684
2632
  document.addEventListener("paste", handlePaste);
2685
2633
  return () => document.removeEventListener("paste", handlePaste);
2686
2634
  }, [imageUploadsEnabled, triggerChatError]);
2687
- (0, import_react15.useEffect)(() => {
2635
+ (0, import_react14.useEffect)(() => {
2688
2636
  if (!(additionalInstructions == null ? void 0 : additionalInstructions.length)) {
2689
2637
  setChatInstructions(instructions || "");
2690
2638
  return;
@@ -2712,8 +2660,8 @@ function CopilotChat({
2712
2660
  onStopGeneration,
2713
2661
  onReloadMessages
2714
2662
  );
2715
- const prevIsLoading = (0, import_react15.useRef)(isLoading);
2716
- (0, import_react15.useEffect)(() => {
2663
+ const prevIsLoading = (0, import_react14.useRef)(isLoading);
2664
+ (0, import_react14.useEffect)(() => {
2717
2665
  if (prevIsLoading.current !== isLoading) {
2718
2666
  if (isLoading) {
2719
2667
  triggerObservabilityHook("onChatStarted");
@@ -2732,7 +2680,7 @@ function CopilotChat({
2732
2680
  triggerObservabilityHook("onMessageSent", text);
2733
2681
  return sendMessage(text, images);
2734
2682
  };
2735
- const chatContext = import_react15.default.useContext(ChatContext);
2683
+ const chatContext = import_react14.default.useContext(ChatContext);
2736
2684
  const isVisible = chatContext ? chatContext.open : true;
2737
2685
  const handleRegenerate = (messageId) => {
2738
2686
  if (onRegenerate) {
@@ -2794,14 +2742,14 @@ function CopilotChat({
2794
2742
  }
2795
2743
  triggerObservabilityHook("onFeedbackGiven", message.id, "thumbsDown");
2796
2744
  };
2797
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
2745
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
2798
2746
  chatError && renderError && renderError(__spreadProps(__spreadValues({}, chatError), {
2799
2747
  onDismiss: () => setChatError(null),
2800
2748
  onRetry: () => {
2801
2749
  setChatError(null);
2802
2750
  }
2803
2751
  })),
2804
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2752
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2805
2753
  Messages2,
2806
2754
  {
2807
2755
  AssistantMessage: AssistantMessage2,
@@ -2815,14 +2763,14 @@ function CopilotChat({
2815
2763
  onThumbsDown: handleThumbsDown,
2816
2764
  markdownTagRenderers,
2817
2765
  ImageRenderer: ImageRenderer2,
2818
- ErrorMessage: ErrorMessage2,
2766
+ ErrorMessage,
2819
2767
  chatError,
2820
2768
  RenderTextMessage,
2821
2769
  RenderActionExecutionMessage,
2822
2770
  RenderAgentStateMessage,
2823
2771
  RenderResultMessage,
2824
2772
  RenderImageMessage,
2825
- children: currentSuggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2773
+ children: currentSuggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2826
2774
  RenderSuggestionsList,
2827
2775
  {
2828
2776
  onSuggestionClick: handleSendMessage,
@@ -2831,9 +2779,9 @@ function CopilotChat({
2831
2779
  )
2832
2780
  }
2833
2781
  ),
2834
- imageUploadsEnabled && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
2835
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageUploadQueue, { images: selectedImages, onRemoveImage: removeSelectedImage }),
2836
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2782
+ imageUploadsEnabled && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
2783
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ImageUploadQueue, { images: selectedImages, onRemoveImage: removeSelectedImage }),
2784
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2837
2785
  "input",
2838
2786
  {
2839
2787
  type: "file",
@@ -2845,7 +2793,7 @@ function CopilotChat({
2845
2793
  }
2846
2794
  )
2847
2795
  ] }),
2848
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2796
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2849
2797
  Input2,
2850
2798
  {
2851
2799
  inProgress: isLoading,
@@ -2867,12 +2815,12 @@ function WrappedCopilotChat({
2867
2815
  labels,
2868
2816
  className
2869
2817
  }) {
2870
- const chatContext = import_react15.default.useContext(ChatContext);
2818
+ const chatContext = import_react14.default.useContext(ChatContext);
2871
2819
  if (!chatContext) {
2872
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ChatContextProvider, { icons, labels, open: true, setOpen: () => {
2873
- }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: `copilotKitChat ${className != null ? className : ""}`, children }) });
2820
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ChatContextProvider, { icons, labels, open: true, setOpen: () => {
2821
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: `copilotKitChat ${className != null ? className : ""}`, children }) });
2874
2822
  }
2875
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children });
2823
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children });
2876
2824
  }
2877
2825
  var useCopilotChatLogic = (chatSuggestions, makeSystemMessage, disableSystemMessage, onInProgress, onSubmitMessage, onStopGeneration, onReloadMessages) => {
2878
2826
  var _a;
@@ -2896,15 +2844,15 @@ var useCopilotChatLogic = (chatSuggestions, makeSystemMessage, disableSystemMess
2896
2844
  const generalContext = (0, import_react_core9.useCopilotContext)();
2897
2845
  const messagesContext = (0, import_react_core9.useCopilotMessagesContext)();
2898
2846
  const { actions } = generalContext;
2899
- const [suggestionsFailed, setSuggestionsFailed] = (0, import_react15.useState)(false);
2900
- const hasGeneratedInitialSuggestions = (0, import_react15.useRef)(false);
2901
- (0, import_react15.useEffect)(() => {
2847
+ const [suggestionsFailed, setSuggestionsFailed] = (0, import_react14.useState)(false);
2848
+ const hasGeneratedInitialSuggestions = (0, import_react14.useRef)(false);
2849
+ (0, import_react14.useEffect)(() => {
2902
2850
  if (Array.isArray(chatSuggestions)) {
2903
2851
  setSuggestions(chatSuggestions);
2904
2852
  hasGeneratedInitialSuggestions.current = true;
2905
2853
  }
2906
2854
  }, [JSON.stringify(chatSuggestions), setSuggestions]);
2907
- const generateSuggestionsWithErrorHandling = (0, import_react15.useCallback)(
2855
+ const generateSuggestionsWithErrorHandling = (0, import_react14.useCallback)(
2908
2856
  (context) => __async(void 0, null, function* () {
2909
2857
  try {
2910
2858
  yield generateSuggestions();
@@ -2915,7 +2863,7 @@ var useCopilotChatLogic = (chatSuggestions, makeSystemMessage, disableSystemMess
2915
2863
  }),
2916
2864
  [generateSuggestions]
2917
2865
  );
2918
- (0, import_react15.useEffect)(() => {
2866
+ (0, import_react14.useEffect)(() => {
2919
2867
  if (chatSuggestions !== "auto" || isLoadingSuggestions || suggestionsFailed) {
2920
2868
  return;
2921
2869
  }
@@ -2945,13 +2893,13 @@ var useCopilotChatLogic = (chatSuggestions, makeSystemMessage, disableSystemMess
2945
2893
  // Use stable string instead of object reference
2946
2894
  generateSuggestionsWithErrorHandling
2947
2895
  ]);
2948
- (0, import_react15.useEffect)(() => {
2896
+ (0, import_react14.useEffect)(() => {
2949
2897
  if (chatSuggestions !== "auto") {
2950
2898
  hasGeneratedInitialSuggestions.current = false;
2951
2899
  setSuggestionsFailed(false);
2952
2900
  }
2953
2901
  }, [chatSuggestions]);
2954
- const stableContext = (0, import_react15.useMemo)(
2902
+ const stableContext = (0, import_react14.useMemo)(
2955
2903
  () => __spreadValues(__spreadValues({}, generalContext), messagesContext),
2956
2904
  [
2957
2905
  // Only include stable dependencies
@@ -2960,12 +2908,12 @@ var useCopilotChatLogic = (chatSuggestions, makeSystemMessage, disableSystemMess
2960
2908
  generalContext.isLoading
2961
2909
  ]
2962
2910
  );
2963
- const resetSuggestions = (0, import_react15.useCallback)(() => {
2911
+ const resetSuggestions = (0, import_react14.useCallback)(() => {
2964
2912
  resetSuggestionsFromHook();
2965
2913
  setSuggestionsFailed(false);
2966
2914
  hasGeneratedInitialSuggestions.current = false;
2967
2915
  }, [resetSuggestionsFromHook]);
2968
- (0, import_react15.useEffect)(() => {
2916
+ (0, import_react14.useEffect)(() => {
2969
2917
  onInProgress == null ? void 0 : onInProgress(isLoading);
2970
2918
  }, [onInProgress, isLoading]);
2971
2919
  const safelySendMessage = (messageContent, imagesToUse) => __async(void 0, null, function* () {
@@ -3111,7 +3059,7 @@ var useCopilotChatLogic = (chatSuggestions, makeSystemMessage, disableSystemMess
3111
3059
  // src/components/chat/Modal.tsx
3112
3060
  var import_react_core11 = require("@copilotkit/react-core");
3113
3061
  var import_shared5 = require("@copilotkit/shared");
3114
- var import_jsx_runtime26 = require("react/jsx-runtime");
3062
+ var import_jsx_runtime25 = require("react/jsx-runtime");
3115
3063
  var CopilotModalInner = (_a) => {
3116
3064
  var _b = _a, {
3117
3065
  observabilityHooks,
@@ -3138,7 +3086,7 @@ var CopilotModalInner = (_a) => {
3138
3086
  ]);
3139
3087
  const { copilotApiConfig, setBannerError } = (0, import_react_core11.useCopilotContext)();
3140
3088
  const { publicApiKey } = copilotApiConfig;
3141
- const triggerObservabilityHook = (0, import_react16.useCallback)(
3089
+ const triggerObservabilityHook = (0, import_react15.useCallback)(
3142
3090
  (hookName, ...args) => {
3143
3091
  if (publicApiKey && (observabilityHooks == null ? void 0 : observabilityHooks[hookName])) {
3144
3092
  observabilityHooks[hookName](...args);
@@ -3158,8 +3106,8 @@ var CopilotModalInner = (_a) => {
3158
3106
  [publicApiKey, observabilityHooks, setBannerError]
3159
3107
  );
3160
3108
  const { open } = useChatContext();
3161
- const prevOpen = (0, import_react16.useRef)(open);
3162
- (0, import_react16.useEffect)(() => {
3109
+ const prevOpen = (0, import_react15.useRef)(open);
3110
+ (0, import_react15.useEffect)(() => {
3163
3111
  if (prevOpen.current !== open) {
3164
3112
  onSetOpen == null ? void 0 : onSetOpen(open);
3165
3113
  if (open) {
@@ -3170,13 +3118,13 @@ var CopilotModalInner = (_a) => {
3170
3118
  prevOpen.current = open;
3171
3119
  }
3172
3120
  }, [open, onSetOpen, triggerObservabilityHook]);
3173
- const memoizedHeader = (0, import_react16.useMemo)(() => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Header2, {}), [Header2]);
3174
- const memoizedChildren = (0, import_react16.useMemo)(() => children, [children]);
3175
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
3121
+ const memoizedHeader = (0, import_react15.useMemo)(() => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Header2, {}), [Header2]);
3122
+ const memoizedChildren = (0, import_react15.useMemo)(() => children, [children]);
3123
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
3176
3124
  memoizedChildren,
3177
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className, children: [
3178
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Button2, {}),
3179
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3125
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className, children: [
3126
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Button2, {}),
3127
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3180
3128
  Window2,
3181
3129
  {
3182
3130
  clickOutsideToClose,
@@ -3184,7 +3132,7 @@ var CopilotModalInner = (_a) => {
3184
3132
  hitEscapeToClose,
3185
3133
  children: [
3186
3134
  memoizedHeader,
3187
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CopilotChat, __spreadProps(__spreadValues({}, chatProps), { observabilityHooks }))
3135
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CopilotChat, __spreadProps(__spreadValues({}, chatProps), { observabilityHooks }))
3188
3136
  ]
3189
3137
  }
3190
3138
  )
@@ -3251,8 +3199,8 @@ var CopilotModal = (_a) => {
3251
3199
  "children",
3252
3200
  "observabilityHooks"
3253
3201
  ]);
3254
- const [openState, setOpenState] = import_react16.default.useState(defaultOpen);
3255
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChatContextProvider, { icons, labels, open: openState, setOpen: setOpenState, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3202
+ const [openState, setOpenState] = import_react15.default.useState(defaultOpen);
3203
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ChatContextProvider, { icons, labels, open: openState, setOpen: setOpenState, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3256
3204
  CopilotModalInner,
3257
3205
  __spreadProps(__spreadValues({
3258
3206
  observabilityHooks,
@@ -3286,22 +3234,22 @@ var CopilotModal = (_a) => {
3286
3234
  };
3287
3235
 
3288
3236
  // src/components/chat/Popup.tsx
3289
- var import_jsx_runtime27 = require("react/jsx-runtime");
3237
+ var import_jsx_runtime26 = require("react/jsx-runtime");
3290
3238
  function CopilotPopup(props) {
3291
3239
  props = __spreadProps(__spreadValues({}, props), {
3292
3240
  className: props.className ? props.className + " copilotKitPopup" : "copilotKitPopup"
3293
3241
  });
3294
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CopilotModal, __spreadProps(__spreadValues({}, props), { children: props.children }));
3242
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CopilotModal, __spreadProps(__spreadValues({}, props), { children: props.children }));
3295
3243
  }
3296
3244
 
3297
3245
  // src/components/chat/Sidebar.tsx
3298
- var import_react17 = require("react");
3299
- var import_jsx_runtime28 = require("react/jsx-runtime");
3246
+ var import_react16 = require("react");
3247
+ var import_jsx_runtime27 = require("react/jsx-runtime");
3300
3248
  function CopilotSidebar(props) {
3301
3249
  props = __spreadProps(__spreadValues({}, props), {
3302
3250
  className: props.className ? props.className + " copilotKitSidebar" : "copilotKitSidebar"
3303
3251
  });
3304
- const [expandedClassName, setExpandedClassName] = (0, import_react17.useState)(
3252
+ const [expandedClassName, setExpandedClassName] = (0, import_react16.useState)(
3305
3253
  props.defaultOpen ? "sidebarExpanded" : ""
3306
3254
  );
3307
3255
  const onSetOpen = (open) => {
@@ -3309,7 +3257,7 @@ function CopilotSidebar(props) {
3309
3257
  (_a = props.onSetOpen) == null ? void 0 : _a.call(props, open);
3310
3258
  setExpandedClassName(open ? "sidebarExpanded" : "");
3311
3259
  };
3312
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: `copilotKitSidebarContentWrapper ${expandedClassName}`, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CopilotModal, __spreadProps(__spreadValues(__spreadValues({}, props), { onSetOpen }), { children: props.children })) });
3260
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: `copilotKitSidebarContentWrapper ${expandedClassName}`, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CopilotModal, __spreadProps(__spreadValues(__spreadValues({}, props), { onSetOpen }), { children: props.children })) });
3313
3261
  }
3314
3262
  // Annotate the CommonJS export names for ESM import in node:
3315
3263
  0 && (module.exports = {