@copilotkit/react-ui 1.7.2-next.2 → 1.8.0-next.3

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 (161) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/{chunk-QXTRFMPM.mjs → chunk-2LRE4W6A.mjs} +13 -11
  3. package/dist/chunk-2LRE4W6A.mjs.map +1 -0
  4. package/dist/{chunk-QXQDIFOC.mjs → chunk-5GNYGURH.mjs} +48 -37
  5. package/dist/chunk-5GNYGURH.mjs.map +1 -0
  6. package/dist/{chunk-CBBFRI3Q.mjs → chunk-5JY5QJ2W.mjs} +9 -5
  7. package/dist/chunk-5JY5QJ2W.mjs.map +1 -0
  8. package/dist/{chunk-OFYI4UU4.mjs → chunk-7RIBDD4K.mjs} +19 -3
  9. package/dist/chunk-7RIBDD4K.mjs.map +1 -0
  10. package/dist/{chunk-YAGE7RCE.mjs → chunk-CGVOCLHN.mjs} +2 -2
  11. package/dist/chunk-FBYETUFL.mjs +118 -0
  12. package/dist/chunk-FBYETUFL.mjs.map +1 -0
  13. package/dist/chunk-GDJAAFIK.mjs +24 -0
  14. package/dist/chunk-GDJAAFIK.mjs.map +1 -0
  15. package/dist/{chunk-6FTRYYR5.mjs → chunk-GJME6MK4.mjs} +72 -62
  16. package/dist/chunk-GJME6MK4.mjs.map +1 -0
  17. package/dist/{chunk-AELKLZSG.mjs → chunk-KG6DW6R2.mjs} +10 -10
  18. package/dist/{chunk-DLG7BZTA.mjs → chunk-LKCAF2HG.mjs} +2 -2
  19. package/dist/{chunk-R2O33F44.mjs → chunk-LXCH2BIB.mjs} +2 -2
  20. package/dist/chunk-ORSMX3SE.mjs +244 -0
  21. package/dist/chunk-ORSMX3SE.mjs.map +1 -0
  22. package/dist/{chunk-UPTB2MVO.mjs → chunk-PCTCOQK2.mjs} +4 -10
  23. package/dist/chunk-PCTCOQK2.mjs.map +1 -0
  24. package/dist/{chunk-ZIF5JJCH.mjs → chunk-QGK5GOSC.mjs} +24 -53
  25. package/dist/chunk-QGK5GOSC.mjs.map +1 -0
  26. package/dist/{chunk-WGAZXTUA.mjs → chunk-TOQ7P4DO.mjs} +6 -9
  27. package/dist/chunk-TOQ7P4DO.mjs.map +1 -0
  28. package/dist/{chunk-3XAXY2Z3.mjs → chunk-UZTZXMYS.mjs} +2 -2
  29. package/dist/{chunk-RQNJNK2W.mjs → chunk-VC4NO5QZ.mjs} +2 -2
  30. package/dist/{chunk-YQ3D5IQV.mjs → chunk-XNQO5AZZ.mjs} +2 -5
  31. package/dist/chunk-XNQO5AZZ.mjs.map +1 -0
  32. package/dist/chunk-YC4NBUGE.mjs +97 -0
  33. package/dist/chunk-YC4NBUGE.mjs.map +1 -0
  34. package/dist/components/chat/Button.js.map +1 -1
  35. package/dist/components/chat/Button.mjs +3 -3
  36. package/dist/components/chat/Chat.d.ts +17 -1
  37. package/dist/components/chat/Chat.js +378 -905
  38. package/dist/components/chat/Chat.js.map +1 -1
  39. package/dist/components/chat/Chat.mjs +11 -18
  40. package/dist/components/chat/ChatContext.d.ts +20 -0
  41. package/dist/components/chat/ChatContext.js +44 -74
  42. package/dist/components/chat/ChatContext.js.map +1 -1
  43. package/dist/components/chat/ChatContext.mjs +2 -2
  44. package/dist/components/chat/CodeBlock.js +58 -82
  45. package/dist/components/chat/CodeBlock.js.map +1 -1
  46. package/dist/components/chat/CodeBlock.mjs +2 -2
  47. package/dist/components/chat/Header.js +516 -4
  48. package/dist/components/chat/Header.js.map +1 -1
  49. package/dist/components/chat/Header.mjs +10 -3
  50. package/dist/components/chat/Icons.d.ts +10 -9
  51. package/dist/components/chat/Icons.js +125 -164
  52. package/dist/components/chat/Icons.js.map +1 -1
  53. package/dist/components/chat/Icons.mjs +9 -5
  54. package/dist/components/chat/Input.d.ts +1 -1
  55. package/dist/components/chat/Input.js +11 -9
  56. package/dist/components/chat/Input.js.map +1 -1
  57. package/dist/components/chat/Input.mjs +3 -3
  58. package/dist/components/chat/Markdown.js +58 -56
  59. package/dist/components/chat/Markdown.js.map +1 -1
  60. package/dist/components/chat/Markdown.mjs +3 -3
  61. package/dist/components/chat/Messages.d.ts +1 -1
  62. package/dist/components/chat/Messages.js +70 -60
  63. package/dist/components/chat/Messages.js.map +1 -1
  64. package/dist/components/chat/Messages.mjs +3 -3
  65. package/dist/components/chat/Modal.js +1708 -1749
  66. package/dist/components/chat/Modal.js.map +1 -1
  67. package/dist/components/chat/Modal.mjs +21 -21
  68. package/dist/components/chat/Popup.js +1708 -1749
  69. package/dist/components/chat/Popup.js.map +1 -1
  70. package/dist/components/chat/Popup.mjs +22 -22
  71. package/dist/components/chat/Response.js.map +1 -1
  72. package/dist/components/chat/Response.mjs +3 -3
  73. package/dist/components/chat/Sidebar.js +1710 -1751
  74. package/dist/components/chat/Sidebar.js.map +1 -1
  75. package/dist/components/chat/Sidebar.mjs +22 -22
  76. package/dist/components/chat/Suggestion.js +4 -40
  77. package/dist/components/chat/Suggestion.js.map +1 -1
  78. package/dist/components/chat/Suggestion.mjs +2 -2
  79. package/dist/components/chat/Window.js.map +1 -1
  80. package/dist/components/chat/Window.mjs +3 -3
  81. package/dist/components/chat/index.js +1710 -1751
  82. package/dist/components/chat/index.js.map +1 -1
  83. package/dist/components/chat/index.mjs +24 -24
  84. package/dist/components/chat/messages/AssistantMessage.js +211 -59
  85. package/dist/components/chat/messages/AssistantMessage.js.map +1 -1
  86. package/dist/components/chat/messages/AssistantMessage.mjs +5 -5
  87. package/dist/components/chat/messages/RenderTextMessage.js +18 -2
  88. package/dist/components/chat/messages/RenderTextMessage.js.map +1 -1
  89. package/dist/components/chat/messages/RenderTextMessage.mjs +1 -1
  90. package/dist/components/chat/props.d.ts +53 -0
  91. package/dist/components/chat/props.js.map +1 -1
  92. package/dist/components/dev-console/console.js +51 -233
  93. package/dist/components/dev-console/console.js.map +1 -1
  94. package/dist/components/dev-console/console.mjs +3 -3
  95. package/dist/components/dev-console/index.js +51 -233
  96. package/dist/components/dev-console/index.js.map +1 -1
  97. package/dist/components/dev-console/index.mjs +3 -3
  98. package/dist/components/help-modal/index.js +29 -147
  99. package/dist/components/help-modal/index.js.map +1 -1
  100. package/dist/components/help-modal/index.mjs +1 -1
  101. package/dist/components/help-modal/modal.js +29 -147
  102. package/dist/components/help-modal/modal.js.map +1 -1
  103. package/dist/components/help-modal/modal.mjs +1 -1
  104. package/dist/components/index.js +1683 -1724
  105. package/dist/components/index.js.map +1 -1
  106. package/dist/components/index.mjs +28 -28
  107. package/dist/index.css +254 -90
  108. package/dist/index.css.map +1 -1
  109. package/dist/index.js +1692 -1733
  110. package/dist/index.js.map +1 -1
  111. package/dist/index.mjs +28 -28
  112. package/dist/types/css.d.ts +7 -1
  113. package/dist/types/css.js.map +1 -1
  114. package/package.json +4 -4
  115. package/src/components/chat/Chat.tsx +59 -22
  116. package/src/components/chat/ChatContext.tsx +29 -1
  117. package/src/components/chat/CodeBlock.tsx +2 -4
  118. package/src/components/chat/Header.tsx +8 -3
  119. package/src/components/chat/Icons.tsx +108 -108
  120. package/src/components/chat/Input.tsx +42 -38
  121. package/src/components/chat/Markdown.tsx +0 -3
  122. package/src/components/chat/Messages.tsx +68 -56
  123. package/src/components/chat/Suggestion.tsx +2 -3
  124. package/src/components/chat/messages/AssistantMessage.tsx +95 -3
  125. package/src/components/chat/messages/RenderTextMessage.tsx +17 -1
  126. package/src/components/chat/props.ts +66 -0
  127. package/src/components/dev-console/console.tsx +16 -54
  128. package/src/components/help-modal/modal.tsx +38 -101
  129. package/src/css/button.css +15 -4
  130. package/src/css/colors.css +27 -6
  131. package/src/css/console.css +46 -39
  132. package/src/css/header.css +22 -5
  133. package/src/css/input.css +24 -17
  134. package/src/css/markdown.css +2 -1
  135. package/src/css/messages.css +125 -15
  136. package/src/css/panel.css +1 -0
  137. package/src/css/suggestions.css +14 -6
  138. package/src/types/css.ts +7 -1
  139. package/dist/chunk-3VNMQWGT.mjs +0 -25
  140. package/dist/chunk-3VNMQWGT.mjs.map +0 -1
  141. package/dist/chunk-6FTRYYR5.mjs.map +0 -1
  142. package/dist/chunk-CBBFRI3Q.mjs.map +0 -1
  143. package/dist/chunk-FZC7X5PK.mjs +0 -262
  144. package/dist/chunk-FZC7X5PK.mjs.map +0 -1
  145. package/dist/chunk-OFYI4UU4.mjs.map +0 -1
  146. package/dist/chunk-QXQDIFOC.mjs.map +0 -1
  147. package/dist/chunk-QXTRFMPM.mjs.map +0 -1
  148. package/dist/chunk-TI7SY2RI.mjs +0 -164
  149. package/dist/chunk-TI7SY2RI.mjs.map +0 -1
  150. package/dist/chunk-UPTB2MVO.mjs.map +0 -1
  151. package/dist/chunk-VEC45H6Q.mjs +0 -18
  152. package/dist/chunk-VEC45H6Q.mjs.map +0 -1
  153. package/dist/chunk-WGAZXTUA.mjs.map +0 -1
  154. package/dist/chunk-YQ3D5IQV.mjs.map +0 -1
  155. package/dist/chunk-ZIF5JJCH.mjs.map +0 -1
  156. /package/dist/{chunk-YAGE7RCE.mjs.map → chunk-CGVOCLHN.mjs.map} +0 -0
  157. /package/dist/{chunk-AELKLZSG.mjs.map → chunk-KG6DW6R2.mjs.map} +0 -0
  158. /package/dist/{chunk-DLG7BZTA.mjs.map → chunk-LKCAF2HG.mjs.map} +0 -0
  159. /package/dist/{chunk-R2O33F44.mjs.map → chunk-LXCH2BIB.mjs.map} +0 -0
  160. /package/dist/{chunk-3XAXY2Z3.mjs.map → chunk-UZTZXMYS.mjs.map} +0 -0
  161. /package/dist/{chunk-RQNJNK2W.mjs.map → chunk-VC4NO5QZ.mjs.map} +0 -0
