@copilotkit/react-ui 0.15.0-alpha.0 → 0.15.0-alpha.2

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 (328) hide show
  1. package/.turbo/turbo-build.log +196 -209
  2. package/CHANGELOG.md +27 -1
  3. package/dist/chunk-3M4HWSE7.mjs +61 -0
  4. package/dist/chunk-3M4HWSE7.mjs.map +1 -0
  5. package/dist/chunk-47SYBLI2.mjs +110 -0
  6. package/dist/chunk-47SYBLI2.mjs.map +1 -0
  7. package/dist/chunk-5O2MCJZ2.mjs +21 -0
  8. package/dist/chunk-5O2MCJZ2.mjs.map +1 -0
  9. package/dist/chunk-7YXG7D47.mjs +191 -0
  10. package/dist/chunk-7YXG7D47.mjs.map +1 -0
  11. package/dist/chunk-CKJXXQ2W.mjs +26 -0
  12. package/dist/chunk-CKJXXQ2W.mjs.map +1 -0
  13. package/dist/{chunk-6LAZQHEB.mjs → chunk-DPRH4HX3.mjs} +18 -43
  14. package/dist/chunk-DPRH4HX3.mjs.map +1 -0
  15. package/dist/chunk-GWGHQNRI.mjs +54 -0
  16. package/dist/chunk-GWGHQNRI.mjs.map +1 -0
  17. package/dist/chunk-JD7BAH7U.mjs +3 -0
  18. package/dist/chunk-KBGIPFXA.mjs +14 -0
  19. package/dist/chunk-KBGIPFXA.mjs.map +1 -0
  20. package/dist/chunk-NNVWLSYK.mjs +72 -0
  21. package/dist/chunk-NNVWLSYK.mjs.map +1 -0
  22. package/dist/chunk-NYLOXKYT.mjs +51 -0
  23. package/dist/chunk-NYLOXKYT.mjs.map +1 -0
  24. package/dist/chunk-OF66AL5Z.mjs +56 -0
  25. package/dist/chunk-OF66AL5Z.mjs.map +1 -0
  26. package/dist/chunk-P4GBO6MW.mjs +3 -0
  27. package/dist/chunk-UWPFPWAW.mjs +14 -0
  28. package/dist/chunk-UWPFPWAW.mjs.map +1 -0
  29. package/dist/chunk-WB3YULQ4.mjs +3 -0
  30. package/dist/chunk-WM6BS77F.mjs +53 -0
  31. package/dist/chunk-WM6BS77F.mjs.map +1 -0
  32. package/dist/chunk-Z34F3WLK.mjs +14 -0
  33. package/dist/chunk-Z34F3WLK.mjs.map +1 -0
  34. package/dist/components/chat/Button.d.ts +6 -0
  35. package/dist/components/chat/Button.js +38 -0
  36. package/dist/components/chat/Button.js.map +1 -0
  37. package/dist/components/chat/Button.mjs +6 -0
  38. package/dist/components/chat/Chat.d.ts +96 -0
  39. package/dist/components/chat/Chat.js +800 -0
  40. package/dist/components/chat/Chat.js.map +1 -0
  41. package/dist/components/chat/Chat.mjs +16 -0
  42. package/dist/components/chat/ChatContext.d.ts +105 -0
  43. package/dist/components/chat/ChatContext.js +220 -0
  44. package/dist/components/chat/ChatContext.js.map +1 -0
  45. package/dist/components/chat/ChatContext.mjs +5 -0
  46. package/dist/components/chat/CodeBlock.js +221 -0
  47. package/dist/components/chat/CodeBlock.js.map +1 -0
  48. package/dist/components/chat/CodeBlock.mjs +6 -0
  49. package/dist/components/chat/Header.d.ts +6 -0
  50. package/dist/components/chat/Header.js +31 -0
  51. package/dist/components/chat/Header.js.map +1 -0
  52. package/dist/components/chat/Header.mjs +6 -0
  53. package/dist/components/chat/Icons.d.ts +15 -0
  54. package/dist/components/chat/Icons.js +233 -0
  55. package/dist/components/chat/Icons.js.map +1 -0
  56. package/dist/components/chat/Icons.mjs +4 -0
  57. package/dist/components/chat/Input.d.ts +6 -0
  58. package/dist/components/chat/Input.js +111 -0
  59. package/dist/components/chat/Input.js.map +1 -0
  60. package/dist/components/chat/Input.mjs +7 -0
  61. package/dist/components/chat/Markdown.d.ts +6 -0
  62. package/dist/components/chat/Markdown.js +269 -0
  63. package/dist/components/chat/Markdown.js.map +1 -0
  64. package/dist/components/chat/Markdown.mjs +7 -0
  65. package/dist/components/chat/Messages.d.ts +6 -0
  66. package/dist/components/chat/Messages.js +331 -0
  67. package/dist/components/chat/Messages.js.map +1 -0
  68. package/dist/components/chat/Messages.mjs +9 -0
  69. package/dist/components/chat/Popup.d.ts +10 -0
  70. package/dist/components/chat/Popup.js +806 -0
  71. package/dist/components/chat/Popup.js.map +1 -0
  72. package/dist/components/chat/Popup.mjs +17 -0
  73. package/dist/components/chat/Response.d.ts +6 -0
  74. package/dist/components/chat/Response.js +31 -0
  75. package/dist/components/chat/Response.js.map +1 -0
  76. package/dist/components/chat/Response.mjs +6 -0
  77. package/dist/components/chat/Sidebar.d.ts +13 -0
  78. package/dist/components/chat/Sidebar.js +817 -0
  79. package/dist/components/chat/Sidebar.js.map +1 -0
  80. package/dist/components/chat/Sidebar.mjs +17 -0
  81. package/dist/components/chat/Textarea.d.ts +13 -0
  82. package/dist/components/chat/Textarea.js +55 -0
  83. package/dist/components/chat/Textarea.js.map +1 -0
  84. package/dist/components/chat/Textarea.mjs +4 -0
  85. package/dist/components/chat/Window.d.ts +6 -0
  86. package/dist/components/chat/Window.js +116 -0
  87. package/dist/components/chat/Window.js.map +1 -0
  88. package/dist/components/chat/Window.mjs +4 -0
  89. package/dist/components/chat/index.d.ts +8 -0
  90. package/dist/components/chat/index.js +824 -0
  91. package/dist/components/chat/index.js.map +1 -0
  92. package/dist/components/chat/index.mjs +20 -0
  93. package/dist/components/chat/props.d.ts +33 -0
  94. package/dist/components/chat/props.js +4 -0
  95. package/dist/components/chat/props.mjs +3 -0
  96. package/dist/components/index.d.ts +6 -7
  97. package/dist/components/index.js +824 -0
  98. package/dist/components/index.js.map +1 -0
  99. package/dist/components/index.mjs +17 -22
  100. package/dist/context/index.js +4 -0
  101. package/dist/hooks/index.js +4 -0
  102. package/dist/hooks/use-copy-to-clipboard.js +47 -0
  103. package/dist/hooks/use-copy-to-clipboard.js.map +1 -0
  104. package/dist/index.css +565 -917
  105. package/dist/index.css.map +1 -1
  106. package/dist/index.d.ts +6 -7
  107. package/dist/index.js +824 -0
  108. package/dist/index.js.map +1 -0
  109. package/dist/index.mjs +18 -23
  110. package/dist/lib/utils.js +64 -0
  111. package/dist/lib/utils.js.map +1 -0
  112. package/dist/lib/utils.mjs +38 -2
  113. package/dist/lib/utils.mjs.map +1 -1
  114. package/dist/lib/utils.test.js +10 -0
  115. package/dist/lib/utils.test.js.map +1 -0
  116. package/dist/types/index.js +4 -0
  117. package/dist/types/index.js.map +1 -0
  118. package/dist/types/types.d.ts +1 -1
  119. package/dist/types/types.js +4 -0
  120. package/dist/types/types.js.map +1 -0
  121. package/package.json +8 -7
  122. package/src/components/chat/Button.tsx +23 -0
  123. package/src/components/chat/Chat.tsx +186 -0
  124. package/src/components/chat/ChatContext.tsx +176 -0
  125. package/src/components/{chat-components/ui/codeblock.tsx → chat/CodeBlock.tsx} +21 -33
  126. package/src/components/chat/Header.tsx +15 -0
  127. package/src/components/chat/Icons.tsx +179 -0
  128. package/src/components/chat/Input.tsx +51 -0
  129. package/src/components/chat/Markdown.tsx +68 -0
  130. package/src/components/chat/Messages.tsx +113 -0
  131. package/src/components/chat/Popup.tsx +9 -0
  132. package/src/components/chat/Response.tsx +12 -0
  133. package/src/components/chat/Sidebar.tsx +28 -0
  134. package/src/components/chat/Textarea.tsx +61 -0
  135. package/src/components/chat/Window.tsx +141 -0
  136. package/src/components/chat/index.tsx +3 -0
  137. package/src/components/chat/props.ts +36 -0
  138. package/src/components/index.ts +1 -7
  139. package/src/css/animations.css +35 -0
  140. package/src/css/button.css +54 -0
  141. package/src/css/colors.css +61 -0
  142. package/src/css/header.css +43 -0
  143. package/src/css/input.css +79 -0
  144. package/src/css/markdown.css +123 -0
  145. package/src/css/messages.css +57 -0
  146. package/src/css/popup.css +22 -0
  147. package/src/css/response.css +29 -0
  148. package/src/css/sidebar.css +34 -0
  149. package/src/css/window.css +58 -0
  150. package/src/styles.css +12 -0
  151. package/src/types/types.ts +1 -1
  152. package/tsup.config.ts +1 -2
  153. package/dist/chunk-2KAF7NKC.mjs +0 -484
  154. package/dist/chunk-2KAF7NKC.mjs.map +0 -1
  155. package/dist/chunk-5KEDV5VC.mjs +0 -27
  156. package/dist/chunk-5KEDV5VC.mjs.map +0 -1
  157. package/dist/chunk-6LAZQHEB.mjs.map +0 -1
  158. package/dist/chunk-CF3BK4OX.mjs +0 -53
  159. package/dist/chunk-CF3BK4OX.mjs.map +0 -1
  160. package/dist/chunk-CNQX2VY3.mjs +0 -66
  161. package/dist/chunk-CNQX2VY3.mjs.map +0 -1
  162. package/dist/chunk-GCOPYGHH.mjs +0 -27
  163. package/dist/chunk-GCOPYGHH.mjs.map +0 -1
  164. package/dist/chunk-IJLMKBSZ.mjs +0 -25
  165. package/dist/chunk-IJLMKBSZ.mjs.map +0 -1
  166. package/dist/chunk-INCNMGJ7.mjs +0 -72
  167. package/dist/chunk-INCNMGJ7.mjs.map +0 -1
  168. package/dist/chunk-M3CZWJI3.mjs +0 -44
  169. package/dist/chunk-M3CZWJI3.mjs.map +0 -1
  170. package/dist/chunk-MC6KTH4X.mjs +0 -12
  171. package/dist/chunk-MC6KTH4X.mjs.map +0 -1
  172. package/dist/chunk-NMT7XT2R.mjs +0 -39
  173. package/dist/chunk-NMT7XT2R.mjs.map +0 -1
  174. package/dist/chunk-OHWEJUCS.mjs +0 -18
  175. package/dist/chunk-OHWEJUCS.mjs.map +0 -1
  176. package/dist/chunk-OOBQC5H6.mjs +0 -34
  177. package/dist/chunk-OOBQC5H6.mjs.map +0 -1
  178. package/dist/chunk-Q6YO7LDK.mjs +0 -40
  179. package/dist/chunk-Q6YO7LDK.mjs.map +0 -1
  180. package/dist/chunk-RPTRCFSO.mjs +0 -42
  181. package/dist/chunk-RPTRCFSO.mjs.map +0 -1
  182. package/dist/chunk-SEH5PQVW.mjs +0 -52
  183. package/dist/chunk-SEH5PQVW.mjs.map +0 -1
  184. package/dist/chunk-SHOTWRKC.mjs +0 -18
  185. package/dist/chunk-SHOTWRKC.mjs.map +0 -1
  186. package/dist/chunk-SRBUGQTM.mjs +0 -109
  187. package/dist/chunk-SRBUGQTM.mjs.map +0 -1
  188. package/dist/chunk-TEYIQHMK.mjs +0 -12
  189. package/dist/chunk-TEYIQHMK.mjs.map +0 -1
  190. package/dist/chunk-U6NJWGTV.mjs +0 -3
  191. package/dist/chunk-VGX2W5ZB.mjs +0 -28
  192. package/dist/chunk-VGX2W5ZB.mjs.map +0 -1
  193. package/dist/chunk-WLTEQ2FW.mjs +0 -80
  194. package/dist/chunk-WLTEQ2FW.mjs.map +0 -1
  195. package/dist/chunk-ZYC5YVDO.mjs +0 -21
  196. package/dist/chunk-ZYC5YVDO.mjs.map +0 -1
  197. package/dist/components/chat-components/chat-list.d.ts +0 -8
  198. package/dist/components/chat-components/chat-list.mjs +0 -13
  199. package/dist/components/chat-components/chat-message-actions.d.ts +0 -8
  200. package/dist/components/chat-components/chat-message-actions.mjs +0 -8
  201. package/dist/components/chat-components/chat-message.d.ts +0 -8
  202. package/dist/components/chat-components/chat-message.mjs +0 -11
  203. package/dist/components/chat-components/chat-panel.d.ts +0 -8
  204. package/dist/components/chat-components/chat-panel.mjs +0 -10
  205. package/dist/components/chat-components/chat-scroll-anchor.d.ts +0 -6
  206. package/dist/components/chat-components/chat-scroll-anchor.mjs +0 -5
  207. package/dist/components/chat-components/clear-history.d.ts +0 -9
  208. package/dist/components/chat-components/clear-history.mjs +0 -56
  209. package/dist/components/chat-components/clear-history.mjs.map +0 -1
  210. package/dist/components/chat-components/copilot-chat.d.ts +0 -12
  211. package/dist/components/chat-components/copilot-chat.mjs +0 -22
  212. package/dist/components/chat-components/default-empty-screen.d.ts +0 -8
  213. package/dist/components/chat-components/default-empty-screen.mjs +0 -8
  214. package/dist/components/chat-components/external-link.d.ts +0 -6
  215. package/dist/components/chat-components/external-link.mjs +0 -4
  216. package/dist/components/chat-components/markdown.d.ts +0 -6
  217. package/dist/components/chat-components/markdown.mjs +0 -4
  218. package/dist/components/chat-components/prompt-form.d.ts +0 -9
  219. package/dist/components/chat-components/prompt-form.mjs +0 -9
  220. package/dist/components/chat-components/theme-toggle.d.ts +0 -3
  221. package/dist/components/chat-components/theme-toggle.mjs +0 -32
  222. package/dist/components/chat-components/theme-toggle.mjs.map +0 -1
  223. package/dist/components/chat-components/toaster.d.ts +0 -1
  224. package/dist/components/chat-components/toaster.mjs +0 -4
  225. package/dist/components/chat-components/toaster.mjs.map +0 -1
  226. package/dist/components/chat-components/ui/alert-dialog.d.ts +0 -20
  227. package/dist/components/chat-components/ui/alert-dialog.mjs +0 -6
  228. package/dist/components/chat-components/ui/badge.d.ts +0 -12
  229. package/dist/components/chat-components/ui/badge.mjs +0 -29
  230. package/dist/components/chat-components/ui/badge.mjs.map +0 -1
  231. package/dist/components/chat-components/ui/button.d.ts +0 -14
  232. package/dist/components/chat-components/ui/button.mjs +0 -5
  233. package/dist/components/chat-components/ui/codeblock.mjs +0 -8
  234. package/dist/components/chat-components/ui/dialog.d.ts +0 -18
  235. package/dist/components/chat-components/ui/dialog.mjs +0 -94
  236. package/dist/components/chat-components/ui/dialog.mjs.map +0 -1
  237. package/dist/components/chat-components/ui/dropdown-menu.d.ts +0 -24
  238. package/dist/components/chat-components/ui/dropdown-menu.mjs +0 -87
  239. package/dist/components/chat-components/ui/dropdown-menu.mjs.map +0 -1
  240. package/dist/components/chat-components/ui/icons.d.ts +0 -33
  241. package/dist/components/chat-components/ui/icons.mjs +0 -5
  242. package/dist/components/chat-components/ui/input.d.ts +0 -7
  243. package/dist/components/chat-components/ui/input.mjs +0 -26
  244. package/dist/components/chat-components/ui/input.mjs.map +0 -1
  245. package/dist/components/chat-components/ui/label.d.ts +0 -8
  246. package/dist/components/chat-components/ui/label.mjs +0 -19
  247. package/dist/components/chat-components/ui/label.mjs.map +0 -1
  248. package/dist/components/chat-components/ui/select.d.ts +0 -13
  249. package/dist/components/chat-components/ui/select.mjs +0 -101
  250. package/dist/components/chat-components/ui/select.mjs.map +0 -1
  251. package/dist/components/chat-components/ui/separator.d.ts +0 -6
  252. package/dist/components/chat-components/ui/separator.mjs +0 -5
  253. package/dist/components/chat-components/ui/sheet.d.ts +0 -19
  254. package/dist/components/chat-components/ui/sheet.mjs +0 -93
  255. package/dist/components/chat-components/ui/sheet.mjs.map +0 -1
  256. package/dist/components/chat-components/ui/switch.d.ts +0 -6
  257. package/dist/components/chat-components/ui/switch.mjs +0 -33
  258. package/dist/components/chat-components/ui/switch.mjs.map +0 -1
  259. package/dist/components/chat-components/ui/textarea.d.ts +0 -7
  260. package/dist/components/chat-components/ui/textarea.mjs +0 -25
  261. package/dist/components/chat-components/ui/textarea.mjs.map +0 -1
  262. package/dist/components/chat-components/ui/tooltip.d.ts +0 -9
  263. package/dist/components/chat-components/ui/tooltip.mjs +0 -5
  264. package/dist/components/sidebar/copilot-sidebar-ui-provider.d.ts +0 -9
  265. package/dist/components/sidebar/copilot-sidebar-ui-provider.mjs +0 -25
  266. package/dist/components/sidebar/copilot-sidebar.d.ts +0 -7
  267. package/dist/components/sidebar/copilot-sidebar.mjs +0 -23
  268. package/dist/components/sidebar/sidebar-context.d.ts +0 -9
  269. package/dist/components/sidebar/sidebar-context.mjs +0 -4
  270. package/dist/hooks/use-at-bottom.d.ts +0 -3
  271. package/dist/hooks/use-at-bottom.mjs +0 -4
  272. package/dist/hooks/use-enter-submit.d.ts +0 -8
  273. package/dist/hooks/use-enter-submit.mjs +0 -4
  274. package/src/components/chat-components/chat-list.tsx +0 -28
  275. package/src/components/chat-components/chat-message-actions.tsx +0 -36
  276. package/src/components/chat-components/chat-message.tsx +0 -70
  277. package/src/components/chat-components/chat-panel.tsx +0 -64
  278. package/src/components/chat-components/chat-scroll-anchor.tsx +0 -29
  279. package/src/components/chat-components/clear-history.tsx +0 -72
  280. package/src/components/chat-components/copilot-chat.tsx +0 -57
  281. package/src/components/chat-components/default-empty-screen.tsx +0 -57
  282. package/src/components/chat-components/external-link.tsx +0 -17
  283. package/src/components/chat-components/markdown.tsx +0 -8
  284. package/src/components/chat-components/prompt-form.tsx +0 -85
  285. package/src/components/chat-components/theme-toggle.tsx +0 -31
  286. package/src/components/chat-components/toaster.tsx +0 -3
  287. package/src/components/chat-components/ui/alert-dialog.tsx +0 -126
  288. package/src/components/chat-components/ui/badge.tsx +0 -33
  289. package/src/components/chat-components/ui/button.tsx +0 -49
  290. package/src/components/chat-components/ui/dialog.tsx +0 -106
  291. package/src/components/chat-components/ui/dropdown-menu.tsx +0 -117
  292. package/src/components/chat-components/ui/icons.tsx +0 -484
  293. package/src/components/chat-components/ui/input.tsx +0 -24
  294. package/src/components/chat-components/ui/label.tsx +0 -21
  295. package/src/components/chat-components/ui/select.tsx +0 -119
  296. package/src/components/chat-components/ui/separator.tsx +0 -26
  297. package/src/components/chat-components/ui/sheet.tsx +0 -106
  298. package/src/components/chat-components/ui/switch.tsx +0 -29
  299. package/src/components/chat-components/ui/textarea.tsx +0 -23
  300. package/src/components/chat-components/ui/tooltip.tsx +0 -30
  301. package/src/components/sidebar/copilot-sidebar-ui-provider.tsx +0 -77
  302. package/src/components/sidebar/copilot-sidebar.tsx +0 -39
  303. package/src/components/sidebar/sidebar-context.tsx +0 -11
  304. package/src/hooks/use-at-bottom.tsx +0 -20
  305. package/src/hooks/use-enter-submit.tsx +0 -17
  306. /package/dist/{chunk-U6NJWGTV.mjs.map → chunk-JD7BAH7U.mjs.map} +0 -0
  307. /package/dist/{components/chat-components/chat-list.mjs.map → chunk-P4GBO6MW.mjs.map} +0 -0
  308. /package/dist/{components/chat-components/chat-message-actions.mjs.map → chunk-WB3YULQ4.mjs.map} +0 -0
  309. /package/dist/components/{chat-components/chat-message.mjs.map → chat/Button.mjs.map} +0 -0
  310. /package/dist/components/{chat-components/chat-panel.mjs.map → chat/Chat.mjs.map} +0 -0
  311. /package/dist/components/{chat-components/chat-scroll-anchor.mjs.map → chat/ChatContext.mjs.map} +0 -0
  312. /package/dist/components/{chat-components/ui/codeblock.d.ts → chat/CodeBlock.d.ts} +0 -0
  313. /package/dist/components/{chat-components/copilot-chat.mjs.map → chat/CodeBlock.mjs.map} +0 -0
  314. /package/dist/components/{chat-components/default-empty-screen.mjs.map → chat/Header.mjs.map} +0 -0
  315. /package/dist/components/{chat-components/external-link.mjs.map → chat/Icons.mjs.map} +0 -0
  316. /package/dist/components/{chat-components/markdown.mjs.map → chat/Input.mjs.map} +0 -0
  317. /package/dist/components/{chat-components/prompt-form.mjs.map → chat/Markdown.mjs.map} +0 -0
  318. /package/dist/components/{chat-components/ui/alert-dialog.mjs.map → chat/Messages.mjs.map} +0 -0
  319. /package/dist/components/{chat-components/ui/button.mjs.map → chat/Popup.mjs.map} +0 -0
  320. /package/dist/components/{chat-components/ui/codeblock.mjs.map → chat/Response.mjs.map} +0 -0
  321. /package/dist/components/{chat-components/ui/icons.mjs.map → chat/Sidebar.mjs.map} +0 -0
  322. /package/dist/components/{chat-components/ui/separator.mjs.map → chat/Textarea.mjs.map} +0 -0
  323. /package/dist/components/{chat-components/ui/tooltip.mjs.map → chat/Window.mjs.map} +0 -0
  324. /package/dist/components/{sidebar/copilot-sidebar-ui-provider.mjs.map → chat/index.mjs.map} +0 -0
  325. /package/dist/components/{sidebar/copilot-sidebar.mjs.map → chat/props.js.map} +0 -0
  326. /package/dist/components/{sidebar/sidebar-context.mjs.map → chat/props.mjs.map} +0 -0
  327. /package/dist/{hooks/use-at-bottom.mjs.map → context/index.js.map} +0 -0
  328. /package/dist/hooks/{use-enter-submit.mjs.map → index.js.map} +0 -0
