@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
  CopilotPopup
3
- } from "../../chunk-QQDCZRPA.mjs";
4
- import "../../chunk-FJFWH5AF.mjs";
3
+ } from "../../chunk-TNN2ZGO6.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";
@@ -82,10 +82,10 @@ __export(Sidebar_exports, {
82
82
  CopilotSidebar: () => CopilotSidebar
83
83
  });
84
84
  module.exports = __toCommonJS(Sidebar_exports);
85
- var import_react17 = require("react");
85
+ var import_react16 = require("react");
86
86
 
87
87
  // src/components/chat/Modal.tsx
88
- var import_react16 = __toESM(require("react"));
88
+ var import_react15 = __toESM(require("react"));
89
89
 
90
90
  // src/components/chat/ChatContext.tsx
91
91
  var import_react = __toESM(require("react"));
@@ -1873,7 +1873,7 @@ var Messages = ({
1873
1873
  RenderMessage: RenderMessage2,
1874
1874
  AssistantMessage: AssistantMessage2,
1875
1875
  UserMessage: UserMessage2,
1876
- ErrorMessage: ErrorMessage2,
1876
+ ErrorMessage,
1877
1877
  ImageRenderer: ImageRenderer2,
1878
1878
  onRegenerate,
1879
1879
  onCopy,
@@ -1942,7 +1942,7 @@ var Messages = ({
1942
1942
  );
1943
1943
  }),
1944
1944
  interrupt,
1945
- chatError && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ErrorMessage2, { error: chatError, isCurrentMessage: true })
1945
+ chatError && ErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ErrorMessage, { error: chatError, isCurrentMessage: true })
1946
1946
  ] }),
1947
1947
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("footer", { className: "copilotKitMessagesFooter", ref: messagesEndRef, children })
1948
1948
  ] });
@@ -2325,67 +2325,15 @@ var Input = ({
2325
2325
  ] });
2326
2326
  };
2327
2327
 
2328
- // src/components/chat/messages/ErrorMessage.tsx
2329
- var import_react14 = require("react");
2330
- var import_jsx_runtime21 = require("react/jsx-runtime");
2331
- var ErrorMessage = (props) => {
2332
- const { icons, labels } = useChatContext();
2333
- const { error, onRegenerate, onCopy, isCurrentMessage } = props;
2334
- const [copied, setCopied] = (0, import_react14.useState)(false);
2335
- const handleCopy = () => {
2336
- const content = error.message;
2337
- if (content && onCopy) {
2338
- navigator.clipboard.writeText(content);
2339
- setCopied(true);
2340
- onCopy(content);
2341
- setTimeout(() => setCopied(false), 2e3);
2342
- } else if (content) {
2343
- navigator.clipboard.writeText(content);
2344
- setCopied(true);
2345
- setTimeout(() => setCopied(false), 2e3);
2346
- }
2347
- };
2348
- const handleRegenerate = () => {
2349
- if (onRegenerate)
2350
- onRegenerate();
2351
- };
2352
- console.log(error);
2353
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "copilotKitMessage copilotKitAssistantMessage", children: [
2354
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Markdown, { content: error.message }),
2355
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `copilotKitMessageControls ${isCurrentMessage ? "currentMessage" : ""}`, children: [
2356
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2357
- "button",
2358
- {
2359
- className: "copilotKitMessageControlButton",
2360
- onClick: handleRegenerate,
2361
- "aria-label": labels.regenerateResponse,
2362
- title: labels.regenerateResponse,
2363
- children: icons.regenerateIcon
2364
- }
2365
- ),
2366
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2367
- "button",
2368
- {
2369
- className: "copilotKitMessageControlButton",
2370
- onClick: handleCopy,
2371
- "aria-label": labels.copyToClipboard,
2372
- title: labels.copyToClipboard,
2373
- children: copied ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: { fontSize: "10px", fontWeight: "bold" }, children: "\u2713" }) : icons.copyIcon
2374
- }
2375
- )
2376
- ] })
2377
- ] });
2378
- };
2379
-
2380
2328
  // src/components/chat/Chat.tsx
2381
- var import_react15 = __toESM(require("react"));
2329
+ var import_react14 = __toESM(require("react"));
2382
2330
  var import_react_core9 = require("@copilotkit/react-core");
2383
2331
  var import_shared3 = require("@copilotkit/shared");
2384
2332
  var import_shared4 = require("@copilotkit/shared");