package/dist/index.mjs CHANGED
@@ -6,7 +6,7 @@ import "./chunk-N7LTE54T.mjs";
6
6
  import "./chunk-SQMEPWVT.mjs";
7
7
  import {
8
8
  CopilotSidebar
9
- } from "./chunk-DLG7BZTA.mjs";
9
+ } from "./chunk-LKCAF2HG.mjs";
10
10
  import "./chunk-WB3YULQ4.mjs";
11
11
  import {
12
12
  DefaultResponseRenderer,
@@ -17,48 +17,48 @@ import {
17
17
  } from "./chunk-MCO235PS.mjs";
18
18
  import {
19
19
  CopilotPopup
20
- } from "./chunk-R2O33F44.mjs";
21
- import "./chunk-AELKLZSG.mjs";
22
- import "./chunk-YAGE7RCE.mjs";
23
- import "./chunk-VEC45H6Q.mjs";
24
- import "./chunk-RQNJNK2W.mjs";
20
+ } from "./chunk-LXCH2BIB.mjs";
21
+ import "./chunk-KG6DW6R2.mjs";
22
+ import "./chunk-CGVOCLHN.mjs";
23
+ import "./chunk-GDJAAFIK.mjs";
24
+ import "./chunk-V7W6IM2V.mjs";
25
+ import {
26
+ CopilotDevConsole
27
+ } from "./chunk-QGK5GOSC.mjs";
28
+ import "./chunk-KXE2JCUH.mjs";
29
+ import "./chunk-YC4NBUGE.mjs";
30
+ import "./chunk-OTPAZXVR.mjs";
31
+ import {
32
+ shouldShowDevConsole
33
+ } from "./chunk-6TCUJ3B7.mjs";
34
+ import "./chunk-BH6PCAAL.mjs";
35
+ import "./chunk-VC4NO5QZ.mjs";
25
36
  import {
26
37
  CopilotChat
27
- } from "./chunk-QXQDIFOC.mjs";
38
+ } from "./chunk-5GNYGURH.mjs";
28
39
  import {
29
40
  AssistantMessage
30
- } from "./chunk-3VNMQWGT.mjs";
41
+ } from "./chunk-FBYETUFL.mjs";
31
42
  import "./chunk-XB6QCUPB.mjs";