@@ -0,0 +1,176 @@
1
+ import React, { useMemo } from "react";
2
+ import * as DefaultIcons from "./Icons";
3
+
4
+ /**
5
+ * Icons for CopilotChat component.
6
+ */
7
+ export interface CopilotChatIcons {
8
+ /**
9
+ * The icon to use for the open chat button.
10
+ * @default <OpenIcon />
11
+ */
12
+ openIcon?: React.ReactNode;
13
+
14
+ /**
15
+ * The icon to use for the close chat button.
16
+ * @default <CloseIcon />
17
+ */
18
+ closeIcon?: React.ReactNode;
19
+
20
+ /**
21
+ * The icon to use for the close chat button in the header.
22
+ * @default <HeaderCloseIcon />
23
+ */
24
+ headerCloseIcon?: React.ReactNode;
25
+
26
+ /**
27
+ * The icon to use for the send button.
28
+ * @default <SendIcon />
29
+ */
30
+ sendIcon?: React.ReactNode;
31
+
32
+ /**
33
+ * The icon to use for the activity indicator.
34
+ * @default <ActivityIcon />
35
+ */
36
+ activityIcon?: React.ReactNode;
37
+
38
+ /**
39
+ * The icon to use for the spinner.
40
+ * @default <SpinnerIcon />
41
+ */
42
+ spinnerIcon?: React.ReactNode;
43
+
44
+ /**
45
+ * The icon to use for the stop button.
46
+ * @default <StopIcon />
47
+ */
48
+ stopIcon?: React.ReactNode;
49
+
50
+ /**
51
+ * The icon to use for the regenerate button.
52
+ * @default <RegenerateIcon />
53
+ */
54
+ regenerateIcon?: React.ReactNode;
55
+ }
56
+
57
+ /**
58
+ * Labels for CopilotChat component.
59
+ */
60
+ export interface CopilotChatLabels {
61
+ /**
62
+ * The initial message(s) to display in the chat window.
63
+ */
64
+ initial?: string | string[];
65
+
66
+ /**
67
+ * The title to display in the header.
68
+ * @default "CopilotKit"
69
+ */
70
+ title?: string;
71
+
72
+ /**
73
+ * The placeholder to display in the input.
74
+ * @default "Type a message..."
75
+ */
76
+ placeholder?: string;
77
+
78
+ /**
79
+ * The message to display while the chat GPT is "thinking".
80
+ * @default "Thinking..."
81
+ */
82
+ thinking?: string;
83
+
84
+ /**
85
+ * The message to display when the chat is done executing a function.
86
+ * @default "✅ Done"
87
+ */
88
+ done?: string;
89
+
90
+ /**
91
+ * The message to display when an error occurs.
92
+ * @default "❌ An error occurred. Please try again."
93
+ */
94
+ error?: string;
95
+
96
+ /**
97
+ * The label to display on the stop button.
98
+ * @default "Stop generating"
99
+ */
100
+ stopGenerating?: string;
101
+
102
+ /**
103
+ * The label to display on the regenerate button.
104
+ * @default "Regenerate response"
105
+ */
106
+ regenerateResponse?: string;
107
+ }
108
+
109
+ interface ChatContext {
110
+ labels: Required<CopilotChatLabels>;
111
+ icons: Required<CopilotChatIcons>;
112
+ }
113
+
114
+ export const ChatContext = React.createContext<ChatContext | undefined>(undefined);
115
+
116
+ export function useChatContext(): ChatContext {
117
+ const context = React.useContext(ChatContext);
118
+ if (context === undefined) {
119
+ throw new Error(
120
+ "Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?",
121
+ );
122
+ }
123
+ return context;
124
+ }
125
+
126
+ interface ChatContextProps {
127
+ // temperature?: number;
128
+ // instructions?: string;
129
+ // maxFeedback?: number;
130
+ labels?: CopilotChatLabels;
131
+ icons?: CopilotChatIcons;
132
+ children?: React.ReactNode;
133
+ }
134
+
135
+ export const ChatContextProvider = ({
136
+ // temperature,
137
+ // instructions,
138
+ // maxFeedback,
139
+ labels,
140
+ icons,
141
+ children,
142
+ }: ChatContextProps) => {
143
+ const context = useMemo(
144
+ () => ({
145
+ labels: {
146
+ ...{
147
+ initial: "",
148
+ title: "CopilotKit",
149
+ placeholder: "Type a message...",
150
+ thinking: "Thinking...",
151
+ done: "✅ Done",
152
+ error: "❌ An error occurred. Please try again.",
153
+ stopGenerating: "Stop generating",
154
+ regenerateResponse: "Regenerate response",
155
+ },
156
+ ...labels,
157
+ },
158
+
159
+ icons: {
160
+ ...{
161
+ openIcon: DefaultIcons.OpenIcon,
162
+ closeIcon: DefaultIcons.CloseIcon,
163
+ headerCloseIcon: DefaultIcons.HeaderCloseIcon,
164
+ sendIcon: DefaultIcons.SendIcon,
165
+ activityIcon: DefaultIcons.ActivityIcon,
166
+ spinnerIcon: DefaultIcons.SpinnerIcon,
167
+ stopIcon: DefaultIcons.StopIcon,
168
+ regenerateIcon: DefaultIcons.RegenerateIcon,
169
+ },
170
+ icons,
171
+ },
172
+ }),
173
+ [labels, icons],
174
+ );
175
+ return <ChatContext.Provider value={context}>{children}</ChatContext.Provider>;
176
+ };
@@ -2,10 +2,15 @@
2
2
 