2385
2333
  var import_react_core10 = require("@copilotkit/react-core");
2386
2334
 
2387
2335
  // src/components/chat/ImageUploadQueue.tsx
2388
- var import_jsx_runtime22 = require("react/jsx-runtime");
2336
+ var import_jsx_runtime21 = require("react/jsx-runtime");
2389
2337
  var ImageUploadQueue = ({
2390
2338
  images,
2391
2339
  onRemoveImage,
@@ -2393,7 +2341,7 @@ var ImageUploadQueue = ({
2393
2341
  }) => {
2394
2342
  if (images.length === 0)
2395
2343
  return null;
2396
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2344
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2397
2345
  "div",
2398
2346
  {
2399
2347
  className: `copilotKitImageUploadQueue ${className}`,
@@ -2404,7 +2352,7 @@ var ImageUploadQueue = ({
2404
2352
  margin: "8px",
2405
2353
  padding: "8px"
2406
2354
  },
2407
- children: images.map((image, index) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2355
+ children: images.map((image, index) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2408
2356
  "div",
2409
2357
  {
2410
2358
  className: "copilotKitImageUploadQueueItem",
@@ -2417,7 +2365,7 @@ var ImageUploadQueue = ({
2417
2365
  overflow: "hidden"
2418
2366
  },
2419
2367
  children: [
2420
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2368
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2421
2369
  "img",
2422
2370
  {
2423
2371
  src: `data:${image.contentType};base64,${image.bytes}`,
@@ -2429,7 +2377,7 @@ var ImageUploadQueue = ({
2429
2377
  }
2430
2378
  }
2431
2379
  ),
2432
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2380
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2433
2381
  "button",
2434
2382
  {
2435
2383
  onClick: () => onRemoveImage(index),
@@ -2464,12 +2412,12 @@ var ImageUploadQueue = ({
2464
2412
 
2465
2413
  // src/components/chat/Suggestion.tsx
2466
2414
  var import_react_core8 = require("@copilotkit/react-core");
2467
- var import_jsx_runtime23 = require("react/jsx-runtime");
2415
+ var import_jsx_runtime22 = require("react/jsx-runtime");
2468
2416
  function Suggestion({ title, onClick, partial, className }) {
2469
2417
  if (!title)
2470
2418
  return null;
2471
2419
  const { isLoading } = (0, import_react_core8.useCopilotChatInternal)();
2472
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2420
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2473
2421
  "button",
2474
2422
  {
2475
2423
  disabled: partial || isLoading,
@@ -2479,15 +2427,15 @@ function Suggestion({ title, onClick, partial, className }) {
2479
2427
  },
2480
2428
  className: className || (partial ? "suggestion loading" : "suggestion"),
2481
2429
  "data-test-id": "suggestion",
2482
- children: partial ? SmallSpinnerIcon : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: title })
2430
+ children: partial ? SmallSpinnerIcon : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: title })
2483
2431
  }
2484
2432
  );
2485
2433
  }
2486
2434
 
2487
2435
  // src/components/chat/Suggestions.tsx
2488
- var import_jsx_runtime24 = require("react/jsx-runtime");
2436
+ var import_jsx_runtime23 = require("react/jsx-runtime");
2489
2437
  function Suggestions({ suggestions, onSuggestionClick }) {
2490
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "suggestions", children: suggestions.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2438
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "suggestions", children: suggestions.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2491
2439
  Suggestion,
2492
2440
  {
2493
2441
  title: suggestion.title,
@@ -2501,7 +2449,7 @@ function Suggestions({ suggestions, onSuggestionClick }) {
2501
2449
  }
2502
2450
 
2503
2451
  // src/components/chat/Chat.tsx
2504
- var import_jsx_runtime25 = require("react/jsx-runtime");
2452
+ var import_jsx_runtime24 = require("react/jsx-runtime");
2505
2453
  function CopilotChat({
2506
2454
  instructions,
2507
2455
  suggestions = "auto",
@@ -2526,7 +2474,7 @@ function CopilotChat({
2526
2474
  AssistantMessage: AssistantMessage2 = AssistantMessage,
2527
2475
  UserMessage: UserMessage2 = UserMessage,
2528
2476
  ImageRenderer: ImageRenderer2 = ImageRenderer,
2529
- ErrorMessage: ErrorMessage2 = ErrorMessage,
2477
+ ErrorMessage,
2530
2478
  imageUploadsEnabled,
2531
2479
  inputFileAccept = "image/*",
2532
2480
  hideStopButton,
@@ -2549,10 +2497,10 @@ function CopilotChat({
2549
2497
  removeInternalErrorHandler
2550
2498
  } = (0, import_react_core9.useCopilotContext)();
2551
2499
  const { publicApiKey, chatApiEndpoint } = copilotApiConfig;
2552
- const [selectedImages, setSelectedImages] = (0, import_react15.useState)([]);
2553
- const [chatError, setChatError] = (0, import_react15.useState)(null);
2554
- const fileInputRef = (0, import_react15.useRef)(null);
2555
- const triggerObservabilityHook = (0, import_react15.useCallback)(
2500
+ const [selectedImages, setSelectedImages] = (0, import_react14.useState)([]);
2501
+ const [chatError, setChatError] = (0, import_react14.useState)(null);
2502
+ const fileInputRef = (0, import_react14.useRef)(null);
2503
+ const triggerObservabilityHook = (0, import_react14.useCallback)(
2556
2504
  (hookName, ...args) => {
2557
2505
  if (publicApiKey && (observabilityHooks == null ? void 0 : observabilityHooks[hookName])) {
2558
2506
  observabilityHooks[hookName](...args);
@@ -2571,7 +2519,7 @@ function CopilotChat({
2571
2519
  },
2572
2520
  [publicApiKey, observabilityHooks, setBannerError]
2573
2521
  );
2574
- const triggerChatError = (0, import_react15.useCallback)(
2522
+ const triggerChatError = (0, import_react14.useCallback)(
2575
2523
  (error, operation, originalError) => {
2576
2524
  const errorMessage = (error == null ? void 0 : error.message) || (error == null ? void 0 : error.toString()) || "An error occurred";
2577
2525
  setChatError({
@@ -2617,7 +2565,7 @@ function CopilotChat({
2617
2565
  },
2618
2566
  [publicApiKey, chatApiEndpoint, observabilityHooks, setBannerError]
2619
2567
  );
2620
- (0, import_react15.useEffect)(() => {
2568
+ (0, import_react14.useEffect)(() => {
2621
2569
  const id = "chat-component";
2622
2570
  setInternalErrorHandler({
2623
2571
  [id]: (error) => {
@@ -2630,7 +2578,7 @@ function CopilotChat({
2630
2578
  removeInternalErrorHandler == null ? void 0 : removeInternalErrorHandler(id);
2631
2579
  };
2632
2580
  }, [triggerChatError, setInternalErrorHandler, removeInternalErrorHandler]);
2633
- (0, import_react15.useEffect)(() => {
2581
+ (0, import_react14.useEffect)(() => {
2634
2582
  if (!imageUploadsEnabled)
2635
2583
  return;
2636
2584
  const handlePaste = (e) => __async(this, null, function* () {
@@ -2676,7 +2624,7 @@ function CopilotChat({
2676
2624
  document.addEventListener("paste", handlePaste);
2677
2625
  return () => document.removeEventListener("paste", handlePaste);
2678
2626
  }, [imageUploadsEnabled, triggerChatError]);
2679
- (0, import_react15.useEffect)(() => {
2627
+ (0, import_react14.useEffect)(() => {
2680
2628
  if (!(additionalInstructions == null ? void 0 : additionalInstructions.length)) {
2681
2629
  setChatInstructions(instructions || "");
2682
2630
  return;
@@ -2704,8 +2652,8 @@ function CopilotChat({
2704
2652
  onStopGeneration,
2705
2653
  onReloadMessages
2706
2654
  );
2707
- const prevIsLoading = (0, import_react15.useRef)(isLoading);
2708
- (0, import_react15.useEffect)(() => {
2655
+ const prevIsLoading = (0, import_react14.useRef)(isLoading);
2656
+ (0, import_react14.useEffect)(() => {
2709
2657
  if (prevIsLoading.current !== isLoading) {
2710
2658
  if (isLoading) {
2711
2659
  triggerObservabilityHook("onChatStarted");
@@ -2724,7 +2672,7 @@ function CopilotChat({
2724
2672
  triggerObservabilityHook("onMessageSent", text);
2725
2673
  return sendMessage(text, images);
2726
2674
  };
2727
- const chatContext = import_react15.default.useContext(ChatContext);
2675
+ const chatContext = import_react14.default.useContext(ChatContext);
2728
2676
  const isVisible = chatContext ? chatContext.open : true;
2729
2677
  const handleRegenerate = (messageId) => {
2730
2678
  if (onRegenerate) {
@@ -2786,14 +2734,14 @@ function CopilotChat({
2786
2734
  }
2787
2735
  triggerObservabilityHook("onFeedbackGiven", message.id, "thumbsDown");
2788
2736
  };
2789
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
2737
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
2790
2738
  chatError && renderError && renderError(__spreadProps(__spreadValues({}, chatError), {
2791
2739
  onDismiss: () => setChatError(null),
2792
2740
  onRetry: () => {
2793
2741
  setChatError(null);
2794
2742
  }
2795
2743
  })),
2796
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2744
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2797
2745
  Messages2,
2798
2746
  {
2799
2747
  AssistantMessage: AssistantMessage2,
@@ -2807,14 +2755,14 @@ function CopilotChat({
2807
2755
  onThumbsDown: handleThumbsDown,
2808
2756
  markdownTagRenderers,
2809
2757
  ImageRenderer: ImageRenderer2,
2810
- ErrorMessage: ErrorMessage2,
2758
+ ErrorMessage,
2811
2759
  chatError,
2812
2760
  RenderTextMessage,
2813
2761
  RenderActionExecutionMessage,
2814
2762
  RenderAgentStateMessage,
2815
2763
  RenderResultMessage,
2816
2764
  RenderImageMessage,
2817
- children: currentSuggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2765
+ children: currentSuggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2818
2766
  RenderSuggestionsList,
2819
2767
  {
2820
2768
  onSuggestionClick: handleSendMessage,
@@ -2823,9 +2771,9 @@ function CopilotChat({
2823
2771
  )
2824
2772
  }
2825
2773
  ),
2826
- imageUploadsEnabled && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
2827
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageUploadQueue, { images: selectedImages, onRemoveImage: removeSelectedImage }),
2828
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2774
+ imageUploadsEnabled && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
2775
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ImageUploadQueue, { images: selectedImages, onRemoveImage: removeSelectedImage }),
2776
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2829
2777
  "input",
2830
2778
  {
2831
2779
  type: "file",
@@ -2837,7 +2785,7 @@ function CopilotChat({
2837
2785
  }
2838
2786
  )
2839
2787
  ] }),
2840
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2788
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2841
2789
  Input2,
2842
2790
  {
2843
2791
  inProgress: isLoading,
@@ -2859,12 +2807,12 @@ function WrappedCopilotChat({
2859
2807
  labels,
2860
2808
  className
2861
2809
  }) {
2862
- const chatContext = import_react15.default.useContext(ChatContext);
2810
+ const chatContext = import_react14.default.useContext(ChatContext);
2863
2811
  if (!chatContext) {
2864
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ChatContextProvider, { icons, labels, open: true, setOpen: () => {
2865
- }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: `copilotKitChat ${className != null ? className : ""}`, children }) });
2812
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ChatContextProvider, { icons, labels, open: true, setOpen: () => {
2813
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: `copilotKitChat ${className != null ? className : ""}`, children }) });
2866
2814
  }
2867
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children });
2815
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children });
2868
2816
  }
2869
2817
  var useCopilotChatLogic = (chatSuggestions, makeSystemMessage, disableSystemMessage, onInProgress, onSubmitMessage, onStopGeneration, onReloadMessages) => {
2870
2818
  var _a;
@@ -2888,15 +2836,15 @@ var useCopilotChatLogic = (chatSuggestions, makeSystemMessage, disableSystemMess
2888
2836
  const generalContext = (0, import_react_core9.useCopilotContext)();
2889
2837
  const messagesContext = (0, import_react_core9.useCopilotMessagesContext)();
2890
2838
  const { actions } = generalContext;
2891
- const [suggestionsFailed, setSuggestionsFailed] = (0, import_react15.useState)(false);
2892
- const hasGeneratedInitialSuggestions = (0, import_react15.useRef)(false);
2893
- (0, import_react15.useEffect)(() => {
2839
+ const [suggestionsFailed, setSuggestionsFailed] = (0, import_react14.useState)(false);
2840
+ const hasGeneratedInitialSuggestions = (0, import_react14.useRef)(false);
2841
+ (0, import_react14.useEffect)(() => {
2894
2842
  if (Array.isArray(chatSuggestions)) {
2895
2843
  setSuggestions(chatSuggestions);
2896
2844
  hasGeneratedInitialSuggestions.current = true;
2897
2845
  }
2898
2846
  }, [JSON.stringify(chatSuggestions), setSuggestions]);
2899
- const generateSuggestionsWithErrorHandling = (0, import_react15.useCallback)(
2847
+ const generateSuggestionsWithErrorHandling = (0, import_react14.useCallback)(
2900
2848
  (context) => __async(void 0, null, function* () {
2901
2849
  try {
2902
2850
  yield generateSuggestions();
@@ -2907,7 +2855,7 @@ var useCopilotChatLogic = (chatSuggestions, makeSystemMessage, disableSystemMess
2907
2855
  }),
2908
2856
  [generateSuggestions]
2909
2857
  );
2910
- (0, import_react15.useEffect)(() => {
2858
+ (0, import_react14.useEffect)(() => {
2911
2859
  if (chatSuggestions !== "auto" || isLoadingSuggestions || suggestionsFailed) {
2912
2860
  return;
2913
2861
  }
@@ -2937,13 +2885,13 @@ var useCopilotChatLogic = (chatSuggestions, makeSystemMessage, disableSystemMess
2937
2885
  // Use stable string instead of object reference
2938
2886
  generateSuggestionsWithErrorHandling
2939
2887
  ]);
2940
- (0, import_react15.useEffect)(() => {
2888
+ (0, import_react14.useEffect)(() => {
2941
2889
  if (chatSuggestions !== "auto") {
2942
2890
  hasGeneratedInitialSuggestions.current = false;
2943
2891
  setSuggestionsFailed(false);
2944
2892
  }
2945
2893
  }, [chatSuggestions]);
2946
- const stableContext = (0, import_react15.useMemo)(
2894
+ const stableContext = (0, import_react14.useMemo)(
2947
2895
  () => __spreadValues(__spreadValues({}, generalContext), messagesContext),
2948
2896
  [
2949
2897
  // Only include stable dependencies
@@ -2952,12 +2900,12 @@ var useCopilotChatLogic = (chatSuggestions, makeSystemMessage, disableSystemMess
2952
2900
  generalContext.isLoading
2953
2901
  ]
2954
2902
  );
2955
- const resetSuggestions = (0, import_react15.useCallback)(() => {
2903
+ const resetSuggestions = (0, import_react14.useCallback)(() => {
2956
2904
  resetSuggestionsFromHook();
2957
2905
  setSuggestionsFailed(false);
2958
2906
  hasGeneratedInitialSuggestions.current = false;
2959
2907
  }, [resetSuggestionsFromHook]);
2960
- (0, import_react15.useEffect)(() => {
2908
+ (0, import_react14.useEffect)(() => {
2961
2909
  onInProgress == null ? void 0 : onInProgress(isLoading);
2962
2910
  }, [onInProgress, isLoading]);
2963
2911
  const safelySendMessage = (messageContent, imagesToUse) => __async(void 0, null, function* () {
@@ -3103,7 +3051,7 @@ var useCopilotChatLogic = (chatSuggestions, makeSystemMessage, disableSystemMess
3103
3051
  // src/components/chat/Modal.tsx
3104
3052
  var import_react_core11 = require("@copilotkit/react-core");
3105
3053
  var import_shared5 = require("@copilotkit/shared");
3106
- var import_jsx_runtime26 = require("react/jsx-runtime");
3054
+ var import_jsx_runtime25 = require("react/jsx-runtime");
3107
3055
  var CopilotModalInner = (_a) => {
3108
3056
  var _b = _a, {
3109
3057
  observabilityHooks,
@@ -3130,7 +3078,7 @@ var CopilotModalInner = (_a) => {
3130
3078
  ]);
3131
3079
  const { copilotApiConfig, setBannerError } = (0, import_react_core11.useCopilotContext)();
3132
3080
  const { publicApiKey } = copilotApiConfig;
3133
- const triggerObservabilityHook = (0, import_react16.useCallback)(
3081
+ const triggerObservabilityHook = (0, import_react15.useCallback)(
3134
3082
  (hookName, ...args) => {
3135
3083
  if (publicApiKey && (observabilityHooks == null ? void 0 : observabilityHooks[hookName])) {
3136
3084
  observabilityHooks[hookName](...args);
@@ -3150,8 +3098,8 @@ var CopilotModalInner = (_a) => {
3150
3098
  [publicApiKey, observabilityHooks, setBannerError]
3151
3099
  );
3152
3100
  const { open } = useChatContext();
3153
- const prevOpen = (0, import_react16.useRef)(open);
3154
- (0, import_react16.useEffect)(() => {
3101
+ const prevOpen = (0, import_react15.useRef)(open);
3102
+ (0, import_react15.useEffect)(() => {
3155
3103
  if (prevOpen.current !== open) {
3156
3104
  onSetOpen == null ? void 0 : onSetOpen(open);
3157
3105
  if (open) {
@@ -3162,13 +3110,13 @@ var CopilotModalInner = (_a) => {
3162
3110
  prevOpen.current = open;
3163
3111
  }
3164
3112
  }, [open, onSetOpen, triggerObservabilityHook]);
3165
- const memoizedHeader = (0, import_react16.useMemo)(() => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Header2, {}), [Header2]);
3166
- const memoizedChildren = (0, import_react16.useMemo)(() => children, [children]);
3167
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
3113
+ const memoizedHeader = (0, import_react15.useMemo)(() => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Header2, {}), [Header2]);
3114
+ const memoizedChildren = (0, import_react15.useMemo)(() => children, [children]);
3115
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
3168
3116
  memoizedChildren,
3169
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className, children: [
3170
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Button2, {}),
3171
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3117
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className, children: [
3118
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Button2, {}),
3119
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3172
3120
  Window2,
3173
3121
  {
3174
3122
  clickOutsideToClose,
@@ -3176,7 +3124,7 @@ var CopilotModalInner = (_a) => {
3176
3124
  hitEscapeToClose,
3177
3125
  children: [
3178
3126
  memoizedHeader,
3179
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CopilotChat, __spreadProps(__spreadValues({}, chatProps), { observabilityHooks }))
3127
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CopilotChat, __spreadProps(__spreadValues({}, chatProps), { observabilityHooks }))
3180
3128
  ]
3181
3129
  }
3182
3130
  )
@@ -3243,8 +3191,8 @@ var CopilotModal = (_a) => {
3243
3191
  "children",
3244
3192
  "observabilityHooks"
3245
3193
  ]);
3246
- const [openState, setOpenState] = import_react16.default.useState(defaultOpen);
3247
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChatContextProvider, { icons, labels, open: openState, setOpen: setOpenState, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3194
+ const [openState, setOpenState] = import_react15.default.useState(defaultOpen);
3195
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ChatContextProvider, { icons, labels, open: openState, setOpen: setOpenState, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3248
3196
  CopilotModalInner,
3249
3197
  __spreadProps(__spreadValues({
3250
3198
  observabilityHooks,
@@ -3278,12 +3226,12 @@ var CopilotModal = (_a) => {
3278
3226
  };
3279
3227
 
3280
3228
  // src/components/chat/Sidebar.tsx
3281
- var import_jsx_runtime27 = require("react/jsx-runtime");
3229
+ var import_jsx_runtime26 = require("react/jsx-runtime");
3282
3230
  function CopilotSidebar(props) {
3283
3231
  props = __spreadProps(__spreadValues({}, props), {
3284
3232
  className: props.className ? props.className + " copilotKitSidebar" : "copilotKitSidebar"
3285
3233
  });
3286
- const [expandedClassName, setExpandedClassName] = (0, import_react17.useState)(
3234
+ const [expandedClassName, setExpandedClassName] = (0, import_react16.useState)(
3287
3235
  props.defaultOpen ? "sidebarExpanded" : ""
3288
3236
  );
3289
3237
  const onSetOpen = (open) => {
@@ -3291,7 +3239,7 @@ function CopilotSidebar(props) {
3291
3239
  (_a = props.onSetOpen) == null ? void 0 : _a.call(props, open);
3292
3240
  setExpandedClassName(open ? "sidebarExpanded" : "");
3293
3241
  };
3294
- 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 })) });
3242
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: `copilotKitSidebarContentWrapper ${expandedClassName}`, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CopilotModal, __spreadProps(__spreadValues(__spreadValues({}, props), { onSetOpen }), { children: props.children })) });
3295
3243
  }
3296
3244
  // Annotate the CommonJS export names for ESM import in node:
3297
3245
  0 && (module.exports = {