32
43
  import "./chunk-UWWMAJ7R.mjs";
33
44
  import "./chunk-WEYDZBT7.mjs";
34
- import "./chunk-OFYI4UU4.mjs";
45
+ import "./chunk-7RIBDD4K.mjs";
35
46
  import {
36
47
  UserMessage
37
48
  } from "./chunk-HEIDCT7I.mjs";
38
- import "./chunk-V7W6IM2V.mjs";
39
- import {
40
- CopilotDevConsole
41
- } from "./chunk-ZIF5JJCH.mjs";
42
- import "./chunk-KXE2JCUH.mjs";
43
- import "./chunk-TI7SY2RI.mjs";
44
- import "./chunk-OTPAZXVR.mjs";
45
- import {
46
- shouldShowDevConsole
47
- } from "./chunk-6TCUJ3B7.mjs";
48
- import "./chunk-BH6PCAAL.mjs";
49
- import "./chunk-WGAZXTUA.mjs";
50
- import "./chunk-QXTRFMPM.mjs";
49
+ import "./chunk-TOQ7P4DO.mjs";
50
+ import "./chunk-2LRE4W6A.mjs";
51
51
  import "./chunk-YQFVRDNC.mjs";
52
52
  import {
53
53
  Markdown
54
- } from "./chunk-YQ3D5IQV.mjs";
55
- import "./chunk-6FTRYYR5.mjs";
56
- import "./chunk-3XAXY2Z3.mjs";
54
+ } from "./chunk-XNQO5AZZ.mjs";
55
+ import "./chunk-GJME6MK4.mjs";
56
+ import "./chunk-UZTZXMYS.mjs";
57
57
  import {
58
58
  useChatContext
59
- } from "./chunk-CBBFRI3Q.mjs";
60
- import "./chunk-UPTB2MVO.mjs";
61
- import "./chunk-FZC7X5PK.mjs";
59
+ } from "./chunk-5JY5QJ2W.mjs";
60
+ import "./chunk-PCTCOQK2.mjs";
61
+ import "./chunk-ORSMX3SE.mjs";
62
62
  import "./chunk-IU3WTXLQ.mjs";
