@copilotkit/react-ui 1.9.3-next.4 → 1.10.0-next.0

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 (178) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/{chunk-KENCH7RN.mjs → chunk-B5IFB5YJ.mjs} +1 -1
  3. package/dist/chunk-B5IFB5YJ.mjs.map +1 -0
  4. package/dist/chunk-DBKRAOH7.mjs +34 -0
  5. package/dist/chunk-DBKRAOH7.mjs.map +1 -0
  6. package/dist/{chunk-4HUXYD3B.mjs → chunk-DTRPPNSA.mjs} +2 -2
  7. package/dist/{chunk-YTXEWDNC.mjs → chunk-E6MQUIZW.mjs} +15 -4
  8. package/dist/chunk-E6MQUIZW.mjs.map +1 -0
  9. package/dist/{chunk-L3GZ7TXC.mjs → chunk-GCKKSSBU.mjs} +21 -24
  10. package/dist/chunk-GCKKSSBU.mjs.map +1 -0
  11. package/dist/{chunk-KN2GCKBE.mjs → chunk-GJ3MFNBX.mjs} +6 -6
  12. package/dist/{chunk-32MUWKL3.mjs → chunk-JHUTTP5C.mjs} +21 -17
  13. package/dist/chunk-JHUTTP5C.mjs.map +1 -0
  14. package/dist/{chunk-HKTWKCPS.mjs → chunk-LXCD3K7B.mjs} +127 -92
  15. package/dist/chunk-LXCD3K7B.mjs.map +1 -0
  16. package/dist/{chunk-S5MBUNGN.mjs → chunk-O72ZB5V3.mjs} +4 -4
  17. package/dist/chunk-O72ZB5V3.mjs.map +1 -0
  18. package/dist/{chunk-QGSPTXOV.mjs → chunk-O7KTFUAN.mjs} +2 -2
  19. package/dist/chunk-O7KTFUAN.mjs.map +1 -0
  20. package/dist/chunk-Q2467VHZ.mjs +30 -0
  21. package/dist/chunk-Q2467VHZ.mjs.map +1 -0
  22. package/dist/{chunk-H3EM63WS.mjs → chunk-VLNT34X3.mjs} +2 -2
  23. package/dist/chunk-VVL6JFCJ.mjs +16 -0
  24. package/dist/chunk-VVL6JFCJ.mjs.map +1 -0
  25. package/dist/chunk-WHDNKXMP.mjs +135 -0
  26. package/dist/chunk-WHDNKXMP.mjs.map +1 -0
  27. package/dist/{chunk-ALIBUJML.mjs → chunk-WPVTPQ7X.mjs} +2 -2
  28. package/dist/components/chat/Button.d.ts +1 -1
  29. package/dist/components/chat/Chat.d.ts +119 -28
  30. package/dist/components/chat/Chat.js +298 -658
  31. package/dist/components/chat/Chat.js.map +1 -1
  32. package/dist/components/chat/Chat.mjs +12 -15
  33. package/dist/components/chat/CodeBlock.js.map +1 -1
  34. package/dist/components/chat/CodeBlock.mjs +1 -1
  35. package/dist/components/chat/Header.d.ts +1 -1
  36. package/dist/components/chat/Input.d.ts +1 -1
  37. package/dist/components/chat/Input.js +3 -3
  38. package/dist/components/chat/Input.js.map +1 -1
  39. package/dist/components/chat/Input.mjs +2 -2
  40. package/dist/components/chat/Markdown.js +13 -2
  41. package/dist/components/chat/Markdown.js.map +1 -1
  42. package/dist/components/chat/Markdown.mjs +2 -2
  43. package/dist/components/chat/Messages.d.ts +3 -3
  44. package/dist/components/chat/Messages.js +40 -116
  45. package/dist/components/chat/Messages.js.map +1 -1
  46. package/dist/components/chat/Messages.mjs +1 -1
  47. package/dist/components/chat/Modal.d.ts +7 -2
  48. package/dist/components/chat/Modal.js +308 -668
  49. package/dist/components/chat/Modal.js.map +1 -1
  50. package/dist/components/chat/Modal.mjs +13 -16
  51. package/dist/components/chat/Popup.d.ts +7 -2
  52. package/dist/components/chat/Popup.js +310 -670
  53. package/dist/components/chat/Popup.js.map +1 -1
  54. package/dist/components/chat/Popup.mjs +14 -17
  55. package/dist/components/chat/Sidebar.d.ts +7 -2
  56. package/dist/components/chat/Sidebar.js +312 -672
  57. package/dist/components/chat/Sidebar.js.map +1 -1
  58. package/dist/components/chat/Sidebar.mjs +14 -17
  59. package/dist/components/chat/Suggestion.d.ts +2 -9
  60. package/dist/components/chat/Suggestion.js +6 -96
  61. package/dist/components/chat/Suggestion.js.map +1 -1
  62. package/dist/components/chat/Suggestion.mjs +3 -5
  63. package/dist/components/chat/Suggestions.d.ts +1 -1
  64. package/dist/components/chat/Suggestions.js +4 -3
  65. package/dist/components/chat/Suggestions.js.map +1 -1
  66. package/dist/components/chat/Suggestions.mjs +2 -2
  67. package/dist/components/chat/Window.d.ts +1 -1
  68. package/dist/components/chat/index.d.ts +8 -3
  69. package/dist/components/chat/index.js +316 -676
  70. package/dist/components/chat/index.js.map +1 -1
  71. package/dist/components/chat/index.mjs +18 -21
  72. package/dist/components/chat/messages/AssistantMessage.d.ts +1 -1
  73. package/dist/components/chat/messages/AssistantMessage.js +32 -24
  74. package/dist/components/chat/messages/AssistantMessage.js.map +1 -1
  75. package/dist/components/chat/messages/AssistantMessage.mjs +3 -3
  76. package/dist/components/chat/messages/ImageRenderer.d.ts +12 -0
  77. package/dist/components/chat/messages/ImageRenderer.js +58 -0
  78. package/dist/components/chat/messages/ImageRenderer.js.map +1 -0
  79. package/dist/components/chat/messages/ImageRenderer.mjs +8 -0
  80. package/dist/components/chat/messages/RenderMessage.d.ts +9 -0
  81. package/dist/components/chat/messages/{RenderTextMessage.js → RenderMessage.js} +92 -47
  82. package/dist/components/chat/messages/RenderMessage.js.map +1 -0
  83. package/dist/components/chat/messages/RenderMessage.mjs +16 -0
  84. package/dist/components/chat/messages/UserMessage.d.ts +1 -1
  85. package/dist/components/chat/messages/UserMessage.js +7 -1
  86. package/dist/components/chat/messages/UserMessage.js.map +1 -1
  87. package/dist/components/chat/messages/UserMessage.mjs +1 -1
  88. package/dist/components/chat/props.d.ts +32 -27
  89. package/dist/components/chat/props.js.map +1 -1
  90. package/dist/components/index.d.ts +8 -3
  91. package/dist/components/index.js +316 -676
  92. package/dist/components/index.js.map +1 -1
  93. package/dist/components/index.mjs +18 -21
  94. package/dist/hooks/use-push-to-talk.d.ts +1 -1
  95. package/dist/hooks/use-push-to-talk.js +3 -3
  96. package/dist/hooks/use-push-to-talk.js.map +1 -1
  97. package/dist/hooks/use-push-to-talk.mjs +1 -1
  98. package/dist/index.css +59 -3
  99. package/dist/index.css.map +1 -1
  100. package/dist/index.d.ts +8 -3
  101. package/dist/index.js +322 -682
  102. package/dist/index.js.map +1 -1
  103. package/dist/index.mjs +18 -21
  104. package/dist/types/css.d.ts +3 -0
  105. package/dist/types/css.js.map +1 -1
  106. package/package.json +4 -4
  107. package/src/components/chat/Chat.tsx +193 -105
  108. package/src/components/chat/CodeBlock.tsx +1 -1
  109. package/src/components/chat/Markdown.tsx +12 -2
  110. package/src/components/chat/Messages.tsx +43 -122
  111. package/src/components/chat/Suggestion.tsx +5 -108
  112. package/src/components/chat/Suggestions.tsx +0 -1
  113. package/src/components/chat/index.tsx +1 -1
  114. package/src/components/chat/messages/AssistantMessage.tsx +15 -23
  115. package/src/components/chat/messages/ImageRenderer.tsx +37 -0
  116. package/src/components/chat/messages/{RenderTextMessage.tsx → RenderMessage.tsx} +10 -9
  117. package/src/components/chat/messages/UserMessage.tsx +16 -5
  118. package/src/components/chat/props.ts +36 -28
  119. package/src/css/colors.css +10 -0
  120. package/src/css/markdown.css +8 -0
  121. package/src/css/messages.css +54 -5
  122. package/src/css/suggestions.css +1 -1
  123. package/src/hooks/use-push-to-talk.tsx +6 -5
  124. package/src/styles.css +1 -1
  125. package/src/types/css.ts +3 -0
  126. package/dist/chunk-2II3Q27P.mjs +0 -112
  127. package/dist/chunk-2II3Q27P.mjs.map +0 -1
  128. package/dist/chunk-32MUWKL3.mjs.map +0 -1
  129. package/dist/chunk-53CVDVS5.mjs +0 -127
  130. package/dist/chunk-53CVDVS5.mjs.map +0 -1
  131. package/dist/chunk-B3D7U7TJ.mjs +0 -211
  132. package/dist/chunk-B3D7U7TJ.mjs.map +0 -1
  133. package/dist/chunk-C7OB63U5.mjs +0 -36
  134. package/dist/chunk-C7OB63U5.mjs.map +0 -1
  135. package/dist/chunk-HKTWKCPS.mjs.map +0 -1
  136. package/dist/chunk-HWMFMBJC.mjs +0 -10
  137. package/dist/chunk-HWMFMBJC.mjs.map +0 -1
  138. package/dist/chunk-IMBPSLL4.mjs +0 -104
  139. package/dist/chunk-IMBPSLL4.mjs.map +0 -1
  140. package/dist/chunk-KENCH7RN.mjs.map +0 -1
  141. package/dist/chunk-L3GZ7TXC.mjs.map +0 -1
  142. package/dist/chunk-QGSPTXOV.mjs.map +0 -1
  143. package/dist/chunk-S5MBUNGN.mjs.map +0 -1
  144. package/dist/chunk-ULDQXCED.mjs +0 -78
  145. package/dist/chunk-ULDQXCED.mjs.map +0 -1
  146. package/dist/chunk-YTXEWDNC.mjs.map +0 -1
  147. package/dist/components/chat/messages/RenderActionExecutionMessage.d.ts +0 -9
  148. package/dist/components/chat/messages/RenderActionExecutionMessage.js +0 -869
  149. package/dist/components/chat/messages/RenderActionExecutionMessage.js.map +0 -1
  150. package/dist/components/chat/messages/RenderActionExecutionMessage.mjs +0 -14
  151. package/dist/components/chat/messages/RenderAgentStateMessage.d.ts +0 -9
  152. package/dist/components/chat/messages/RenderAgentStateMessage.js +0 -854
  153. package/dist/components/chat/messages/RenderAgentStateMessage.js.map +0 -1
  154. package/dist/components/chat/messages/RenderAgentStateMessage.mjs +0 -14
  155. package/dist/components/chat/messages/RenderImageMessage.d.ts +0 -9
  156. package/dist/components/chat/messages/RenderImageMessage.js +0 -823
  157. package/dist/components/chat/messages/RenderImageMessage.js.map +0 -1
  158. package/dist/components/chat/messages/RenderImageMessage.mjs +0 -15
  159. package/dist/components/chat/messages/RenderImageMessage.mjs.map +0 -1
  160. package/dist/components/chat/messages/RenderResultMessage.d.ts +0 -9
  161. package/dist/components/chat/messages/RenderResultMessage.js +0 -778
  162. package/dist/components/chat/messages/RenderResultMessage.js.map +0 -1
  163. package/dist/components/chat/messages/RenderResultMessage.mjs +0 -14
  164. package/dist/components/chat/messages/RenderResultMessage.mjs.map +0 -1
  165. package/dist/components/chat/messages/RenderTextMessage.d.ts +0 -9
  166. package/dist/components/chat/messages/RenderTextMessage.js.map +0 -1
  167. package/dist/components/chat/messages/RenderTextMessage.mjs +0 -15
  168. package/dist/components/chat/messages/RenderTextMessage.mjs.map +0 -1
  169. package/src/components/chat/messages/RenderActionExecutionMessage.tsx +0 -127
  170. package/src/components/chat/messages/RenderAgentStateMessage.tsx +0 -116
  171. package/src/components/chat/messages/RenderImageMessage.tsx +0 -64
  172. package/src/components/chat/messages/RenderResultMessage.tsx +0 -26
  173. /package/dist/{chunk-4HUXYD3B.mjs.map → chunk-DTRPPNSA.mjs.map} +0 -0
  174. /package/dist/{chunk-KN2GCKBE.mjs.map → chunk-GJ3MFNBX.mjs.map} +0 -0
  175. /package/dist/{chunk-H3EM63WS.mjs.map → chunk-VLNT34X3.mjs.map} +0 -0
  176. /package/dist/{chunk-ALIBUJML.mjs.map → chunk-WPVTPQ7X.mjs.map} +0 -0
  177. /package/dist/components/chat/messages/{RenderActionExecutionMessage.mjs.map → ImageRenderer.mjs.map} +0 -0
  178. /package/dist/components/chat/messages/{RenderAgentStateMessage.mjs.map → RenderMessage.mjs.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  CopilotSidebar
3
- } from "../../chunk-ALIBUJML.mjs";
4
- import "../../chunk-KN2GCKBE.mjs";
3
+ } from "../../chunk-WPVTPQ7X.mjs";
4
+ import "../../chunk-GJ3MFNBX.mjs";
5
5
  import "../../chunk-C3GSYRC3.mjs";