3
3
  import { FC, memo } from "react";
4
4
  import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
5
+ import { vscDarkPlus as highlightStyle } from "react-syntax-highlighter/dist/esm/styles/prism";
5
6
 
6
- import { useCopyToClipboard } from "../../../hooks/use-copy-to-clipboard";
7
- import { IconCheck, IconCopy, IconDownload } from "./icons";
8
- import { Button } from "./button";
7
+ import { useCopyToClipboard } from "../../hooks/use-copy-to-clipboard";
8
+ import { CheckIcon, CopyIcon, DownloadIcon } from "./Icons";
9
+
10
+ interface CodeActionButtonProps {
11
+ onClick: () => void;
12
+ children: React.ReactNode;
13
+ }
9
14
 
10
15
  interface Props {
11
16
  language: string;
@@ -86,45 +91,28 @@ const CodeBlock: FC<Props> = memo(({ language, value }) => {
86
91
  };
87
92
 
88
93
  return (
89
- <div className="codeblock relative w-full bg-zinc-950 font-sans">
90
- <div className="flex w-full items-center justify-between bg-zinc-800 px-6 py-2 pr-4 text-zinc-100">
91
- <span className="text-xs lowercase">{language}</span>
92
- <div className="flex items-center space-x-1">
93
- <Button
94
- variant="ghost"
95
- className="hover:bg-zinc-800 focus-visible:ring-1 focus-visible:ring-slate-700 focus-visible:ring-offset-0"
96
- onClick={downloadAsFile}
97
- size="icon"
98
- >
99
- <IconDownload />
94
+ <div className="copilotKitCodeBlock">
95
+ <div className="copilotKitCodeBlockToolbar">
96
+ <span className="copilotKitCodeBlockToolbarLanguage">{language}</span>
97
+ <div className="copilotKitCodeBlockToolbarButtons">
98
+ <button className="copilotKitCodeBlockToolbarButton" onClick={downloadAsFile}>
99
+ <DownloadIcon />
100
100
  <span className="sr-only">Download</span>
101
- </Button>
102
- <Button
103
- variant="ghost"
104
- size="icon"
105
- className="text-xs hover:bg-zinc-800 focus-visible:ring-1 focus-visible:ring-slate-700 focus-visible:ring-offset-0"
106
- onClick={onCopy}
107
- >
108
- {isCopied ? <IconCheck /> : <IconCopy />}
101
+ </button>
102
+ <button className="copilotKitCodeBlockToolbarButton" onClick={onCopy}>
103
+ {isCopied ? <CheckIcon /> : <CopyIcon />}
109
104
  <span className="sr-only">Copy code</span>
110
- </Button>
105
+ </button>
111
106
  </div>
112
107
  </div>
113
108
  <SyntaxHighlighter
114
109
  language={language}
110
+ style={highlightStyle}
115
111
  PreTag="div"
116
- showLineNumbers
117
112
  customStyle={{
118
113
  margin: 0,
119
- width: "100%",
120
- background: "transparent",
121
- padding: "1.5rem 1rem",
122
- }}
123
- codeTagProps={{
124
- style: {
125
- fontSize: "0.9rem",
126
- fontFamily: "var(--font-mono)",
127
- },
114
+ borderBottomLeftRadius: "0.375rem",
115
+ borderBottomRightRadius: "0.375rem",
128
116
  }}
129
117
  >
130
118
  {value}
@@ -0,0 +1,15 @@
1
+ import { HeaderProps } from "./props";
2
+ import { useChatContext } from "./ChatContext";
3
+
4
+ export const Header = ({ setOpen }: HeaderProps) => {
5
+ const context = useChatContext();
6
+
7
+ return (
8
+ <div className="copilotKitHeader">
9
+ <div>{context.labels.title}</div>
10
+ <button onClick={() => setOpen(false)} aria-label="Close">
11
+ {context.icons.headerCloseIcon}
12
+ </button>
13
+ </div>
14
+ );
15
+ };
@@ -0,0 +1,179 @@
1
+ import React from "react";
2
+
3
+ export const OpenIcon = (
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ viewBox="0 0 24 24"
7
+ fill="currentColor"
8
+ width="24"
9
+ height="24"
10
+ >
11
+ <g transform="translate(24, 0) scale(-1, 1)">
12
+ <path
13
+ fillRule="evenodd"
14
+ 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"
15
+ clipRule="evenodd"
16
+ />
17
+ </g>
18
+ </svg>
19
+ );
20
+
21
+ export const CloseIcon = (
22
+ <svg
23
+ xmlns="http://www.w3.org/2000/svg"
24
+ fill="none"
25
+ viewBox="0 0 24 24"
26
+ strokeWidth="1.5"
27
+ stroke="currentColor"
28
+ width="24"
29
+ height="24"
30
+ >
31
+ <path strokeLinecap="round" strokeLinejoin="round" d="M19.5 8.25l-7.5 7.5-7.5-7.5" />
32
+ </svg>
33
+ );
34
+
35
+ export const HeaderCloseIcon = (
36
+ <svg
37
+ xmlns="http://www.w3.org/2000/svg"
38
+ fill="none"
39
+ viewBox="0 0 24 24"
40
+ strokeWidth="1.5"
41
+ stroke="currentColor"
42
+ width="24"
43
+ height="24"
44
+ >
45
+ <path strokeLinecap="round" strokeLinejoin="round" d="M6 18L18 6M6 6l12 12" />
46
+ </svg>
47
+ );
48
+
49
+ export const SendIcon = (
50
+ <svg
51
+ xmlns="http://www.w3.org/2000/svg"
52
+ fill="none"
53
+ viewBox="0 0 24 24"
54
+ strokeWidth={1.5}
55
+ stroke="currentColor"
56
+ width="24"
57
+ height="24"
58
+ >
59
+ <path
60
+ strokeLinecap="round"
61
+ 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"
63
+ />
64
+ </svg>
65
+ );
66
+
67
+ export const SpinnerIcon = (
68
+ <svg
69
+ style={{
70
+ animation: "copilotKitSpinAnimation 1s linear infinite",
71
+ color: "rgb(107 114 128)",
72
+ }}
73
+ width="24"
74
+ height="24"
75
+ xmlns="http://www.w3.org/2000/svg"
76
+ fill="none"
77
+ viewBox="0 0 24 24"
78
+ >
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
+ <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
+ </svg>
93
+ );
94
+
95
+ export const ActivityIcon = (
96
+ <svg
97
+ style={{
98
+ display: "inline-block",
99
+ marginLeft: "0.25rem",
100
+ marginRight: "0.25rem",
101
+ }}
102
+ height="24"
103
+ width="24"
104
+ viewBox="0 0 27 27"
105
+ xmlns="http://www.w3.org/2000/svg"
106
+ fill="currentColor"
107
+ >
108
+ <circle className="copilotKitActivityDot1" cx="4" cy="12" r="3" />
109
+ <circle className="copilotKitActivityDot1 copilotKitActivityDot2" cx="12" cy="12" r="3" />
110
+ <circle className="copilotKitActivityDot1 copilotKitActivityDot3" cx="20" cy="12" r="3" />
111
+ </svg>
112
+ );
113
+
114
+ export function CheckIcon({ className, ...props }: React.ComponentProps<"svg">) {
115
+ return (
116
+ <svg
117
+ xmlns="http://www.w3.org/2000/svg"
118
+ viewBox="0 0 256 256"
119
+ fill="currentColor"
120
+ style={{ height: "1rem", width: "1rem" }}
121
+ className={className}
122
+ {...props}
123
+ >
124
+ <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" />
125
+ </svg>
126
+ );
127
+ }
128
+
129
+ export function DownloadIcon({ className, ...props }: React.ComponentProps<"svg">) {
130
+ return (
131
+ <svg
132
+ xmlns="http://www.w3.org/2000/svg"
133
+ viewBox="0 0 256 256"
134
+ fill="currentColor"
135
+ style={{ height: "1rem", width: "1rem" }}
136
+ className={className}
137
+ {...props}
138
+ >
139
+ <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" />
140
+ </svg>
141
+ );
142
+ }
143
+
144
+ export function CopyIcon({ className, ...props }: React.ComponentProps<"svg">) {
145
+ return (
146
+ <svg
147
+ xmlns="http://www.w3.org/2000/svg"
148
+ viewBox="0 0 256 256"
149
+ fill="currentColor"
150
+ style={{ height: "1rem", width: "1rem" }}
151
+ className={className}
152
+ {...props}
153
+ >
154
+ <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" />
155
+ </svg>
156
+ );
157
+ }
158
+
159
+ export const StopIcon = (
160
+ <svg
161
+ xmlns="http://www.w3.org/2000/svg"
162
+ viewBox="0 0 256 256"
163
+ fill="currentColor"
164
+ style={{ height: "1rem", width: "1rem" }}
165
+ >
166
+ <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" />
167
+ </svg>
168
+ );
169
+
170
+ export const RegenerateIcon = (
171
+ <svg
172
+ xmlns="http://www.w3.org/2000/svg"
173
+ viewBox="0 0 256 256"
174
+ fill="currentColor"
175
+ style={{ height: "1rem", width: "1rem" }}
176
+ >
177
+ <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" />
178
+ </svg>
179
+ );
@@ -0,0 +1,51 @@
1
+ import React, { useRef, useState } from "react";
2
+ import { InputProps } from "./props";
3
+ import { useChatContext } from "./ChatContext";
4
+ import AutoResizingTextarea from "./Textarea";
5
+
6
+ export const Input = ({ inProgress, onSend, children }: InputProps) => {
7
+ const context = useChatContext();
8
+ const textareaRef = useRef<HTMLTextAreaElement>(null);
9
+
10
+ const handleDivClick = (event: React.MouseEvent<HTMLDivElement>) => {
11
+ // Check if the clicked element is not the textarea itself
12
+ if (event.target !== event.currentTarget) return;
13
+
14
+ textareaRef.current?.focus();
15
+ };
16
+
17
+ const [text, setText] = useState("");
18
+ const send = () => {
19
+ if (inProgress) return;
20
+ onSend(text);
21
+ setText("");
22
+
23
+ textareaRef.current?.focus();
24
+ };
25
+
26
+ const icon = inProgress ? context.icons.activityIcon : context.icons.sendIcon;
27
+ const disabled = inProgress || text.length === 0;
28
+
29
+ return (
30
+ <div className="copilotKitInput" onClick={handleDivClick}>
31
+ <span>{children}</span>
32
+ <button className="copilotKitSendButton" disabled={disabled} onClick={send}>
33
+ {icon}
34
+ </button>
35
+ <AutoResizingTextarea
36
+ ref={textareaRef}
37
+ placeholder={context.labels.placeholder}
38
+ autoFocus={true}
39
+ maxRows={5}
40
+ value={text}
41
+ onChange={(event) => setText(event.target.value)}
42
+ onKeyDown={(event) => {
43
+ if (event.key === "Enter" && !event.shiftKey) {
44
+ event.preventDefault();
45
+ send();
46
+ }
47
+ }}
48
+ />
49
+ </div>
50
+ );
51
+ };
@@ -0,0 +1,68 @@
1
+ import { FC, memo } from "react";
2
+ import ReactMarkdown, { Options, Components } from "react-markdown";
3
+ import { CodeBlock } from "./CodeBlock";
4
+ import remarkGfm from "remark-gfm";
5
+ import remarkMath from "remark-math";
6
+
7
+ const MemoizedReactMarkdown: FC<Options> = memo(
8
+ ReactMarkdown,
9
+ (prevProps, nextProps) =>
10
+ prevProps.children === nextProps.children && prevProps.className === nextProps.className,
11
+ );
12
+
13
+ type MarkdownProps = {
14
+ content: string;
15
+ };
16
+
17
+ export const Markdown = ({ content }: MarkdownProps) => {
18
+ return (
19
+ <div className="copilotKitMarkdown">
20
+ <MemoizedReactMarkdown components={components} remarkPlugins={[remarkGfm, remarkMath]}>
21
+ {content}
22
+ </MemoizedReactMarkdown>
23
+ </div>
24
+ );
25
+ };
26
+
27
+ const components: Components = {
28
+ p({ children }) {
29
+ return <p>{children}</p>;
30
+ },
31
+ code({ children, className, inline, ...props }) {
32
+ if (children.length) {
33
+ if (children[0] == "▍") {
34
+ return (
35
+ <span
36
+ style={{
37
+ animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
38
+ marginTop: "0.25rem",
39
+ }}
40
+ >
41
+
42
+ </span>
43
+ );
44
+ }
45
+
46
+ children[0] = (children[0] as string).replace("`▍`", "▍");
47
+ }
48
+
49
+ const match = /language-(\w+)/.exec(className || "");
50
+
51
+ if (inline) {
52
+ return (
53
+ <code className={className} {...props}>
54
+ {children}
55
+ </code>
56
+ );
57
+ }
58
+
59
+ return (
60
+ <CodeBlock
61
+ key={Math.random()}
62
+ language={(match && match[1]) || ""}
63
+ value={String(children).replace(/\n$/, "")}
64
+ {...props}
65
+ />
66
+ );
67
+ },
68
+ };
@@ -0,0 +1,113 @@
1
+ import React, { useEffect, useMemo } from "react";
2
+ import { MessagesProps } from "./props";
3
+ import { useChatContext } from "./ChatContext";
4
+ import { nanoid } from "nanoid";
5
+ import { Message } from "@copilotkit/shared";
6
+ import { Markdown } from "./Markdown";
7
+
8
+ export const Messages = ({ messages, inProgress }: MessagesProps) => {
9
+ const context = useChatContext();
10
+ const initialMessages = useMemo(
11
+ () => makeInitialMessages(context.labels.initial),
12
+ [context.labels.initial],
13
+ );
14
+ messages = [...initialMessages, ...messages];
15
+
16
+ const messagesEndRef = React.useRef<HTMLDivElement>(null);
17
+
18
+ const scrollToBottom = () => {
19
+ if (messagesEndRef.current) {
20
+ messagesEndRef.current.scrollIntoView({
21
+ behavior: "auto",
22
+ });
23
+ }
24
+ };
25
+
26
+ useEffect(() => {
27
+ scrollToBottom();
28
+ }, [messages]);
29
+
30
+ return (
31
+ <div className="copilotKitMessages">
32
+ {messages.map((message, index) => {
33
+ const isCurrentMessage = index === messages.length - 1;
34
+
35
+ if (message.role === "user") {
36
+ return (
37
+ <div key={index} className="copilotKitMessage copilotKitUserMessage">
38
+ {message.content}
39
+ </div>
40
+ );
41
+ } else if (message.role == "assistant") {
42
+ if (isCurrentMessage && inProgress && !message.content) {
43
+ return (
44
+ <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>
45
+ {context.icons.spinnerIcon}
46
+ </div>
47
+ );
48
+ } else if (
49
+ (!inProgress || index != messages.length - 1) &&
50
+ !message.content &&
51
+ message.function_call
52
+ ) {
53
+ return (
54
+ <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>
55
+ {context.labels.done}
56
+ </div>
57
+ );
58
+ }
59
+ // TODO: Add back partial message
60
+ // This shows up when the assistant is executing a function
61
+ //
62
+ // else if (message.status === "partial") {
63
+ // return (
64
+ // <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>
65
+ // {context.labels.thinking} {context.icons.spinnerIcon}
66
+ // </div>
67
+ // );
68
+ // }
69
+ else {
70
+ return (
71
+ <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>
72
+ <Markdown content={message.content} />
73
+ </div>
74
+ );
75
+ }
76
+ }
77
+ // TODO: Add back function and error messages
78
+ //
79
+ // else if (message.role === "function" && message.status === "success") {
80
+ // return (
81
+ // <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>
82
+ // {context.labels.done}
83
+ // </div>
84
+ // );
85
+ // } else if (message.status === "error") {
86
+ // return (
87
+ // <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>
88
+ // {context.labels.error}
89
+ // </div>
90
+ // );
91
+ // }
92
+ })}
93
+ <div ref={messagesEndRef} />
94
+ </div>
95
+ );
96
+ };
97
+
98
+ function makeInitialMessages(initial?: string | string[]): Message[] {
99
+ let initialArray: string[] = [];
100
+ if (initial) {
101
+ if (Array.isArray(initial)) {
102
+ initialArray.push(...initial);
103
+ } else {
104
+ initialArray.push(initial);
105
+ }
106
+ }
107
+
108
+ return initialArray.map((message) => ({
109
+ id: nanoid(),
110
+ role: "assistant",
111
+ content: message,
112
+ }));
113
+ }
@@ -0,0 +1,9 @@
1
+ import { CopilotChat, CopilotChatProps } from "./Chat";
2
+
3
+ export const CopilotPopup = (props: CopilotChatProps) => {
4
+ props = {
5
+ ...props,
6
+ className: props.className ? props.className + " copilotKitPopup" : "copilotKitPopup",
7
+ };
8
+ return <CopilotChat {...props} />;
9
+ };