@copilotkit/react-ui 0.0.0-0.0.0-max-changeset-10101010101010-20260109191632
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/CHANGELOG.md +17415 -0
- package/LICENSE +21 -0
- package/README.md +141 -0
- package/dist/chunk-3W6J75HS.mjs +126 -0
- package/dist/chunk-3W6J75HS.mjs.map +1 -0
- package/dist/chunk-54JAUBUJ.mjs +26 -0
- package/dist/chunk-54JAUBUJ.mjs.map +1 -0
- package/dist/chunk-7OURDQZJ.mjs +133 -0
- package/dist/chunk-7OURDQZJ.mjs.map +1 -0
- package/dist/chunk-7PR2KJDO.mjs +222 -0
- package/dist/chunk-7PR2KJDO.mjs.map +1 -0
- package/dist/chunk-BH6PCAAL.mjs +81 -0
- package/dist/chunk-BH6PCAAL.mjs.map +1 -0
- package/dist/chunk-C3GSYRC3.mjs +118 -0
- package/dist/chunk-C3GSYRC3.mjs.map +1 -0
- package/dist/chunk-DBKRAOH7.mjs +34 -0
- package/dist/chunk-DBKRAOH7.mjs.map +1 -0
- package/dist/chunk-EFZPSZWO.mjs +1 -0
- package/dist/chunk-EFZPSZWO.mjs.map +1 -0
- package/dist/chunk-ELGRNEAO.mjs +32 -0
- package/dist/chunk-ELGRNEAO.mjs.map +1 -0
- package/dist/chunk-ELUJRANC.mjs +21 -0
- package/dist/chunk-ELUJRANC.mjs.map +1 -0
- package/dist/chunk-FFJHOZX6.mjs +202 -0
- package/dist/chunk-FFJHOZX6.mjs.map +1 -0
- package/dist/chunk-GDSZGYCE.mjs +32 -0
- package/dist/chunk-GDSZGYCE.mjs.map +1 -0
- package/dist/chunk-HIW7RXCD.mjs +184 -0
- package/dist/chunk-HIW7RXCD.mjs.map +1 -0
- package/dist/chunk-IEMQ2SQW.mjs +93 -0
- package/dist/chunk-IEMQ2SQW.mjs.map +1 -0
- package/dist/chunk-IHFR6PYG.mjs +116 -0
- package/dist/chunk-IHFR6PYG.mjs.map +1 -0
- package/dist/chunk-IK2BPURM.mjs +400 -0
- package/dist/chunk-IK2BPURM.mjs.map +1 -0
- package/dist/chunk-IU3WTXLQ.mjs +1 -0
- package/dist/chunk-IU3WTXLQ.mjs.map +1 -0
- package/dist/chunk-JGMFJZMG.mjs +11 -0
- package/dist/chunk-JGMFJZMG.mjs.map +1 -0
- package/dist/chunk-JY2CSDKN.mjs +135 -0
- package/dist/chunk-JY2CSDKN.mjs.map +1 -0
- package/dist/chunk-JZ3RFQQ6.mjs +128 -0
- package/dist/chunk-JZ3RFQQ6.mjs.map +1 -0
- package/dist/chunk-KXE2JCUH.mjs +1 -0
- package/dist/chunk-KXE2JCUH.mjs.map +1 -0
- package/dist/chunk-LQEFRHRT.mjs +30 -0
- package/dist/chunk-LQEFRHRT.mjs.map +1 -0
- package/dist/chunk-MMVDU6DF.mjs +1 -0
- package/dist/chunk-MMVDU6DF.mjs.map +1 -0
- package/dist/chunk-MRXNTQOX.mjs +59 -0
- package/dist/chunk-MRXNTQOX.mjs.map +1 -0
- package/dist/chunk-NCIAFFQ2.mjs +82 -0
- package/dist/chunk-NCIAFFQ2.mjs.map +1 -0
- package/dist/chunk-NGJ32FAP.mjs +30 -0
- package/dist/chunk-NGJ32FAP.mjs.map +1 -0
- package/dist/chunk-NRA3CFEE.mjs +97 -0
- package/dist/chunk-NRA3CFEE.mjs.map +1 -0
- package/dist/chunk-O72ZB5V3.mjs +140 -0
- package/dist/chunk-O72ZB5V3.mjs.map +1 -0
- package/dist/chunk-PLHTVHUW.mjs +82 -0
- package/dist/chunk-PLHTVHUW.mjs.map +1 -0
- package/dist/chunk-Q5V6S67N.mjs +103 -0
- package/dist/chunk-Q5V6S67N.mjs.map +1 -0
- package/dist/chunk-QB3GUN2N.mjs +31 -0
- package/dist/chunk-QB3GUN2N.mjs.map +1 -0
- package/dist/chunk-QIOJXTIQ.mjs +64 -0
- package/dist/chunk-QIOJXTIQ.mjs.map +1 -0
- package/dist/chunk-QPQRLXN3.mjs +435 -0
- package/dist/chunk-QPQRLXN3.mjs.map +1 -0
- package/dist/chunk-RYUCX3ZK.mjs +32 -0
- package/dist/chunk-RYUCX3ZK.mjs.map +1 -0
- package/dist/chunk-SC6JRFAJ.mjs +1 -0
- package/dist/chunk-SC6JRFAJ.mjs.map +1 -0
- package/dist/chunk-T26KLXLH.mjs +1 -0
- package/dist/chunk-T26KLXLH.mjs.map +1 -0
- package/dist/chunk-UFN2VWSR.mjs +25 -0
- package/dist/chunk-UFN2VWSR.mjs.map +1 -0
- package/dist/chunk-V7W6IM2V.mjs +1 -0
- package/dist/chunk-V7W6IM2V.mjs.map +1 -0
- package/dist/chunk-WB3YULQ4.mjs +1 -0
- package/dist/chunk-WB3YULQ4.mjs.map +1 -0
- package/dist/chunk-XWG3L6QC.mjs +258 -0
- package/dist/chunk-XWG3L6QC.mjs.map +1 -0
- package/dist/chunk-Y4FKRAKJ.mjs +12 -0
- package/dist/chunk-Y4FKRAKJ.mjs.map +1 -0
- package/dist/components/chat/Button.d.ts +9 -0
- package/dist/components/chat/Button.js +71 -0
- package/dist/components/chat/Button.js.map +1 -0
- package/dist/components/chat/Button.mjs +10 -0
- package/dist/components/chat/Button.mjs.map +1 -0
- package/dist/components/chat/Chat.d.ts +204 -0
- package/dist/components/chat/Chat.js +2270 -0
- package/dist/components/chat/Chat.js.map +1 -0
- package/dist/components/chat/Chat.mjs +29 -0
- package/dist/components/chat/Chat.mjs.map +1 -0
- package/dist/components/chat/ChatContext.d.ts +145 -0
- package/dist/components/chat/ChatContext.js +329 -0
- package/dist/components/chat/ChatContext.js.map +1 -0
- package/dist/components/chat/ChatContext.mjs +13 -0
- package/dist/components/chat/ChatContext.mjs.map +1 -0
- package/dist/components/chat/CodeBlock.d.ts +14 -0
- package/dist/components/chat/CodeBlock.js +510 -0
- package/dist/components/chat/CodeBlock.js.map +1 -0
- package/dist/components/chat/CodeBlock.mjs +14 -0
- package/dist/components/chat/CodeBlock.mjs.map +1 -0
- package/dist/components/chat/Header.d.ts +9 -0
- package/dist/components/chat/Header.js +582 -0
- package/dist/components/chat/Header.js.map +1 -0
- package/dist/components/chat/Header.mjs +17 -0
- package/dist/components/chat/Header.mjs.map +1 -0
- package/dist/components/chat/Icons.d.ts +20 -0
- package/dist/components/chat/Icons.js +297 -0
- package/dist/components/chat/Icons.js.map +1 -0
- package/dist/components/chat/Icons.mjs +38 -0
- package/dist/components/chat/Icons.mjs.map +1 -0
- package/dist/components/chat/ImageUploadQueue.d.ts +13 -0
- package/dist/components/chat/ImageUploadQueue.js +106 -0
- package/dist/components/chat/ImageUploadQueue.js.map +1 -0
- package/dist/components/chat/ImageUploadQueue.mjs +8 -0
- package/dist/components/chat/ImageUploadQueue.mjs.map +1 -0
- package/dist/components/chat/Input.d.ts +9 -0
- package/dist/components/chat/Input.js +396 -0
- package/dist/components/chat/Input.js.map +1 -0
- package/dist/components/chat/Input.mjs +14 -0
- package/dist/components/chat/Input.mjs.map +1 -0
- package/dist/components/chat/Markdown.d.ts +10 -0
- package/dist/components/chat/Markdown.js +652 -0
- package/dist/components/chat/Markdown.js.map +1 -0
- package/dist/components/chat/Markdown.mjs +11 -0
- package/dist/components/chat/Markdown.mjs.map +1 -0
- package/dist/components/chat/Messages.d.ts +13 -0
- package/dist/components/chat/Messages.js +1195 -0
- package/dist/components/chat/Messages.js.map +1 -0
- package/dist/components/chat/Messages.mjs +20 -0
- package/dist/components/chat/Messages.mjs.map +1 -0
- package/dist/components/chat/Modal.d.ts +51 -0
- package/dist/components/chat/Modal.js +3075 -0
- package/dist/components/chat/Modal.js.map +1 -0
- package/dist/components/chat/Modal.mjs +38 -0
- package/dist/components/chat/Modal.mjs.map +1 -0
- package/dist/components/chat/Popup.d.ts +13 -0
- package/dist/components/chat/Popup.js +3086 -0
- package/dist/components/chat/Popup.js.map +1 -0
- package/dist/components/chat/Popup.mjs +39 -0
- package/dist/components/chat/Popup.mjs.map +1 -0
- package/dist/components/chat/PoweredByTag.d.ts +7 -0
- package/dist/components/chat/PoweredByTag.js +61 -0
- package/dist/components/chat/PoweredByTag.js.map +1 -0
- package/dist/components/chat/PoweredByTag.mjs +9 -0
- package/dist/components/chat/PoweredByTag.mjs.map +1 -0
- package/dist/components/chat/Sidebar.d.ts +13 -0
- package/dist/components/chat/Sidebar.js +3095 -0
- package/dist/components/chat/Sidebar.js.map +1 -0
- package/dist/components/chat/Sidebar.mjs +39 -0
- package/dist/components/chat/Sidebar.mjs.map +1 -0
- package/dist/components/chat/Suggestion.d.ts +12 -0
- package/dist/components/chat/Suggestion.js +56 -0
- package/dist/components/chat/Suggestion.js.map +1 -0
- package/dist/components/chat/Suggestion.mjs +9 -0
- package/dist/components/chat/Suggestion.mjs.map +1 -0
- package/dist/components/chat/Suggestions.d.ts +9 -0
- package/dist/components/chat/Suggestions.js +81 -0
- package/dist/components/chat/Suggestions.js.map +1 -0
- package/dist/components/chat/Suggestions.mjs +10 -0
- package/dist/components/chat/Suggestions.mjs.map +1 -0
- package/dist/components/chat/Textarea.d.ts +15 -0
- package/dist/components/chat/Textarea.js +84 -0
- package/dist/components/chat/Textarea.js.map +1 -0
- package/dist/components/chat/Textarea.mjs +8 -0
- package/dist/components/chat/Textarea.mjs.map +1 -0
- package/dist/components/chat/Window.d.ts +9 -0
- package/dist/components/chat/Window.js +164 -0
- package/dist/components/chat/Window.js.map +1 -0
- package/dist/components/chat/Window.mjs +10 -0
- package/dist/components/chat/Window.mjs.map +1 -0
- package/dist/components/chat/index.d.ts +18 -0
- package/dist/components/chat/index.js +3122 -0
- package/dist/components/chat/index.js.map +1 -0
- package/dist/components/chat/index.mjs +69 -0
- package/dist/components/chat/index.mjs.map +1 -0
- package/dist/components/chat/messages/AssistantMessage.d.ts +9 -0
- package/dist/components/chat/messages/AssistantMessage.js +775 -0
- package/dist/components/chat/messages/AssistantMessage.js.map +1 -0
- package/dist/components/chat/messages/AssistantMessage.mjs +13 -0
- package/dist/components/chat/messages/AssistantMessage.mjs.map +1 -0
- package/dist/components/chat/messages/ErrorMessage.d.ts +9 -0
- package/dist/components/chat/messages/ErrorMessage.js +722 -0
- package/dist/components/chat/messages/ErrorMessage.js.map +1 -0
- package/dist/components/chat/messages/ErrorMessage.mjs +66 -0
- package/dist/components/chat/messages/ErrorMessage.mjs.map +1 -0
- package/dist/components/chat/messages/ImageRenderer.d.ts +12 -0
- package/dist/components/chat/messages/ImageRenderer.js +58 -0
- package/dist/components/chat/messages/ImageRenderer.js.map +1 -0
- package/dist/components/chat/messages/ImageRenderer.mjs +8 -0
- package/dist/components/chat/messages/ImageRenderer.mjs.map +1 -0
- package/dist/components/chat/messages/LegacyRenderMessage.d.ts +28 -0
- package/dist/components/chat/messages/LegacyRenderMessage.js +1023 -0
- package/dist/components/chat/messages/LegacyRenderMessage.js.map +1 -0
- package/dist/components/chat/messages/LegacyRenderMessage.mjs +17 -0
- package/dist/components/chat/messages/LegacyRenderMessage.mjs.map +1 -0
- package/dist/components/chat/messages/RenderMessage.d.ts +9 -0
- package/dist/components/chat/messages/RenderMessage.js +898 -0
- package/dist/components/chat/messages/RenderMessage.js.map +1 -0
- package/dist/components/chat/messages/RenderMessage.mjs +16 -0
- package/dist/components/chat/messages/RenderMessage.mjs.map +1 -0
- package/dist/components/chat/messages/UserMessage.d.ts +9 -0
- package/dist/components/chat/messages/UserMessage.js +56 -0
- package/dist/components/chat/messages/UserMessage.js.map +1 -0
- package/dist/components/chat/messages/UserMessage.mjs +8 -0
- package/dist/components/chat/messages/UserMessage.mjs.map +1 -0
- package/dist/components/chat/props.d.ts +298 -0
- package/dist/components/chat/props.js +19 -0
- package/dist/components/chat/props.js.map +1 -0
- package/dist/components/chat/props.mjs +2 -0
- package/dist/components/chat/props.mjs.map +1 -0
- package/dist/components/dev-console/console.d.ts +11 -0
- package/dist/components/dev-console/console.js +537 -0
- package/dist/components/dev-console/console.js.map +1 -0
- package/dist/components/dev-console/console.mjs +17 -0
- package/dist/components/dev-console/console.mjs.map +1 -0
- package/dist/components/dev-console/icons.d.ts +9 -0
- package/dist/components/dev-console/icons.js +131 -0
- package/dist/components/dev-console/icons.js.map +1 -0
- package/dist/components/dev-console/icons.mjs +16 -0
- package/dist/components/dev-console/icons.mjs.map +1 -0
- package/dist/components/dev-console/index.d.ts +3 -0
- package/dist/components/dev-console/index.js +537 -0
- package/dist/components/dev-console/index.js.map +1 -0
- package/dist/components/dev-console/index.mjs +18 -0
- package/dist/components/dev-console/index.mjs.map +1 -0
- package/dist/components/dev-console/types.d.ts +9 -0
- package/dist/components/dev-console/types.js +19 -0
- package/dist/components/dev-console/types.js.map +1 -0
- package/dist/components/dev-console/types.mjs +1 -0
- package/dist/components/dev-console/types.mjs.map +1 -0
- package/dist/components/dev-console/utils.d.ts +10 -0
- package/dist/components/dev-console/utils.js +177 -0
- package/dist/components/dev-console/utils.js.map +1 -0
- package/dist/components/dev-console/utils.mjs +16 -0
- package/dist/components/dev-console/utils.mjs.map +1 -0
- package/dist/components/help-modal/icons.d.ts +9 -0
- package/dist/components/help-modal/icons.js +107 -0
- package/dist/components/help-modal/icons.js.map +1 -0
- package/dist/components/help-modal/icons.mjs +12 -0
- package/dist/components/help-modal/icons.mjs.map +1 -0
- package/dist/components/help-modal/index.d.ts +2 -0
- package/dist/components/help-modal/index.js +137 -0
- package/dist/components/help-modal/index.js.map +1 -0
- package/dist/components/help-modal/index.mjs +10 -0
- package/dist/components/help-modal/index.mjs.map +1 -0
- package/dist/components/help-modal/modal.d.ts +5 -0
- package/dist/components/help-modal/modal.js +135 -0
- package/dist/components/help-modal/modal.js.map +1 -0
- package/dist/components/help-modal/modal.mjs +9 -0
- package/dist/components/help-modal/modal.mjs.map +1 -0
- package/dist/components/index.d.ts +19 -0
- package/dist/components/index.js +3126 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index.mjs +76 -0
- package/dist/components/index.mjs.map +1 -0
- package/dist/context/index.d.ts +2 -0
- package/dist/context/index.js +19 -0
- package/dist/context/index.js.map +1 -0
- package/dist/context/index.mjs +2 -0
- package/dist/context/index.mjs.map +1 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +36 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/index.mjs +9 -0
- package/dist/hooks/index.mjs.map +1 -0
- package/dist/hooks/use-copilot-chat-suggestions.d.ts +66 -0
- package/dist/hooks/use-copilot-chat-suggestions.js +34 -0
- package/dist/hooks/use-copilot-chat-suggestions.js.map +1 -0
- package/dist/hooks/use-copilot-chat-suggestions.mjs +8 -0
- package/dist/hooks/use-copilot-chat-suggestions.mjs.map +1 -0
- package/dist/hooks/use-copy-to-clipboard.d.ts +9 -0
- package/dist/hooks/use-copy-to-clipboard.js +60 -0
- package/dist/hooks/use-copy-to-clipboard.js.map +1 -0
- package/dist/hooks/use-copy-to-clipboard.mjs +8 -0
- package/dist/hooks/use-copy-to-clipboard.mjs.map +1 -0
- package/dist/hooks/use-dark-mode.d.ts +3 -0
- package/dist/hooks/use-dark-mode.js +35 -0
- package/dist/hooks/use-dark-mode.js.map +1 -0
- package/dist/hooks/use-dark-mode.mjs +8 -0
- package/dist/hooks/use-dark-mode.mjs.map +1 -0
- package/dist/hooks/use-push-to-talk.d.ts +19 -0
- package/dist/hooks/use-push-to-talk.js +195 -0
- package/dist/hooks/use-push-to-talk.js.map +1 -0
- package/dist/hooks/use-push-to-talk.mjs +12 -0
- package/dist/hooks/use-push-to-talk.mjs.map +1 -0
- package/dist/index.css +1258 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +3135 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +84 -0
- package/dist/index.mjs.map +1 -0
- package/dist/lib/utils.d.ts +4 -0
- package/dist/lib/utils.js +76 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/utils.mjs +34 -0
- package/dist/lib/utils.mjs.map +1 -0
- package/dist/types/css.d.ts +22 -0
- package/dist/types/css.js +19 -0
- package/dist/types/css.js.map +1 -0
- package/dist/types/css.mjs +1 -0
- package/dist/types/css.mjs.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.js +19 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/index.mjs +2 -0
- package/dist/types/index.mjs.map +1 -0
- package/dist/types/suggestions.d.ts +9 -0
- package/dist/types/suggestions.js +19 -0
- package/dist/types/suggestions.js.map +1 -0
- package/dist/types/suggestions.mjs +1 -0
- package/dist/types/suggestions.mjs.map +1 -0
- package/dist/v2/index.css +4 -0
- package/dist/v2/index.css.map +1 -0
- package/dist/v2/index.d.ts +2 -0
- package/dist/v2/index.js +2 -0
- package/dist/v2/index.js.map +1 -0
- package/dist/v2/index.mjs +2 -0
- package/dist/v2/index.mjs.map +1 -0
- package/jest.config.js +5 -0
- package/package.json +83 -0
- package/postcss.config.js +60 -0
- package/src/components/chat/Button.tsx +18 -0
- package/src/components/chat/Chat.tsx +795 -0
- package/src/components/chat/ChatContext.tsx +248 -0
- package/src/components/chat/CodeBlock.tsx +418 -0
- package/src/components/chat/Header.tsx +24 -0
- package/src/components/chat/Icons.tsx +237 -0
- package/src/components/chat/ImageUploadQueue.tsx +77 -0
- package/src/components/chat/Input.tsx +156 -0
- package/src/components/chat/Markdown.tsx +144 -0
- package/src/components/chat/Messages.tsx +206 -0
- package/src/components/chat/Modal.tsx +220 -0
- package/src/components/chat/Popup.tsx +77 -0
- package/src/components/chat/PoweredByTag.tsx +42 -0
- package/src/components/chat/Sidebar.tsx +96 -0
- package/src/components/chat/Suggestion.tsx +29 -0
- package/src/components/chat/Suggestions.tsx +23 -0
- package/src/components/chat/Textarea.tsx +77 -0
- package/src/components/chat/Window.tsx +152 -0
- package/src/components/chat/index.tsx +11 -0
- package/src/components/chat/messages/AssistantMessage.tsx +118 -0
- package/src/components/chat/messages/ErrorMessage.tsx +59 -0
- package/src/components/chat/messages/ImageRenderer.tsx +37 -0
- package/src/components/chat/messages/LegacyRenderMessage.tsx +150 -0
- package/src/components/chat/messages/RenderMessage.tsx +61 -0
- package/src/components/chat/messages/UserMessage.tsx +46 -0
- package/src/components/chat/props.ts +353 -0
- package/src/components/dev-console/console.tsx +242 -0
- package/src/components/dev-console/icons.tsx +99 -0
- package/src/components/dev-console/index.tsx +2 -0
- package/src/components/dev-console/types.ts +7 -0
- package/src/components/dev-console/utils.ts +142 -0
- package/src/components/help-modal/icons.tsx +68 -0
- package/src/components/help-modal/index.tsx +1 -0
- package/src/components/help-modal/modal.tsx +101 -0
- package/src/components/index.ts +2 -0
- package/src/context/index.ts +1 -0
- package/src/css/animations.css +35 -0
- package/src/css/button.css +67 -0
- package/src/css/colors.css +78 -0
- package/src/css/console.css +166 -0
- package/src/css/crew.css +277 -0
- package/src/css/header.css +65 -0
- package/src/css/input.css +152 -0
- package/src/css/markdown.css +150 -0
- package/src/css/messages.css +244 -0
- package/src/css/panel.css +39 -0
- package/src/css/popup.css +22 -0
- package/src/css/sidebar.css +34 -0
- package/src/css/suggestions.css +43 -0
- package/src/css/window.css +60 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use-copilot-chat-suggestions.tsx +71 -0
- package/src/hooks/use-copy-to-clipboard.tsx +29 -0
- package/src/hooks/use-dark-mode.ts +10 -0
- package/src/hooks/use-push-to-talk.tsx +167 -0
- package/src/index.tsx +7 -0
- package/src/lib/utils.test.ts +7 -0
- package/src/lib/utils.ts +27 -0
- package/src/styles.css +14 -0
- package/src/types/css.ts +21 -0
- package/src/types/index.ts +2 -0
- package/src/types/suggestions.ts +7 -0
- package/src/v2/index.ts +1 -0
- package/src/v2/styles.css +1 -0
- package/tailwind.config.js +7 -0
- package/tsconfig.json +12 -0
- package/tsup.config.ts +11 -0
- package/typedoc.json +4 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
.copilotKitWindow {
|
|
2
|
+
position: fixed;
|
|
3
|
+
inset: 0px;
|
|
4
|
+
transform-origin: bottom;
|
|
5
|
+
border-color: rgb(229 231 235);
|
|
6
|
+
background-color: var(--copilot-kit-background-color);
|
|
7
|
+
border-radius: 0.75rem;
|
|
8
|
+
box-shadow: rgba(0, 0, 0, 0.16) 0px 5px 40px;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
transition:
|
|
11
|
+
opacity 100ms ease-out,
|
|
12
|
+
transform 200ms ease-out;
|
|
13
|
+
opacity: 0;
|
|
14
|
+
transform: scale(0.95) translateY(20px);
|
|
15
|
+
display: flex;
|
|
16
|
+
pointer-events: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.copilotKitSidebar .copilotKitWindow {
|
|
20
|
+
border-radius: 0;
|
|
21
|
+
opacity: 1;
|
|
22
|
+
transform: translateX(100%);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.copilotKitWindow.open {
|
|
26
|
+
opacity: 1;
|
|
27
|
+
transform: scale(1) translateY(0);
|
|
28
|
+
pointer-events: auto;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.copilotKitSidebar .copilotKitWindow.open {
|
|
32
|
+
transform: translateX(0);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@media (min-width: 640px) {
|
|
36
|
+
.copilotKitWindow {
|
|
37
|
+
transform-origin: bottom right;
|
|
38
|
+
bottom: 5rem;
|
|
39
|
+
right: 1rem;
|
|
40
|
+
top: auto;
|
|
41
|
+
left: auto;
|
|
42
|
+
border-width: 0px;
|
|
43
|
+
margin-bottom: 1rem;
|
|
44
|
+
width: 24rem;
|
|
45
|
+
height: 600px;
|
|
46
|
+
min-height: 200px;
|
|
47
|
+
max-height: calc(100% - 6rem);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.copilotKitSidebar .copilotKitWindow {
|
|
51
|
+
bottom: 0;
|
|
52
|
+
right: 0;
|
|
53
|
+
top: auto;
|
|
54
|
+
left: auto;
|
|
55
|
+
width: 28rem;
|
|
56
|
+
min-height: 100%;
|
|
57
|
+
margin-bottom: 0;
|
|
58
|
+
max-height: none;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./use-copilot-chat-suggestions";
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* <Callout type="warning">
|
|
3
|
+
* useCopilotChatSuggestions is experimental. The interface is not final and
|
|
4
|
+
* can change without notice.
|
|
5
|
+
* </Callout>
|
|
6
|
+
*
|
|
7
|
+
* `useCopilotReadable` is a React hook that provides app-state and other information
|
|
8
|
+
* to the Copilot. Optionally, the hook can also handle hierarchical state within your
|
|
9
|
+
* application, passing these parent-child relationships to the Copilot.
|
|
10
|
+
*
|
|
11
|
+
* <br/>
|
|
12
|
+
* <img src="https://cdn.copilotkit.ai/docs/copilotkit/images/use-copilot-chat-suggestions/use-copilot-chat-suggestions.gif" width="500" />
|
|
13
|
+
*
|
|
14
|
+
* ## Usage
|
|
15
|
+
*
|
|
16
|
+
* ### Install Dependencies
|
|
17
|
+
*
|
|
18
|
+
* This component is part of the [@copilotkit/react-ui](https://npmjs.com/package/@copilotkit/react-ui) package.
|
|
19
|
+
*
|
|
20
|
+
* ```shell npm2yarn \"@copilotkit/react-ui"\
|
|
21
|
+
* npm install @copilotkit/react-core @copilotkit/react-ui
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* ### Simple Usage
|
|
25
|
+
*
|
|
26
|
+
* ```tsx
|
|
27
|
+
* import { useCopilotChatSuggestions } from "@copilotkit/react-ui";
|
|
28
|
+
*
|
|
29
|
+
* export function MyComponent() {
|
|
30
|
+
* const [employees, setEmployees] = useState([]);
|
|
31
|
+
*
|
|
32
|
+
* useCopilotChatSuggestions({
|
|
33
|
+
* instructions: `The following employees are on duty: ${JSON.stringify(employees)}`,
|
|
34
|
+
* });
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* ### Dependency Management
|
|
39
|
+
*
|
|
40
|
+
* ```tsx
|
|
41
|
+
* import { useCopilotChatSuggestions } from "@copilotkit/react-ui";
|
|
42
|
+
*
|
|
43
|
+
* export function MyComponent() {
|
|
44
|
+
* useCopilotChatSuggestions(
|
|
45
|
+
* {
|
|
46
|
+
* instructions: "Suggest the most relevant next actions.",
|
|
47
|
+
* },
|
|
48
|
+
* [appState],
|
|
49
|
+
* );
|
|
50
|
+
* }
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* In the example above, the suggestions are generated based on the given instructions.
|
|
54
|
+
* The hook monitors `appState`, and updates suggestions accordingly whenever it changes.
|
|
55
|
+
*
|
|
56
|
+
* ### Behavior and Lifecycle
|
|
57
|
+
*
|
|
58
|
+
* The hook registers the configuration with the chat context upon component mount and
|
|
59
|
+
* removes it on unmount, ensuring a clean and efficient lifecycle management.
|
|
60
|
+
*/
|
|
61
|
+
import {
|
|
62
|
+
useCopilotChatSuggestions as useCoreCopilotChatSuggestions,
|
|
63
|
+
type UseCopilotChatSuggestionsConfiguration,
|
|
64
|
+
} from "@copilotkit/react-core";
|
|
65
|
+
|
|
66
|
+
export function useCopilotChatSuggestions(
|
|
67
|
+
config: UseCopilotChatSuggestionsConfiguration,
|
|
68
|
+
dependencies: any[] = [],
|
|
69
|
+
) {
|
|
70
|
+
useCoreCopilotChatSuggestions(config, dependencies);
|
|
71
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
export interface useCopyToClipboardProps {
|
|
4
|
+
timeout?: number;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function useCopyToClipboard({ timeout = 2000 }: useCopyToClipboardProps) {
|
|
8
|
+
const [isCopied, setIsCopied] = React.useState<Boolean>(false);
|
|
9
|
+
|
|
10
|
+
const copyToClipboard = (value: string) => {
|
|
11
|
+
if (typeof window === "undefined" || !navigator.clipboard?.writeText) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (!value) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
navigator.clipboard.writeText(value).then(() => {
|
|
20
|
+
setIsCopied(true);
|
|
21
|
+
|
|
22
|
+
setTimeout(() => {
|
|
23
|
+
setIsCopied(false);
|
|
24
|
+
}, timeout);
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return { isCopied, copyToClipboard };
|
|
29
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const useDarkMode = () => {
|
|
2
|
+
if (typeof window === "undefined") return false;
|
|
3
|
+
return (
|
|
4
|
+
document.documentElement.classList.contains("dark") ||
|
|
5
|
+
document.body.classList.contains("dark") ||
|
|
6
|
+
document.documentElement.getAttribute("data-theme") === "dark" ||
|
|
7
|
+
document.body.getAttribute("data-theme") === "dark" ||
|
|
8
|
+
window.matchMedia("(prefers-color-scheme: dark)").matches
|
|
9
|
+
);
|
|
10
|
+
};
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { useCopilotContext, useCopilotMessagesContext } from "@copilotkit/react-core";
|
|
2
|
+
import { gqlToAGUI } from "@copilotkit/runtime-client-gql";
|
|
3
|
+
import { Message } from "@copilotkit/shared";
|
|
4
|
+
import { MutableRefObject, useEffect, useRef, useState } from "react";
|
|
5
|
+
|
|
6
|
+
export const checkMicrophonePermission = async () => {
|
|
7
|
+
try {
|
|
8
|
+
const permissionStatus = await navigator.permissions.query({
|
|
9
|
+
name: "microphone" as PermissionName,
|
|
10
|
+
});
|
|
11
|
+
if (permissionStatus.state === "granted") {
|
|
12
|
+
return true;
|
|
13
|
+
} else {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
} catch (err) {
|
|
17
|
+
console.error("Error checking microphone permission", err);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const requestMicAndPlaybackPermission = async () => {
|
|
22
|
+
try {
|
|
23
|
+
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
|
|
24
|
+
const audioContext = new window.AudioContext();
|
|
25
|
+
await audioContext.resume();
|
|
26
|
+
return { stream, audioContext };
|
|
27
|
+
} catch (err) {
|
|
28
|
+
console.error("Error requesting microphone and playback permissions", err);
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const startRecording = async (
|
|
34
|
+
mediaStreamRef: MutableRefObject<MediaStream | null>,
|
|
35
|
+
mediaRecorderRef: MutableRefObject<MediaRecorder | null>,
|
|
36
|
+
audioContextRef: MutableRefObject<AudioContext | null>,
|
|
37
|
+
recordedChunks: Blob[],
|
|
38
|
+
onStop: () => void,
|
|
39
|
+
) => {
|
|
40
|
+
if (!mediaStreamRef.current || !audioContextRef.current) {
|
|
41
|
+
mediaStreamRef.current = await navigator.mediaDevices.getUserMedia({ audio: true });
|
|
42
|
+
audioContextRef.current = new window.AudioContext();
|
|
43
|
+
await audioContextRef.current.resume();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
mediaRecorderRef.current = new MediaRecorder(mediaStreamRef.current!);
|
|
47
|
+
mediaRecorderRef.current.start(1000);
|
|
48
|
+
mediaRecorderRef.current.ondataavailable = (event) => {
|
|
49
|
+
recordedChunks.push(event.data);
|
|
50
|
+
};
|
|
51
|
+
mediaRecorderRef.current.onstop = onStop;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const stopRecording = (mediaRecorderRef: MutableRefObject<MediaRecorder | null>) => {
|
|
55
|
+
if (mediaRecorderRef.current && mediaRecorderRef.current.state !== "inactive") {
|
|
56
|
+
mediaRecorderRef.current.stop();
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const transcribeAudio = async (recordedChunks: Blob[], transcribeAudioUrl: string) => {
|
|
61
|
+
const completeBlob = new Blob(recordedChunks, { type: "audio/mp4" });
|
|
62
|
+
const formData = new FormData();
|
|
63
|
+
formData.append("file", completeBlob, "recording.mp4");
|
|
64
|
+
|
|
65
|
+
const response = await fetch(transcribeAudioUrl, {
|
|
66
|
+
method: "POST",
|
|
67
|
+
body: formData,
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
if (!response.ok) {
|
|
71
|
+
throw new Error(`Error: ${response.statusText}`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const transcription = await response.json();
|
|
75
|
+
return transcription.text;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const playAudioResponse = (text: string, textToSpeechUrl: string, audioContext: AudioContext) => {
|
|
79
|
+
const encodedText = encodeURIComponent(text);
|
|
80
|
+
const url = `${textToSpeechUrl}?text=${encodedText}`;
|
|
81
|
+
|
|
82
|
+
fetch(url)
|
|
83
|
+
.then((response) => response.arrayBuffer())
|
|
84
|
+
.then((arrayBuffer) => audioContext.decodeAudioData(arrayBuffer))
|
|
85
|
+
.then((audioBuffer) => {
|
|
86
|
+
const source = audioContext.createBufferSource();
|
|
87
|
+
source.buffer = audioBuffer;
|
|
88
|
+
source.connect(audioContext.destination);
|
|
89
|
+
source.start(0);
|
|
90
|
+
})
|
|
91
|
+
.catch((error) => {
|
|
92
|
+
console.error("Error with decoding audio data", error);
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export type PushToTalkState = "idle" | "recording" | "transcribing";
|
|
97
|
+
|
|
98
|
+
export type SendFunction = (text: string) => Promise<Message>;
|
|
99
|
+
|
|
100
|
+
export const usePushToTalk = ({
|
|
101
|
+
sendFunction,
|
|
102
|
+
inProgress,
|
|
103
|
+
}: {
|
|
104
|
+
sendFunction: SendFunction;
|
|
105
|
+
inProgress: boolean;
|
|
106
|
+
}) => {
|
|
107
|
+
const [pushToTalkState, setPushToTalkState] = useState<PushToTalkState>("idle");
|
|
108
|
+
const mediaStreamRef = useRef<MediaStream | null>(null);
|
|
109
|
+
const audioContextRef = useRef<AudioContext | null>(null);
|
|
110
|
+
const mediaRecorderRef = useRef<MediaRecorder | null>(null);
|
|
111
|
+
const recordedChunks = useRef<Blob[]>([]);
|
|
112
|
+
const generalContext = useCopilotContext();
|
|
113
|
+
const messagesContext = useCopilotMessagesContext();
|
|
114
|
+
const context = { ...generalContext, ...messagesContext };
|
|
115
|
+
const [startReadingFromMessageId, setStartReadingFromMessageId] = useState<string | null>(null);
|
|
116
|
+
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
if (pushToTalkState === "recording") {
|
|
119
|
+
startRecording(
|
|
120
|
+
mediaStreamRef,
|
|
121
|
+
mediaRecorderRef,
|
|
122
|
+
audioContextRef,
|
|
123
|
+
recordedChunks.current,
|
|
124
|
+
() => {
|
|
125
|
+
setPushToTalkState("transcribing");
|
|
126
|
+
},
|
|
127
|
+
);
|
|
128
|
+
} else {
|
|
129
|
+
stopRecording(mediaRecorderRef);
|
|
130
|
+
if (pushToTalkState === "transcribing") {
|
|
131
|
+
transcribeAudio(recordedChunks.current, context.copilotApiConfig.transcribeAudioUrl!).then(
|
|
132
|
+
async (transcription) => {
|
|
133
|
+
recordedChunks.current = [];
|
|
134
|
+
setPushToTalkState("idle");
|
|
135
|
+
const message = await sendFunction(transcription);
|
|
136
|
+
setStartReadingFromMessageId(message.id);
|
|
137
|
+
},
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return () => {
|
|
143
|
+
stopRecording(mediaRecorderRef);
|
|
144
|
+
};
|
|
145
|
+
}, [pushToTalkState]);
|
|
146
|
+
|
|
147
|
+
useEffect(() => {
|
|
148
|
+
if (inProgress === false && startReadingFromMessageId) {
|
|
149
|
+
const lastMessageIndex = context.messages.findIndex(
|
|
150
|
+
(message) => message.id === startReadingFromMessageId,
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
const aguiMessages = gqlToAGUI(context.messages);
|
|
154
|
+
|
|
155
|
+
const messagesAfterLast = aguiMessages
|
|
156
|
+
.slice(lastMessageIndex + 1)
|
|
157
|
+
.filter((message) => message.role === "assistant");
|
|
158
|
+
|
|
159
|
+
const text = messagesAfterLast.map((message) => message.content).join("\n");
|
|
160
|
+
playAudioResponse(text, context.copilotApiConfig.textToSpeechUrl!, audioContextRef.current!);
|
|
161
|
+
|
|
162
|
+
setStartReadingFromMessageId(null);
|
|
163
|
+
}
|
|
164
|
+
}, [startReadingFromMessageId, inProgress]);
|
|
165
|
+
|
|
166
|
+
return { pushToTalkState, setPushToTalkState };
|
|
167
|
+
};
|
package/src/index.tsx
ADDED
package/src/lib/utils.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export async function fetcher<JSON = any>(input: RequestInfo, init?: RequestInit): Promise<JSON> {
|
|
2
|
+
const res = await fetch(input, init);
|
|
3
|
+
|
|
4
|
+
if (!res.ok) {
|
|
5
|
+
const json = await res.json();
|
|
6
|
+
if (json.error) {
|
|
7
|
+
const error = new Error(json.error) as Error & {
|
|
8
|
+
status: number;
|
|
9
|
+
};
|
|
10
|
+
error.status = res.status;
|
|
11
|
+
throw error;
|
|
12
|
+
} else {
|
|
13
|
+
throw new Error("An unexpected error occurred");
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return res.json();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function formatDate(input: string | number | Date): string {
|
|
21
|
+
const date = new Date(input);
|
|
22
|
+
return date.toLocaleDateString("en-US", {
|
|
23
|
+
month: "long",
|
|
24
|
+
day: "numeric",
|
|
25
|
+
year: "numeric",
|
|
26
|
+
});
|
|
27
|
+
}
|
package/src/styles.css
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
@import "./css/colors.css";
|
|
2
|
+
@import "./css/popup.css";
|
|
3
|
+
@import "./css/sidebar.css";
|
|
4
|
+
@import "./css/button.css";
|
|
5
|
+
@import "./css/header.css";
|
|
6
|
+
@import "./css/input.css";
|
|
7
|
+
@import "./css/messages.css";
|
|
8
|
+
@import "./css/window.css";
|
|
9
|
+
@import "./css/animations.css";
|
|
10
|
+
@import "./css/markdown.css";
|
|
11
|
+
@import "./css/suggestions.css";
|
|
12
|
+
@import "./css/panel.css";
|
|
13
|
+
@import "./css/console.css";
|
|
14
|
+
@import "./css/crew.css";
|
package/src/types/css.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// autogenerated (see postcss.config.js) - do not edit
|
|
2
|
+
import { CSSProperties } from "react";
|
|
3
|
+
|
|
4
|
+
export interface CopilotKitCSSProperties extends CSSProperties {
|
|
5
|
+
"--copilot-kit-primary-color"?: string;
|
|
6
|
+
"--copilot-kit-contrast-color"?: string;
|
|
7
|
+
"--copilot-kit-background-color"?: string;
|
|
8
|
+
"--copilot-kit-input-background-color"?: string;
|
|
9
|
+
"--copilot-kit-secondary-color"?: string;
|
|
10
|
+
"--copilot-kit-secondary-contrast-color"?: string;
|
|
11
|
+
"--copilot-kit-separator-color"?: string;
|
|
12
|
+
"--copilot-kit-muted-color"?: string;
|
|
13
|
+
"--copilot-kit-error-background"?: string;
|
|
14
|
+
"--copilot-kit-error-border"?: string;
|
|
15
|
+
"--copilot-kit-error-text"?: string;
|
|
16
|
+
"--copilot-kit-shadow-sm"?: string;
|
|
17
|
+
"--copilot-kit-shadow-md"?: string;
|
|
18
|
+
"--copilot-kit-shadow-lg"?: string;
|
|
19
|
+
"--copilot-kit-dev-console-bg"?: string;
|
|
20
|
+
"--copilot-kit-dev-console-text"?: string;
|
|
21
|
+
}
|
package/src/v2/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./styles.css";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import "@copilotkit/react-core/v2/styles.css";
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../utilities/tsconfig/react-library.json",
|
|
3
|
+
"include": ["."],
|
|
4
|
+
"exclude": [
|
|
5
|
+
"dist",
|
|
6
|
+
"build",
|
|
7
|
+
"node_modules",
|
|
8
|
+
"**/*.test.ts", // Exclude TypeScript test files
|
|
9
|
+
"**/*.test.tsx", // Exclude TypeScript React test files
|
|
10
|
+
"**/__tests__/*" // Exclude any files inside a __tests__ directory
|
|
11
|
+
]
|
|
12
|
+
}
|
package/tsup.config.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { defineConfig, Options } from "tsup";
|
|
2
|
+
|
|
3
|
+
export default defineConfig((options: Options) => ({
|
|
4
|
+
entry: ["src/**/*.{ts,tsx}", "!src/**/*.test.{ts,tsx}", "!src/**/__tests__/**/*"],
|
|
5
|
+
format: ["esm", "cjs"],
|
|
6
|
+
dts: true,
|
|
7
|
+
minify: false,
|
|
8
|
+
external: ["react", "@copilotkitnext/core", "@copilotkitnext/react"],
|
|
9
|
+
sourcemap: true,
|
|
10
|
+
...options,
|
|
11
|
+
}));
|
package/typedoc.json
ADDED