6
6
  import "../../chunk-GVKA7RQQ.mjs";
7
7
  import "../../chunk-V7W6IM2V.mjs";
@@ -12,28 +12,25 @@ import "../../chunk-KXE2JCUH.mjs";
12
12
  import "../../chunk-NRA3CFEE.mjs";
13
13
  import "../../chunk-BH6PCAAL.mjs";
14
14
  import "../../chunk-UFN2VWSR.mjs";
15
- import "../../chunk-HKTWKCPS.mjs";
16
- import "../../chunk-53CVDVS5.mjs";
17
- import "../../chunk-2II3Q27P.mjs";
18
- import "../../chunk-ULDQXCED.mjs";
19
- import "../../chunk-C7OB63U5.mjs";
20
- import "../../chunk-32MUWKL3.mjs";
21
- import "../../chunk-L3GZ7TXC.mjs";
22
- import "../../chunk-HWMFMBJC.mjs";
23
- import "../../chunk-QGSPTXOV.mjs";
24
- import "../../chunk-IMBPSLL4.mjs";
15
+ import "../../chunk-LXCD3K7B.mjs";
16
+ import "../../chunk-JHUTTP5C.mjs";
17
+ import "../../chunk-GCKKSSBU.mjs";
18
+ import "../../chunk-DBKRAOH7.mjs";
19
+ import "../../chunk-VVL6JFCJ.mjs";
20
+ import "../../chunk-O7KTFUAN.mjs";
21
+ import "../../chunk-Q2467VHZ.mjs";
25
22
  import "../../chunk-PLHTVHUW.mjs";
26
- import "../../chunk-4HUXYD3B.mjs";
23
+ import "../../chunk-DTRPPNSA.mjs";
27
24
  import "../../chunk-CGEAG65D.mjs";
28
25
  import "../../chunk-QIOJXTIQ.mjs";
29
- import "../../chunk-YTXEWDNC.mjs";
30
- import "../../chunk-B3D7U7TJ.mjs";
26
+ import "../../chunk-E6MQUIZW.mjs";
27
+ import "../../chunk-WHDNKXMP.mjs";
31
28
  import "../../chunk-IEMQ2SQW.mjs";
32
- import "../../chunk-KENCH7RN.mjs";
29
+ import "../../chunk-B5IFB5YJ.mjs";
33
30
  import "../../chunk-XWG3L6QC.mjs";
34
31
  import "../../chunk-54JAUBUJ.mjs";
35
32
  import "../../chunk-JGMFJZMG.mjs";
36
- import "../../chunk-S5MBUNGN.mjs";
33
+ import "../../chunk-O72ZB5V3.mjs";
37
34
  import "../../chunk-MRXNTQOX.mjs";