63
63
  import "./chunk-T26KLXLH.mjs";
64
64
  import {
@@ -4,13 +4,19 @@ interface CopilotKitCSSProperties extends CSSProperties {
4
4
  "--copilot-kit-primary-color"?: string;
5
5
  "--copilot-kit-contrast-color"?: string;
6
6
  "--copilot-kit-secondary-color"?: string;
7
- "--copilot-kit-secondary-contrast-color"?: string;
8
7
  "--copilot-kit-background-color"?: string;
9
8
  "--copilot-kit-muted-color"?: string;
9
+ "--copilot-kit-text-light-color"?: string;
10
+ "--copilot-kit-text-dark-color"?: string;
10
11
  "--copilot-kit-separator-color"?: string;
11
12
  "--copilot-kit-scrollbar-color"?: string;
13
+ "--copilot-kit-header-color"?: string;
12
14
  "--copilot-kit-response-button-color"?: string;
13
15
  "--copilot-kit-response-button-background-color"?: string;
16
+ "--copilot-kit-shadow-sm"?: string;
17
+ "--copilot-kit-shadow-md"?: string;
18
+ "--copilot-kit-shadow-lg"?: string;
19
+ "--copilot-kit-text-color"?: string;
14
20
  }
15
21
 
16
22
  export { CopilotKitCSSProperties };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/types/css.ts"],"sourcesContent":["// autogenerated (see postcss.config.js) - do not edit\nimport { CSSProperties } from \"react\";\n\nexport interface CopilotKitCSSProperties extends CSSProperties {\n \"--copilot-kit-primary-color\"?: string;\n \"--copilot-kit-contrast-color\"?: string;\n \"--copilot-kit-secondary-color\"?: string;\n \"--copilot-kit-secondary-contrast-color\"?: string;\n \"--copilot-kit-background-color\"?: string;\n \"--copilot-kit-muted-color\"?: string;\n \"--copilot-kit-separator-color\"?: string;\n \"--copilot-kit-scrollbar-color\"?: string;\n \"--copilot-kit-response-button-color\"?: string;\n \"--copilot-kit-response-button-background-color\"?: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../src/types/css.ts"],"sourcesContent":["// autogenerated (see postcss.config.js) - do not edit\nimport { CSSProperties } from \"react\";\n\nexport interface CopilotKitCSSProperties extends CSSProperties {\n \"--copilot-kit-primary-color\"?: string;\n \"--copilot-kit-contrast-color\"?: string;\n \"--copilot-kit-secondary-color\"?: string;\n \"--copilot-kit-background-color\"?: string;\n \"--copilot-kit-muted-color\"?: string;\n \"--copilot-kit-text-color\"?: string;\n \"--copilot-kit-separator-color\"?: string;\n \"--copilot-kit-scrollbar-color\"?: string;\n \"--copilot-kit-response-button-color\"?: string;\n \"--copilot-kit-response-button-background-color\"?: string;\n \"--copilot-kit-shadow-sm\"?: string;\n \"--copilot-kit-shadow-md\"?: string;\n \"--copilot-kit-shadow-lg\"?: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "publishConfig": {
10
10
  "access": "public"
11
11
  },
12
- "version": "1.7.2-next.2",
12
+ "version": "1.8.0-next.3",
13
13
  "sideEffects": [
14
14
  "**/*.css"
15
15
  ],
@@ -50,9 +50,9 @@
50
50
  "react-syntax-highlighter": "^15.5.0",
51
51
  "remark-gfm": "^3.0.1",
52
52
  "remark-math": "^5.1.1",
53
- "@copilotkit/react-core": "1.7.2-next.2",
54
- "@copilotkit/runtime-client-gql": "1.7.2-next.2",
55
- "@copilotkit/shared": "1.7.2-next.2"
53
+ "@copilotkit/react-core": "1.8.0-next.3",
54
+ "@copilotkit/runtime-client-gql": "1.8.0-next.3",
55
+ "@copilotkit/shared": "1.8.0-next.3"
56
56
  },
