@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/Messages.tsx"],"names":[],"mappings":";;;;;;;;AAAA,OAAO,SAAS,WAAW,eAAe;AAG1C,SAAS,cAAc;AA2BnB,SAMQ,KANR;AAvBG,IAAM,WAAW,CAAC,EAAE,UAAU,WAAW,MAAqB;AACnE,QAAM,UAAU,eAAe;AAC/B,QAAM,kBAAkB;AAAA,IACtB,MAAM,oBAAoB,QAAQ,OAAO,OAAO;AAAA,IAChD,CAAC,QAAQ,OAAO,OAAO;AAAA,EACzB;AACA,aAAW,CAAC,GAAG,iBAAiB,GAAG,QAAQ;AAE3C,QAAM,iBAAiB,MAAM,OAAuB,IAAI;AAExD,QAAM,iBAAiB,MAAM;AAC3B,QAAI,eAAe,SAAS;AAC1B,qBAAe,QAAQ,eAAe;AAAA,QACpC,UAAU;AAAA,MACZ,CAAC;AAAA,IACH;AAAA,EACF;AAEA,YAAU,MAAM;AACd,mBAAe;AAAA,EACjB,GAAG,CAAC,QAAQ,CAAC;AAEb,SACE,qBAAC,SAAI,WAAU,sBACZ;AAAA,aAAS,IAAI,CAAC,SAAS,UAAU;AAChC,YAAM,mBAAmB,UAAU,SAAS,SAAS;AAErD,UAAI,QAAQ,SAAS,QAAQ;AAC3B,eACE,oBAAC,SAAgB,WAAU,2CACxB,kBAAQ,WADD,KAEV;AAAA,MAEJ,WAAW,QAAQ,QAAQ,aAAa;AACtC,YAAI,oBAAoB,cAAc,CAAC,QAAQ,SAAS;AACtD,iBACE,oBAAC,SAAgB,WAAW,gDACzB,kBAAQ,MAAM,eADP,KAEV;AAAA,QAEJ,YACG,CAAC,cAAc,SAAS,SAAS,SAAS,MAC3C,CAAC,QAAQ,WACT,QAAQ,eACR;AACA,iBACE,oBAAC,SAAgB,WAAW,gDACzB,kBAAQ,OAAO,QADR,KAEV;AAAA,QAEJ,OAWK;AACH,iBACE,oBAAC,SAAgB,WAAW,gDAC1B,8BAAC,YAAS,SAAS,QAAQ,SAAS,KAD5B,KAEV;AAAA,QAEJ;AAAA,MACF;AAAA,IAgBF,CAAC;AAAA,IACD,oBAAC,SAAI,KAAK,gBAAgB;AAAA,KAC5B;AAEJ;AAEA,SAAS,oBAAoB,SAAwC;AACnE,MAAI,eAAyB,CAAC;AAC9B,MAAI,SAAS;AACX,QAAI,MAAM,QAAQ,OAAO,GAAG;AAC1B,mBAAa,KAAK,GAAG,OAAO;AAAA,IAC9B,OAAO;AACL,mBAAa,KAAK,OAAO;AAAA,IAC3B;AAAA,EACF;AAEA,SAAO,aAAa,IAAI,CAAC,aAAa;AAAA,IACpC,IAAI,OAAO;AAAA,IACX,MAAM;AAAA,IACN,SAAS;AAAA,EACX,EAAE;AACJ","sourcesContent":["import React, { useEffect, useMemo } from \"react\";\nimport { MessagesProps } from \"./props\";\nimport { useChatContext } from \"./ChatContext\";\nimport { nanoid } from \"nanoid\";\nimport { Message } from \"@copilotkit/shared\";\nimport { Markdown } from \"./Markdown\";\n\nexport const Messages = ({ messages, inProgress }: MessagesProps) => {\n const context = useChatContext();\n const initialMessages = useMemo(\n () => makeInitialMessages(context.labels.initial),\n [context.labels.initial],\n );\n messages = [...initialMessages, ...messages];\n\n const messagesEndRef = React.useRef<HTMLDivElement>(null);\n\n const scrollToBottom = () => {\n if (messagesEndRef.current) {\n messagesEndRef.current.scrollIntoView({\n behavior: \"auto\",\n });\n }\n };\n\n useEffect(() => {\n scrollToBottom();\n }, [messages]);\n\n return (\n <div className=\"copilotKitMessages\">\n {messages.map((message, index) => {\n const isCurrentMessage = index === messages.length - 1;\n\n if (message.role === \"user\") {\n return (\n <div key={index} className=\"copilotKitMessage copilotKitUserMessage\">\n {message.content}\n </div>\n );\n } else if (message.role == \"assistant\") {\n if (isCurrentMessage && inProgress && !message.content) {\n return (\n <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>\n {context.icons.spinnerIcon}\n </div>\n );\n } else if (\n (!inProgress || index != messages.length - 1) &&\n !message.content &&\n message.function_call\n ) {\n return (\n <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>\n {context.labels.done}\n </div>\n );\n }\n // TODO: Add back partial message\n // This shows up when the assistant is executing a function\n //\n // else if (message.status === \"partial\") {\n // return (\n // <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>\n // {context.labels.thinking} {context.icons.spinnerIcon}\n // </div>\n // );\n // }\n else {\n return (\n <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>\n <Markdown content={message.content} />\n </div>\n );\n }\n }\n // TODO: Add back function and error messages\n //\n // else if (message.role === \"function\" && message.status === \"success\") {\n // return (\n // <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>\n // {context.labels.done}\n // </div>\n // );\n // } else if (message.status === \"error\") {\n // return (\n // <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>\n // {context.labels.error}\n // </div>\n // );\n // }\n })}\n <div ref={messagesEndRef} />\n </div>\n );\n};\n\nfunction makeInitialMessages(initial?: string | string[]): Message[] {\n let initialArray: string[] = [];\n if (initial) {\n if (Array.isArray(initial)) {\n initialArray.push(...initial);\n } else {\n initialArray.push(initial);\n }\n }\n\n return initialArray.map((message) => ({\n id: nanoid(),\n role: \"assistant\",\n content: message,\n }));\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useChatContext } from './chunk-
|
|
1
|
+
import { useChatContext } from './chunk-OF66AL5Z.mjs';
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
|
|
4
4
|
var Button = ({ open, setOpen }) => {
|
|
@@ -18,4 +18,4 @@ var Button = ({ open, setOpen }) => {
|
|
|
18
18
|
|
|
19
19
|
export { Button };
|
|
20
20
|
//# sourceMappingURL=out.js.map
|
|
21
|
-
//# sourceMappingURL=chunk-
|
|
21
|
+
//# sourceMappingURL=chunk-5O2MCJZ2.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/Button.tsx"],"names":[],"mappings":";;;;;AASM,SAIE,KAJF;AANC,IAAM,SAAS,CAAC,EAAE,MAAM,QAAQ,MAAmB;AACxD,QAAM,UAAU,eAAe;AAG/B,SACE,oBAAC,SAAI,SAAS,MAAM,QAAQ,CAAC,IAAI,GAC/B;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,oBAAoB,OAAO,SAAS;AAAA,MAC/C,cAAY,OAAO,eAAe;AAAA,MAElC;AAAA,4BAAC,SAAI,WAAU,iDACZ,kBAAQ,MAAM,UACjB;AAAA,QACA,oBAAC,SAAI,WAAU,kDACZ,kBAAQ,MAAM,WACjB;AAAA;AAAA;AAAA,EACF,GACF;AAEJ","sourcesContent":["import { ButtonProps } from \"./props\";\nimport { useChatContext } from \"./ChatContext\";\n\nexport const Button = ({ open, setOpen }: ButtonProps) => {\n const context = useChatContext();\n // To ensure that the mouse handler fires even when the button is scaled down\n // we wrap the button in a div and attach the handler to the div\n return (\n <div onClick={() => setOpen(!open)}>\n <button\n className={`copilotKitButton ${open ? \"open\" : \"\"}`}\n aria-label={open ? \"Close Chat\" : \"Open Chat\"}\n >\n <div className=\"copilotKitButtonIcon copilotKitButtonIconOpen\">\n {context.icons.openIcon}\n </div>\n <div className=\"copilotKitButtonIcon copilotKitButtonIconClose\">\n {context.icons.closeIcon}\n </div>\n </button>\n </div>\n );\n};\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CopilotChat } from './chunk-NNVWLSYK.mjs';
|
|
2
2
|
import { __spreadProps, __spreadValues } from './chunk-MRXNTQOX.mjs';
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var CopilotSidebar = (props) => {
|
|
7
7
|
props = __spreadProps(__spreadValues({}, props), {
|
|
8
8
|
className: props.className ? props.className + " copilotKitSidebar" : "copilotKitSidebar"
|
|
9
9
|
});
|
|
@@ -17,10 +17,10 @@ var CopilotKitSidebar = (props) => {
|
|
|
17
17
|
};
|
|
18
18
|
return /* @__PURE__ */ jsxs("div", { className: `copilotKitSidebarContentWrapper ${expandedClassName}`, children: [
|
|
19
19
|
props.children,
|
|
20
|
-
/* @__PURE__ */ jsx(
|
|
20
|
+
/* @__PURE__ */ jsx(CopilotChat, __spreadValues(__spreadValues({}, props), { onSetOpen }))
|
|
21
21
|
] });
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
export {
|
|
24
|
+
export { CopilotSidebar };
|
|
25
25
|
//# sourceMappingURL=out.js.map
|
|
26
|
-
//# sourceMappingURL=chunk-
|
|
26
|
+
//# sourceMappingURL=chunk-CKJXXQ2W.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/Sidebar.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,SAAgB,gBAAgB;AAsB5B,SAEE,KAFF;AAfG,IAAM,iBAAiB,CAAC,UAA+B;AAC5D,UAAQ,iCACH,QADG;AAAA,IAEN,WAAW,MAAM,YAAY,MAAM,YAAY,uBAAuB;AAAA,EACxE;AACA,QAAM,CAAC,mBAAmB,oBAAoB,IAAI;AAAA,IAChD,MAAM,cAAc,oBAAoB;AAAA,EAC1C;AAEA,QAAM,YAAY,CAAC,SAAkB;AAhBvC;AAiBI,gBAAM,cAAN,+BAAkB;AAClB,yBAAqB,OAAO,oBAAoB,EAAE;AAAA,EACpD;AAEA,SACE,qBAAC,SAAI,WAAW,mCAAmC,qBAChD;AAAA,UAAM;AAAA,IACP,oBAAC,+CAAgB,QAAW,EAAE,UAAU,EAAG;AAAA,KAC7C;AAEJ","sourcesContent":["import React, { useState } from \"react\";\nimport { CopilotChat, CopilotChatProps } from \"./Chat\";\n\ninterface CopilotSidebarProps extends CopilotChatProps {\n children?: React.ReactNode;\n}\n\nexport const CopilotSidebar = (props: CopilotSidebarProps) => {\n props = {\n ...props,\n className: props.className ? props.className + \" copilotKitSidebar\" : \"copilotKitSidebar\",\n };\n const [expandedClassName, setExpandedClassName] = useState(\n props.defaultOpen ? \"sidebarExpanded\" : \"\",\n );\n\n const onSetOpen = (open: boolean) => {\n props.onSetOpen?.(open);\n setExpandedClassName(open ? \"sidebarExpanded\" : \"\");\n };\n\n return (\n <div className={`copilotKitSidebarContentWrapper ${expandedClassName}`}>\n {props.children}\n <CopilotChat {...props} {...{ onSetOpen }} />\n </div>\n );\n};\n"]}
|
|
@@ -2,15 +2,9 @@ import { DownloadIcon, CheckIcon, CopyIcon } from './chunk-7YXG7D47.mjs';
|
|
|
2
2
|
import { useCopyToClipboard } from './chunk-POVINPXX.mjs';
|
|
3
3
|
import { memo } from 'react';
|
|
4
4
|
import { Prism } from 'react-syntax-highlighter';
|
|
5
|
+
import { vscDarkPlus } from 'react-syntax-highlighter/dist/esm/styles/prism';
|
|
5
6
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
7
|
|
|
7
|
-
var CodeActionButton = ({ onClick, children }) => {
|
|
8
|
-
let className = "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 ";
|
|
9
|
-
className += "hover:bg-zinc-800 focus-visible:ring-1 focus-visible:ring-slate-700 focus-visible:ring-offset-0 ";
|
|
10
|
-
className += "hover:bg-accent hover:text-accent-foreground ";
|
|
11
|
-
className += "h-10 w-10";
|
|
12
|
-
return /* @__PURE__ */ jsx("button", { className, onClick, children });
|
|
13
|
-
};
|
|
14
8
|
var programmingLanguages = {
|
|
15
9
|
javascript: ".js",
|
|
16
10
|
python: ".py",
|
|
@@ -73,15 +67,15 @@ var CodeBlock = memo(({ language, value }) => {
|
|
|
73
67
|
return;
|
|
74
68
|
copyToClipboard(value);
|
|
75
69
|
};
|
|
76
|
-
return /* @__PURE__ */ jsxs("div", { className: "
|
|
77
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
78
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
79
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
80
|
-
/* @__PURE__ */ jsxs(
|
|
70
|
+
return /* @__PURE__ */ jsxs("div", { className: "copilotKitCodeBlock", children: [
|
|
71
|
+
/* @__PURE__ */ jsxs("div", { className: "copilotKitCodeBlockToolbar", children: [
|
|
72
|
+
/* @__PURE__ */ jsx("span", { className: "copilotKitCodeBlockToolbarLanguage", children: language }),
|
|
73
|
+
/* @__PURE__ */ jsxs("div", { className: "copilotKitCodeBlockToolbarButtons", children: [
|
|
74
|
+
/* @__PURE__ */ jsxs("button", { className: "copilotKitCodeBlockToolbarButton", onClick: downloadAsFile, children: [
|
|
81
75
|
/* @__PURE__ */ jsx(DownloadIcon, {}),
|
|
82
76
|
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Download" })
|
|
83
77
|
] }),
|
|
84
|
-
/* @__PURE__ */ jsxs(
|
|
78
|
+
/* @__PURE__ */ jsxs("button", { className: "copilotKitCodeBlockToolbarButton", onClick: onCopy, children: [
|
|
85
79
|
isCopied ? /* @__PURE__ */ jsx(CheckIcon, {}) : /* @__PURE__ */ jsx(CopyIcon, {}),
|
|
86
80
|
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Copy code" })
|
|
87
81
|
] })
|
|
@@ -91,19 +85,12 @@ var CodeBlock = memo(({ language, value }) => {
|
|
|
91
85
|
Prism,
|
|
92
86
|
{
|
|
93
87
|
language,
|
|
88
|
+
style: vscDarkPlus,
|
|
94
89
|
PreTag: "div",
|
|
95
|
-
showLineNumbers: true,
|
|
96
90
|
customStyle: {
|
|
97
91
|
margin: 0,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
padding: "1.5rem 1rem"
|
|
101
|
-
},
|
|
102
|
-
codeTagProps: {
|
|
103
|
-
style: {
|
|
104
|
-
fontSize: "0.9rem",
|
|
105
|
-
fontFamily: "var(--font-mono)"
|
|
106
|
-
}
|
|
92
|
+
borderBottomLeftRadius: "0.375rem",
|
|
93
|
+
borderBottomRightRadius: "0.375rem"
|
|
107
94
|
},
|
|
108
95
|
children: value
|
|
109
96
|
}
|
|
@@ -114,4 +101,4 @@ CodeBlock.displayName = "CodeBlock";
|
|
|
114
101
|
|
|
115
102
|
export { CodeBlock, generateRandomString, programmingLanguages };
|
|
116
103
|
//# sourceMappingURL=out.js.map
|
|
117
|
-
//# sourceMappingURL=chunk-
|
|
104
|
+
//# sourceMappingURL=chunk-DPRH4HX3.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/CodeBlock.tsx"],"names":[],"mappings":";;;;;;;;;;AAEA,SAAa,YAAY;AACzB,SAAS,SAAS,yBAAyB;AAC3C,SAAS,eAAe,sBAAsB;AA2FtC,cAEE,YAFF;AAxED,IAAM,uBAAoC;AAAA,EAC/C,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,GAAG;AAAA,EACH,KAAK;AAAA,EACL,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AAAA,EACP,eAAe;AAAA,EACf,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,EACT,KAAK;AAAA,EACL,OAAO;AAAA,EACP,KAAK;AAAA,EACL,MAAM;AAAA,EACN,KAAK;AAAA;AAEP;AAEO,IAAM,uBAAuB,CAAC,QAAgB,YAAY,UAAU;AACzE,QAAM,QAAQ;AACd,MAAI,SAAS;AACb,WAAS,IAAI,GAAG,IAAI,QAAQ,KAAK;AAC/B,cAAU,MAAM,OAAO,KAAK,MAAM,KAAK,OAAO,IAAI,MAAM,MAAM,CAAC;AAAA,EACjE;AACA,SAAO,YAAY,OAAO,YAAY,IAAI;AAC5C;AAEA,IAAM,YAAuB,KAAK,CAAC,EAAE,UAAU,MAAM,MAAM;AACzD,QAAM,EAAE,UAAU,gBAAgB,IAAI,mBAAmB,EAAE,SAAS,IAAK,CAAC;AAE1E,QAAM,iBAAiB,MAAM;AAC3B,QAAI,OAAO,WAAW,aAAa;AACjC;AAAA,IACF;AACA,UAAM,gBAAgB,qBAAqB,QAAQ,KAAK;AACxD,UAAM,oBAAoB,QAAQ,qBAAqB,GAAG,IAAI,IAAI;AAClE,UAAM,WAAW,OAAO,OAAO,mBAAyB,iBAAiB;AAEzE,QAAI,CAAC,UAAU;AAEb;AAAA,IACF;AAEA,UAAM,OAAO,IAAI,KAAK,CAAC,KAAK,GAAG,EAAE,MAAM,aAAa,CAAC;AACrD,UAAM,MAAM,IAAI,gBAAgB,IAAI;AACpC,UAAM,OAAO,SAAS,cAAc,GAAG;AACvC,SAAK,WAAW;AAChB,SAAK,OAAO;AACZ,SAAK,MAAM,UAAU;AACrB,aAAS,KAAK,YAAY,IAAI;AAC9B,SAAK,MAAM;AACX,aAAS,KAAK,YAAY,IAAI;AAC9B,QAAI,gBAAgB,GAAG;AAAA,EACzB;AAEA,QAAM,SAAS,MAAM;AACnB,QAAI;AAAU;AACd,oBAAgB,KAAK;AAAA,EACvB;AAEA,SACE,qBAAC,SAAI,WAAU,uBACb;AAAA,yBAAC,SAAI,WAAU,8BACb;AAAA,0BAAC,UAAK,WAAU,sCAAsC,oBAAS;AAAA,MAC/D,qBAAC,SAAI,WAAU,qCACb;AAAA,6BAAC,YAAO,WAAU,oCAAmC,SAAS,gBAC5D;AAAA,8BAAC,gBAAa;AAAA,UACd,oBAAC,UAAK,WAAU,WAAU,sBAAQ;AAAA,WACpC;AAAA,QACA,qBAAC,YAAO,WAAU,oCAAmC,SAAS,QAC3D;AAAA,qBAAW,oBAAC,aAAU,IAAK,oBAAC,YAAS;AAAA,UACtC,oBAAC,UAAK,WAAU,WAAU,uBAAS;AAAA,WACrC;AAAA,SACF;AAAA,OACF;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,OAAO;AAAA,QACP,QAAO;AAAA,QACP,aAAa;AAAA,UACX,QAAQ;AAAA,UACR,wBAAwB;AAAA,UACxB,yBAAyB;AAAA,QAC3B;AAAA,QAEC;AAAA;AAAA,IACH;AAAA,KACF;AAEJ,CAAC;AACD,UAAU,cAAc","sourcesContent":["\"use client\";\n\nimport { FC, memo } from \"react\";\nimport { Prism as SyntaxHighlighter } from \"react-syntax-highlighter\";\nimport { vscDarkPlus as highlightStyle } from \"react-syntax-highlighter/dist/esm/styles/prism\";\n\nimport { useCopyToClipboard } from \"../../hooks/use-copy-to-clipboard\";\nimport { CheckIcon, CopyIcon, DownloadIcon } from \"./Icons\";\n\ninterface CodeActionButtonProps {\n onClick: () => void;\n children: React.ReactNode;\n}\n\ninterface Props {\n language: string;\n value: string;\n}\n\ninterface languageMap {\n [key: string]: string | undefined;\n}\n\nexport const programmingLanguages: languageMap = {\n javascript: \".js\",\n python: \".py\",\n java: \".java\",\n c: \".c\",\n cpp: \".cpp\",\n \"c++\": \".cpp\",\n \"c#\": \".cs\",\n ruby: \".rb\",\n php: \".php\",\n swift: \".swift\",\n \"objective-c\": \".m\",\n kotlin: \".kt\",\n typescript: \".ts\",\n go: \".go\",\n perl: \".pl\",\n rust: \".rs\",\n scala: \".scala\",\n haskell: \".hs\",\n lua: \".lua\",\n shell: \".sh\",\n sql: \".sql\",\n html: \".html\",\n css: \".css\",\n // add more file extensions here, make sure the key is same as language prop in CodeBlock.tsx component\n};\n\nexport const generateRandomString = (length: number, lowercase = false) => {\n const chars = \"ABCDEFGHJKLMNPQRSTUVWXY3456789\"; // excluding similar looking characters like Z, 2, I, 1, O, 0\n let result = \"\";\n for (let i = 0; i < length; i++) {\n result += chars.charAt(Math.floor(Math.random() * chars.length));\n }\n return lowercase ? result.toLowerCase() : result;\n};\n\nconst CodeBlock: FC<Props> = memo(({ language, value }) => {\n const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2000 });\n\n const downloadAsFile = () => {\n if (typeof window === \"undefined\") {\n return;\n }\n const fileExtension = programmingLanguages[language] || \".file\";\n const suggestedFileName = `file-${generateRandomString(3, true)}${fileExtension}`;\n const fileName = window.prompt(\"Enter file name\" || \"\", suggestedFileName);\n\n if (!fileName) {\n // User pressed cancel on prompt.\n return;\n }\n\n const blob = new Blob([value], { type: \"text/plain\" });\n const url = URL.createObjectURL(blob);\n const link = document.createElement(\"a\");\n link.download = fileName;\n link.href = url;\n link.style.display = \"none\";\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n URL.revokeObjectURL(url);\n };\n\n const onCopy = () => {\n if (isCopied) return;\n copyToClipboard(value);\n };\n\n return (\n <div className=\"copilotKitCodeBlock\">\n <div className=\"copilotKitCodeBlockToolbar\">\n <span className=\"copilotKitCodeBlockToolbarLanguage\">{language}</span>\n <div className=\"copilotKitCodeBlockToolbarButtons\">\n <button className=\"copilotKitCodeBlockToolbarButton\" onClick={downloadAsFile}>\n <DownloadIcon />\n <span className=\"sr-only\">Download</span>\n </button>\n <button className=\"copilotKitCodeBlockToolbarButton\" onClick={onCopy}>\n {isCopied ? <CheckIcon /> : <CopyIcon />}\n <span className=\"sr-only\">Copy code</span>\n </button>\n </div>\n </div>\n <SyntaxHighlighter\n language={language}\n style={highlightStyle}\n PreTag=\"div\"\n customStyle={{\n margin: 0,\n borderBottomLeftRadius: \"0.375rem\",\n borderBottomRightRadius: \"0.375rem\",\n }}\n >\n {value}\n </SyntaxHighlighter>\n </div>\n );\n});\nCodeBlock.displayName = \"CodeBlock\";\n\nexport { CodeBlock };\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CodeBlock } from './chunk-
|
|
1
|
+
import { CodeBlock } from './chunk-DPRH4HX3.mjs';
|
|
2
2
|
import { __objRest, __spreadProps, __spreadValues } from './chunk-MRXNTQOX.mjs';
|
|
3
3
|
import { memo } from 'react';
|
|
4
4
|
import ReactMarkdown from 'react-markdown';
|
|
@@ -11,25 +11,26 @@ var MemoizedReactMarkdown = memo(
|
|
|
11
11
|
(prevProps, nextProps) => prevProps.children === nextProps.children && prevProps.className === nextProps.className
|
|
12
12
|
);
|
|
13
13
|
var Markdown = ({ content }) => {
|
|
14
|
-
return /* @__PURE__ */ jsx(
|
|
15
|
-
MemoizedReactMarkdown,
|
|
16
|
-
{
|
|
17
|
-
className: "prose break-words dark:prose-invert prose-p:leading-relaxed prose-pre:p-0 text-sm",
|
|
18
|
-
components,
|
|
19
|
-
remarkPlugins: [remarkGfm, remarkMath],
|
|
20
|
-
children: content
|
|
21
|
-
}
|
|
22
|
-
);
|
|
14
|
+
return /* @__PURE__ */ jsx("div", { className: "copilotKitMarkdown", children: /* @__PURE__ */ jsx(MemoizedReactMarkdown, { components, remarkPlugins: [remarkGfm, remarkMath], children: content }) });
|
|
23
15
|
};
|
|
24
16
|
var components = {
|
|
25
17
|
p({ children }) {
|
|
26
|
-
return /* @__PURE__ */ jsx("p", {
|
|
18
|
+
return /* @__PURE__ */ jsx("p", { children });
|
|
27
19
|
},
|
|
28
20
|
code(_a) {
|
|
29
21
|
var _b = _a, { children, className, inline } = _b, props = __objRest(_b, ["children", "className", "inline"]);
|
|
30
22
|
if (children.length) {
|
|
31
23
|
if (children[0] == "\u258D") {
|
|
32
|
-
return /* @__PURE__ */ jsx(
|
|
24
|
+
return /* @__PURE__ */ jsx(
|
|
25
|
+
"span",
|
|
26
|
+
{
|
|
27
|
+
style: {
|
|
28
|
+
animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
|
|
29
|
+
marginTop: "0.25rem"
|
|
30
|
+
},
|
|
31
|
+
children: "\u258D"
|
|
32
|
+
}
|
|
33
|
+
);
|
|
33
34
|
}
|
|
34
35
|
children[0] = children[0].replace("`\u258D`", "\u258D");
|
|
35
36
|
}
|
|
@@ -50,4 +51,4 @@ var components = {
|
|
|
50
51
|
|
|
51
52
|
export { Markdown };
|
|
52
53
|
//# sourceMappingURL=out.js.map
|
|
53
|
-
//# sourceMappingURL=chunk-
|
|
54
|
+
//# sourceMappingURL=chunk-GWGHQNRI.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/Markdown.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,SAAa,YAAY;AACzB,OAAO,mBAA4C;AAEnD,OAAO,eAAe;AACtB,OAAO,gBAAgB;AAejB;AAbN,IAAM,wBAAqC;AAAA,EACzC;AAAA,EACA,CAAC,WAAW,cACV,UAAU,aAAa,UAAU,YAAY,UAAU,cAAc,UAAU;AACnF;AAMO,IAAM,WAAW,CAAC,EAAE,QAAQ,MAAqB;AACtD,SACE,oBAAC,SAAI,WAAU,sBACb,8BAAC,yBAAsB,YAAwB,eAAe,CAAC,WAAW,UAAU,GACjF,mBACH,GACF;AAEJ;AAEA,IAAM,aAAyB;AAAA,EAC7B,EAAE,EAAE,SAAS,GAAG;AACd,WAAO,oBAAC,OAAG,UAAS;AAAA,EACtB;AAAA,EACA,KAAK,IAA2C;AAA3C,iBAAE,YAAU,WAAW,OA9B9B,IA8BO,IAAkC,kBAAlC,IAAkC,CAAhC,YAAU,aAAW;AAC1B,QAAI,SAAS,QAAQ;AACnB,UAAI,SAAS,CAAC,KAAK,UAAK;AACtB,eACE;AAAA,UAAC;AAAA;AAAA,YACC,OAAO;AAAA,cACL,WAAW;AAAA,cACX,WAAW;AAAA,YACb;AAAA,YACD;AAAA;AAAA,QAED;AAAA,MAEJ;AAEA,eAAS,CAAC,IAAK,SAAS,CAAC,EAAa,QAAQ,YAAO,QAAG;AAAA,IAC1D;AAEA,UAAM,QAAQ,iBAAiB,KAAK,aAAa,EAAE;AAEnD,QAAI,QAAQ;AACV,aACE,oBAAC,uCAAK,aAA0B,QAA/B,EACE,WACH;AAAA,IAEJ;AAEA,WACE;AAAA,MAAC;AAAA;AAAA,QAEC,UAAW,SAAS,MAAM,CAAC,KAAM;AAAA,QACjC,OAAO,OAAO,QAAQ,EAAE,QAAQ,OAAO,EAAE;AAAA,SACrC;AAAA,MAHC,KAAK,OAAO;AAAA,IAInB;AAAA,EAEJ;AACF","sourcesContent":["import { FC, memo } from \"react\";\nimport ReactMarkdown, { Options, Components } from \"react-markdown\";\nimport { CodeBlock } from \"./CodeBlock\";\nimport remarkGfm from \"remark-gfm\";\nimport remarkMath from \"remark-math\";\n\nconst MemoizedReactMarkdown: FC<Options> = memo(\n ReactMarkdown,\n (prevProps, nextProps) =>\n prevProps.children === nextProps.children && prevProps.className === nextProps.className,\n);\n\ntype MarkdownProps = {\n content: string;\n};\n\nexport const Markdown = ({ content }: MarkdownProps) => {\n return (\n <div className=\"copilotKitMarkdown\">\n <MemoizedReactMarkdown components={components} remarkPlugins={[remarkGfm, remarkMath]}>\n {content}\n </MemoizedReactMarkdown>\n </div>\n );\n};\n\nconst components: Components = {\n p({ children }) {\n return <p>{children}</p>;\n },\n code({ children, className, inline, ...props }) {\n if (children.length) {\n if (children[0] == \"▍\") {\n return (\n <span\n style={{\n animation: \"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite\",\n marginTop: \"0.25rem\",\n }}\n >\n ▍\n </span>\n );\n }\n\n children[0] = (children[0] as string).replace(\"`▍`\", \"▍\");\n }\n\n const match = /language-(\\w+)/.exec(className || \"\");\n\n if (inline) {\n return (\n <code className={className} {...props}>\n {children}\n </code>\n );\n }\n\n return (\n <CodeBlock\n key={Math.random()}\n language={(match && match[1]) || \"\"}\n value={String(children).replace(/\\n$/, \"\")}\n {...props}\n />\n );\n },\n};\n"]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CopilotChat } from './chunk-NNVWLSYK.mjs';
|
|
2
2
|
import { __spreadProps, __spreadValues } from './chunk-MRXNTQOX.mjs';
|
|
3
3
|
import { jsx } from 'react/jsx-runtime';
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var CopilotPopup = (props) => {
|
|
6
6
|
props = __spreadProps(__spreadValues({}, props), {
|
|
7
7
|
className: props.className ? props.className + " copilotKitPopup" : "copilotKitPopup"
|
|
8
8
|
});
|
|
9
|
-
return /* @__PURE__ */ jsx(
|
|
9
|
+
return /* @__PURE__ */ jsx(CopilotChat, __spreadValues({}, props));
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
export {
|
|
12
|
+
export { CopilotPopup };
|
|
13
13
|
//# sourceMappingURL=out.js.map
|
|
14
|
-
//# sourceMappingURL=chunk-
|
|
14
|
+
//# sourceMappingURL=chunk-KBGIPFXA.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/Popup.tsx"],"names":[],"mappings":";;;;;;;;;AAOS;AALF,IAAM,eAAe,CAAC,UAA4B;AACvD,UAAQ,iCACH,QADG;AAAA,IAEN,WAAW,MAAM,YAAY,MAAM,YAAY,qBAAqB;AAAA,EACtE;AACA,SAAO,oBAAC,gCAAgB,MAAO;AACjC","sourcesContent":["import { CopilotChat, CopilotChatProps } from \"./Chat\";\n\nexport const CopilotPopup = (props: CopilotChatProps) => {\n props = {\n ...props,\n className: props.className ? props.className + \" copilotKitPopup\" : \"copilotKitPopup\",\n };\n return <CopilotChat {...props} />;\n};\n"]}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
+
import { Messages } from './chunk-3M4HWSE7.mjs';
|
|
2
|
+
import { ResponseButton } from './chunk-Z34F3WLK.mjs';
|
|
1
3
|
import { Window } from './chunk-47SYBLI2.mjs';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { Header } from './chunk-DPUPEOGG.mjs';
|
|
7
|
-
import { ChatContextProvider } from './chunk-6H3Y2XEI.mjs';
|
|
4
|
+
import { Button } from './chunk-5O2MCJZ2.mjs';
|
|
5
|
+
import { Header } from './chunk-UWPFPWAW.mjs';
|
|
6
|
+
import { Input } from './chunk-NYLOXKYT.mjs';
|
|
7
|
+
import { ChatContextProvider } from './chunk-OF66AL5Z.mjs';
|
|
8
8
|
import { __async } from './chunk-MRXNTQOX.mjs';
|
|
9
9
|
import React from 'react';
|
|
10
10
|
import { useCopilotChat } from '@copilotkit/react-core';
|
|
11
11
|
import { nanoid } from 'nanoid';
|
|
12
12
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var CopilotChat = ({
|
|
15
15
|
instructions,
|
|
16
16
|
defaultOpen = false,
|
|
17
17
|
clickOutsideToClose = true,
|
|
@@ -67,6 +67,6 @@ var CopilotKitChat = ({
|
|
|
67
67
|
] }) });
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
-
export {
|
|
70
|
+
export { CopilotChat };
|
|
71
71
|
//# sourceMappingURL=out.js.map
|
|
72
|
-
//# sourceMappingURL=chunk-
|
|
72
|
+
//# sourceMappingURL=chunk-NNVWLSYK.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/Chat.tsx"],"names":["Window","Button","Header","Messages","Input","ResponseButton"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW;AAElB,SAAgC,sBAAsB;AActD,SAAS,cAAc;AAsJf,cACA,YADA;AA3CD,IAAM,cAAc,CAAC;AAAA,EAC1B;AAAA,EACA,cAAc;AAAA,EACd,sBAAsB;AAAA,EACtB,mBAAmB;AAAA,EACnB;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA,qBAAqB;AAAA,EACrB,QAAAA,UAAS;AAAA,EACT,QAAAC,UAAS;AAAA,EACT,QAAAC,UAAS;AAAA,EACT,UAAAC,YAAW;AAAA,EACX,OAAAC,SAAQ;AAAA,EACR,gBAAAC,kBAAiB;AAAA,EACjB;AACF,MAAwB;AACtB,QAAM,EAAE,iBAAiB,QAAQ,QAAQ,MAAM,WAAW,OAAO,SAAS,IAAI,eAAe;AAAA,IAC3F,IAAI,OAAO;AAAA,IACX;AAAA,IACA,wBAAwB;AAAA,EAC1B,CAAC;AAED,QAAM,CAAC,WAAW,YAAY,IAAI,MAAM,SAAS,WAAW;AAE5D,QAAM,UAAU,CAAC,SAAkB;AACjC,2CAAY;AACZ,iBAAa,IAAI;AAAA,EACnB;AAEA,QAAM,cAAc,CAAO,YAAoB;AAC7C,WAAO;AAAA,MACL,IAAI,OAAO;AAAA,MACX,SAAS;AAAA,MACT,MAAM;AAAA,IACR,CAAC;AAAA,EACH;AAEA,SACE,oBAAC,uBAAoB,OAAc,QACjC,+BAAC,SAAI,WACH;AAAA,wBAACJ,SAAA,EAAO,MAAM,WAAW,SAAkB;AAAA,IAC3C;AAAA,MAACD;AAAA,MAAA;AAAA,QACC,MAAM;AAAA,QACN;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QAEA;AAAA,8BAACE,SAAA,EAAO,MAAM,WAAW,SAAkB;AAAA,UAC3C,oBAACC,WAAA,EAAS,UAAU,iBAAiB,YAAY,WAAW;AAAA,UAC5D,oBAACC,QAAA,EAAM,YAAY,WAAW,QAAQ,aACnC,gCAAsB,gBAAgB,SAAS,KAC9C,oBAACC,iBAAA,EAAe,SAAS,YAAY,OAAO,QAAQ,YAAY,WAAW,GAE/E;AAAA;AAAA;AAAA,IACF;AAAA,KACF,GACF;AAEJ","sourcesContent":["import React from \"react\";\nimport { CopilotChatIcons, ChatContextProvider, CopilotChatLabels } from \"./ChatContext\";\nimport { SystemMessageFunction, useCopilotChat } from \"@copilotkit/react-core\";\nimport {\n ButtonProps,\n HeaderProps,\n WindowProps,\n MessagesProps,\n InputProps,\n ResponseButtonProps,\n} from \"./props\";\nimport { Window as DefaultWindow } from \"./Window\";\nimport { Button as DefaultButton } from \"./Button\";\nimport { Header as DefaultHeader } from \"./Header\";\nimport { Messages as DefaultMessages } from \"./Messages\";\nimport { Input as DefaultInput } from \"./Input\";\nimport { nanoid } from \"nanoid\";\nimport { ResponseButton as DefaultResponseButton } from \"./Response\";\n\n/**\n * Props for CopilotChat component.\n */\nexport interface CopilotChatProps {\n /**\n * Custom instructions to be added to the system message. Use this property to\n * provide additional context or guidance to the language model, influencing\n * its responses. These instructions can include specific directions,\n * preferences, or criteria that the model should consider when generating\n * its output, thereby tailoring the conversation more precisely to the\n * user's needs or the application's requirements.\n */\n instructions?: string;\n\n /**\n * Whether the chat window should be open by default.\n * @default false\n */\n defaultOpen?: boolean;\n\n /**\n * If the chat window should close when the user clicks outside of it.\n * @default true\n */\n clickOutsideToClose?: boolean;\n\n /**\n * If the chat window should close when the user hits the Escape key.\n * @default true\n */\n hitEscapeToClose?: boolean;\n\n /**\n * A callback that gets called when the chat window opens or closes.\n */\n onSetOpen?: (open: boolean) => void;\n\n /**\n * The hotkey to open the chat window.\n * Uses Command-<hotkey> on a Mac and Ctrl-<hotkey> on Windows.\n * @default \"e\"\n */\n hotkey?: string;\n\n /**\n * Icons can be used to set custom icons for the chat window.\n */\n icons?: CopilotChatIcons;\n\n /**\n * Labels can be used to set custom labels for the chat window.\n */\n labels?: CopilotChatLabels;\n\n /**\n * A function that takes in context string and instructions and returns\n * the system message to include in the chat request.\n * Use this to completely override the system message, when providing\n * instructions is not enough.\n */\n makeSystemMessage?: SystemMessageFunction;\n\n /**\n * Whether to show the response button.\n * @default true\n */\n showResponseButton?: boolean;\n\n /**\n * A custom Window component to use instead of the default.\n */\n Window?: React.ComponentType<WindowProps>;\n\n /**\n * A custom Button component to use instead of the default.\n */\n Button?: React.ComponentType<ButtonProps>;\n\n /**\n * A custom Header component to use instead of the default.\n */\n Header?: React.ComponentType<HeaderProps>;\n\n /**\n * A custom Messages component to use instead of the default.\n */\n Messages?: React.ComponentType<MessagesProps>;\n\n /**\n * A custom Input component to use instead of the default.\n */\n Input?: React.ComponentType<InputProps>;\n\n /**\n * A custom ResponseButton component to use instead of the default.\n */\n ResponseButton?: React.ComponentType<ResponseButtonProps>;\n\n /**\n * A class name to apply to the root element.\n */\n className?: string;\n}\n\nexport const CopilotChat = ({\n instructions,\n defaultOpen = false,\n clickOutsideToClose = true,\n hitEscapeToClose = true,\n onSetOpen,\n hotkey = \"e\",\n icons,\n labels,\n makeSystemMessage,\n showResponseButton = true,\n Window = DefaultWindow,\n Button = DefaultButton,\n Header = DefaultHeader,\n Messages = DefaultMessages,\n Input = DefaultInput,\n ResponseButton = DefaultResponseButton,\n className,\n}: CopilotChatProps) => {\n const { visibleMessages, append, reload, stop, isLoading, input, setInput } = useCopilotChat({\n id: nanoid(),\n makeSystemMessage,\n additionalInstructions: instructions,\n });\n\n const [openState, setOpenState] = React.useState(defaultOpen);\n\n const setOpen = (open: boolean) => {\n onSetOpen?.(open);\n setOpenState(open);\n };\n\n const sendMessage = async (message: string) => {\n append({\n id: nanoid(),\n content: message,\n role: \"user\",\n });\n };\n\n return (\n <ChatContextProvider icons={icons} labels={labels}>\n <div className={className}>\n <Button open={openState} setOpen={setOpen}></Button>\n <Window\n open={openState}\n setOpen={setOpen}\n clickOutsideToClose={clickOutsideToClose}\n hotkey={hotkey}\n hitEscapeToClose={hitEscapeToClose}\n >\n <Header open={openState} setOpen={setOpen} />\n <Messages messages={visibleMessages} inProgress={isLoading} />\n <Input inProgress={isLoading} onSend={sendMessage}>\n {showResponseButton && visibleMessages.length > 0 && (\n <ResponseButton onClick={isLoading ? stop : reload} inProgress={isLoading} />\n )}\n </Input>\n </Window>\n </div>\n </ChatContextProvider>\n );\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Textarea_default } from './chunk-WM6BS77F.mjs';
|
|
2
|
-
import { useChatContext } from './chunk-
|
|
2
|
+
import { useChatContext } from './chunk-OF66AL5Z.mjs';
|
|
3
3
|
import { useRef, useState } from 'react';
|
|
4
4
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
5
|
|
|
@@ -48,4 +48,4 @@ var Input = ({ inProgress, onSend, children }) => {
|
|
|
48
48
|
|
|
49
49
|
export { Input };
|
|
50
50
|
//# sourceMappingURL=out.js.map
|
|
51
|
-
//# sourceMappingURL=chunk-
|
|
51
|
+
//# sourceMappingURL=chunk-NYLOXKYT.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/Input.tsx"],"names":[],"mappings":";;;;;;;;AAAA,SAAgB,QAAQ,gBAAgB;AA6BpC,SACE,KADF;AAxBG,IAAM,QAAQ,CAAC,EAAE,YAAY,QAAQ,SAAS,MAAkB;AACrE,QAAM,UAAU,eAAe;AAC/B,QAAM,cAAc,OAA4B,IAAI;AAEpD,QAAM,iBAAiB,CAAC,UAA4C;AATtE;AAWI,QAAI,MAAM,WAAW,MAAM;AAAe;AAE1C,sBAAY,YAAZ,mBAAqB;AAAA,EACvB;AAEA,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,EAAE;AACnC,QAAM,OAAO,MAAM;AAjBrB;AAkBI,QAAI;AAAY;AAChB,WAAO,IAAI;AACX,YAAQ,EAAE;AAEV,sBAAY,YAAZ,mBAAqB;AAAA,EACvB;AAEA,QAAM,OAAO,aAAa,QAAQ,MAAM,eAAe,QAAQ,MAAM;AACrE,QAAM,WAAW,cAAc,KAAK,WAAW;AAE/C,SACE,qBAAC,SAAI,WAAU,mBAAkB,SAAS,gBACxC;AAAA,wBAAC,UAAM,UAAS;AAAA,IAChB,oBAAC,YAAO,WAAU,wBAAuB,UAAoB,SAAS,MACnE,gBACH;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC,KAAK;AAAA,QACL,aAAa,QAAQ,OAAO;AAAA,QAC5B,WAAW;AAAA,QACX,SAAS;AAAA,QACT,OAAO;AAAA,QACP,UAAU,CAAC,UAAU,QAAQ,MAAM,OAAO,KAAK;AAAA,QAC/C,WAAW,CAAC,UAAU;AACpB,cAAI,MAAM,QAAQ,WAAW,CAAC,MAAM,UAAU;AAC5C,kBAAM,eAAe;AACrB,iBAAK;AAAA,UACP;AAAA,QACF;AAAA;AAAA,IACF;AAAA,KACF;AAEJ","sourcesContent":["import React, { useRef, useState } from \"react\";\nimport { InputProps } from \"./props\";\nimport { useChatContext } from \"./ChatContext\";\nimport AutoResizingTextarea from \"./Textarea\";\n\nexport const Input = ({ inProgress, onSend, children }: InputProps) => {\n const context = useChatContext();\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n\n const handleDivClick = (event: React.MouseEvent<HTMLDivElement>) => {\n // Check if the clicked element is not the textarea itself\n if (event.target !== event.currentTarget) return;\n\n textareaRef.current?.focus();\n };\n\n const [text, setText] = useState(\"\");\n const send = () => {\n if (inProgress) return;\n onSend(text);\n setText(\"\");\n\n textareaRef.current?.focus();\n };\n\n const icon = inProgress ? context.icons.activityIcon : context.icons.sendIcon;\n const disabled = inProgress || text.length === 0;\n\n return (\n <div className=\"copilotKitInput\" onClick={handleDivClick}>\n <span>{children}</span>\n <button className=\"copilotKitSendButton\" disabled={disabled} onClick={send}>\n {icon}\n </button>\n <AutoResizingTextarea\n ref={textareaRef}\n placeholder={context.labels.placeholder}\n autoFocus={true}\n maxRows={5}\n value={text}\n onChange={(event) => setText(event.target.value)}\n onKeyDown={(event) => {\n if (event.key === \"Enter\" && !event.shiftKey) {\n event.preventDefault();\n send();\n }\n }}\n />\n </div>\n );\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/ChatContext.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,OAAO,SAAS,eAAe;AA8KtB;AA7DF,IAAM,cAAc,MAAM,cAAuC,MAAS;AAE1E,SAAS,iBAA8B;AAC5C,QAAM,UAAU,MAAM,WAAW,WAAW;AAC5C,MAAI,YAAY,QAAW;AACzB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AAWO,IAAM,sBAAsB,CAAC;AAAA;AAAA;AAAA;AAAA,EAIlC;AAAA,EACA;AAAA,EACA;AACF,MAAwB;AACtB,QAAM,UAAU;AAAA,IACd,OAAO;AAAA,MACL,QAAQ,kCACH;AAAA,QACD,SAAS;AAAA,QACT,OAAO;AAAA,QACP,aAAa;AAAA,QACb,UAAU;AAAA,QACV,MAAM;AAAA,QACN,OAAO;AAAA,QACP,gBAAgB;AAAA,QAChB,oBAAoB;AAAA,MACtB,IACG;AAAA,MAGL,OAAO,iCACF;AAAA,QACD,UAAuB;AAAA,QACvB,WAAwB;AAAA,QACxB,iBAA8B;AAAA,QAC9B,UAAuB;AAAA,QACvB,cAA2B;AAAA,QAC3B,aAA0B;AAAA,QAC1B,UAAuB;AAAA,QACvB,gBAA6B;AAAA,MAC/B,IAVK;AAAA,QAWL;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC,QAAQ,KAAK;AAAA,EAChB;AACA,SAAO,oBAAC,YAAY,UAAZ,EAAqB,OAAO,SAAU,UAAS;AACzD","sourcesContent":["import React, { useMemo } from \"react\";\nimport * as DefaultIcons from \"./Icons\";\n\n/**\n * Icons for CopilotChat component.\n */\nexport interface CopilotChatIcons {\n /**\n * The icon to use for the open chat button.\n * @default <OpenIcon />\n */\n openIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button.\n * @default <CloseIcon />\n */\n closeIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button in the header.\n * @default <HeaderCloseIcon />\n */\n headerCloseIcon?: React.ReactNode;\n\n /**\n * The icon to use for the send button.\n * @default <SendIcon />\n */\n sendIcon?: React.ReactNode;\n\n /**\n * The icon to use for the activity indicator.\n * @default <ActivityIcon />\n */\n activityIcon?: React.ReactNode;\n\n /**\n * The icon to use for the spinner.\n * @default <SpinnerIcon />\n */\n spinnerIcon?: React.ReactNode;\n\n /**\n * The icon to use for the stop button.\n * @default <StopIcon />\n */\n stopIcon?: React.ReactNode;\n\n /**\n * The icon to use for the regenerate button.\n * @default <RegenerateIcon />\n */\n regenerateIcon?: React.ReactNode;\n}\n\n/**\n * Labels for CopilotChat component.\n */\nexport interface CopilotChatLabels {\n /**\n * The initial message(s) to display in the chat window.\n */\n initial?: string | string[];\n\n /**\n * The title to display in the header.\n * @default \"CopilotKit\"\n */\n title?: string;\n\n /**\n * The placeholder to display in the input.\n * @default \"Type a message...\"\n */\n placeholder?: string;\n\n /**\n * The message to display while the chat GPT is \"thinking\".\n * @default \"Thinking...\"\n */\n thinking?: string;\n\n /**\n * The message to display when the chat is done executing a function.\n * @default \"✅ Done\"\n */\n done?: string;\n\n /**\n * The message to display when an error occurs.\n * @default \"❌ An error occurred. Please try again.\"\n */\n error?: string;\n\n /**\n * The label to display on the stop button.\n * @default \"Stop generating\"\n */\n stopGenerating?: string;\n\n /**\n * The label to display on the regenerate button.\n * @default \"Regenerate response\"\n */\n regenerateResponse?: string;\n}\n\ninterface ChatContext {\n labels: Required<CopilotChatLabels>;\n icons: Required<CopilotChatIcons>;\n}\n\nexport const ChatContext = React.createContext<ChatContext | undefined>(undefined);\n\nexport function useChatContext(): ChatContext {\n const context = React.useContext(ChatContext);\n if (context === undefined) {\n throw new Error(\n \"Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?\",\n );\n }\n return context;\n}\n\ninterface ChatContextProps {\n // temperature?: number;\n // instructions?: string;\n // maxFeedback?: number;\n labels?: CopilotChatLabels;\n icons?: CopilotChatIcons;\n children?: React.ReactNode;\n}\n\nexport const ChatContextProvider = ({\n // temperature,\n // instructions,\n // maxFeedback,\n labels,\n icons,\n children,\n}: ChatContextProps) => {\n const context = useMemo(\n () => ({\n labels: {\n ...{\n initial: \"\",\n title: \"CopilotKit\",\n placeholder: \"Type a message...\",\n thinking: \"Thinking...\",\n done: \"✅ Done\",\n error: \"❌ An error occurred. Please try again.\",\n stopGenerating: \"Stop generating\",\n regenerateResponse: \"Regenerate response\",\n },\n ...labels,\n },\n\n icons: {\n ...{\n openIcon: DefaultIcons.OpenIcon,\n closeIcon: DefaultIcons.CloseIcon,\n headerCloseIcon: DefaultIcons.HeaderCloseIcon,\n sendIcon: DefaultIcons.SendIcon,\n activityIcon: DefaultIcons.ActivityIcon,\n spinnerIcon: DefaultIcons.SpinnerIcon,\n stopIcon: DefaultIcons.StopIcon,\n regenerateIcon: DefaultIcons.RegenerateIcon,\n },\n icons,\n },\n }),\n [labels, icons],\n );\n return <ChatContext.Provider value={context}>{children}</ChatContext.Provider>;\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useChatContext } from './chunk-
|
|
1
|
+
import { useChatContext } from './chunk-OF66AL5Z.mjs';
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
|
|
4
4
|
var Header = ({ setOpen }) => {
|
|
@@ -11,4 +11,4 @@ var Header = ({ setOpen }) => {
|
|
|
11
11
|
|
|
12
12
|
export { Header };
|
|
13
13
|
//# sourceMappingURL=out.js.map
|
|
14
|
-
//# sourceMappingURL=chunk-
|
|
14
|
+
//# sourceMappingURL=chunk-UWPFPWAW.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/Header.tsx"],"names":[],"mappings":";;;;;AAOI,SACE,KADF;AAJG,IAAM,SAAS,CAAC,EAAE,QAAQ,MAAmB;AAClD,QAAM,UAAU,eAAe;AAE/B,SACE,qBAAC,SAAI,WAAU,oBACb;AAAA,wBAAC,SAAK,kBAAQ,OAAO,OAAM;AAAA,IAC3B,oBAAC,YAAO,SAAS,MAAM,QAAQ,KAAK,GAAG,cAAW,SAC/C,kBAAQ,MAAM,iBACjB;AAAA,KACF;AAEJ","sourcesContent":["import { HeaderProps } from \"./props\";\nimport { useChatContext } from \"./ChatContext\";\n\nexport const Header = ({ setOpen }: HeaderProps) => {\n const context = useChatContext();\n\n return (\n <div className=\"copilotKitHeader\">\n <div>{context.labels.title}</div>\n <button onClick={() => setOpen(false)} aria-label=\"Close\">\n {context.icons.headerCloseIcon}\n </button>\n </div>\n );\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useChatContext } from './chunk-
|
|
1
|
+
import { useChatContext } from './chunk-OF66AL5Z.mjs';
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
|
|
4
4
|
var ResponseButton = ({ onClick, inProgress }) => {
|
|
@@ -11,4 +11,4 @@ var ResponseButton = ({ onClick, inProgress }) => {
|
|
|
11
11
|
|
|
12
12
|
export { ResponseButton };
|
|
13
13
|
//# sourceMappingURL=out.js.map
|
|
14
|
-
//# sourceMappingURL=chunk-
|
|
14
|
+
//# sourceMappingURL=chunk-Z34F3WLK.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/Response.tsx"],"names":[],"mappings":";;;;;AAMI,SACE,KADF;AAHG,IAAM,iBAAiB,CAAC,EAAE,SAAS,WAAW,MAA2B;AAC9E,QAAM,UAAU,eAAe;AAC/B,SACE,qBAAC,YAAO,SAAkB,WAAU,4BAClC;AAAA,wBAAC,UAAM,uBAAa,QAAQ,MAAM,WAAW,QAAQ,MAAM,gBAAe;AAAA,IACzE,aAAa,QAAQ,OAAO,iBAAiB,QAAQ,OAAO;AAAA,KAC/D;AAEJ","sourcesContent":["import { useChatContext } from \"./ChatContext\";\nimport { ResponseButtonProps } from \"./props\";\n\nexport const ResponseButton = ({ onClick, inProgress }: ResponseButtonProps) => {\n const context = useChatContext();\n return (\n <button onClick={onClick} className=\"copilotKitResponseButton\">\n <span>{inProgress ? context.icons.stopIcon : context.icons.regenerateIcon}</span>\n {inProgress ? context.labels.stopGenerating : context.labels.regenerateResponse}\n </button>\n );\n};\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
1
|
import { ButtonProps } from './props.js';
|
|
3
|
-
import '@copilotkit/
|
|
2
|
+
import '@copilotkit/shared';
|
|
4
3
|
|
|
5
|
-
declare const Button:
|
|
4
|
+
declare const Button: ({ open, setOpen }: ButtonProps) => JSX.Element;
|
|
6
5
|
|
|
7
6
|
export { Button };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
|
|
6
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
|
|
8
|
+
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
9
|
+
|
|
10
|
+
// src/components/chat/ChatContext.tsx
|
|
11
|
+
var ChatContext = React__default.default.createContext(void 0);
|
|
12
|
+
function useChatContext() {
|
|
13
|
+
const context = React__default.default.useContext(ChatContext);
|
|
14
|
+
if (context === void 0) {
|
|
15
|
+
throw new Error(
|
|
16
|
+
"Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?"
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
return context;
|
|
20
|
+
}
|
|
21
|
+
var Button = ({ open, setOpen }) => {
|
|
22
|
+
const context = useChatContext();
|
|
23
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { onClick: () => setOpen(!open), children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
24
|
+
"button",
|
|
25
|
+
{
|
|
26
|
+
className: `copilotKitButton ${open ? "open" : ""}`,
|
|
27
|
+
"aria-label": open ? "Close Chat" : "Open Chat",
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "copilotKitButtonIcon copilotKitButtonIconOpen", children: context.icons.openIcon }),
|
|
30
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "copilotKitButtonIcon copilotKitButtonIconClose", children: context.icons.closeIcon })
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
) });
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
exports.Button = Button;
|
|
37
|
+
//# sourceMappingURL=out.js.map
|
|
38
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/chat/ChatContext.tsx","../../../src/components/chat/Button.tsx"],"names":["jsx"],"mappings":";AAAA,OAAO,SAAS,eAAe;AA8KtB;AA7DF,IAAM,cAAc,MAAM,cAAuC,MAAS;AAE1E,SAAS,iBAA8B;AAC5C,QAAM,UAAU,MAAM,WAAW,WAAW;AAC5C,MAAI,YAAY,QAAW;AACzB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;;;AClHM,SAIE,OAAAA,MAJF;AANC,IAAM,SAAS,CAAC,EAAE,MAAM,QAAQ,MAAmB;AACxD,QAAM,UAAU,eAAe;AAG/B,SACE,gBAAAA,KAAC,SAAI,SAAS,MAAM,QAAQ,CAAC,IAAI,GAC/B;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,oBAAoB,OAAO,SAAS;AAAA,MAC/C,cAAY,OAAO,eAAe;AAAA,MAElC;AAAA,wBAAAA,KAAC,SAAI,WAAU,iDACZ,kBAAQ,MAAM,UACjB;AAAA,QACA,gBAAAA,KAAC,SAAI,WAAU,kDACZ,kBAAQ,MAAM,WACjB;AAAA;AAAA;AAAA,EACF,GACF;AAEJ","sourcesContent":["import React, { useMemo } from \"react\";\nimport * as DefaultIcons from \"./Icons\";\n\n/**\n * Icons for CopilotChat component.\n */\nexport interface CopilotChatIcons {\n /**\n * The icon to use for the open chat button.\n * @default <OpenIcon />\n */\n openIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button.\n * @default <CloseIcon />\n */\n closeIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button in the header.\n * @default <HeaderCloseIcon />\n */\n headerCloseIcon?: React.ReactNode;\n\n /**\n * The icon to use for the send button.\n * @default <SendIcon />\n */\n sendIcon?: React.ReactNode;\n\n /**\n * The icon to use for the activity indicator.\n * @default <ActivityIcon />\n */\n activityIcon?: React.ReactNode;\n\n /**\n * The icon to use for the spinner.\n * @default <SpinnerIcon />\n */\n spinnerIcon?: React.ReactNode;\n\n /**\n * The icon to use for the stop button.\n * @default <StopIcon />\n */\n stopIcon?: React.ReactNode;\n\n /**\n * The icon to use for the regenerate button.\n * @default <RegenerateIcon />\n */\n regenerateIcon?: React.ReactNode;\n}\n\n/**\n * Labels for CopilotChat component.\n */\nexport interface CopilotChatLabels {\n /**\n * The initial message(s) to display in the chat window.\n */\n initial?: string | string[];\n\n /**\n * The title to display in the header.\n * @default \"CopilotKit\"\n */\n title?: string;\n\n /**\n * The placeholder to display in the input.\n * @default \"Type a message...\"\n */\n placeholder?: string;\n\n /**\n * The message to display while the chat GPT is \"thinking\".\n * @default \"Thinking...\"\n */\n thinking?: string;\n\n /**\n * The message to display when the chat is done executing a function.\n * @default \"✅ Done\"\n */\n done?: string;\n\n /**\n * The message to display when an error occurs.\n * @default \"❌ An error occurred. Please try again.\"\n */\n error?: string;\n\n /**\n * The label to display on the stop button.\n * @default \"Stop generating\"\n */\n stopGenerating?: string;\n\n /**\n * The label to display on the regenerate button.\n * @default \"Regenerate response\"\n */\n regenerateResponse?: string;\n}\n\ninterface ChatContext {\n labels: Required<CopilotChatLabels>;\n icons: Required<CopilotChatIcons>;\n}\n\nexport const ChatContext = React.createContext<ChatContext | undefined>(undefined);\n\nexport function useChatContext(): ChatContext {\n const context = React.useContext(ChatContext);\n if (context === undefined) {\n throw new Error(\n \"Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?\",\n );\n }\n return context;\n}\n\ninterface ChatContextProps {\n // temperature?: number;\n // instructions?: string;\n // maxFeedback?: number;\n labels?: CopilotChatLabels;\n icons?: CopilotChatIcons;\n children?: React.ReactNode;\n}\n\nexport const ChatContextProvider = ({\n // temperature,\n // instructions,\n // maxFeedback,\n labels,\n icons,\n children,\n}: ChatContextProps) => {\n const context = useMemo(\n () => ({\n labels: {\n ...{\n initial: \"\",\n title: \"CopilotKit\",\n placeholder: \"Type a message...\",\n thinking: \"Thinking...\",\n done: \"✅ Done\",\n error: \"❌ An error occurred. Please try again.\",\n stopGenerating: \"Stop generating\",\n regenerateResponse: \"Regenerate response\",\n },\n ...labels,\n },\n\n icons: {\n ...{\n openIcon: DefaultIcons.OpenIcon,\n closeIcon: DefaultIcons.CloseIcon,\n headerCloseIcon: DefaultIcons.HeaderCloseIcon,\n sendIcon: DefaultIcons.SendIcon,\n activityIcon: DefaultIcons.ActivityIcon,\n spinnerIcon: DefaultIcons.SpinnerIcon,\n stopIcon: DefaultIcons.StopIcon,\n regenerateIcon: DefaultIcons.RegenerateIcon,\n },\n icons,\n },\n }),\n [labels, icons],\n );\n return <ChatContext.Provider value={context}>{children}</ChatContext.Provider>;\n};\n","import { ButtonProps } from \"./props\";\nimport { useChatContext } from \"./ChatContext\";\n\nexport const Button = ({ open, setOpen }: ButtonProps) => {\n const context = useChatContext();\n // To ensure that the mouse handler fires even when the button is scaled down\n // we wrap the button in a div and attach the handler to the div\n return (\n <div onClick={() => setOpen(!open)}>\n <button\n className={`copilotKitButton ${open ? \"open\" : \"\"}`}\n aria-label={open ? \"Close Chat\" : \"Open Chat\"}\n >\n <div className=\"copilotKitButtonIcon copilotKitButtonIconOpen\">\n {context.icons.openIcon}\n </div>\n <div className=\"copilotKitButtonIcon copilotKitButtonIconClose\">\n {context.icons.closeIcon}\n </div>\n </button>\n </div>\n );\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { Button } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
1
|
+
export { Button } from '../../chunk-5O2MCJZ2.mjs';
|
|
2
|
+
import '../../chunk-OF66AL5Z.mjs';
|
|
3
3
|
import '../../chunk-7YXG7D47.mjs';
|
|
4
4
|
import '../../chunk-MRXNTQOX.mjs';
|
|
5
5
|
//# sourceMappingURL=out.js.map
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CopilotChatIcons, CopilotChatLabels } from './ChatContext.js';
|
|
3
3
|
import { SystemMessageFunction } from '@copilotkit/react-core';
|
|
4
4
|
import { WindowProps, ButtonProps, HeaderProps, MessagesProps, InputProps, ResponseButtonProps } from './props.js';
|
|
5
|
+
import '@copilotkit/shared';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
|
-
* Props for
|
|
8
|
+
* Props for CopilotChat component.
|
|
8
9
|
*/
|
|
9
|
-
interface
|
|
10
|
+
interface CopilotChatProps {
|
|
10
11
|
/**
|
|
11
12
|
* Custom instructions to be added to the system message. Use this property to
|
|
12
13
|
* provide additional context or guidance to the language model, influencing
|
|
@@ -44,11 +45,11 @@ interface CopilotKitChatProps {
|
|
|
44
45
|
/**
|
|
45
46
|
* Icons can be used to set custom icons for the chat window.
|
|
46
47
|
*/
|
|
47
|
-
icons?:
|
|
48
|
+
icons?: CopilotChatIcons;
|
|
48
49
|
/**
|
|
49
50
|
* Labels can be used to set custom labels for the chat window.
|
|
50
51
|
*/
|
|
51
|
-
labels?:
|
|
52
|
+
labels?: CopilotChatLabels;
|
|
52
53
|
/**
|
|
53
54
|
* A function that takes in context string and instructions and returns
|
|
54
55
|
* the system message to include in the chat request.
|
|
@@ -64,32 +65,32 @@ interface CopilotKitChatProps {
|
|
|
64
65
|
/**
|
|
65
66
|
* A custom Window component to use instead of the default.
|
|
66
67
|
*/
|
|
67
|
-
Window?:
|
|
68
|
+
Window?: React.ComponentType<WindowProps>;
|
|
68
69
|
/**
|
|
69
70
|
* A custom Button component to use instead of the default.
|
|
70
71
|
*/
|
|
71
|
-
Button?:
|
|
72
|
+
Button?: React.ComponentType<ButtonProps>;
|
|
72
73
|
/**
|
|
73
74
|
* A custom Header component to use instead of the default.
|
|
74
75
|
*/
|
|
75
|
-
Header?:
|
|
76
|
+
Header?: React.ComponentType<HeaderProps>;
|
|
76
77
|
/**
|
|
77
78
|
* A custom Messages component to use instead of the default.
|
|
78
79
|
*/
|
|
79
|
-
Messages?:
|
|
80
|
+
Messages?: React.ComponentType<MessagesProps>;
|
|
80
81
|
/**
|
|
81
82
|
* A custom Input component to use instead of the default.
|
|
82
83
|
*/
|
|
83
|
-
Input?:
|
|
84
|
+
Input?: React.ComponentType<InputProps>;
|
|
84
85
|
/**
|
|
85
86
|
* A custom ResponseButton component to use instead of the default.
|
|
86
87
|
*/
|
|
87
|
-
ResponseButton?:
|
|
88
|
+
ResponseButton?: React.ComponentType<ResponseButtonProps>;
|
|
88
89
|
/**
|
|
89
90
|
* A class name to apply to the root element.
|
|
90
91
|
*/
|
|
91
92
|
className?: string;
|
|
92
93
|
}
|
|
93
|
-
declare const
|
|
94
|
+
declare const CopilotChat: ({ instructions, defaultOpen, clickOutsideToClose, hitEscapeToClose, onSetOpen, hotkey, icons, labels, makeSystemMessage, showResponseButton, Window, Button, Header, Messages, Input, ResponseButton, className, }: CopilotChatProps) => JSX.Element;
|
|
94
95
|
|
|
95
|
-
export {
|
|
96
|
+
export { CopilotChat, CopilotChatProps };
|