38
35
  export {
39
36
  CopilotSidebar
@@ -1,5 +1,4 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { CopilotContextParams, CopilotMessagesContextParams, CopilotChatSuggestionConfiguration } from '@copilotkit/react-core';
3
2
 
4
3
  interface SuggestionsProps {
5
4
  title: string;
@@ -8,12 +7,6 @@ interface SuggestionsProps {
8
7
  className?: string;
9
8
  onClick: () => void;
10
9
  }
11
- declare function Suggestion({ title, onClick, partial, className }: SuggestionsProps): react_jsx_runtime.JSX.Element;
12
- declare const reloadSuggestions: (context: CopilotContextParams & CopilotMessagesContextParams, chatSuggestionConfiguration: {
13
- [key: string]: CopilotChatSuggestionConfiguration;
14
- }, setCurrentSuggestions: (suggestions: {
15
- title: string;
16
- message: string;
17
- }[]) => void, abortControllerRef: React.MutableRefObject<AbortController | null>) => Promise<void>;
10
+ declare function Suggestion({ title, onClick, partial, className }: SuggestionsProps): react_jsx_runtime.JSX.Element | null;
18
11
 
19
- export { Suggestion, reloadSuggestions };
12
+ export { Suggestion };
@@ -16,32 +16,11 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var __async = (__this, __arguments, generator) => {
20
- return new Promise((resolve, reject) => {
21
- var fulfilled = (value) => {
22
- try {
23
- step(generator.next(value));
24
- } catch (e) {
25
- reject(e);
26
- }
27
- };
28
- var rejected = (value) => {
29
- try {
30
- step(generator.throw(value));
31
- } catch (e) {
32
- reject(e);
33
- }
34
- };
35
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
36
- step((generator = generator.apply(__this, __arguments)).next());
37
- });
38
- };
39
19
 
40
20
  // src/components/chat/Suggestion.tsx
41
21
  var Suggestion_exports = {};
42
22
  __export(Suggestion_exports, {
43
- Suggestion: () => Suggestion,
44
- reloadSuggestions: () => reloadSuggestions
23
+ Suggestion: () => Suggestion
45
24
  });
46
25
  module.exports = __toCommonJS(Suggestion_exports);
47
26
  var import_react_core = require("@copilotkit/react-core");
@@ -51,14 +30,15 @@ var import_jsx_runtime = require("react/jsx-runtime");
51
30
  var SmallSpinnerIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "copilotKitSpinner", style: { width: "13px", height: "13px" } });
52
31
 
53
32
  // src/components/chat/Suggestion.tsx
54
- var import_shared = require("@copilotkit/shared");
55
- var import_runtime_client_gql = require("@copilotkit/runtime-client-gql");
56
33
  var import_jsx_runtime2 = require("react/jsx-runtime");
