@copilotkit/react-ui 0.15.0-alpha.1 → 0.15.0-alpha.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.
- package/.turbo/turbo-build.log +192 -288
- package/CHANGELOG.md +28 -1
- package/dist/{chunk-ZVAH2Z2W.mjs → chunk-3M4HWSE7.mjs} +3 -3
- package/dist/chunk-3M4HWSE7.mjs.map +1 -0
- package/dist/{chunk-Y2RUG4B3.mjs → chunk-5O2MCJZ2.mjs} +2 -2
- package/dist/chunk-5O2MCJZ2.mjs.map +1 -0
- package/dist/{chunk-X3Z2EVFV.mjs → chunk-CKJXXQ2W.mjs} +5 -5
- package/dist/chunk-CKJXXQ2W.mjs.map +1 -0
- package/dist/{chunk-NXWVWC33.mjs → chunk-DPRH4HX3.mjs} +11 -24
- package/dist/chunk-DPRH4HX3.mjs.map +1 -0
- package/dist/{chunk-UIRFLYXI.mjs → chunk-GWGHQNRI.mjs} +14 -13
- package/dist/chunk-GWGHQNRI.mjs.map +1 -0
- package/dist/chunk-JD7BAH7U.mjs +3 -0
- package/dist/{chunk-X4T6ZUVM.mjs → chunk-KBGIPFXA.mjs} +5 -5
- package/dist/chunk-KBGIPFXA.mjs.map +1 -0
- package/dist/{chunk-DN3OI5WF.mjs → chunk-NNVWLSYK.mjs} +9 -9
- package/dist/chunk-NNVWLSYK.mjs.map +1 -0
- package/dist/{chunk-QFASQEFJ.mjs → chunk-NYLOXKYT.mjs} +2 -2
- package/dist/chunk-NYLOXKYT.mjs.map +1 -0
- package/dist/{chunk-6H3Y2XEI.mjs → chunk-OF66AL5Z.mjs} +1 -1
- package/dist/chunk-OF66AL5Z.mjs.map +1 -0
- package/dist/{chunk-DPUPEOGG.mjs → chunk-UWPFPWAW.mjs} +2 -2
- package/dist/chunk-UWPFPWAW.mjs.map +1 -0
- package/dist/{chunk-GPEJCUWA.mjs → chunk-Z34F3WLK.mjs} +2 -2
- package/dist/chunk-Z34F3WLK.mjs.map +1 -0
- package/dist/components/chat/Button.d.ts +2 -3
- package/dist/components/chat/Button.js +38 -0
- package/dist/components/chat/Button.js.map +1 -0
- package/dist/components/chat/Button.mjs +2 -2
- package/dist/components/chat/Chat.d.ts +15 -14
- package/dist/components/chat/Chat.js +800 -0
- package/dist/components/chat/Chat.js.map +1 -0
- package/dist/components/chat/Chat.mjs +9 -9
- package/dist/components/chat/ChatContext.d.ts +21 -21
- package/dist/components/chat/ChatContext.js +220 -0
- package/dist/components/chat/ChatContext.js.map +1 -0
- package/dist/components/chat/ChatContext.mjs +1 -1
- package/dist/components/chat/CodeBlock.js +221 -0
- package/dist/components/chat/CodeBlock.js.map +1 -0
- package/dist/components/chat/CodeBlock.mjs +1 -1
- package/dist/components/chat/Header.d.ts +2 -3
- package/dist/components/chat/Header.js +31 -0
- package/dist/components/chat/Header.js.map +1 -0
- package/dist/components/chat/Header.mjs +2 -2
- package/dist/components/chat/Icons.d.ts +4 -4
- package/dist/components/chat/Icons.js +233 -0
- package/dist/components/chat/Icons.js.map +1 -0
- package/dist/components/chat/Input.d.ts +2 -3
- package/dist/components/chat/Input.js +111 -0
- package/dist/components/chat/Input.js.map +1 -0
- package/dist/components/chat/Input.mjs +2 -2
- package/dist/components/chat/Markdown.d.ts +1 -3
- package/dist/components/chat/Markdown.js +269 -0
- package/dist/components/chat/Markdown.js.map +1 -0
- package/dist/components/chat/Markdown.mjs +2 -2
- package/dist/components/chat/Messages.d.ts +2 -3
- package/dist/components/chat/Messages.js +331 -0
- package/dist/components/chat/Messages.js.map +1 -0
- package/dist/components/chat/Messages.mjs +4 -4
- package/dist/components/chat/Popup.d.ts +5 -4
- package/dist/components/chat/Popup.js +806 -0
- package/dist/components/chat/Popup.js.map +1 -0
- package/dist/components/chat/Popup.mjs +10 -10
- package/dist/components/chat/Response.d.ts +2 -3
- package/dist/components/chat/Response.js +31 -0
- package/dist/components/chat/Response.js.map +1 -0
- package/dist/components/chat/Response.mjs +2 -2
- package/dist/components/chat/Sidebar.d.ts +7 -6
- package/dist/components/chat/Sidebar.js +817 -0
- package/dist/components/chat/Sidebar.js.map +1 -0
- package/dist/components/chat/Sidebar.mjs +10 -10
- package/dist/components/chat/Textarea.d.ts +4 -4
- package/dist/components/chat/Textarea.js +55 -0
- package/dist/components/chat/Textarea.js.map +1 -0
- package/dist/components/chat/Window.d.ts +1 -1
- package/dist/components/chat/Window.js +116 -0
- package/dist/components/chat/Window.js.map +1 -0
- package/dist/components/chat/index.d.ts +5 -4
- package/dist/components/chat/index.js +824 -0
- package/dist/components/chat/index.js.map +1 -0
- package/dist/components/chat/index.mjs +11 -11
- package/dist/components/chat/props.d.ts +1 -1
- package/dist/components/chat/props.js +4 -0
- package/dist/components/index.d.ts +5 -11
- package/dist/components/index.js +824 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index.mjs +12 -33
- package/dist/context/index.js +4 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/use-copy-to-clipboard.js +47 -0
- package/dist/hooks/use-copy-to-clipboard.js.map +1 -0
- package/dist/index.css +112 -916
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +5 -11
- package/dist/index.js +824 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +13 -34
- package/dist/lib/utils.js +64 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/utils.mjs +38 -2
- package/dist/lib/utils.mjs.map +1 -1
- package/dist/lib/utils.test.js +10 -0
- package/dist/lib/utils.test.js.map +1 -0
- package/dist/types/index.js +4 -0
- package/dist/types/types.d.ts +1 -1
- package/dist/types/types.js +4 -0
- package/package.json +10 -9
- package/src/components/chat/Button.tsx +1 -2
- package/src/components/chat/Chat.tsx +7 -7
- package/src/components/chat/ChatContext.tsx +10 -10
- package/src/components/chat/CodeBlock.tsx +12 -36
- package/src/components/chat/Header.tsx +1 -2
- package/src/components/chat/Input.tsx +1 -1
- package/src/components/chat/Markdown.tsx +17 -11
- package/src/components/chat/Messages.tsx +2 -2
- package/src/components/chat/Popup.tsx +3 -4
- package/src/components/chat/Response.tsx +1 -2
- package/src/components/chat/Sidebar.tsx +4 -4
- package/src/components/chat/index.tsx +2 -2
- package/src/components/chat/props.ts +1 -1
- package/src/components/index.ts +0 -8
- package/src/css/animations.css +6 -0
- package/src/css/markdown.css +123 -0
- package/src/styles.css +1 -0
- package/src/types/types.ts +1 -1
- package/tsup.config.ts +1 -2
- package/dist/chunk-2KAF7NKC.mjs +0 -484
- package/dist/chunk-2KAF7NKC.mjs.map +0 -1
- package/dist/chunk-5KEDV5VC.mjs +0 -27
- package/dist/chunk-5KEDV5VC.mjs.map +0 -1
- package/dist/chunk-6H3Y2XEI.mjs.map +0 -1
- package/dist/chunk-6LAZQHEB.mjs +0 -129
- package/dist/chunk-6LAZQHEB.mjs.map +0 -1
- package/dist/chunk-C34L4AWW.mjs +0 -39
- package/dist/chunk-C34L4AWW.mjs.map +0 -1
- package/dist/chunk-CF3BK4OX.mjs +0 -53
- package/dist/chunk-CF3BK4OX.mjs.map +0 -1
- package/dist/chunk-CNQX2VY3.mjs +0 -66
- package/dist/chunk-CNQX2VY3.mjs.map +0 -1
- package/dist/chunk-DN3OI5WF.mjs.map +0 -1
- package/dist/chunk-DPUPEOGG.mjs.map +0 -1
- package/dist/chunk-FZRTAML3.mjs +0 -3
- package/dist/chunk-GCOPYGHH.mjs +0 -27
- package/dist/chunk-GCOPYGHH.mjs.map +0 -1
- package/dist/chunk-GPEJCUWA.mjs.map +0 -1
- package/dist/chunk-IJLMKBSZ.mjs +0 -25
- package/dist/chunk-IJLMKBSZ.mjs.map +0 -1
- package/dist/chunk-INCNMGJ7.mjs +0 -72
- package/dist/chunk-INCNMGJ7.mjs.map +0 -1
- package/dist/chunk-M3CZWJI3.mjs +0 -44
- package/dist/chunk-M3CZWJI3.mjs.map +0 -1
- package/dist/chunk-MC6KTH4X.mjs +0 -12
- package/dist/chunk-MC6KTH4X.mjs.map +0 -1
- package/dist/chunk-NXWVWC33.mjs.map +0 -1
- package/dist/chunk-OHWEJUCS.mjs +0 -18
- package/dist/chunk-OHWEJUCS.mjs.map +0 -1
- package/dist/chunk-OOBQC5H6.mjs +0 -34
- package/dist/chunk-OOBQC5H6.mjs.map +0 -1
- package/dist/chunk-Q6YO7LDK.mjs +0 -40
- package/dist/chunk-Q6YO7LDK.mjs.map +0 -1
- package/dist/chunk-QFASQEFJ.mjs.map +0 -1
- package/dist/chunk-RPTRCFSO.mjs +0 -42
- package/dist/chunk-RPTRCFSO.mjs.map +0 -1
- package/dist/chunk-SEH5PQVW.mjs +0 -52
- package/dist/chunk-SEH5PQVW.mjs.map +0 -1
- package/dist/chunk-SHOTWRKC.mjs +0 -18
- package/dist/chunk-SHOTWRKC.mjs.map +0 -1
- package/dist/chunk-SRBUGQTM.mjs +0 -109
- package/dist/chunk-SRBUGQTM.mjs.map +0 -1
- package/dist/chunk-TEYIQHMK.mjs +0 -12
- package/dist/chunk-TEYIQHMK.mjs.map +0 -1
- package/dist/chunk-UIRFLYXI.mjs.map +0 -1
- package/dist/chunk-VGX2W5ZB.mjs +0 -28
- package/dist/chunk-VGX2W5ZB.mjs.map +0 -1
- package/dist/chunk-X3Z2EVFV.mjs.map +0 -1
- package/dist/chunk-X4T6ZUVM.mjs.map +0 -1
- package/dist/chunk-XGUBRIUV.mjs +0 -72
- package/dist/chunk-XGUBRIUV.mjs.map +0 -1
- package/dist/chunk-Y2RUG4B3.mjs.map +0 -1
- package/dist/chunk-ZVAH2Z2W.mjs.map +0 -1
- package/dist/chunk-ZYC5YVDO.mjs +0 -21
- package/dist/chunk-ZYC5YVDO.mjs.map +0 -1
- package/dist/components/chat-components/chat-list.d.ts +0 -8
- package/dist/components/chat-components/chat-list.mjs +0 -13
- package/dist/components/chat-components/chat-message-actions.d.ts +0 -8
- package/dist/components/chat-components/chat-message-actions.mjs +0 -8
- package/dist/components/chat-components/chat-message.d.ts +0 -8
- package/dist/components/chat-components/chat-message.mjs +0 -11
- package/dist/components/chat-components/chat-panel.d.ts +0 -8
- package/dist/components/chat-components/chat-panel.mjs +0 -10
- package/dist/components/chat-components/chat-scroll-anchor.d.ts +0 -6
- package/dist/components/chat-components/chat-scroll-anchor.mjs +0 -5
- package/dist/components/chat-components/clear-history.d.ts +0 -9
- package/dist/components/chat-components/clear-history.mjs +0 -56
- package/dist/components/chat-components/clear-history.mjs.map +0 -1
- package/dist/components/chat-components/copilot-chat.d.ts +0 -12
- package/dist/components/chat-components/copilot-chat.mjs +0 -22
- package/dist/components/chat-components/copilot-chat.mjs.map +0 -1
- package/dist/components/chat-components/default-empty-screen.d.ts +0 -8
- package/dist/components/chat-components/default-empty-screen.mjs +0 -8
- package/dist/components/chat-components/default-empty-screen.mjs.map +0 -1
- package/dist/components/chat-components/external-link.d.ts +0 -6
- package/dist/components/chat-components/external-link.mjs +0 -4
- package/dist/components/chat-components/external-link.mjs.map +0 -1
- package/dist/components/chat-components/markdown.d.ts +0 -6
- package/dist/components/chat-components/markdown.mjs +0 -4
- package/dist/components/chat-components/markdown.mjs.map +0 -1
- package/dist/components/chat-components/prompt-form.d.ts +0 -9
- package/dist/components/chat-components/prompt-form.mjs +0 -9
- package/dist/components/chat-components/prompt-form.mjs.map +0 -1
- package/dist/components/chat-components/theme-toggle.d.ts +0 -3
- package/dist/components/chat-components/theme-toggle.mjs +0 -32
- package/dist/components/chat-components/theme-toggle.mjs.map +0 -1
- package/dist/components/chat-components/toaster.d.ts +0 -1
- package/dist/components/chat-components/toaster.mjs +0 -4
- package/dist/components/chat-components/toaster.mjs.map +0 -1
- package/dist/components/chat-components/ui/alert-dialog.d.ts +0 -20
- package/dist/components/chat-components/ui/alert-dialog.mjs +0 -6
- package/dist/components/chat-components/ui/alert-dialog.mjs.map +0 -1
- package/dist/components/chat-components/ui/badge.d.ts +0 -12
- package/dist/components/chat-components/ui/badge.mjs +0 -29
- package/dist/components/chat-components/ui/badge.mjs.map +0 -1
- package/dist/components/chat-components/ui/button.d.ts +0 -14
- package/dist/components/chat-components/ui/button.mjs +0 -5
- package/dist/components/chat-components/ui/button.mjs.map +0 -1
- package/dist/components/chat-components/ui/codeblock.d.ts +0 -14
- package/dist/components/chat-components/ui/codeblock.mjs +0 -8
- package/dist/components/chat-components/ui/codeblock.mjs.map +0 -1
- package/dist/components/chat-components/ui/dialog.d.ts +0 -18
- package/dist/components/chat-components/ui/dialog.mjs +0 -94
- package/dist/components/chat-components/ui/dialog.mjs.map +0 -1
- package/dist/components/chat-components/ui/dropdown-menu.d.ts +0 -24
- package/dist/components/chat-components/ui/dropdown-menu.mjs +0 -87
- package/dist/components/chat-components/ui/dropdown-menu.mjs.map +0 -1
- package/dist/components/chat-components/ui/icons.d.ts +0 -33
- package/dist/components/chat-components/ui/icons.mjs +0 -5
- package/dist/components/chat-components/ui/icons.mjs.map +0 -1
- package/dist/components/chat-components/ui/input.d.ts +0 -7
- package/dist/components/chat-components/ui/input.mjs +0 -26
- package/dist/components/chat-components/ui/input.mjs.map +0 -1
- package/dist/components/chat-components/ui/label.d.ts +0 -8
- package/dist/components/chat-components/ui/label.mjs +0 -19
- package/dist/components/chat-components/ui/label.mjs.map +0 -1
- package/dist/components/chat-components/ui/select.d.ts +0 -13
- package/dist/components/chat-components/ui/select.mjs +0 -101
- package/dist/components/chat-components/ui/select.mjs.map +0 -1
- package/dist/components/chat-components/ui/separator.d.ts +0 -6
- package/dist/components/chat-components/ui/separator.mjs +0 -5
- package/dist/components/chat-components/ui/separator.mjs.map +0 -1
- package/dist/components/chat-components/ui/sheet.d.ts +0 -19
- package/dist/components/chat-components/ui/sheet.mjs +0 -93
- package/dist/components/chat-components/ui/sheet.mjs.map +0 -1
- package/dist/components/chat-components/ui/switch.d.ts +0 -6
- package/dist/components/chat-components/ui/switch.mjs +0 -33
- package/dist/components/chat-components/ui/switch.mjs.map +0 -1
- package/dist/components/chat-components/ui/textarea.d.ts +0 -7
- package/dist/components/chat-components/ui/textarea.mjs +0 -25
- package/dist/components/chat-components/ui/textarea.mjs.map +0 -1
- package/dist/components/chat-components/ui/tooltip.d.ts +0 -9
- package/dist/components/chat-components/ui/tooltip.mjs +0 -5
- package/dist/components/chat-components/ui/tooltip.mjs.map +0 -1
- package/dist/components/sidebar/copilot-sidebar-ui-provider.d.ts +0 -8
- package/dist/components/sidebar/copilot-sidebar-ui-provider.mjs +0 -25
- package/dist/components/sidebar/copilot-sidebar-ui-provider.mjs.map +0 -1
- package/dist/components/sidebar/copilot-sidebar.d.ts +0 -6
- package/dist/components/sidebar/copilot-sidebar.mjs +0 -23
- package/dist/components/sidebar/copilot-sidebar.mjs.map +0 -1
- package/dist/components/sidebar/sidebar-context.d.ts +0 -9
- package/dist/components/sidebar/sidebar-context.mjs +0 -4
- package/dist/components/sidebar/sidebar-context.mjs.map +0 -1
- package/dist/hooks/use-at-bottom.d.ts +0 -3
- package/dist/hooks/use-at-bottom.mjs +0 -4
- package/dist/hooks/use-at-bottom.mjs.map +0 -1
- package/dist/hooks/use-enter-submit.d.ts +0 -8
- package/dist/hooks/use-enter-submit.mjs +0 -4
- package/dist/hooks/use-enter-submit.mjs.map +0 -1
- package/src/components/chat-components/chat-list.tsx +0 -28
- package/src/components/chat-components/chat-message-actions.tsx +0 -36
- package/src/components/chat-components/chat-message.tsx +0 -70
- package/src/components/chat-components/chat-panel.tsx +0 -64
- package/src/components/chat-components/chat-scroll-anchor.tsx +0 -29
- package/src/components/chat-components/clear-history.tsx +0 -72
- package/src/components/chat-components/copilot-chat.tsx +0 -57
- package/src/components/chat-components/default-empty-screen.tsx +0 -57
- package/src/components/chat-components/external-link.tsx +0 -17
- package/src/components/chat-components/markdown.tsx +0 -8
- package/src/components/chat-components/prompt-form.tsx +0 -85
- package/src/components/chat-components/theme-toggle.tsx +0 -31
- package/src/components/chat-components/toaster.tsx +0 -3
- package/src/components/chat-components/ui/alert-dialog.tsx +0 -126
- package/src/components/chat-components/ui/badge.tsx +0 -33
- package/src/components/chat-components/ui/button.tsx +0 -49
- package/src/components/chat-components/ui/codeblock.tsx +0 -137
- package/src/components/chat-components/ui/dialog.tsx +0 -106
- package/src/components/chat-components/ui/dropdown-menu.tsx +0 -117
- package/src/components/chat-components/ui/icons.tsx +0 -484
- package/src/components/chat-components/ui/input.tsx +0 -24
- package/src/components/chat-components/ui/label.tsx +0 -21
- package/src/components/chat-components/ui/select.tsx +0 -119
- package/src/components/chat-components/ui/separator.tsx +0 -26
- package/src/components/chat-components/ui/sheet.tsx +0 -106
- package/src/components/chat-components/ui/switch.tsx +0 -29
- package/src/components/chat-components/ui/textarea.tsx +0 -23
- package/src/components/chat-components/ui/tooltip.tsx +0 -30
- package/src/components/sidebar/copilot-sidebar-ui-provider.tsx +0 -73
- package/src/components/sidebar/copilot-sidebar.tsx +0 -38
- package/src/components/sidebar/sidebar-context.tsx +0 -11
- package/src/hooks/use-at-bottom.tsx +0 -20
- package/src/hooks/use-enter-submit.tsx +0 -17
- /package/dist/{chunk-FZRTAML3.mjs.map → chunk-JD7BAH7U.mjs.map} +0 -0
- /package/dist/components/{chat-components/chat-list.mjs.map → chat/props.js.map} +0 -0
- /package/dist/{components/chat-components/chat-message-actions.mjs.map → context/index.js.map} +0 -0
- /package/dist/{components/chat-components/chat-message.mjs.map → hooks/index.js.map} +0 -0
- /package/dist/{components/chat-components/chat-panel.mjs.map → types/index.js.map} +0 -0
- /package/dist/{components/chat-components/chat-scroll-anchor.mjs.map → types/types.js.map} +0 -0
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export { CopilotSidebarUIProvider } from '../../chunk-XGUBRIUV.mjs';
|
|
2
|
-
import '../../chunk-C34L4AWW.mjs';
|
|
3
|
-
import '../../chunk-MC6KTH4X.mjs';
|
|
4
|
-
import '../../chunk-RPTRCFSO.mjs';
|
|
5
|
-
import '../../chunk-SEH5PQVW.mjs';
|
|
6
|
-
import '../../chunk-5KEDV5VC.mjs';
|
|
7
|
-
import '../../chunk-SHOTWRKC.mjs';
|
|
8
|
-
import '../../chunk-GCOPYGHH.mjs';
|
|
9
|
-
import '../../chunk-CNQX2VY3.mjs';
|
|
10
|
-
import '../../chunk-6LAZQHEB.mjs';
|
|
11
|
-
import '../../chunk-TEYIQHMK.mjs';
|
|
12
|
-
import '../../chunk-OOBQC5H6.mjs';
|
|
13
|
-
import '../../chunk-CF3BK4OX.mjs';
|
|
14
|
-
import '../../chunk-INCNMGJ7.mjs';
|
|
15
|
-
import '../../chunk-VGX2W5ZB.mjs';
|
|
16
|
-
import '../../chunk-M3CZWJI3.mjs';
|
|
17
|
-
import '../../chunk-2KAF7NKC.mjs';
|
|
18
|
-
import '../../chunk-IJLMKBSZ.mjs';
|
|
19
|
-
import '../../chunk-Q6YO7LDK.mjs';
|
|
20
|
-
import '../../chunk-ZYC5YVDO.mjs';
|
|
21
|
-
import '../../chunk-POVINPXX.mjs';
|
|
22
|
-
import '../../chunk-OHWEJUCS.mjs';
|
|
23
|
-
import '../../chunk-MRXNTQOX.mjs';
|
|
24
|
-
//# sourceMappingURL=out.js.map
|
|
25
|
-
//# sourceMappingURL=copilot-sidebar-ui-provider.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export { CopilotSidebar } from '../../chunk-C34L4AWW.mjs';
|
|
2
|
-
import '../../chunk-RPTRCFSO.mjs';
|
|
3
|
-
import '../../chunk-SEH5PQVW.mjs';
|
|
4
|
-
import '../../chunk-5KEDV5VC.mjs';
|
|
5
|
-
import '../../chunk-SHOTWRKC.mjs';
|
|
6
|
-
import '../../chunk-GCOPYGHH.mjs';
|
|
7
|
-
import '../../chunk-CNQX2VY3.mjs';
|
|
8
|
-
import '../../chunk-6LAZQHEB.mjs';
|
|
9
|
-
import '../../chunk-TEYIQHMK.mjs';
|
|
10
|
-
import '../../chunk-OOBQC5H6.mjs';
|
|
11
|
-
import '../../chunk-CF3BK4OX.mjs';
|
|
12
|
-
import '../../chunk-INCNMGJ7.mjs';
|
|
13
|
-
import '../../chunk-VGX2W5ZB.mjs';
|
|
14
|
-
import '../../chunk-M3CZWJI3.mjs';
|
|
15
|
-
import '../../chunk-2KAF7NKC.mjs';
|
|
16
|
-
import '../../chunk-IJLMKBSZ.mjs';
|
|
17
|
-
import '../../chunk-Q6YO7LDK.mjs';
|
|
18
|
-
import '../../chunk-ZYC5YVDO.mjs';
|
|
19
|
-
import '../../chunk-POVINPXX.mjs';
|
|
20
|
-
import '../../chunk-OHWEJUCS.mjs';
|
|
21
|
-
import '../../chunk-MRXNTQOX.mjs';
|
|
22
|
-
//# sourceMappingURL=out.js.map
|
|
23
|
-
//# sourceMappingURL=copilot-sidebar.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
interface CopilotSidebarContextType {
|
|
4
|
-
isSidebarOpen: boolean;
|
|
5
|
-
toggleSidebar: () => void;
|
|
6
|
-
}
|
|
7
|
-
declare const CopilotSidebarContext: React.Context<CopilotSidebarContextType>;
|
|
8
|
-
|
|
9
|
-
export { CopilotSidebarContext, CopilotSidebarContextType };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { type Message } from "@copilotkit/react-core";
|
|
2
|
-
|
|
3
|
-
import { Separator } from "./ui/separator";
|
|
4
|
-
import { ChatMessage } from "./chat-message";
|
|
5
|
-
|
|
6
|
-
export interface ChatList {
|
|
7
|
-
messages: Message[];
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function ChatList({ messages }: ChatList) {
|
|
11
|
-
// we don't want to display system messages
|
|
12
|
-
const displayedMessages = messages.filter((message) => message.role !== "system");
|
|
13
|
-
|
|
14
|
-
if (!displayedMessages.length) {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<div className="relative mx-auto max-w-2xl px-0">
|
|
20
|
-
{displayedMessages.map((message, index) => (
|
|
21
|
-
<div key={index}>
|
|
22
|
-
<ChatMessage message={message} />
|
|
23
|
-
{index < displayedMessages.length - 1 && <Separator className="my-4 md:my-4" />}
|
|
24
|
-
</div>
|
|
25
|
-
))}
|
|
26
|
-
</div>
|
|
27
|
-
);
|
|
28
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { type Message } from "@copilotkit/react-core";
|
|
4
|
-
|
|
5
|
-
import { Button } from "./ui/button";
|
|
6
|
-
import { IconCheck, IconCopy } from "./ui/icons";
|
|
7
|
-
import { useCopyToClipboard } from "../../hooks/use-copy-to-clipboard";
|
|
8
|
-
import { cn } from "../../lib/utils";
|
|
9
|
-
|
|
10
|
-
interface ChatMessageActionsProps extends React.ComponentProps<"div"> {
|
|
11
|
-
message: Message;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function ChatMessageActions({ message, className, ...props }: ChatMessageActionsProps) {
|
|
15
|
-
const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2000 });
|
|
16
|
-
|
|
17
|
-
const onCopy = () => {
|
|
18
|
-
if (isCopied) return;
|
|
19
|
-
copyToClipboard(message.content);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<div
|
|
24
|
-
className={cn(
|
|
25
|
-
"flex items-center justify-end transition-opacity group-hover:opacity-100 md:absolute md:-right-10 md:-top-2 md:opacity-0",
|
|
26
|
-
className,
|
|
27
|
-
)}
|
|
28
|
-
{...props}
|
|
29
|
-
>
|
|
30
|
-
<Button variant="ghost" size="icon" onClick={onCopy}>
|
|
31
|
-
{isCopied ? <IconCheck /> : <IconCopy />}
|
|
32
|
-
<span className="sr-only">Copy message</span>
|
|
33
|
-
</Button>
|
|
34
|
-
</div>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { Message } from "@copilotkit/react-core";
|
|
2
|
-
import remarkGfm from "remark-gfm";
|
|
3
|
-
import remarkMath from "remark-math";
|
|
4
|
-
|
|
5
|
-
import { cn } from "../../lib/utils";
|
|
6
|
-
import { CodeBlock } from "./ui/codeblock";
|
|
7
|
-
import { MemoizedReactMarkdown } from "./markdown";
|
|
8
|
-
import { IconOpenAI, IconUser } from "./ui/icons";
|
|
9
|
-
import { ChatMessageActions } from "./chat-message-actions";
|
|
10
|
-
|
|
11
|
-
export interface ChatMessageProps {
|
|
12
|
-
message: Message;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function ChatMessage({ message, ...props }: ChatMessageProps) {
|
|
16
|
-
return (
|
|
17
|
-
<div className={cn("group relative mb-4 flex items-start")} {...props}>
|
|
18
|
-
<div
|
|
19
|
-
className={cn(
|
|
20
|
-
"flex h-8 w-8 shrink-0 select-none items-center justify-center rounded-md border shadow",
|
|
21
|
-
message.role === "user" ? "bg-background" : "bg-primary text-primary-foreground",
|
|
22
|
-
)}
|
|
23
|
-
>
|
|
24
|
-
{message.role === "user" ? <IconUser /> : <IconOpenAI />}
|
|
25
|
-
</div>
|
|
26
|
-
<div className="ml-4 flex-1 space-y-2 overflow-hidden px-1">
|
|
27
|
-
<MemoizedReactMarkdown
|
|
28
|
-
className="prose break-words dark:prose-invert prose-p:leading-relaxed prose-pre:p-0 text-sm"
|
|
29
|
-
remarkPlugins={[remarkGfm, remarkMath]}
|
|
30
|
-
components={{
|
|
31
|
-
p({ children }) {
|
|
32
|
-
return <p className="mb-2 last:mb-0">{children}</p>;
|
|
33
|
-
},
|
|
34
|
-
code({ children, className, inline, ...props }) {
|
|
35
|
-
if (children.length) {
|
|
36
|
-
if (children[0] == "▍") {
|
|
37
|
-
return <span className="mt-1 animate-pulse cursor-default">▍</span>;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
children[0] = (children[0] as string).replace("`▍`", "▍");
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const match = /language-(\w+)/.exec(className || "");
|
|
44
|
-
|
|
45
|
-
if (inline) {
|
|
46
|
-
return (
|
|
47
|
-
<code className={className} {...props}>
|
|
48
|
-
{children}
|
|
49
|
-
</code>
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return (
|
|
54
|
-
<CodeBlock
|
|
55
|
-
key={Math.random()}
|
|
56
|
-
language={(match && match[1]) || ""}
|
|
57
|
-
value={String(children).replace(/\n$/, "")}
|
|
58
|
-
{...props}
|
|
59
|
-
/>
|
|
60
|
-
);
|
|
61
|
-
},
|
|
62
|
-
}}
|
|
63
|
-
>
|
|
64
|
-
{message.content}
|
|
65
|
-
</MemoizedReactMarkdown>
|
|
66
|
-
<ChatMessageActions message={message} />
|
|
67
|
-
</div>
|
|
68
|
-
</div>
|
|
69
|
-
);
|
|
70
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { type UseChatHelpers } from "@copilotkit/react-core";
|
|
2
|
-
|
|
3
|
-
import { Button } from "./ui/button";
|
|
4
|
-
import { PromptForm } from "./prompt-form";
|
|
5
|
-
import { IconRefresh, IconStop } from "./ui/icons";
|
|
6
|
-
import { nanoid } from "nanoid";
|
|
7
|
-
|
|
8
|
-
export interface ChatPanelProps
|
|
9
|
-
extends Pick<
|
|
10
|
-
UseChatHelpers,
|
|
11
|
-
"append" | "isLoading" | "reload" | "messages" | "stop" | "input" | "setInput"
|
|
12
|
-
> {
|
|
13
|
-
id?: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function ChatPanel({
|
|
17
|
-
id,
|
|
18
|
-
isLoading,
|
|
19
|
-
stop,
|
|
20
|
-
append,
|
|
21
|
-
reload,
|
|
22
|
-
input,
|
|
23
|
-
setInput,
|
|
24
|
-
messages,
|
|
25
|
-
}: ChatPanelProps) {
|
|
26
|
-
return (
|
|
27
|
-
<div
|
|
28
|
-
className="inset-x-0 bottom-0 bg-gradient-to-b from-muted/10 from-10% to-muted/30 to-50% mt-4 mb-8"
|
|
29
|
-
style={{ width: "100%", overflow: "hidden", boxSizing: "border-box" }}
|
|
30
|
-
>
|
|
31
|
-
<div className="mx-auto sm:max-w-2xl sm:px-4">
|
|
32
|
-
<div className="flex h-10 items-center justify-center mb-4">
|
|
33
|
-
{isLoading ? (
|
|
34
|
-
<Button variant="outline" onClick={() => stop()} className="bg-background">
|
|
35
|
-
<IconStop className="mr-2" />
|
|
36
|
-
Stop generating
|
|
37
|
-
</Button>
|
|
38
|
-
) : (
|
|
39
|
-
messages?.length > 0 && (
|
|
40
|
-
<Button variant="outline" onClick={() => reload()} className="bg-background">
|
|
41
|
-
<IconRefresh className="mr-2" />
|
|
42
|
-
Regenerate response
|
|
43
|
-
</Button>
|
|
44
|
-
)
|
|
45
|
-
)}
|
|
46
|
-
</div>
|
|
47
|
-
<div className="space-y-4 border-2 bg-background px-4 py-2 shadow-lg sm:rounded-xl md:py-4">
|
|
48
|
-
<PromptForm
|
|
49
|
-
onSubmit={async (value) => {
|
|
50
|
-
await append({
|
|
51
|
-
id: id || nanoid(),
|
|
52
|
-
content: value,
|
|
53
|
-
role: "user",
|
|
54
|
-
});
|
|
55
|
-
}}
|
|
56
|
-
input={input}
|
|
57
|
-
setInput={setInput}
|
|
58
|
-
isLoading={isLoading}
|
|
59
|
-
/>
|
|
60
|
-
</div>
|
|
61
|
-
</div>
|
|
62
|
-
</div>
|
|
63
|
-
);
|
|
64
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { useInView } from "react-intersection-observer";
|
|
5
|
-
|
|
6
|
-
import { useAtBottom } from "../../hooks/use-at-bottom";
|
|
7
|
-
|
|
8
|
-
interface ChatScrollAnchorProps {
|
|
9
|
-
trackVisibility?: boolean;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function ChatScrollAnchor({ trackVisibility }: ChatScrollAnchorProps) {
|
|
13
|
-
const isAtBottom = useAtBottom();
|
|
14
|
-
const { ref, entry, inView } = useInView({
|
|
15
|
-
trackVisibility,
|
|
16
|
-
delay: 100,
|
|
17
|
-
rootMargin: "0px 0px -150px 0px",
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
React.useEffect(() => {
|
|
21
|
-
if (isAtBottom && trackVisibility && !inView) {
|
|
22
|
-
entry?.target.scrollIntoView({
|
|
23
|
-
block: "start",
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
}, [inView, entry, isAtBottom, trackVisibility]);
|
|
27
|
-
|
|
28
|
-
return <div ref={ref} className="h-px w-full" />;
|
|
29
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { useRouter } from "next/navigation";
|
|
5
|
-
import { toast } from "react-hot-toast";
|
|
6
|
-
|
|
7
|
-
import { ServerActionResult } from "../../types/types";
|
|
8
|
-
import { Button } from "./ui/button";
|
|
9
|
-
import {
|
|
10
|
-
AlertDialog,
|
|
11
|
-
AlertDialogAction,
|
|
12
|
-
AlertDialogCancel,
|
|
13
|
-
AlertDialogContent,
|
|
14
|
-
AlertDialogDescription,
|
|
15
|
-
AlertDialogFooter,
|
|
16
|
-
AlertDialogHeader,
|
|
17
|
-
AlertDialogTitle,
|
|
18
|
-
AlertDialogTrigger,
|
|
19
|
-
} from "./ui/alert-dialog";
|
|
20
|
-
import { IconSpinner } from "./ui/icons";
|
|
21
|
-
|
|
22
|
-
interface ClearHistoryProps {
|
|
23
|
-
clearChats: () => ServerActionResult<void>;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function ClearHistory({ clearChats }: ClearHistoryProps) {
|
|
27
|
-
const [open, setOpen] = React.useState(false);
|
|
28
|
-
const [isPending, startTransition] = React.useTransition();
|
|
29
|
-
const router = useRouter();
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<AlertDialog open={open} onOpenChange={setOpen}>
|
|
33
|
-
<AlertDialogTrigger asChild>
|
|
34
|
-
<Button variant="ghost" disabled={isPending}>
|
|
35
|
-
{isPending && <IconSpinner className="mr-2" />}
|
|
36
|
-
Clear history
|
|
37
|
-
</Button>
|
|
38
|
-
</AlertDialogTrigger>
|
|
39
|
-
<AlertDialogContent>
|
|
40
|
-
<AlertDialogHeader>
|
|
41
|
-
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
|
|
42
|
-
<AlertDialogDescription>
|
|
43
|
-
This will permanently delete your chat history and remove your data from our servers.
|
|
44
|
-
</AlertDialogDescription>
|
|
45
|
-
</AlertDialogHeader>
|
|
46
|
-
<AlertDialogFooter>
|
|
47
|
-
<AlertDialogCancel disabled={isPending}>Cancel</AlertDialogCancel>
|
|
48
|
-
<AlertDialogAction
|
|
49
|
-
disabled={isPending}
|
|
50
|
-
onClick={(event: any) => {
|
|
51
|
-
event.preventDefault();
|
|
52
|
-
startTransition(async () => {
|
|
53
|
-
const result = await clearChats();
|
|
54
|
-
|
|
55
|
-
if (result && "error" in result) {
|
|
56
|
-
toast.error(result.error);
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
setOpen(false);
|
|
61
|
-
router.push("/");
|
|
62
|
-
});
|
|
63
|
-
}}
|
|
64
|
-
>
|
|
65
|
-
{isPending && <IconSpinner className="mr-2 animate-spin" />}
|
|
66
|
-
Delete
|
|
67
|
-
</AlertDialogAction>
|
|
68
|
-
</AlertDialogFooter>
|
|
69
|
-
</AlertDialogContent>
|
|
70
|
-
</AlertDialog>
|
|
71
|
-
);
|
|
72
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import React from "react";
|
|
4
|
-
|
|
5
|
-
import { ChatList } from "./chat-list";
|
|
6
|
-
import { ChatPanel } from "./chat-panel";
|
|
7
|
-
import { DefaultEmptyScreen, EmptyScreenProps } from "./default-empty-screen";
|
|
8
|
-
import { ChatScrollAnchor } from "./chat-scroll-anchor";
|
|
9
|
-
import { UseCopilotChatOptions } from "@copilotkit/react-core";
|
|
10
|
-
import { useCopilotChat } from "@copilotkit/react-core";
|
|
11
|
-
|
|
12
|
-
interface ChatComponentInjectionsProps {
|
|
13
|
-
EmptyScreen?: React.FC<EmptyScreenProps>;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
interface CopilotChatProps extends UseCopilotChatOptions, ChatComponentInjectionsProps {}
|
|
17
|
-
|
|
18
|
-
export function CopilotChat({
|
|
19
|
-
id,
|
|
20
|
-
initialMessages,
|
|
21
|
-
makeSystemMessage,
|
|
22
|
-
EmptyScreen = DefaultEmptyScreen,
|
|
23
|
-
}: CopilotChatProps) {
|
|
24
|
-
const { visibleMessages, append, reload, stop, isLoading, input, setInput } = useCopilotChat({
|
|
25
|
-
id,
|
|
26
|
-
initialMessages,
|
|
27
|
-
makeSystemMessage,
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<div className="w-full h-full flex flex-col overflow-hidden box-border items-start">
|
|
32
|
-
<div className="pt-5 px-5 overflow-y-auto overflow-x-hidden w-full flex-grow">
|
|
33
|
-
{visibleMessages.length ? (
|
|
34
|
-
<div className="pl-0 pr-6">
|
|
35
|
-
<ChatList messages={visibleMessages} />
|
|
36
|
-
<ChatScrollAnchor trackVisibility={isLoading} />
|
|
37
|
-
</div>
|
|
38
|
-
) : (
|
|
39
|
-
<EmptyScreen setInput={setInput} />
|
|
40
|
-
)}
|
|
41
|
-
</div>
|
|
42
|
-
|
|
43
|
-
<div className="flex-shrink-0 w-full">
|
|
44
|
-
<ChatPanel
|
|
45
|
-
id={id}
|
|
46
|
-
isLoading={isLoading}
|
|
47
|
-
stop={stop}
|
|
48
|
-
append={append}
|
|
49
|
-
reload={reload}
|
|
50
|
-
messages={visibleMessages}
|
|
51
|
-
input={input}
|
|
52
|
-
setInput={setInput}
|
|
53
|
-
/>
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
);
|
|
57
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import React from "react";
|
|
3
|
-
|
|
4
|
-
import { Button } from "./ui/button";
|
|
5
|
-
import { ExternalLink } from "./external-link";
|
|
6
|
-
import { IconArrowRight } from "./ui/icons";
|
|
7
|
-
|
|
8
|
-
const exampleMessages = [
|
|
9
|
-
{
|
|
10
|
-
heading: "Explain technical concepts",
|
|
11
|
-
message: `What is a "serverless function"?`,
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
heading: "Summarize an article",
|
|
15
|
-
message: "Summarize the following article for a 2nd grader: \n",
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
heading: "Draft an email",
|
|
19
|
-
message: `Draft an email to my boss about the following: \n`,
|
|
20
|
-
},
|
|
21
|
-
];
|
|
22
|
-
|
|
23
|
-
export interface EmptyScreenProps {
|
|
24
|
-
setInput: React.Dispatch<React.SetStateAction<string>>;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const DefaultEmptyScreen: React.FC<EmptyScreenProps> = (props) => {
|
|
28
|
-
return (
|
|
29
|
-
<div className="mx-auto max-w-2xl px-4">
|
|
30
|
-
<div className="rounded-lg border bg-background p-8">
|
|
31
|
-
<h1 className="mb-2 text-lg font-semibold">Welcome to CopilotKit! 👋</h1>
|
|
32
|
-
<p className="mb-2 leading-normal text-muted-foreground">
|
|
33
|
-
This is a Copilot built with{" "}
|
|
34
|
-
<ExternalLink href="https://recursively.ai">recursively.ai's</ExternalLink>{" "}
|
|
35
|
-
<ExternalLink href="https://github.com/RecursivelyAI/CopilotKit">CopilotKit</ExternalLink>{" "}
|
|
36
|
-
.
|
|
37
|
-
</p>
|
|
38
|
-
<p className="leading-normal text-muted-foreground">
|
|
39
|
-
You can start a conversation here or try the following examples:
|
|
40
|
-
</p>
|
|
41
|
-
<div className="mt-4 flex flex-col items-start space-y-2">
|
|
42
|
-
{exampleMessages.map((message, index) => (
|
|
43
|
-
<Button
|
|
44
|
-
key={index}
|
|
45
|
-
variant="link"
|
|
46
|
-
className="h-auto p-0 text-base"
|
|
47
|
-
onClick={() => props.setInput(message.message)}
|
|
48
|
-
>
|
|
49
|
-
<IconArrowRight className="mr-2 text-muted-foreground" />
|
|
50
|
-
{message.heading}
|
|
51
|
-
</Button>
|
|
52
|
-
))}
|
|
53
|
-
</div>
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
);
|
|
57
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export function ExternalLink({ href, children }: { href: string; children: React.ReactNode }) {
|
|
2
|
-
return (
|
|
3
|
-
<a
|
|
4
|
-
href={href}
|
|
5
|
-
target="_blank"
|
|
6
|
-
className="inline-flex flex-1 justify-center gap-1 leading-4 hover:underline"
|
|
7
|
-
>
|
|
8
|
-
<span>{children}</span>
|
|
9
|
-
<svg aria-hidden="true" height="7" viewBox="0 0 6 6" width="7" className="opacity-70">
|
|
10
|
-
<path
|
|
11
|
-
d="M1.25215 5.54731L0.622742 4.9179L3.78169 1.75597H1.3834L1.38936 0.890915H5.27615V4.78069H4.40513L4.41109 2.38538L1.25215 5.54731Z"
|
|
12
|
-
fill="currentColor"
|
|
13
|
-
></path>
|
|
14
|
-
</svg>
|
|
15
|
-
</a>
|
|
16
|
-
);
|
|
17
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { FC, memo } from "react";
|
|
2
|
-
import ReactMarkdown, { Options } from "react-markdown";
|
|
3
|
-
|
|
4
|
-
export const MemoizedReactMarkdown: FC<Options> = memo(
|
|
5
|
-
ReactMarkdown,
|
|
6
|
-
(prevProps, nextProps) =>
|
|
7
|
-
prevProps.children === nextProps.children && prevProps.className === nextProps.className,
|
|
8
|
-
);
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import TextareaAutosize from "react-textarea-autosize";
|
|
3
|
-
import { UseChatHelpers } from "@copilotkit/react-core";
|
|
4
|
-
|
|
5
|
-
import { useEnterSubmit } from "../../hooks/use-enter-submit";
|
|
6
|
-
import { cn } from "../../lib/utils";
|
|
7
|
-
import { Button, buttonVariants } from "./ui/button";
|
|
8
|
-
import { Tooltip, TooltipContent, TooltipTrigger } from "./ui/tooltip";
|
|
9
|
-
import { IconArrowElbow, IconPlus } from "./ui/icons";
|
|
10
|
-
// import Link from "next/link";
|
|
11
|
-
|
|
12
|
-
export interface PromptProps extends Pick<UseChatHelpers, "input" | "setInput"> {
|
|
13
|
-
onSubmit: (value: string) => Promise<void>;
|
|
14
|
-
isLoading: boolean;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function PromptForm({ onSubmit, input, setInput, isLoading }: PromptProps) {
|
|
18
|
-
const { formRef, onKeyDown } = useEnterSubmit();
|
|
19
|
-
const inputRef = React.useRef<HTMLTextAreaElement>(null);
|
|
20
|
-
|
|
21
|
-
React.useEffect(() => {
|
|
22
|
-
if (inputRef.current) {
|
|
23
|
-
inputRef.current.focus();
|
|
24
|
-
}
|
|
25
|
-
}, []);
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<form
|
|
29
|
-
onSubmit={async (e) => {
|
|
30
|
-
e.preventDefault();
|
|
31
|
-
if (!input?.trim()) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
setInput("");
|
|
35
|
-
await onSubmit(input);
|
|
36
|
-
}}
|
|
37
|
-
ref={formRef}
|
|
38
|
-
>
|
|
39
|
-
<div className="relative flex max-h-60 w-full grow flex-col overflow-hidden bg-background px-8 sm:rounded-md border sm:px-12">
|
|
40
|
-
<Tooltip>
|
|
41
|
-
<TooltipTrigger asChild>
|
|
42
|
-
{/* <Link
|
|
43
|
-
href="/"
|
|
44
|
-
className={cn(
|
|
45
|
-
buttonVariants({ size: "sm", variant: "outline" }),
|
|
46
|
-
"absolute left-0 top-4 h-8 w-8 rounded-full bg-background p-0 sm:left-4"
|
|
47
|
-
)}
|
|
48
|
-
>
|
|
49
|
-
<IconPlus />
|
|
50
|
-
<span className="sr-only">New Chat</span>
|
|
51
|
-
</Link> */}
|
|
52
|
-
</TooltipTrigger>
|
|
53
|
-
<TooltipContent>New Chat</TooltipContent>
|
|
54
|
-
</Tooltip>
|
|
55
|
-
<TextareaAutosize
|
|
56
|
-
ref={inputRef}
|
|
57
|
-
tabIndex={0}
|
|
58
|
-
onKeyDown={onKeyDown}
|
|
59
|
-
rows={1}
|
|
60
|
-
value={input}
|
|
61
|
-
onChange={(e) => setInput(e.target.value)}
|
|
62
|
-
placeholder="Send a message."
|
|
63
|
-
spellCheck={false}
|
|
64
|
-
className="min-h-[60px] w-full resize-none bg-transparent px-4 py-[1.3rem] focus-within:outline-none sm:text-sm"
|
|
65
|
-
/>
|
|
66
|
-
<div className="absolute right-0 top-4 sm:right-4">
|
|
67
|
-
<Tooltip>
|
|
68
|
-
<TooltipTrigger asChild>
|
|
69
|
-
<Button
|
|
70
|
-
type="submit"
|
|
71
|
-
size="icon"
|
|
72
|
-
disabled={isLoading || input === ""}
|
|
73
|
-
className=" bg-slate-300"
|
|
74
|
-
>
|
|
75
|
-
<IconArrowElbow />
|
|
76
|
-
<span className="sr-only">Send message</span>
|
|
77
|
-
</Button>
|
|
78
|
-
</TooltipTrigger>
|
|
79
|
-
<TooltipContent>Send message</TooltipContent>
|
|
80
|
-
</Tooltip>
|
|
81
|
-
</div>
|
|
82
|
-
</div>
|
|
83
|
-
</form>
|
|
84
|
-
);
|
|
85
|
-
}
|