57
57
  "keywords": [
58
58
  "copilotkit",
@@ -118,6 +118,26 @@ export interface CopilotChatProps {
118
118
  */
119
119
  onReloadMessages?: OnReloadMessages;
120
120
 
121
+ /**
122
+ * A callback function to regenerate the assistant's response
123
+ */
124
+ onRegenerate?: () => void;
125
+
126
+ /**
127
+ * A callback function when the message is copied
128
+ */
129
+ onCopy?: (message: string) => void;
130
+
131
+ /**
132
+ * A callback function for thumbs up feedback
133
+ */
134
+ onThumbsUp?: (message: string) => void;
135
+
136
+ /**
137
+ * A callback function for thumbs down feedback
138
+ */
139
+ onThumbsDown?: (message: string) => void;
140
+
121
141
  /**
122
142
  * Icons can be used to set custom icons for the chat window.
123
143
  */
@@ -254,6 +274,10 @@ export function CopilotChat({
254
274
  onInProgress,
255
275
  onStopGeneration,
256
276
  onReloadMessages,
277
+ onRegenerate,
278
+ onCopy,
279
+ onThumbsUp,
280
+ onThumbsDown,
257
281
  Messages = DefaultMessages,
258
282
  RenderTextMessage = DefaultRenderTextMessage,
259
283
  RenderActionExecutionMessage = DefaultRenderActionExecutionMessage,
@@ -312,9 +336,22 @@ export function CopilotChat({
312
336
  const chatContext = React.useContext(ChatContext);
313
337
  const isVisible = chatContext ? chatContext.open : true;
314
338
 
339
+ const handleRegenerate = () => {
340
+ if (onRegenerate) {
341
+ onRegenerate();
342
+ }
343
+
344
+ reloadMessages();
345
+ };
346
+
347
+ const handleCopy = (message: string) => {
348
+ if (onCopy) {
349
+ onCopy(message);
350
+ }
351
+ };
352
+
315
353
  return (
316
354
  <WrappedCopilotChat icons={icons} labels={labels} className={className}>
317
- <CopilotDevConsole />
318
355
  <Messages
319
356
  AssistantMessage={AssistantMessage}
320
357
  UserMessage={UserMessage}
@@ -324,32 +361,32 @@ export function CopilotChat({
324
361
  RenderResultMessage={RenderResultMessage}
325
362
  messages={visibleMessages}
326
363
  inProgress={isLoading}
364
+ onRegenerate={handleRegenerate}
365
+ onCopy={handleCopy}
366
+ onThumbsUp={onThumbsUp}
367
+ onThumbsDown={onThumbsDown}
327
368
  >
328
369
  {currentSuggestions.length > 0 && (
329
- <div>
330
- <h6>Suggested:</h6>
331
- <div className="suggestions">
332
- {currentSuggestions.map((suggestion, index) => (
333
- <Suggestion
334
- key={index}
335
- title={suggestion.title}
336
- message={suggestion.message}
337
- partial={suggestion.partial}
338
- className={suggestion.className}
339
- onClick={(message) => sendMessage(message)}
340
- />
341
- ))}
342
- </div>
370
+ <div className="suggestions">
371
+ {currentSuggestions.map((suggestion, index) => (
372
+ <Suggestion
373
+ key={index}
374
+ title={suggestion.title}
375
+ message={suggestion.message}
376
+ partial={suggestion.partial}
377
+ className={suggestion.className}
378
+ onClick={(message) => sendMessage(message)}
379
+ />
380
+ ))}
343
381
  </div>
344
382
  )}
345
- {showResponseButton && visibleMessages.length > 0 && (
346
- <ResponseButton
347
- onClick={isLoading ? stopGeneration : reloadMessages}
348
- inProgress={isLoading}
349
- />
350
- )}
351
383
  </Messages>
352
- <Input inProgress={isLoading} onSend={sendMessage} isVisible={isVisible} />
384
+ <Input
385
+ inProgress={isLoading}
386
+ onSend={sendMessage}
387
+ isVisible={isVisible}
388
+ onStop={stopGeneration}
389
+ />
353
390
  </WrappedCopilotChat>
354
391
  );
355
392
  }
@@ -99,6 +99,30 @@ export interface CopilotChatLabels {
99
99
  * @default "Regenerate response"
100
100
  */
101
101
  regenerateResponse?: string;
102
+
103
+ /**
104
+ * The label for the copy button.
105
+ * @default "Copy to clipboard"
106
+ */
107
+ copyToClipboard?: string;
108
+
109
+ /**
110
+ * The label for the thumbs up button.
111
+ * @default "Thumbs up"
112
+ */
113
+ thumbsUp?: string;
114
+
115
+ /**
116
+ * The label for the thumbs down button.
117
+ * @default "Thumbs down"
118
+ */
119
+ thumbsDown?: string;
120
+
121
+ /**
122
+ * The text to display when content is copied.
123
+ * @default "Copied!"
124
+ */
125
+ copied?: string;
102
126
  }
103
127
 
104
128
  interface ChatContext {
@@ -150,6 +174,10 @@ export const ChatContextProvider = ({
150
174
  error: "❌ An error occurred. Please try again.",
151
175
  stopGenerating: "Stop generating",
152
176
  regenerateResponse: "Regenerate response",
177
+ copyToClipboard: "Copy to clipboard",
178
+ thumbsUp: "Thumbs up",
179
+ thumbsDown: "Thumbs down",
180
+ copied: "Copied!",
153
181
  },
154
182
  ...labels,
155
183
  }),
@@ -167,7 +195,7 @@ export const ChatContextProvider = ({
167
195
  spinnerIcon: DefaultIcons.SpinnerIcon,
168
196
  stopIcon: DefaultIcons.StopIcon,
169
197
  regenerateIcon: DefaultIcons.RegenerateIcon,
170
- pushToTalkIcon: DefaultIcons.PushToTalkIcon,
198
+ pushToTalkIcon: DefaultIcons.MicrophoneIcon,
171
199
  },
172
200
  ...icons,
173
201
  }),
@@ -92,12 +92,10 @@ const CodeBlock: FC<Props> = memo(({ language, value }) => {
92
92
  <span className="copilotKitCodeBlockToolbarLanguage">{language}</span>
93
93
  <div className="copilotKitCodeBlockToolbarButtons">
94
94
  <button className="copilotKitCodeBlockToolbarButton" onClick={downloadAsFile}>
95
- <DownloadIcon />
96
- <span className="sr-only">Download</span>
95
+ {DownloadIcon}
97
96
  </button>
98
97
  <button className="copilotKitCodeBlockToolbarButton" onClick={onCopy}>
99
- {isCopied ? <CheckIcon /> : <CopyIcon />}
100
- <span className="sr-only">Copy code</span>
98
+ {isCopied ? CheckIcon : CopyIcon}
101
99
  </button>
102
100
  </div>
103
101
  </div>
@@ -1,5 +1,7 @@
1
1
  import { HeaderProps } from "./props";
2
2
  import { useChatContext } from "./ChatContext";
3
+ import { CopilotDevConsole } from "../dev-console";
4
+ import React from "react";
3
5
 
4
6
  export const Header = ({}: HeaderProps) => {
5
7
  const { setOpen, icons, labels } = useChatContext();
@@ -7,9 +9,12 @@ export const Header = ({}: HeaderProps) => {
7
9
  return (
8
10
  <div className="copilotKitHeader">
9
11
  <div>{labels.title}</div>
10
- <button onClick={() => setOpen(false)} aria-label="Close">
11
- {icons.headerCloseIcon}
12
- </button>
12
+ <div className="copilotKitHeaderControls">
13
+ <CopilotDevConsole />
14
+ <button onClick={() => setOpen(false)} aria-label="Close">
15
+ {icons.headerCloseIcon}
16
+ </button>
17
+ </div>
13
18
  </div>
14
19
  );
15
20
  };
@@ -51,7 +51,21 @@ export const SendIcon = (
51
51
  xmlns="http://www.w3.org/2000/svg"
52
52
  fill="none"
53
53
  viewBox="0 0 24 24"
54
- strokeWidth={1.5}
54
+ strokeWidth="1.5"
55
+ stroke="currentColor"
56
+ width="24"
57
+ height="24"
58
+ >
59
+ <path strokeLinecap="round" strokeLinejoin="round" d="M12 19V5m0 0l-7 7m7-7l7 7" />
60
+ </svg>
61
+ );
62
+
63
+ export const MicrophoneIcon = (
64
+ <svg
65
+ xmlns="http://www.w3.org/2000/svg"
66
+ fill="none"
67
+ viewBox="0 0 24 24"
68
+ strokeWidth="1.5"
55
69
  stroke="currentColor"
56
70
  width="24"
57
71
  height="24"
@@ -59,165 +73,151 @@ export const SendIcon = (
59
73
  <path
60
74
  strokeLinecap="round"
61
75
  strokeLinejoin="round"
62
- d="M6 12L3.269 3.126A59.768 59.768 0 0121.485 12 59.77 59.77 0 013.27 20.876L5.999 12zm0 0h7.5"
76
+ 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"
63
77
  />
64
78
  </svg>
65
79
  );
66
80
 
67
- export const SpinnerIcon = (
81
+ export const StopIcon = (
68
82
  <svg
69
- style={{
70
- animation: "copilotKitSpinAnimation 1s linear infinite",
71
- color: "rgb(107 114 128)",
72
- }}
73
- width="24"
74
- height="24"
75
83
  xmlns="http://www.w3.org/2000/svg"
76
84
  fill="none"
77
85
  viewBox="0 0 24 24"
86
+ strokeWidth="1.5"
87
+ stroke="currentColor"
88
+ width="24"
89
+ height="24"
78
90
  >
79
- <circle
80
- style={{ opacity: 0.25 }}
81
- cx="12"
82
- cy="12"
83
- r="10"
84
- stroke="currentColor"
85
- strokeWidth="4"
86
- ></circle>
87
91
  <path
88
- style={{ opacity: 0.75 }}
89
- fill="currentColor"
90
- d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
91
- ></path>
92
+ strokeLinecap="round"
93
+ strokeLinejoin="round"
94
+ 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"
95
+ />
92
96
  </svg>
93
97
  );
94
98
 
95
- export const SmallSpinnerIcon = (
99
+ export const RegenerateIcon = (
96
100
  <svg
97
- style={{
98
- animation: "copilotKitSpinAnimation 1s linear infinite",
99
- }}
100
- width="13"
101
- height="13"
102
101
  xmlns="http://www.w3.org/2000/svg"
103
102
  fill="none"
104
103
  viewBox="0 0 24 24"
104
+ strokeWidth="2"
105
+ stroke="currentColor"
106
+ width="16"
107
+ height="16"
108
+ style={{ minWidth: "16px", minHeight: "16px" }}
105
109
  >
106
- <circle
107
- style={{ opacity: 0.25 }}
108
- cx="12"
109
- cy="12"
110
- r="10"
111
- stroke="currentColor"
112
- strokeWidth="4"
113
- ></circle>
114
110
  <path
115
- style={{ opacity: 0.75 }}
116
- fill="currentColor"
117
- d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
118
- ></path>
111
+ strokeLinecap="round"
112
+ strokeLinejoin="round"
113
+ 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"
114
+ />
119
115
  </svg>
120
116
  );
121
117
 
122
- export const ActivityIcon = (
118
+ export const CopyIcon = (
123
119
  <svg
124
- style={{
125
- display: "inline-block",
126
- marginLeft: "0.25rem",
127
- marginRight: "0.25rem",
128
- }}
129
- height="24"
130
- width="24"
131
- viewBox="0 0 27 27"
132
120
  xmlns="http://www.w3.org/2000/svg"
133
- fill="currentColor"
121
+ fill="none"
122
+ viewBox="0 0 24 24"
123
+ strokeWidth="2"
124
+ stroke="currentColor"
125
+ width="16"
126
+ height="16"
127
+ style={{ minWidth: "16px", minHeight: "16px" }}
134
128
  >
135
- <circle className="copilotKitActivityDot1" cx="4" cy="12" r="3" />
136
- <circle className="copilotKitActivityDot1 copilotKitActivityDot2" cx="12" cy="12" r="3" />
137
- <circle className="copilotKitActivityDot1 copilotKitActivityDot3" cx="20" cy="12" r="3" />
129
+ <path
130
+ strokeLinecap="round"
131
+ strokeLinejoin="round"
132
+ 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"
133
+ />
138
134
  </svg>
139
135
  );
140
136
 
141
- export function CheckIcon({ className, ...props }: React.ComponentProps<"svg">) {
142
- return (
143
- <svg
144
- xmlns="http://www.w3.org/2000/svg"
145
- viewBox="0 0 256 256"
146
- fill="currentColor"
147
- style={{ height: "1rem", width: "1rem" }}
148
- className={className}
149
- {...props}
150
- >
151
- <path d="m229.66 77.66-128 128a8 8 0 0 1-11.32 0l-56-56a8 8 0 0 1 11.32-11.32L96 188.69 218.34 66.34a8 8 0 0 1 11.32 11.32Z" />
152
- </svg>
153
- );
154
- }
137
+ export const SmallSpinnerIcon = (
138
+ <span className="copilotKitSpinner" style={{ width: "13px", height: "13px" }}></span>
139
+ );
155
140
 
156
- export function DownloadIcon({ className, ...props }: React.ComponentProps<"svg">) {
157
- return (
158
- <svg
159
- xmlns="http://www.w3.org/2000/svg"
160
- viewBox="0 0 256 256"
161
- fill="currentColor"
162
- style={{ height: "1rem", width: "1rem" }}
163
- className={className}
164
- {...props}
165
- >
166
- <path d="M224 152v56a16 16 0 0 1-16 16H48a16 16 0 0 1-16-16v-56a8 8 0 0 1 16 0v56h160v-56a8 8 0 0 1 16 0Zm-101.66 5.66a8 8 0 0 0 11.32 0l40-40a8 8 0 0 0-11.32-11.32L136 132.69V40a8 8 0 0 0-16 0v92.69l-26.34-26.35a8 8 0 0 0-11.32 11.32Z" />
167
- </svg>
168
- );
169
- }
141
+ export const SpinnerIcon = (
142
+ <span className="copilotKitSpinner" style={{ width: "24px", height: "24px" }}></span>
143
+ );
170
144
 
171
- export function CopyIcon({ className, ...props }: React.ComponentProps<"svg">) {
172
- return (
173
- <svg
174
- xmlns="http://www.w3.org/2000/svg"
175
- viewBox="0 0 256 256"
176
- fill="currentColor"
177
- style={{ height: "1rem", width: "1rem" }}
178
- className={className}
179
- {...props}
180
- >
181
- <path d="M216 32H88a8 8 0 0 0-8 8v40H40a8 8 0 0 0-8 8v128a8 8 0 0 0 8 8h128a8 8 0 0 0 8-8v-40h40a8 8 0 0 0 8-8V40a8 8 0 0 0-8-8Zm-56 176H48V96h112Zm48-48h-32V88a8 8 0 0 0-8-8H96V48h112Z" />
182
- </svg>
183
- );
184
- }
145
+ export const ActivityIcon = (
146
+ <div style={{ display: "flex", alignItems: "center", gap: "4px" }}>
147
+ <span className="copilotKitActivityDot" style={{ animationDelay: "0s" }}></span>
148
+ <span className="copilotKitActivityDot" style={{ animationDelay: "0.2s" }}></span>
149
+ <span className="copilotKitActivityDot" style={{ animationDelay: "0.4s" }}></span>
150
+ </div>
151
+ );
185
152
 
186
- export const StopIcon = (
153
+ export const ThumbsUpIcon = (
187
154
  <svg
188
155
  xmlns="http://www.w3.org/2000/svg"
189
- viewBox="0 0 256 256"
190
- fill="currentColor"
191
- style={{ height: "1rem", width: "1rem" }}
156
+ fill="none"
157
+ viewBox="0 0 24 24"
158
+ strokeWidth="2"
159
+ stroke="currentColor"
160
+ width="16"
161
+ height="16"
162
+ style={{ minWidth: "16px", minHeight: "16px" }}
192
163
  >
193
- <path d="M128 24a104 104 0 1 0 104 104A104.11 104.11 0 0 0 128 24Zm0 192a88 88 0 1 1 88-88 88.1 88.1 0 0 1-88 88Zm24-120h-48a8 8 0 0 0-8 8v48a8 8 0 0 0 8 8h48a8 8 0 0 0 8-8v-48a8 8 0 0 0-8-8Zm-8 48h-32v-32h32Z" />
164
+ <path
165
+ strokeLinecap="round"
166
+ strokeLinejoin="round"
167
+ 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"
168
+ />
194
169
  </svg>
195
170
  );
196
171
 
197
- export const RegenerateIcon = (
172
+ export const ThumbsDownIcon = (
198
173
  <svg
199
174
  xmlns="http://www.w3.org/2000/svg"
200
- viewBox="0 0 256 256"
201
- fill="currentColor"
202
- style={{ height: "1rem", width: "1rem" }}
175
+ fill="none"
176
+ viewBox="0 0 24 24"
177
+ strokeWidth="2"
178
+ stroke="currentColor"
179
+ width="16"
180
+ height="16"
181
+ style={{ minWidth: "16px", minHeight: "16px" }}
203
182
  >
204
- <path d="M197.67 186.37a8 8 0 0 1 0 11.29C196.58 198.73 170.82 224 128 224c-37.39 0-64.53-22.4-80-39.85V208a8 8 0 0 1-16 0v-48a8 8 0 0 1 8-8h48a8 8 0 0 1 0 16H55.44C67.76 183.35 93 208 128 208c36 0 58.14-21.46 58.36-21.68a8 8 0 0 1 11.31.05ZM216 40a8 8 0 0 0-8 8v23.85C192.53 54.4 165.39 32 128 32c-42.82 0-68.58 25.27-69.66 26.34a8 8 0 0 0 11.3 11.34C69.86 69.46 92 48 128 48c35 0 60.24 24.65 72.56 40H168a8 8 0 0 0 0 16h48a8 8 0 0 0 8-8V48a8 8 0 0 0-8-8Z" />
183
+ <path
184
+ strokeLinecap="round"
185
+ strokeLinejoin="round"
186
+ 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"
187
+ />
205
188
  </svg>
206
189
  );
207
190
 
208
- export const PushToTalkIcon = (
191
+ export const DownloadIcon = (
209
192
  <svg
210
193
  xmlns="http://www.w3.org/2000/svg"
211
194
  fill="none"
212
195
  viewBox="0 0 24 24"
213
- strokeWidth={1.5}
196
+ strokeWidth="2"
214
197
  stroke="currentColor"
215
- className="w-6 h-6"
198
+ width="16"
199
+ height="16"
200
+ style={{ minWidth: "16px", minHeight: "16px" }}
216
201
  >
217
202
  <path
218
203
  strokeLinecap="round"
219
204
  strokeLinejoin="round"
220
- d="M12 18.75a6 6 0 0 0 6-6v-1.5m-6 7.5a6 6 0 0 1-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 0 1-3-3V4.5a3 3 0 1 1 6 0v8.25a3 3 0 0 1-3 3Z"
205
+ 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"
221
206
  />
222
207
  </svg>
223
208
  );
209
+
210
+ export const CheckIcon = (
211
+ <svg
212
+ xmlns="http://www.w3.org/2000/svg"
213
+ fill="none"
214
+ viewBox="0 0 24 24"
215
+ strokeWidth="2"
216
+ stroke="currentColor"
217
+ width="16"
218
+ height="16"
219
+ style={{ minWidth: "16px", minHeight: "16px" }}
220
+ >
221
+ <path strokeLinecap="round" strokeLinejoin="round" d="M4.5 12.75l6 6 9-13.5" />
222
+ </svg>
223
+ );