57
34
  function Suggestion({ title, onClick, partial, className }) {
35
+ if (!title)
36
+ return null;
37
+ const { isLoading } = (0, import_react_core.useCopilotChat)();
58
38
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
59
39
  "button",
60
40
  {
61
- disabled: partial,
41
+ disabled: partial || isLoading,
62
42
  onClick: (e) => {
63
43
  e.preventDefault();
64
44
  onClick();
@@ -69,78 +49,8 @@ function Suggestion({ title, onClick, partial, className }) {
69
49
  }
70
50
  );
71
51
  }
72
- var reloadSuggestions = (context, chatSuggestionConfiguration, setCurrentSuggestions, abortControllerRef) => __async(void 0, null, function* () {
73
- const abortController = abortControllerRef.current;
74
- const tools = JSON.stringify(
75
- Object.values(context.actions).map((action) => ({
76
- name: action.name,
77
- description: action.description,
78
- jsonSchema: JSON.stringify((0, import_shared.actionParametersToJsonSchema)(action.parameters))
79
- }))
80
- );
81
- const allSuggestions = [];
82
- for (const config of Object.values(chatSuggestionConfiguration)) {
83
- try {
84
- const numOfSuggestionsInstructions = config.minSuggestions === 0 ? `Produce up to ${config.maxSuggestions} suggestions. If there are no highly relevant suggestions you can think of, provide an empty array.` : `Produce between ${config.minSuggestions} and ${config.maxSuggestions} suggestions.`;
85
- const result = yield (0, import_react_core.extract)({
86
- context,
87
- instructions: "Suggest what the user could say next. Provide clear, highly relevant suggestions. Do not literally suggest function calls. ",
88
- data: config.instructions + "\n\n" + numOfSuggestionsInstructions + "\n\nAvailable tools: " + tools + "\n\n",
89
- requestType: import_runtime_client_gql.CopilotRequestType.Task,
90
- parameters: [
91
- {
92
- name: "suggestions",
93
- type: "object[]",
94
- attributes: [
95
- {
96
- name: "title",
97
- description: "The title of the suggestion. This is shown as a button and should be short.",
98
- type: "string"
99
- },
100
- {
101
- name: "message",
102
- description: "The message to send when the suggestion is clicked. This should be a clear, complete sentence and will be sent as an instruction to the AI.",
103
- type: "string"
104
- }
105
- ]
106
- }
107
- ],
108
- include: {
109
- messages: true,
110
- readable: true
111
- },
112
- abortSignal: abortController == null ? void 0 : abortController.signal,
113
- stream: ({ status, args }) => {
114
- const suggestions = args.suggestions || [];
115
- const newSuggestions = [];
116
- for (let i = 0; i < suggestions.length; i++) {
117
- if (config.maxSuggestions !== void 0 && i >= config.maxSuggestions) {
118
- break;
119
- }
120
- const { title, message } = suggestions[i];
121
- const partial = i == suggestions.length - 1 && status !== "complete";
122
- newSuggestions.push({
123
- title,
124
- message,
125
- partial,
126
- className: config.className
127
- });
128
- }
129
- setCurrentSuggestions([...allSuggestions, ...newSuggestions]);
130
- }
131
- });
132
- allSuggestions.push(...result.suggestions);
133
- } catch (error) {
134
- console.error("Error loading suggestions", error);
135
- }
136
- }
137
- if (abortControllerRef.current === abortController) {
138
- abortControllerRef.current = null;
139
- }
140
- });
141
52
  // Annotate the CommonJS export names for ESM import in node:
142
53
  0 && (module.exports = {
143
- Suggestion,
144
- reloadSuggestions
54
+ Suggestion
145
55
  });
146
56
  //# sourceMappingURL=Suggestion.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/chat/Suggestion.tsx","../../../src/components/chat/Icons.tsx"],"sourcesContent":["import {\n CopilotContextParams,\n extract,\n CopilotChatSuggestionConfiguration,\n CopilotMessagesContextParams,\n} from \"@copilotkit/react-core\";\nimport { SmallSpinnerIcon } from \"./Icons\";\nimport { CopilotChatSuggestion } from \"../../types/suggestions\";\nimport { actionParametersToJsonSchema } from \"@copilotkit/shared\";\nimport { CopilotRequestType } from \"@copilotkit/runtime-client-gql\";\n\ninterface SuggestionsProps {\n title: string;\n message: string;\n partial?: boolean;\n className?: string;\n onClick: () => void;\n}\n\nexport function Suggestion({ title, onClick, partial, className }: SuggestionsProps) {\n return (\n <button\n disabled={partial}\n onClick={(e) => {\n e.preventDefault();\n onClick();\n }}\n className={className || (partial ? \"suggestion loading\" : \"suggestion\")}\n data-test-id=\"suggestion\"\n >\n {partial ? SmallSpinnerIcon : <span>{title}</span>}\n </button>\n );\n}\n\nexport const reloadSuggestions = async (\n context: CopilotContextParams & CopilotMessagesContextParams,\n chatSuggestionConfiguration: { [key: string]: CopilotChatSuggestionConfiguration },\n setCurrentSuggestions: (suggestions: { title: string; message: string }[]) => void,\n abortControllerRef: React.MutableRefObject<AbortController | null>,\n) => {\n const abortController = abortControllerRef.current;\n\n const tools = JSON.stringify(\n Object.values(context.actions).map((action) => ({\n name: action.name,\n description: action.description,\n jsonSchema: JSON.stringify(actionParametersToJsonSchema(action.parameters)),\n })),\n );\n\n const allSuggestions: CopilotChatSuggestion[] = [];\n\n for (const config of Object.values(chatSuggestionConfiguration)) {\n try {\n const numOfSuggestionsInstructions =\n config.minSuggestions === 0\n ? `Produce up to ${config.maxSuggestions} suggestions. ` +\n `If there are no highly relevant suggestions you can think of, provide an empty array.`\n : `Produce between ${config.minSuggestions} and ${config.maxSuggestions} suggestions.`;\n\n const result = await extract({\n context,\n instructions:\n \"Suggest what the user could say next. Provide clear, highly relevant suggestions. Do not literally suggest function calls. \",\n data:\n config.instructions +\n \"\\n\\n\" +\n numOfSuggestionsInstructions +\n \"\\n\\n\" +\n \"Available tools: \" +\n tools +\n \"\\n\\n\",\n requestType: CopilotRequestType.Task,\n parameters: [\n {\n name: \"suggestions\",\n type: \"object[]\",\n attributes: [\n {\n name: \"title\",\n description:\n \"The title of the suggestion. This is shown as a button and should be short.\",\n type: \"string\",\n },\n {\n name: \"message\",\n description:\n \"The message to send when the suggestion is clicked. This should be a clear, complete sentence and will be sent as an instruction to the AI.\",\n type: \"string\",\n },\n ],\n },\n ],\n include: {\n messages: true,\n readable: true,\n },\n abortSignal: abortController?.signal,\n stream: ({ status, args }) => {\n const suggestions = args.suggestions || [];\n const newSuggestions: CopilotChatSuggestion[] = [];\n for (let i = 0; i < suggestions.length; i++) {\n // if GPT provides too many suggestions, limit the number of suggestions\n if (config.maxSuggestions !== undefined && i >= config.maxSuggestions) {\n break;\n }\n const { title, message } = suggestions[i];\n\n // If this is the last suggestion and the status is not complete, mark it as partial\n const partial = i == suggestions.length - 1 && status !== \"complete\";\n\n newSuggestions.push({\n title,\n message,\n partial,\n className: config.className,\n });\n }\n setCurrentSuggestions([...allSuggestions, ...newSuggestions]);\n },\n });\n allSuggestions.push(...result.suggestions);\n } catch (error) {\n console.error(\"Error loading suggestions\", error);\n }\n }\n\n if (abortControllerRef.current === abortController) {\n abortControllerRef.current = null;\n }\n};\n","import React from \"react\";\n\nexport const OpenIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <g transform=\"translate(24, 0) scale(-1, 1)\">\n <path\n fillRule=\"evenodd\"\n d=\"M5.337 21.718a6.707 6.707 0 01-.533-.074.75.75 0 01-.44-1.223 3.73 3.73 0 00.814-1.686c.023-.115-.022-.317-.254-.543C3.274 16.587 2.25 14.41 2.25 12c0-5.03 4.428-9 9.75-9s9.75 3.97 9.75 9c0 5.03-4.428 9-9.75 9-.833 0-1.643-.097-2.417-.279a6.721 6.721 0 01-4.246.997z\"\n clipRule=\"evenodd\"\n />\n </g>\n </svg>\n);\n\nexport const CloseIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M19.5 8.25l-7.5 7.5-7.5-7.5\" />\n </svg>\n);\n\nexport const HeaderCloseIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M6 18L18 6M6 6l12 12\" />\n </svg>\n);\n\nexport const SendIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M12 19V5m0 0l-7 7m7-7l7 7\" />\n </svg>\n);\n\nexport const MicrophoneIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z\"\n />\n </svg>\n);\n\nexport const StopIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z\"\n />\n </svg>\n);\n\nexport const RegenerateIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182m0-4.991v4.99\"\n />\n </svg>\n);\n\nexport const CopyIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 01-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 011.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 00-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 01-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 00-3.375-3.375h-1.5a1.125 1.125 0 01-1.125-1.125v-1.5a3.375 3.375 0 00-3.375-3.375H9.75\"\n />\n </svg>\n);\n\nexport const SmallSpinnerIcon = (\n <span className=\"copilotKitSpinner\" style={{ width: \"13px\", height: \"13px\" }}></span>\n);\n\nexport const SpinnerIcon = (\n <span className=\"copilotKitSpinner\" style={{ width: \"24px\", height: \"24px\" }}></span>\n);\n\nexport const ActivityIcon = (\n <div style={{ display: \"flex\", alignItems: \"center\", gap: \"4px\" }}>\n <span className=\"copilotKitActivityDot\" style={{ animationDelay: \"0s\" }}></span>\n <span className=\"copilotKitActivityDot\" style={{ animationDelay: \"0.2s\" }}></span>\n <span className=\"copilotKitActivityDot\" style={{ animationDelay: \"0.4s\" }}></span>\n </div>\n);\n\nexport const ThumbsUpIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M6.633 10.5c.806 0 1.533-.446 2.031-1.08a9.041 9.041 0 012.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 00.322-1.672V3a.75.75 0 01.75-.75A2.25 2.25 0 0116.5 4.5c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 01-2.649 7.521c-.388.482-.987.729-1.605.729H13.48c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 00-1.423-.23H5.904M14.25 9h2.25M5.904 18.75c.083.205.173.405.27.602.197.4-.078.898-.523.898h-.908c-.889 0-1.713-.518-1.972-1.368a12 12 0 01-.521-3.507c0-1.553.295-3.036.831-4.398C3.387 10.203 4.167 9.75 5 9.75h1.053c.472 0 .745.556.5.96a8.958 8.958 0 00-1.302 4.665c0 1.194.232 2.333.654 3.375z\"\n />\n </svg>\n);\n\nexport const ThumbsDownIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M7.5 15h2.25m8.024-9.75c.011.05.028.1.052.148.591 1.2.924 2.55.924 3.977a8.96 8.96 0 01-.999 4.125m.023-8.25c-.076-.365.183-.75.575-.75h.908c.889 0 1.713.518 1.972 1.368.339 1.11.521 2.287.521 3.507 0 1.553-.295 3.036-.831 4.398C20.613 14.547 19.833 15 19 15h-1.053c-.472 0-.745-.556-.5-.96a8.95 8.95 0 00.303-.54m.023-8.25H16.48a4.5 4.5 0 01-1.423-.23l-3.114-1.04a4.5 4.5 0 00-1.423-.23H6.504c-.618 0-1.217.247-1.605.729A11.95 11.95 0 002.25 12c0 .434.023.863.068 1.285C2.427 14.306 3.346 15 4.372 15h3.126c.618 0 .991.724.725 1.282A7.471 7.471 0 007.5 19.5a2.25 2.25 0 002.25 2.25.75.75 0 00.75-.75v-.633c0-.573.11-1.14.322-1.672.304-.76.93-1.33 1.653-1.715a9.04 9.04 0 002.86-2.4c.498-.634 1.226-1.08 2.032-1.08h.384\"\n />\n </svg>\n);\n\nexport const DownloadIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3\"\n />\n </svg>\n);\n\nexport const UploadIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M12 4.5v15m7.5-7.5h-15\" />\n </svg>\n);\n\nexport const CheckIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\" />\n </svg>\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAKO;;;ACMD;AA6HC,IAAM,mBACX,4CAAC,UAAK,WAAU,qBAAoB,OAAO,EAAE,OAAO,QAAQ,QAAQ,OAAO,GAAG;;;ADjIhF,oBAA6C;AAC7C,gCAAmC;AAqBC,IAAAA,sBAAA;AAX7B,SAAS,WAAW,EAAE,OAAO,SAAS,SAAS,UAAU,GAAqB;AACnF,SACE;AAAA,IAAC;AAAA;AAAA,MACC,UAAU;AAAA,MACV,SAAS,CAAC,MAAM;AACd,UAAE,eAAe;AACjB,gBAAQ;AAAA,MACV;AAAA,MACA,WAAW,cAAc,UAAU,uBAAuB;AAAA,MAC1D,gBAAa;AAAA,MAEZ,oBAAU,mBAAmB,6CAAC,UAAM,iBAAM;AAAA;AAAA,EAC7C;AAEJ;AAEO,IAAM,oBAAoB,CAC/B,SACA,6BACA,uBACA,uBACG;AACH,QAAM,kBAAkB,mBAAmB;AAE3C,QAAM,QAAQ,KAAK;AAAA,IACjB,OAAO,OAAO,QAAQ,OAAO,EAAE,IAAI,CAAC,YAAY;AAAA,MAC9C,MAAM,OAAO;AAAA,MACb,aAAa,OAAO;AAAA,MACpB,YAAY,KAAK,cAAU,4CAA6B,OAAO,UAAU,CAAC;AAAA,IAC5E,EAAE;AAAA,EACJ;AAEA,QAAM,iBAA0C,CAAC;AAEjD,aAAW,UAAU,OAAO,OAAO,2BAA2B,GAAG;AAC/D,QAAI;AACF,YAAM,+BACJ,OAAO,mBAAmB,IACtB,iBAAiB,OAAO,sHAExB,mBAAmB,OAAO,sBAAsB,OAAO;AAE7D,YAAM,SAAS,UAAM,2BAAQ;AAAA,QAC3B;AAAA,QACA,cACE;AAAA,QACF,MACE,OAAO,eACP,SACA,+BACA,0BAEA,QACA;AAAA,QACF,aAAa,6CAAmB;AAAA,QAChC,YAAY;AAAA,UACV;AAAA,YACE,MAAM;AAAA,YACN,MAAM;AAAA,YACN,YAAY;AAAA,cACV;AAAA,gBACE,MAAM;AAAA,gBACN,aACE;AAAA,gBACF,MAAM;AAAA,cACR;AAAA,cACA;AAAA,gBACE,MAAM;AAAA,gBACN,aACE;AAAA,gBACF,MAAM;AAAA,cACR;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,QACA,SAAS;AAAA,UACP,UAAU;AAAA,UACV,UAAU;AAAA,QACZ;AAAA,QACA,aAAa,mDAAiB;AAAA,QAC9B,QAAQ,CAAC,EAAE,QAAQ,KAAK,MAAM;AAC5B,gBAAM,cAAc,KAAK,eAAe,CAAC;AACzC,gBAAM,iBAA0C,CAAC;AACjD,mBAAS,IAAI,GAAG,IAAI,YAAY,QAAQ,KAAK;AAE3C,gBAAI,OAAO,mBAAmB,UAAa,KAAK,OAAO,gBAAgB;AACrE;AAAA,YACF;AACA,kBAAM,EAAE,OAAO,QAAQ,IAAI,YAAY,CAAC;AAGxC,kBAAM,UAAU,KAAK,YAAY,SAAS,KAAK,WAAW;AAE1D,2BAAe,KAAK;AAAA,cAClB;AAAA,cACA;AAAA,cACA;AAAA,cACA,WAAW,OAAO;AAAA,YACpB,CAAC;AAAA,UACH;AACA,gCAAsB,CAAC,GAAG,gBAAgB,GAAG,cAAc,CAAC;AAAA,QAC9D;AAAA,MACF,CAAC;AACD,qBAAe,KAAK,GAAG,OAAO,WAAW;AAAA,IAC3C,SAAS,OAAP;AACA,cAAQ,MAAM,6BAA6B,KAAK;AAAA,IAClD;AAAA,EACF;AAEA,MAAI,mBAAmB,YAAY,iBAAiB;AAClD,uBAAmB,UAAU;AAAA,EAC/B;AACF;","names":["import_jsx_runtime"]}
1
+ {"version":3,"sources":["../../../src/components/chat/Suggestion.tsx","../../../src/components/chat/Icons.tsx"],"sourcesContent":["import { useCopilotChat } from \"@copilotkit/react-core\";\nimport { SmallSpinnerIcon } from \"./Icons\";\n\ninterface SuggestionsProps {\n title: string;\n message: string;\n partial?: boolean;\n className?: string;\n onClick: () => void;\n}\n\nexport function Suggestion({ title, onClick, partial, className }: SuggestionsProps) {\n if (!title) return null;\n const { isLoading } = useCopilotChat();\n\n return (\n <button\n disabled={partial || isLoading}\n onClick={(e) => {\n e.preventDefault();\n onClick();\n }}\n className={className || (partial ? \"suggestion loading\" : \"suggestion\")}\n data-test-id=\"suggestion\"\n >\n {partial ? SmallSpinnerIcon : <span>{title}</span>}\n </button>\n );\n}\n","import React from \"react\";\n\nexport const OpenIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <g transform=\"translate(24, 0) scale(-1, 1)\">\n <path\n fillRule=\"evenodd\"\n d=\"M5.337 21.718a6.707 6.707 0 01-.533-.074.75.75 0 01-.44-1.223 3.73 3.73 0 00.814-1.686c.023-.115-.022-.317-.254-.543C3.274 16.587 2.25 14.41 2.25 12c0-5.03 4.428-9 9.75-9s9.75 3.97 9.75 9c0 5.03-4.428 9-9.75 9-.833 0-1.643-.097-2.417-.279a6.721 6.721 0 01-4.246.997z\"\n clipRule=\"evenodd\"\n />\n </g>\n </svg>\n);\n\nexport const CloseIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M19.5 8.25l-7.5 7.5-7.5-7.5\" />\n </svg>\n);\n\nexport const HeaderCloseIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M6 18L18 6M6 6l12 12\" />\n </svg>\n);\n\nexport const SendIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M12 19V5m0 0l-7 7m7-7l7 7\" />\n </svg>\n);\n\nexport const MicrophoneIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z\"\n />\n </svg>\n);\n\nexport const StopIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z\"\n />\n </svg>\n);\n\nexport const RegenerateIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182m0-4.991v4.99\"\n />\n </svg>\n);\n\nexport const CopyIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 01-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 011.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 00-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 01-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 00-3.375-3.375h-1.5a1.125 1.125 0 01-1.125-1.125v-1.5a3.375 3.375 0 00-3.375-3.375H9.75\"\n />\n </svg>\n);\n\nexport const SmallSpinnerIcon = (\n <span className=\"copilotKitSpinner\" style={{ width: \"13px\", height: \"13px\" }}></span>\n);\n\nexport const SpinnerIcon = (\n <span className=\"copilotKitSpinner\" style={{ width: \"24px\", height: \"24px\" }}></span>\n);\n\nexport const ActivityIcon = (\n <div style={{ display: \"flex\", alignItems: \"center\", gap: \"4px\" }}>\n <span className=\"copilotKitActivityDot\" style={{ animationDelay: \"0s\" }}></span>\n <span className=\"copilotKitActivityDot\" style={{ animationDelay: \"0.2s\" }}></span>\n <span className=\"copilotKitActivityDot\" style={{ animationDelay: \"0.4s\" }}></span>\n </div>\n);\n\nexport const ThumbsUpIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M6.633 10.5c.806 0 1.533-.446 2.031-1.08a9.041 9.041 0 012.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 00.322-1.672V3a.75.75 0 01.75-.75A2.25 2.25 0 0116.5 4.5c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 01-2.649 7.521c-.388.482-.987.729-1.605.729H13.48c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 00-1.423-.23H5.904M14.25 9h2.25M5.904 18.75c.083.205.173.405.27.602.197.4-.078.898-.523.898h-.908c-.889 0-1.713-.518-1.972-1.368a12 12 0 01-.521-3.507c0-1.553.295-3.036.831-4.398C3.387 10.203 4.167 9.75 5 9.75h1.053c.472 0 .745.556.5.96a8.958 8.958 0 00-1.302 4.665c0 1.194.232 2.333.654 3.375z\"\n />\n </svg>\n);\n\nexport const ThumbsDownIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M7.5 15h2.25m8.024-9.75c.011.05.028.1.052.148.591 1.2.924 2.55.924 3.977a8.96 8.96 0 01-.999 4.125m.023-8.25c-.076-.365.183-.75.575-.75h.908c.889 0 1.713.518 1.972 1.368.339 1.11.521 2.287.521 3.507 0 1.553-.295 3.036-.831 4.398C20.613 14.547 19.833 15 19 15h-1.053c-.472 0-.745-.556-.5-.96a8.95 8.95 0 00.303-.54m.023-8.25H16.48a4.5 4.5 0 01-1.423-.23l-3.114-1.04a4.5 4.5 0 00-1.423-.23H6.504c-.618 0-1.217.247-1.605.729A11.95 11.95 0 002.25 12c0 .434.023.863.068 1.285C2.427 14.306 3.346 15 4.372 15h3.126c.618 0 .991.724.725 1.282A7.471 7.471 0 007.5 19.5a2.25 2.25 0 002.25 2.25.75.75 0 00.75-.75v-.633c0-.573.11-1.14.322-1.672.304-.76.93-1.33 1.653-1.715a9.04 9.04 0 002.86-2.4c.498-.634 1.226-1.08 2.032-1.08h.384\"\n />\n </svg>\n);\n\nexport const DownloadIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3\"\n />\n </svg>\n);\n\nexport const UploadIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M12 4.5v15m7.5-7.5h-15\" />\n </svg>\n);\n\nexport const CheckIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\" />\n </svg>\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAA+B;;;ACWzB;AA6HC,IAAM,mBACX,4CAAC,UAAK,WAAU,qBAAoB,OAAO,EAAE,OAAO,QAAQ,QAAQ,OAAO,GAAG;;;ADhH5C,IAAAA,sBAAA;AAd7B,SAAS,WAAW,EAAE,OAAO,SAAS,SAAS,UAAU,GAAqB;AACnF,MAAI,CAAC;AAAO,WAAO;AACnB,QAAM,EAAE,UAAU,QAAI,kCAAe;AAErC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,UAAU,WAAW;AAAA,MACrB,SAAS,CAAC,MAAM;AACd,UAAE,eAAe;AACjB,gBAAQ;AAAA,MACV;AAAA,MACA,WAAW,cAAc,UAAU,uBAAuB;AAAA,MAC1D,gBAAa;AAAA,MAEZ,oBAAU,mBAAmB,6CAAC,UAAM,iBAAM;AAAA;AAAA,EAC7C;AAEJ;","names":["import_jsx_runtime"]}
@@ -1,11 +1,9 @@
1
1
  import {
2
- Suggestion,
3
- reloadSuggestions
4
- } from "../../chunk-IMBPSLL4.mjs";
2
+ Suggestion
3
+ } from "../../chunk-Q2467VHZ.mjs";
5
4
  import "../../chunk-XWG3L6QC.mjs";
6
5
  import "../../chunk-MRXNTQOX.mjs";
7
6
  export {
8
- Suggestion,
9
- reloadSuggestions
7
+ Suggestion
10
8
  };
11
9
  //# sourceMappingURL=Suggestion.mjs.map
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { RenderSuggestionsListProps } from './props.js';
3
- import '@copilotkit/runtime-client-gql';
3
+ import '@copilotkit/shared';
4
4
  import '../../types/suggestions.js';
5
5
  import 'react';
6
6
 
@@ -32,14 +32,15 @@ var import_jsx_runtime = require("react/jsx-runtime");
32
32
  var SmallSpinnerIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "copilotKitSpinner", style: { width: "13px", height: "13px" } });
33
33
 
34
34
  // src/components/chat/Suggestion.tsx
35
- var import_shared = require("@copilotkit/shared");
36
- var import_runtime_client_gql = require("@copilotkit/runtime-client-gql");
37
35
  var import_jsx_runtime2 = require("react/jsx-runtime");
38
36
  function Suggestion({ title, onClick, partial, className }) {
37
+ if (!title)
38
+ return null;
39
+ const { isLoading } = (0, import_react_core.useCopilotChat)();
39
40
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
40
41
  "button",
41
42
  {
42
- disabled: partial,
43
+ disabled: partial || isLoading,
43
44
  onClick: (e) => {
44
45
  e.preventDefault();
45
46
  onClick();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/chat/Suggestions.tsx","../../../src/components/chat/Suggestion.tsx","../../../src/components/chat/Icons.tsx"],"sourcesContent":["import { Suggestion } from \"./Suggestion\";\nimport React from \"react\";\nimport { RenderSuggestionsListProps } from \"./props\";\n\nexport function Suggestions({ suggestions, onSuggestionClick }: RenderSuggestionsListProps) {\n return (\n <div className=\"suggestions\">\n {suggestions.map((suggestion, index) => (\n <Suggestion\n key={index}\n title={suggestion.title}\n message={suggestion.message}\n partial={suggestion.partial}\n className={suggestion.className}\n onClick={() => onSuggestionClick(suggestion.message)}\n />\n ))}\n </div>\n );\n}\n","import {\n CopilotContextParams,\n extract,\n CopilotChatSuggestionConfiguration,\n CopilotMessagesContextParams,\n} from \"@copilotkit/react-core\";\nimport { SmallSpinnerIcon } from \"./Icons\";\nimport { CopilotChatSuggestion } from \"../../types/suggestions\";\nimport { actionParametersToJsonSchema } from \"@copilotkit/shared\";\nimport { CopilotRequestType } from \"@copilotkit/runtime-client-gql\";\n\ninterface SuggestionsProps {\n title: string;\n message: string;\n partial?: boolean;\n className?: string;\n onClick: () => void;\n}\n\nexport function Suggestion({ title, onClick, partial, className }: SuggestionsProps) {\n return (\n <button\n disabled={partial}\n onClick={(e) => {\n e.preventDefault();\n onClick();\n }}\n className={className || (partial ? \"suggestion loading\" : \"suggestion\")}\n data-test-id=\"suggestion\"\n >\n {partial ? SmallSpinnerIcon : <span>{title}</span>}\n </button>\n );\n}\n\nexport const reloadSuggestions = async (\n context: CopilotContextParams & CopilotMessagesContextParams,\n chatSuggestionConfiguration: { [key: string]: CopilotChatSuggestionConfiguration },\n setCurrentSuggestions: (suggestions: { title: string; message: string }[]) => void,\n abortControllerRef: React.MutableRefObject<AbortController | null>,\n) => {\n const abortController = abortControllerRef.current;\n\n const tools = JSON.stringify(\n Object.values(context.actions).map((action) => ({\n name: action.name,\n description: action.description,\n jsonSchema: JSON.stringify(actionParametersToJsonSchema(action.parameters)),\n })),\n );\n\n const allSuggestions: CopilotChatSuggestion[] = [];\n\n for (const config of Object.values(chatSuggestionConfiguration)) {\n try {\n const numOfSuggestionsInstructions =\n config.minSuggestions === 0\n ? `Produce up to ${config.maxSuggestions} suggestions. ` +\n `If there are no highly relevant suggestions you can think of, provide an empty array.`\n : `Produce between ${config.minSuggestions} and ${config.maxSuggestions} suggestions.`;\n\n const result = await extract({\n context,\n instructions:\n \"Suggest what the user could say next. Provide clear, highly relevant suggestions. Do not literally suggest function calls. \",\n data:\n config.instructions +\n \"\\n\\n\" +\n numOfSuggestionsInstructions +\n \"\\n\\n\" +\n \"Available tools: \" +\n tools +\n \"\\n\\n\",\n requestType: CopilotRequestType.Task,\n parameters: [\n {\n name: \"suggestions\",\n type: \"object[]\",\n attributes: [\n {\n name: \"title\",\n description:\n \"The title of the suggestion. This is shown as a button and should be short.\",\n type: \"string\",\n },\n {\n name: \"message\",\n description:\n \"The message to send when the suggestion is clicked. This should be a clear, complete sentence and will be sent as an instruction to the AI.\",\n type: \"string\",\n },\n ],\n },\n ],\n include: {\n messages: true,\n readable: true,\n },\n abortSignal: abortController?.signal,\n stream: ({ status, args }) => {\n const suggestions = args.suggestions || [];\n const newSuggestions: CopilotChatSuggestion[] = [];\n for (let i = 0; i < suggestions.length; i++) {\n // if GPT provides too many suggestions, limit the number of suggestions\n if (config.maxSuggestions !== undefined && i >= config.maxSuggestions) {\n break;\n }\n const { title, message } = suggestions[i];\n\n // If this is the last suggestion and the status is not complete, mark it as partial\n const partial = i == suggestions.length - 1 && status !== \"complete\";\n\n newSuggestions.push({\n title,\n message,\n partial,\n className: config.className,\n });\n }\n setCurrentSuggestions([...allSuggestions, ...newSuggestions]);\n },\n });\n allSuggestions.push(...result.suggestions);\n } catch (error) {\n console.error(\"Error loading suggestions\", error);\n }\n }\n\n if (abortControllerRef.current === abortController) {\n abortControllerRef.current = null;\n }\n};\n","import React from \"react\";\n\nexport const OpenIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <g transform=\"translate(24, 0) scale(-1, 1)\">\n <path\n fillRule=\"evenodd\"\n d=\"M5.337 21.718a6.707 6.707 0 01-.533-.074.75.75 0 01-.44-1.223 3.73 3.73 0 00.814-1.686c.023-.115-.022-.317-.254-.543C3.274 16.587 2.25 14.41 2.25 12c0-5.03 4.428-9 9.75-9s9.75 3.97 9.75 9c0 5.03-4.428 9-9.75 9-.833 0-1.643-.097-2.417-.279a6.721 6.721 0 01-4.246.997z\"\n clipRule=\"evenodd\"\n />\n </g>\n </svg>\n);\n\nexport const CloseIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M19.5 8.25l-7.5 7.5-7.5-7.5\" />\n </svg>\n);\n\nexport const HeaderCloseIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M6 18L18 6M6 6l12 12\" />\n </svg>\n);\n\nexport const SendIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M12 19V5m0 0l-7 7m7-7l7 7\" />\n </svg>\n);\n\nexport const MicrophoneIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z\"\n />\n </svg>\n);\n\nexport const StopIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z\"\n />\n </svg>\n);\n\nexport const RegenerateIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182m0-4.991v4.99\"\n />\n </svg>\n);\n\nexport const CopyIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 01-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 011.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 00-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 01-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 00-3.375-3.375h-1.5a1.125 1.125 0 01-1.125-1.125v-1.5a3.375 3.375 0 00-3.375-3.375H9.75\"\n />\n </svg>\n);\n\nexport const SmallSpinnerIcon = (\n <span className=\"copilotKitSpinner\" style={{ width: \"13px\", height: \"13px\" }}></span>\n);\n\nexport const SpinnerIcon = (\n <span className=\"copilotKitSpinner\" style={{ width: \"24px\", height: \"24px\" }}></span>\n);\n\nexport const ActivityIcon = (\n <div style={{ display: \"flex\", alignItems: \"center\", gap: \"4px\" }}>\n <span className=\"copilotKitActivityDot\" style={{ animationDelay: \"0s\" }}></span>\n <span className=\"copilotKitActivityDot\" style={{ animationDelay: \"0.2s\" }}></span>\n <span className=\"copilotKitActivityDot\" style={{ animationDelay: \"0.4s\" }}></span>\n </div>\n);\n\nexport const ThumbsUpIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M6.633 10.5c.806 0 1.533-.446 2.031-1.08a9.041 9.041 0 012.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 00.322-1.672V3a.75.75 0 01.75-.75A2.25 2.25 0 0116.5 4.5c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 01-2.649 7.521c-.388.482-.987.729-1.605.729H13.48c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 00-1.423-.23H5.904M14.25 9h2.25M5.904 18.75c.083.205.173.405.27.602.197.4-.078.898-.523.898h-.908c-.889 0-1.713-.518-1.972-1.368a12 12 0 01-.521-3.507c0-1.553.295-3.036.831-4.398C3.387 10.203 4.167 9.75 5 9.75h1.053c.472 0 .745.556.5.96a8.958 8.958 0 00-1.302 4.665c0 1.194.232 2.333.654 3.375z\"\n />\n </svg>\n);\n\nexport const ThumbsDownIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M7.5 15h2.25m8.024-9.75c.011.05.028.1.052.148.591 1.2.924 2.55.924 3.977a8.96 8.96 0 01-.999 4.125m.023-8.25c-.076-.365.183-.75.575-.75h.908c.889 0 1.713.518 1.972 1.368.339 1.11.521 2.287.521 3.507 0 1.553-.295 3.036-.831 4.398C20.613 14.547 19.833 15 19 15h-1.053c-.472 0-.745-.556-.5-.96a8.95 8.95 0 00.303-.54m.023-8.25H16.48a4.5 4.5 0 01-1.423-.23l-3.114-1.04a4.5 4.5 0 00-1.423-.23H6.504c-.618 0-1.217.247-1.605.729A11.95 11.95 0 002.25 12c0 .434.023.863.068 1.285C2.427 14.306 3.346 15 4.372 15h3.126c.618 0 .991.724.725 1.282A7.471 7.471 0 007.5 19.5a2.25 2.25 0 002.25 2.25.75.75 0 00.75-.75v-.633c0-.573.11-1.14.322-1.672.304-.76.93-1.33 1.653-1.715a9.04 9.04 0 002.86-2.4c.498-.634 1.226-1.08 2.032-1.08h.384\"\n />\n </svg>\n);\n\nexport const DownloadIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3\"\n />\n </svg>\n);\n\nexport const UploadIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M12 4.5v15m7.5-7.5h-15\" />\n </svg>\n);\n\nexport const CheckIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\" />\n </svg>\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,wBAKO;;;ACMD;AA6HC,IAAM,mBACX,4CAAC,UAAK,WAAU,qBAAoB,OAAO,EAAE,OAAO,QAAQ,QAAQ,OAAO,GAAG;;;ADjIhF,oBAA6C;AAC7C,gCAAmC;AAqBC,IAAAA,sBAAA;AAX7B,SAAS,WAAW,EAAE,OAAO,SAAS,SAAS,UAAU,GAAqB;AACnF,SACE;AAAA,IAAC;AAAA;AAAA,MACC,UAAU;AAAA,MACV,SAAS,CAAC,MAAM;AACd,UAAE,eAAe;AACjB,gBAAQ;AAAA,MACV;AAAA,MACA,WAAW,cAAc,UAAU,uBAAuB;AAAA,MAC1D,gBAAa;AAAA,MAEZ,oBAAU,mBAAmB,6CAAC,UAAM,iBAAM;AAAA;AAAA,EAC7C;AAEJ;;;ADzBQ,IAAAC,sBAAA;AAJD,SAAS,YAAY,EAAE,aAAa,kBAAkB,GAA+B;AAC1F,SACE,6CAAC,SAAI,WAAU,eACZ,sBAAY,IAAI,CAAC,YAAY,UAC5B;AAAA,IAAC;AAAA;AAAA,MAEC,OAAO,WAAW;AAAA,MAClB,SAAS,WAAW;AAAA,MACpB,SAAS,WAAW;AAAA,MACpB,WAAW,WAAW;AAAA,MACtB,SAAS,MAAM,kBAAkB,WAAW,OAAO;AAAA;AAAA,IAL9C;AAAA,EAMP,CACD,GACH;AAEJ;","names":["import_jsx_runtime","import_jsx_runtime"]}
1
+ {"version":3,"sources":["../../../src/components/chat/Suggestions.tsx","../../../src/components/chat/Suggestion.tsx","../../../src/components/chat/Icons.tsx"],"sourcesContent":["import { Suggestion } from \"./Suggestion\";\nimport { RenderSuggestionsListProps } from \"./props\";\n\nexport function Suggestions({ suggestions, onSuggestionClick }: RenderSuggestionsListProps) {\n return (\n <div className=\"suggestions\">\n {suggestions.map((suggestion, index) => (\n <Suggestion\n key={index}\n title={suggestion.title}\n message={suggestion.message}\n partial={suggestion.partial}\n className={suggestion.className}\n onClick={() => onSuggestionClick(suggestion.message)}\n />\n ))}\n </div>\n );\n}\n","import { useCopilotChat } from \"@copilotkit/react-core\";\nimport { SmallSpinnerIcon } from \"./Icons\";\n\ninterface SuggestionsProps {\n title: string;\n message: string;\n partial?: boolean;\n className?: string;\n onClick: () => void;\n}\n\nexport function Suggestion({ title, onClick, partial, className }: SuggestionsProps) {\n if (!title) return null;\n const { isLoading } = useCopilotChat();\n\n return (\n <button\n disabled={partial || isLoading}\n onClick={(e) => {\n e.preventDefault();\n onClick();\n }}\n className={className || (partial ? \"suggestion loading\" : \"suggestion\")}\n data-test-id=\"suggestion\"\n >\n {partial ? SmallSpinnerIcon : <span>{title}</span>}\n </button>\n );\n}\n","import React from \"react\";\n\nexport const OpenIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <g transform=\"translate(24, 0) scale(-1, 1)\">\n <path\n fillRule=\"evenodd\"\n d=\"M5.337 21.718a6.707 6.707 0 01-.533-.074.75.75 0 01-.44-1.223 3.73 3.73 0 00.814-1.686c.023-.115-.022-.317-.254-.543C3.274 16.587 2.25 14.41 2.25 12c0-5.03 4.428-9 9.75-9s9.75 3.97 9.75 9c0 5.03-4.428 9-9.75 9-.833 0-1.643-.097-2.417-.279a6.721 6.721 0 01-4.246.997z\"\n clipRule=\"evenodd\"\n />\n </g>\n </svg>\n);\n\nexport const CloseIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M19.5 8.25l-7.5 7.5-7.5-7.5\" />\n </svg>\n);\n\nexport const HeaderCloseIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M6 18L18 6M6 6l12 12\" />\n </svg>\n);\n\nexport const SendIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M12 19V5m0 0l-7 7m7-7l7 7\" />\n </svg>\n);\n\nexport const MicrophoneIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z\"\n />\n </svg>\n);\n\nexport const StopIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z\"\n />\n </svg>\n);\n\nexport const RegenerateIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182m0-4.991v4.99\"\n />\n </svg>\n);\n\nexport const CopyIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 01-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 011.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 00-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 01-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 00-3.375-3.375h-1.5a1.125 1.125 0 01-1.125-1.125v-1.5a3.375 3.375 0 00-3.375-3.375H9.75\"\n />\n </svg>\n);\n\nexport const SmallSpinnerIcon = (\n <span className=\"copilotKitSpinner\" style={{ width: \"13px\", height: \"13px\" }}></span>\n);\n\nexport const SpinnerIcon = (\n <span className=\"copilotKitSpinner\" style={{ width: \"24px\", height: \"24px\" }}></span>\n);\n\nexport const ActivityIcon = (\n <div style={{ display: \"flex\", alignItems: \"center\", gap: \"4px\" }}>\n <span className=\"copilotKitActivityDot\" style={{ animationDelay: \"0s\" }}></span>\n <span className=\"copilotKitActivityDot\" style={{ animationDelay: \"0.2s\" }}></span>\n <span className=\"copilotKitActivityDot\" style={{ animationDelay: \"0.4s\" }}></span>\n </div>\n);\n\nexport const ThumbsUpIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M6.633 10.5c.806 0 1.533-.446 2.031-1.08a9.041 9.041 0 012.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 00.322-1.672V3a.75.75 0 01.75-.75A2.25 2.25 0 0116.5 4.5c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 01-2.649 7.521c-.388.482-.987.729-1.605.729H13.48c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 00-1.423-.23H5.904M14.25 9h2.25M5.904 18.75c.083.205.173.405.27.602.197.4-.078.898-.523.898h-.908c-.889 0-1.713-.518-1.972-1.368a12 12 0 01-.521-3.507c0-1.553.295-3.036.831-4.398C3.387 10.203 4.167 9.75 5 9.75h1.053c.472 0 .745.556.5.96a8.958 8.958 0 00-1.302 4.665c0 1.194.232 2.333.654 3.375z\"\n />\n </svg>\n);\n\nexport const ThumbsDownIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M7.5 15h2.25m8.024-9.75c.011.05.028.1.052.148.591 1.2.924 2.55.924 3.977a8.96 8.96 0 01-.999 4.125m.023-8.25c-.076-.365.183-.75.575-.75h.908c.889 0 1.713.518 1.972 1.368.339 1.11.521 2.287.521 3.507 0 1.553-.295 3.036-.831 4.398C20.613 14.547 19.833 15 19 15h-1.053c-.472 0-.745-.556-.5-.96a8.95 8.95 0 00.303-.54m.023-8.25H16.48a4.5 4.5 0 01-1.423-.23l-3.114-1.04a4.5 4.5 0 00-1.423-.23H6.504c-.618 0-1.217.247-1.605.729A11.95 11.95 0 002.25 12c0 .434.023.863.068 1.285C2.427 14.306 3.346 15 4.372 15h3.126c.618 0 .991.724.725 1.282A7.471 7.471 0 007.5 19.5a2.25 2.25 0 002.25 2.25.75.75 0 00.75-.75v-.633c0-.573.11-1.14.322-1.672.304-.76.93-1.33 1.653-1.715a9.04 9.04 0 002.86-2.4c.498-.634 1.226-1.08 2.032-1.08h.384\"\n />\n </svg>\n);\n\nexport const DownloadIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3\"\n />\n </svg>\n);\n\nexport const UploadIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M12 4.5v15m7.5-7.5h-15\" />\n </svg>\n);\n\nexport const CheckIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\" />\n </svg>\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,wBAA+B;;;ACWzB;AA6HC,IAAM,mBACX,4CAAC,UAAK,WAAU,qBAAoB,OAAO,EAAE,OAAO,QAAQ,QAAQ,OAAO,GAAG;;;ADhH5C,IAAAA,sBAAA;AAd7B,SAAS,WAAW,EAAE,OAAO,SAAS,SAAS,UAAU,GAAqB;AACnF,MAAI,CAAC;AAAO,WAAO;AACnB,QAAM,EAAE,UAAU,QAAI,kCAAe;AAErC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,UAAU,WAAW;AAAA,MACrB,SAAS,CAAC,MAAM;AACd,UAAE,eAAe;AACjB,gBAAQ;AAAA,MACV;AAAA,MACA,WAAW,cAAc,UAAU,uBAAuB;AAAA,MAC1D,gBAAa;AAAA,MAEZ,oBAAU,mBAAmB,6CAAC,UAAM,iBAAM;AAAA;AAAA,EAC7C;AAEJ;;;ADrBQ,IAAAC,sBAAA;AAJD,SAAS,YAAY,EAAE,aAAa,kBAAkB,GAA+B;AAC1F,SACE,6CAAC,SAAI,WAAU,eACZ,sBAAY,IAAI,CAAC,YAAY,UAC5B;AAAA,IAAC;AAAA;AAAA,MAEC,OAAO,WAAW;AAAA,MAClB,SAAS,WAAW;AAAA,MACpB,SAAS,WAAW;AAAA,MACpB,WAAW,WAAW;AAAA,MACtB,SAAS,MAAM,kBAAkB,WAAW,OAAO;AAAA;AAAA,IAL9C;AAAA,EAMP,CACD,GACH;AAEJ;","names":["import_jsx_runtime","import_jsx_runtime"]}
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Suggestions
3
- } from "../../chunk-QGSPTXOV.mjs";
4
- import "../../chunk-IMBPSLL4.mjs";
3
+ } from "../../chunk-O7KTFUAN.mjs";
4
+ import "../../chunk-Q2467VHZ.mjs";
5
5
  import "../../chunk-XWG3L6QC.mjs";
6
6
  import "../../chunk-MRXNTQOX.mjs";
7
7
  export {
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { WindowProps } from './props.js';
3
- import '@copilotkit/runtime-client-gql';
3
+ import '@copilotkit/shared';
4
4
  import '../../types/suggestions.js';
5
5
  import 'react';
6
6
 
@@ -1,18 +1,23 @@
1
- export { AssistantMessageProps, ButtonProps, ComponentsMap, HeaderProps, InputProps, MessagesProps, RenderMessageProps, RenderSuggestionsListProps, Renderer, SuggestionsProps, UserMessageProps, WindowProps } from './props.js';
1
+ export { AssistantMessageProps, ButtonProps, ComponentsMap, HeaderProps, ImageRendererProps, InputProps, MessagesProps, RenderMessageProps, RenderSuggestionsListProps, Renderer, SuggestionsProps, UserMessageProps, WindowProps } from './props.js';
2
2
  export { CopilotPopup } from './Popup.js';
3
3
  export { CopilotSidebar } from './Sidebar.js';
4
4
  export { CopilotChat } from './Chat.js';
5
5
  export { Markdown } from './Markdown.js';
6
6
  export { AssistantMessage } from './messages/AssistantMessage.js';
7
7
  export { UserMessage } from './messages/UserMessage.js';
8
+ export { ImageRenderer } from './messages/ImageRenderer.js';
8
9
  export { useChatContext } from './ChatContext.js';
9
- export { RenderImageMessage } from './messages/RenderImageMessage.js';
10
10
  export { Suggestions as RenderSuggestionsList } from './Suggestions.js';
11
11
  export { Suggestion as RenderSuggestion } from './Suggestion.js';
12
- import '@copilotkit/runtime-client-gql';
12
+ import '@copilotkit/shared';
13
13
  import '../../types/suggestions.js';
14
14
  import 'react';
15
15
  import 'react/jsx-runtime';
16
16
  import './Modal.js';
17
+ import '@copilotkit/react-core/dist/types/coagent-state';
18
+ import '@copilotkit/react-core/dist/hooks/use-tree';
19
+ import '@copilotkit/react-core/dist/copilot-context-bd88d30d';
20
+ import '@copilotkit/react-core/dist/types/coagent-action';
17
21
  import '@copilotkit/react-core';
22
+ import '@copilotkit/runtime-client-gql';
18
23
  import 'react-markdown';