@copilotkit/react-ui 0.0.0-main-20250416144141 → 0.0.0-main-20260126221712
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 +14287 -15
- package/LICENSE +21 -0
- package/README.md +124 -29
- package/dist/chunk-3W6J75HS.mjs +126 -0
- package/dist/chunk-3W6J75HS.mjs.map +1 -0
- package/dist/{chunk-X6EFGEBJ.mjs → chunk-4S4ZEKE6.mjs} +2 -2
- package/dist/chunk-4S4ZEKE6.mjs.map +1 -0
- package/dist/chunk-6TWQUA2Q.mjs +31 -0
- package/dist/chunk-6TWQUA2Q.mjs.map +1 -0
- package/dist/{chunk-HIORSNVD.mjs → chunk-C3GSYRC3.mjs} +9 -37
- 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-ELGRNEAO.mjs +32 -0
- package/dist/chunk-ELGRNEAO.mjs.map +1 -0
- package/dist/{chunk-D5XIJNXQ.mjs → chunk-FFJHOZX6.mjs} +11 -13
- package/dist/chunk-FFJHOZX6.mjs.map +1 -0
- package/dist/{chunk-2OTVZXDX.mjs → chunk-GDSZGYCE.mjs} +3 -3
- package/dist/chunk-HKZL4P3F.mjs +222 -0
- package/dist/chunk-HKZL4P3F.mjs.map +1 -0
- package/dist/{chunk-UN2E3HCK.mjs → chunk-IEMQ2SQW.mjs} +6 -4
- package/dist/chunk-IEMQ2SQW.mjs.map +1 -0
- package/dist/{chunk-PCTCOQK2.mjs → chunk-IK2BPURM.mjs} +15 -4
- package/dist/chunk-IK2BPURM.mjs.map +1 -0
- package/dist/{chunk-6TCUJ3B7.mjs → chunk-JY2CSDKN.mjs} +4 -15
- package/dist/chunk-JY2CSDKN.mjs.map +1 -0
- package/dist/{chunk-SMJ3QQCE.mjs → chunk-O4PPO3K3.mjs} +2 -2
- package/dist/chunk-O4PPO3K3.mjs.map +1 -0
- package/dist/{chunk-S5MBUNGN.mjs → chunk-O72ZB5V3.mjs} +4 -4
- package/dist/chunk-O72ZB5V3.mjs.map +1 -0
- package/dist/chunk-PKSW6ZMQ.mjs +133 -0
- package/dist/chunk-PKSW6ZMQ.mjs.map +1 -0
- package/dist/chunk-PLHTVHUW.mjs +82 -0
- package/dist/chunk-PLHTVHUW.mjs.map +1 -0
- package/dist/{chunk-YQFVRDNC.mjs → chunk-QIOJXTIQ.mjs} +13 -2
- package/dist/chunk-QIOJXTIQ.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-5M7ODWKH.mjs → chunk-SLM2AOHF.mjs} +23 -19
- package/dist/chunk-SLM2AOHF.mjs.map +1 -0
- package/dist/{chunk-YOEL33HG.mjs → chunk-UFN2VWSR.mjs} +2 -2
- package/dist/chunk-UH5GQ7QF.mjs +184 -0
- package/dist/chunk-UH5GQ7QF.mjs.map +1 -0
- package/dist/chunk-VHKHX7GV.mjs +31 -0
- package/dist/chunk-VHKHX7GV.mjs.map +1 -0
- package/dist/{chunk-62QMTKMJ.mjs → chunk-XEZ5ODJS.mjs} +35 -19
- package/dist/chunk-XEZ5ODJS.mjs.map +1 -0
- package/dist/chunk-XOBQLKUU.mjs +118 -0
- package/dist/chunk-XOBQLKUU.mjs.map +1 -0
- package/dist/{chunk-ORSMX3SE.mjs → chunk-XWG3L6QC.mjs} +15 -1
- package/dist/{chunk-ORSMX3SE.mjs.map → chunk-XWG3L6QC.mjs.map} +1 -1
- package/dist/chunk-Y4FKRAKJ.mjs +12 -0
- package/dist/chunk-Y4FKRAKJ.mjs.map +1 -0
- package/dist/chunk-YQOESY4Y.mjs +435 -0
- package/dist/chunk-YQOESY4Y.mjs.map +1 -0
- package/dist/components/chat/Button.d.ts +3 -1
- package/dist/components/chat/Button.js.map +1 -1
- package/dist/components/chat/Button.mjs +3 -3
- package/dist/components/chat/Chat.d.ts +89 -53
- package/dist/components/chat/Chat.js +1324 -1112
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +21 -20
- package/dist/components/chat/ChatContext.d.ts +5 -0
- package/dist/components/chat/ChatContext.js +15 -1
- package/dist/components/chat/ChatContext.js.map +1 -1
- package/dist/components/chat/ChatContext.mjs +2 -2
- package/dist/components/chat/CodeBlock.js +12 -1
- package/dist/components/chat/CodeBlock.js.map +1 -1
- package/dist/components/chat/CodeBlock.mjs +2 -2
- package/dist/components/chat/Header.d.ts +3 -1
- package/dist/components/chat/Header.js +8 -21
- package/dist/components/chat/Header.js.map +1 -1
- package/dist/components/chat/Header.mjs +6 -6
- package/dist/components/chat/Icons.d.ts +2 -1
- package/dist/components/chat/Icons.js +17 -2
- package/dist/components/chat/Icons.js.map +1 -1
- package/dist/components/chat/Icons.mjs +5 -3
- 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/Input.d.ts +4 -2
- package/dist/components/chat/Input.js +128 -65
- package/dist/components/chat/Input.js.map +1 -1
- package/dist/components/chat/Input.mjs +7 -5
- package/dist/components/chat/Markdown.d.ts +5 -1
- package/dist/components/chat/Markdown.js +84 -27
- package/dist/components/chat/Markdown.js.map +1 -1
- package/dist/components/chat/Markdown.mjs +3 -3
- package/dist/components/chat/Messages.d.ts +7 -6
- package/dist/components/chat/Messages.js +1061 -116
- package/dist/components/chat/Messages.js.map +1 -1
- package/dist/components/chat/Messages.mjs +11 -3
- package/dist/components/chat/Modal.d.ts +3 -3
- package/dist/components/chat/Modal.js +1464 -1193
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +25 -23
- package/dist/components/chat/Popup.d.ts +2 -2
- package/dist/components/chat/Popup.js +1467 -1196
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +26 -24
- 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/Sidebar.d.ts +2 -2
- package/dist/components/chat/Sidebar.js +1469 -1198
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +26 -24
- package/dist/components/chat/Suggestion.d.ts +7 -9
- package/dist/components/chat/Suggestion.js +10 -99
- package/dist/components/chat/Suggestion.js.map +1 -1
- package/dist/components/chat/Suggestion.mjs +4 -6
- package/dist/components/chat/Suggestions.d.ts +9 -0
- package/dist/components/chat/Suggestions.js +82 -0
- package/dist/components/chat/Suggestions.js.map +1 -0
- package/dist/components/chat/Suggestions.mjs +10 -0
- package/dist/components/chat/Textarea.d.ts +2 -0
- package/dist/components/chat/Textarea.js +12 -1
- package/dist/components/chat/Textarea.js.map +1 -1
- package/dist/components/chat/Textarea.mjs +1 -1
- package/dist/components/chat/Window.d.ts +3 -1
- package/dist/components/chat/Window.js +7 -41
- package/dist/components/chat/Window.js.map +1 -1
- package/dist/components/chat/Window.mjs +3 -4
- package/dist/components/chat/index.d.ts +8 -4
- package/dist/components/chat/index.js +1477 -1200
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +40 -29
- package/dist/components/chat/messages/AssistantMessage.d.ts +3 -1
- package/dist/components/chat/messages/AssistantMessage.js +106 -45
- package/dist/components/chat/messages/AssistantMessage.js.map +1 -1
- package/dist/components/chat/messages/AssistantMessage.mjs +5 -5
- package/dist/components/chat/messages/ErrorMessage.d.ts +9 -0
- package/dist/components/chat/messages/{RenderResultMessage.js → ErrorMessage.js} +125 -142
- 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/LegacyRenderMessage.d.ts +28 -0
- package/dist/components/chat/messages/{RenderActionExecutionMessage.js → LegacyRenderMessage.js} +376 -180
- 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/{RenderTextMessage.js → RenderMessage.js} +194 -68
- 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 +3 -1
- package/dist/components/chat/messages/UserMessage.js +23 -1
- package/dist/components/chat/messages/UserMessage.js.map +1 -1
- package/dist/components/chat/messages/UserMessage.mjs +1 -1
- package/dist/components/chat/props.d.ts +192 -24
- package/dist/components/chat/props.js.map +1 -1
- package/dist/components/dev-console/console.d.ts +1 -0
- package/dist/components/dev-console/console.js +8 -21
- package/dist/components/dev-console/console.js.map +1 -1
- package/dist/components/dev-console/console.mjs +4 -4
- package/dist/components/dev-console/index.d.ts +1 -3
- package/dist/components/dev-console/index.js +9 -22
- package/dist/components/dev-console/index.js.map +1 -1
- package/dist/components/dev-console/index.mjs +4 -4
- package/dist/components/dev-console/utils.d.ts +2 -2
- package/dist/components/dev-console/utils.js +2 -13
- package/dist/components/dev-console/utils.js.map +1 -1
- package/dist/components/dev-console/utils.mjs +1 -1
- package/dist/components/index.d.ts +9 -7
- package/dist/components/index.js +1478 -1201
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +40 -29
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +2 -24
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/hooks/use-copilot-chat-suggestions.d.ts +5 -27
- package/dist/hooks/use-copilot-chat-suggestions.js +2 -24
- package/dist/hooks/use-copilot-chat-suggestions.js.map +1 -1
- package/dist/hooks/use-copilot-chat-suggestions.mjs +1 -1
- package/dist/hooks/use-push-to-talk.d.ts +1 -1
- package/dist/hooks/use-push-to-talk.js +3 -3
- package/dist/hooks/use-push-to-talk.js.map +1 -1
- package/dist/hooks/use-push-to-talk.mjs +1 -1
- package/dist/index.css +143 -62
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +9 -7
- package/dist/index.js +1480 -1225
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +42 -31
- package/dist/types/css.d.ts +3 -0
- package/dist/types/css.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/suggestions.d.ts +1 -0
- package/dist/types/suggestions.js.map +1 -1
- package/dist/v2/index.css +4 -0
- package/dist/v2/index.css.map +1 -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/package.json +13 -14
- package/src/components/chat/Chat.tsx +479 -272
- package/src/components/chat/ChatContext.tsx +7 -0
- package/src/components/chat/CodeBlock.tsx +15 -3
- package/src/components/chat/Icons.tsx +14 -0
- package/src/components/chat/ImageUploadQueue.tsx +77 -0
- package/src/components/chat/Input.tsx +63 -27
- package/src/components/chat/Markdown.tsx +92 -34
- package/src/components/chat/Messages.tsx +106 -105
- package/src/components/chat/Modal.tsx +130 -36
- package/src/components/chat/Popup.tsx +21 -1
- package/src/components/chat/PoweredByTag.tsx +42 -0
- package/src/components/chat/Sidebar.tsx +23 -1
- package/src/components/chat/Suggestion.tsx +17 -112
- package/src/components/chat/Suggestions.tsx +23 -0
- package/src/components/chat/Textarea.tsx +17 -1
- package/src/components/chat/Window.tsx +2 -28
- package/src/components/chat/index.tsx +3 -0
- package/src/components/chat/messages/AssistantMessage.tsx +22 -15
- 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/{RenderTextMessage.tsx → RenderMessage.tsx} +20 -8
- package/src/components/chat/messages/UserMessage.tsx +42 -1
- package/src/components/chat/props.ts +225 -25
- package/src/components/dev-console/console.tsx +3 -5
- package/src/components/dev-console/utils.ts +1 -21
- package/src/css/colors.css +10 -0
- package/src/css/console.css +1 -1
- package/src/css/input.css +50 -3
- package/src/css/markdown.css +41 -28
- package/src/css/messages.css +65 -6
- package/src/css/suggestions.css +1 -1
- package/src/css/window.css +1 -29
- package/src/hooks/use-copilot-chat-suggestions.tsx +7 -58
- package/src/hooks/use-push-to-talk.tsx +6 -5
- package/src/styles.css +1 -1
- package/src/types/css.ts +3 -0
- package/src/types/index.ts +1 -0
- package/src/types/suggestions.ts +1 -0
- package/src/v2/index.ts +1 -0
- package/src/v2/styles.css +1 -0
- package/tsup.config.ts +2 -7
- package/dist/chunk-5M7ODWKH.mjs.map +0 -1
- package/dist/chunk-62QMTKMJ.mjs.map +0 -1
- package/dist/chunk-6TCUJ3B7.mjs.map +0 -1
- package/dist/chunk-D5XIJNXQ.mjs.map +0 -1
- package/dist/chunk-GOAED4H6.mjs +0 -106
- package/dist/chunk-GOAED4H6.mjs.map +0 -1
- package/dist/chunk-HEIDCT7I.mjs +0 -10
- package/dist/chunk-HEIDCT7I.mjs.map +0 -1
- package/dist/chunk-HIORSNVD.mjs.map +0 -1
- package/dist/chunk-NMNC4ROZ.mjs +0 -124
- package/dist/chunk-NMNC4ROZ.mjs.map +0 -1
- package/dist/chunk-PCTCOQK2.mjs.map +0 -1
- package/dist/chunk-Q2YY2NX3.mjs +0 -112
- package/dist/chunk-Q2YY2NX3.mjs.map +0 -1
- package/dist/chunk-QJKMOGWN.mjs +0 -106
- package/dist/chunk-QJKMOGWN.mjs.map +0 -1
- package/dist/chunk-S5MBUNGN.mjs.map +0 -1
- package/dist/chunk-SMJ3QQCE.mjs.map +0 -1
- package/dist/chunk-SQMEPWVT.mjs +0 -1
- package/dist/chunk-TOQ7P4DO.mjs +0 -104
- package/dist/chunk-TOQ7P4DO.mjs.map +0 -1
- package/dist/chunk-UN2E3HCK.mjs.map +0 -1
- package/dist/chunk-WNC6OCIB.mjs +0 -36
- package/dist/chunk-WNC6OCIB.mjs.map +0 -1
- package/dist/chunk-X6EFGEBJ.mjs.map +0 -1
- package/dist/chunk-XNQO5AZZ.mjs +0 -72
- package/dist/chunk-XNQO5AZZ.mjs.map +0 -1
- package/dist/chunk-YQFVRDNC.mjs.map +0 -1
- package/dist/chunk-Z4XPPVZT.mjs +0 -32
- package/dist/chunk-Z4XPPVZT.mjs.map +0 -1
- package/dist/chunk-ZLRUNNS7.mjs +0 -331
- package/dist/chunk-ZLRUNNS7.mjs.map +0 -1
- package/dist/chunk-ZY25LVYR.mjs +0 -193
- package/dist/chunk-ZY25LVYR.mjs.map +0 -1
- package/dist/components/chat/messages/RenderActionExecutionMessage.d.ts +0 -7
- package/dist/components/chat/messages/RenderActionExecutionMessage.js.map +0 -1
- package/dist/components/chat/messages/RenderActionExecutionMessage.mjs +0 -14
- package/dist/components/chat/messages/RenderAgentStateMessage.d.ts +0 -7
- package/dist/components/chat/messages/RenderAgentStateMessage.js +0 -805
- package/dist/components/chat/messages/RenderAgentStateMessage.js.map +0 -1
- package/dist/components/chat/messages/RenderAgentStateMessage.mjs +0 -14
- package/dist/components/chat/messages/RenderResultMessage.d.ts +0 -7
- package/dist/components/chat/messages/RenderResultMessage.js.map +0 -1
- package/dist/components/chat/messages/RenderResultMessage.mjs +0 -14
- package/dist/components/chat/messages/RenderTextMessage.d.ts +0 -7
- package/dist/components/chat/messages/RenderTextMessage.js.map +0 -1
- package/dist/components/chat/messages/RenderTextMessage.mjs +0 -15
- package/dist/lib/utils.test.js +0 -9
- package/dist/lib/utils.test.js.map +0 -1
- package/dist/lib/utils.test.mjs +0 -7
- package/dist/lib/utils.test.mjs.map +0 -1
- package/src/components/chat/messages/RenderActionExecutionMessage.tsx +0 -125
- package/src/components/chat/messages/RenderAgentStateMessage.tsx +0 -116
- package/src/components/chat/messages/RenderResultMessage.tsx +0 -26
- /package/dist/{chunk-2OTVZXDX.mjs.map → chunk-GDSZGYCE.mjs.map} +0 -0
- /package/dist/{chunk-SQMEPWVT.mjs.map → chunk-SC6JRFAJ.mjs.map} +0 -0
- /package/dist/{chunk-YOEL33HG.mjs.map → chunk-UFN2VWSR.mjs.map} +0 -0
- /package/dist/components/chat/{messages/RenderActionExecutionMessage.mjs.map → ImageUploadQueue.mjs.map} +0 -0
- /package/dist/components/chat/{messages/RenderAgentStateMessage.mjs.map → PoweredByTag.mjs.map} +0 -0
- /package/dist/components/chat/{messages/RenderResultMessage.mjs.map → Suggestions.mjs.map} +0 -0
- /package/dist/components/chat/messages/{RenderTextMessage.mjs.map → ImageRenderer.mjs.map} +0 -0
- /package/dist/{lib/utils.test.d.ts → v2/index.d.ts} +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Atai Barkai
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,46 +1,141 @@
|
|
|
1
|
-
|
|
2
|
-
<a href="https://copilotkit.ai" target="_blank">
|
|
3
|
-
<img src="https://github.com/copilotkit/copilotkit/raw/main/assets/banner.png" alt="CopilotKit Logo">
|
|
4
|
-
</a>
|
|
5
|
-
|
|
6
|
-
<br/>
|
|
7
|
-
|
|
8
|
-
<strong>
|
|
9
|
-
CopilotKit is the open-source framework for integrating powerful AI Copilots into any application. Easily implement custom AI Chatbots, AI Agents, AI Textareas, and more.
|
|
10
|
-
</strong>
|
|
11
|
-
</div>
|
|
1
|
+
# CopilotKit - React UI
|
|
12
2
|
|
|
13
|
-
<
|
|
3
|
+
<img src="https://github.com/user-attachments/assets/0a6b64d9-e193-4940-a3f6-60334ac34084" alt="banner" style="border-radius: 12px; border: 2px solid #d6d4fa;" />
|
|
14
4
|
|
|
15
|
-
<
|
|
5
|
+
<br>
|
|
6
|
+
<div align="center" style="display:flex;justify-content:center;gap:16px;height:20px;margin: 0;">
|
|
16
7
|
<a href="https://www.npmjs.com/package/@copilotkit/react-core" target="_blank">
|
|
17
|
-
<img src="https://img.shields.io/npm/v/%40copilotkit%2Freact-
|
|
8
|
+
<img src="https://img.shields.io/npm/v/%40copilotkit%2Freact-ui?logo=npm&logoColor=%23FFFFFF&label=Version&color=%236963ff" alt="NPM">
|
|
9
|
+
</a>
|
|
10
|
+
<a href="https://github.com/copilotkit/copilotkit/blob/main/LICENSE" target="_blank">
|
|
11
|
+
<img src="https://img.shields.io/github/license/copilotkit/copilotkit?color=%236963ff&label=License" alt="MIT">
|
|
18
12
|
</a>
|
|
19
|
-
<img src="https://img.shields.io/github/license/copilotkit/copilotkit?color=%236963ff&label=License" alt="MIT">
|
|
20
13
|
<a href="https://discord.gg/6dffbvGU3D" target="_blank">
|
|
21
14
|
<img src="https://img.shields.io/discord/1122926057641742418?logo=discord&logoColor=%23FFFFFF&label=Discord&color=%236963ff" alt="Discord">
|
|
22
15
|
</a>
|
|
23
16
|
</div>
|
|
24
17
|
<br/>
|
|
25
|
-
|
|
26
18
|
<div align="center">
|
|
27
|
-
<a href="https://
|
|
28
|
-
<img src="https://
|
|
29
|
-
</a>
|
|
30
|
-
<a href="https://docs.copilotkit.ai?ref=github_readme" target="_blank">
|
|
31
|
-
<img src="https://github.com/copilotkit/copilotkit/raw/main/assets/btn_docs.png" alt="CopilotKit GitHub" height="40px">
|
|
32
|
-
</a>
|
|
33
|
-
<a href="https://cloud.copilotkit.ai?ref=github_readme" target="_blank">
|
|
34
|
-
<img src="https://github.com/copilotkit/copilotkit/raw/main/assets/btn_cloud.png" alt="CopilotKit GitHub" height="40px">
|
|
19
|
+
<a href="https://www.producthunt.com/posts/copilotkit" target="_blank">
|
|
20
|
+
<img src="https://api.producthunt.com/widgets/embed-image/v1/top-post-badge.svg?post_id=428778&theme=light&period=daily">
|
|
35
21
|
</a>
|
|
36
22
|
</div>
|
|
37
23
|
|
|
38
|
-
|
|
24
|
+
## ✨ Why CopilotKit?
|
|
39
25
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
26
|
+
- Minutes to integrate - Get started quickly with our CLI
|
|
27
|
+
- Framework agnostic - Works with React, Next.js, AGUI and more
|
|
28
|
+
- Production-ready UI - Use customizable components or build with headless UI
|
|
29
|
+
- Built-in security - Prompt injection protection
|
|
30
|
+
- Open source - Full transparency and community-driven
|
|
31
|
+
|
|
32
|
+
<img src="https://github.com/user-attachments/assets/6cb425f8-ffcb-49d2-9bbb-87cab5995b78" alt="class-support-ecosystem" style="border-radius: 12px; border: 2px solid #d6d4fa;">
|
|
33
|
+
|
|
34
|
+
## 🧑💻 Real life use cases
|
|
35
|
+
|
|
36
|
+
<span>Deploy deeply-integrated AI assistants & agents that work alongside your users inside your applications.</span>
|
|
37
|
+
|
|
38
|
+
<img src="https://github.com/user-attachments/assets/3b810240-e9f8-43ae-acec-31a58095e223" alt="headless-ui" style="border-radius: 12px; border: 2px solid #d6d4fa;">
|
|
39
|
+
|
|
40
|
+
## 🖥️ Code Samples
|
|
41
|
+
|
|
42
|
+
<span>Drop in these building blocks and tailor them to your needs.</span>
|
|
43
|
+
|
|
44
|
+
<h3>Build with Headless APIs and Pre-Built Components</h3>
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
// Headless UI with full control
|
|
48
|
+
const { visibleMessages, appendMessage, setMessages, ... } = useCopilotChat();
|
|
49
|
+
|
|
50
|
+
// Pre-built components with deep customization options (CSS + pass custom sub-components)
|
|
51
|
+
<CopilotPopup
|
|
52
|
+
instructions={"You are assisting the user as best as you can. Answer in the best way possible given the data you have."}
|
|
53
|
+
labels={{ title: "Popup Assistant", initial: "Need any help?" }}
|
|
54
|
+
/>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
// Frontend actions + generative UI, with full streaming support
|
|
59
|
+
useCopilotAction({
|
|
60
|
+
name: "appendToSpreadsheet",
|
|
61
|
+
description: "Append rows to the current spreadsheet",
|
|
62
|
+
parameters: [
|
|
63
|
+
{ name: "rows", type: "object[]", attributes: [{ name: "cells", type: "object[]", attributes: [{ name: "value", type: "string" }] }] }
|
|
64
|
+
],
|
|
65
|
+
render: ({ status, args }) => <Spreadsheet data={canonicalSpreadsheetData(args.rows)} />,
|
|
66
|
+
handler: ({ rows }) => setSpreadsheet({ ...spreadsheet, rows: [...spreadsheet.rows, ...canonicalSpreadsheetData(rows)] }),
|
|
67
|
+
});
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
<h3>Integrate In-App CoAgents with LangGraph</h3>
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
// Share state between app and agent
|
|
74
|
+
const { agentState } = useCoAgent({
|
|
75
|
+
name: "basic_agent",
|
|
76
|
+
initialState: { input: "NYC" }
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// agentic generative UI
|
|
80
|
+
useCoAgentStateRender({
|
|
81
|
+
name: "basic_agent",
|
|
82
|
+
render: ({ state }) => <WeatherDisplay {...state.final_response} />,
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// Human in the Loop (Approval)
|
|
86
|
+
useCopilotAction({
|
|
87
|
+
name: "email_tool",
|
|
88
|
+
parameters: [
|
|
89
|
+
{
|
|
90
|
+
name: "email_draft",
|
|
91
|
+
type: "string",
|
|
92
|
+
description: "The email content",
|
|
93
|
+
required: true,
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
renderAndWaitForResponse: ({ args, status, respond }) => {
|
|
97
|
+
return (
|
|
98
|
+
<EmailConfirmation
|
|
99
|
+
emailContent={args.email_draft || ""}
|
|
100
|
+
isExecuting={status === "executing"}
|
|
101
|
+
onCancel={() => respond?.({ approved: false })}
|
|
102
|
+
onSend={() =>
|
|
103
|
+
respond?.({
|
|
104
|
+
approved: true,
|
|
105
|
+
metadata: { sentAt: new Date().toISOString() },
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
/>
|
|
109
|
+
);
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
```ts
|
|
115
|
+
// intermediate agent state streaming (supports both LangGraph.js + LangGraph python)
|
|
116
|
+
const modifiedConfig = copilotKitCustomizeConfig(config, {
|
|
117
|
+
emitIntermediateState: [{
|
|
118
|
+
stateKey: "outline",
|
|
119
|
+
tool: "set_outline",
|
|
120
|
+
toolArgument: "outline"
|
|
121
|
+
}],
|
|
122
|
+
});
|
|
123
|
+
const response = await ChatOpenAI({ model: "gpt-4o" }).invoke(messages, modifiedConfig);
|
|
124
|
+
```
|
|
125
|
+
## 🏆 Featured Examples
|
|
126
|
+
|
|
127
|
+
<p align="center">
|
|
128
|
+
<a href="https://www.copilotkit.ai/examples/form-filling-copilot">
|
|
129
|
+
<img src="https://github.com/user-attachments/assets/874da84a-67ff-47fa-a6b4-cbc3c65eb704" width="300" style="border-radius: 16px;" />
|
|
130
|
+
</a>
|
|
131
|
+
<a href="https://www.copilotkit.ai/examples/state-machine-copilot">
|
|
132
|
+
<img src="https://github.com/user-attachments/assets/0b5e45b3-2704-4678-82dc-2f3e1c58e2dd" width="300" style="border-radius: 16px;" />
|
|
133
|
+
</a>
|
|
134
|
+
<a href="https://www.copilotkit.ai/examples/chat-with-your-data">
|
|
135
|
+
<img src="https://github.com/user-attachments/assets/0fed66be-a4c2-4093-8eab-75c0b27a62f6" width="300" style="border-radius: 16px;" />
|
|
136
|
+
</a>
|
|
137
|
+
</p>
|
|
43
138
|
|
|
44
|
-
|
|
139
|
+
## Documentation
|
|
45
140
|
|
|
46
141
|
To get started with CopilotKit, please check out the [documentation](https://docs.copilotkit.ai).
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PoweredByTag
|
|
3
|
+
} from "./chunk-ELGRNEAO.mjs";
|
|
4
|
+
import {
|
|
5
|
+
Textarea_default
|
|
6
|
+
} from "./chunk-QIOJXTIQ.mjs";
|
|
7
|
+
import {
|
|
8
|
+
useChatContext
|
|
9
|
+
} from "./chunk-IEMQ2SQW.mjs";
|
|
10
|
+
import {
|
|
11
|
+
usePushToTalk
|
|
12
|
+
} from "./chunk-O72ZB5V3.mjs";
|
|
13
|
+
|
|
14
|
+
// src/components/chat/Input.tsx
|
|
15
|
+
import { useMemo, useRef, useState } from "react";
|
|
16
|
+
import { useCopilotContext, useCopilotChatInternal } from "@copilotkit/react-core";
|
|
17
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
+
var MAX_NEWLINES = 6;
|
|
19
|
+
var Input = ({
|
|
20
|
+
inProgress,
|
|
21
|
+
onSend,
|
|
22
|
+
chatReady = false,
|
|
23
|
+
onStop,
|
|
24
|
+
onUpload,
|
|
25
|
+
hideStopButton = false
|
|
26
|
+
}) => {
|
|
27
|
+
var _a;
|
|
28
|
+
const context = useChatContext();
|
|
29
|
+
const copilotContext = useCopilotContext();
|
|
30
|
+
const showPoweredBy = !((_a = copilotContext.copilotApiConfig) == null ? void 0 : _a.publicApiKey);
|
|
31
|
+
const pushToTalkConfigured = copilotContext.copilotApiConfig.textToSpeechUrl !== void 0 && copilotContext.copilotApiConfig.transcribeAudioUrl !== void 0;
|
|
32
|
+
const textareaRef = useRef(null);
|
|
33
|
+
const [isComposing, setIsComposing] = useState(false);
|
|
34
|
+
const handleDivClick = (event) => {
|
|
35
|
+
var _a2;
|
|
36
|
+
const target = event.target;
|
|
37
|
+
if (target.closest("button"))
|
|
38
|
+
return;
|
|
39
|
+
if (target.tagName === "TEXTAREA")
|
|
40
|
+
return;
|
|
41
|
+
(_a2 = textareaRef.current) == null ? void 0 : _a2.focus();
|
|
42
|
+
};
|
|
43
|
+
const [text, setText] = useState("");
|
|
44
|
+
const send = () => {
|
|
45
|
+
var _a2;
|
|
46
|
+
if (inProgress)
|
|
47
|
+
return;
|
|
48
|
+
onSend(text);
|
|
49
|
+
setText("");
|
|
50
|
+
(_a2 = textareaRef.current) == null ? void 0 : _a2.focus();
|
|
51
|
+
};
|
|
52
|
+
const { pushToTalkState, setPushToTalkState } = usePushToTalk({
|
|
53
|
+
sendFunction: onSend,
|
|
54
|
+
inProgress
|
|
55
|
+
});
|
|
56
|
+
const isInProgress = inProgress || pushToTalkState === "transcribing";
|
|
57
|
+
const { buttonIcon, buttonAlt } = useMemo(() => {
|
|
58
|
+
if (!chatReady)
|
|
59
|
+
return { buttonIcon: context.icons.spinnerIcon, buttonAlt: "Loading" };
|
|
60
|
+
return isInProgress && !hideStopButton && chatReady ? { buttonIcon: context.icons.stopIcon, buttonAlt: "Stop" } : { buttonIcon: context.icons.sendIcon, buttonAlt: "Send" };
|
|
61
|
+
}, [isInProgress, chatReady, hideStopButton, context.icons.stopIcon, context.icons.sendIcon]);
|
|
62
|
+
const showPushToTalk = pushToTalkConfigured && (pushToTalkState === "idle" || pushToTalkState === "recording") && !inProgress;
|
|
63
|
+
const { interrupt } = useCopilotChatInternal();
|
|
64
|
+
const canSend = useMemo(() => {
|
|
65
|
+
return !isInProgress && text.trim().length > 0 && pushToTalkState === "idle" && !interrupt;
|
|
66
|
+
}, [interrupt, isInProgress, text, pushToTalkState]);
|
|
67
|
+
const canStop = useMemo(() => {
|
|
68
|
+
return isInProgress && !hideStopButton;
|
|
69
|
+
}, [isInProgress, hideStopButton]);
|
|
70
|
+
const sendDisabled = !canSend && !canStop;
|
|
71
|
+
return /* @__PURE__ */ jsxs("div", { className: `copilotKitInputContainer ${showPoweredBy ? "poweredByContainer" : ""}`, children: [
|
|
72
|
+
/* @__PURE__ */ jsxs("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
|
|
73
|
+
/* @__PURE__ */ jsx(
|
|
74
|
+
Textarea_default,
|
|
75
|
+
{
|
|
76
|
+
ref: textareaRef,
|
|
77
|
+
placeholder: context.labels.placeholder,
|
|
78
|
+
autoFocus: false,
|
|
79
|
+
maxRows: MAX_NEWLINES,
|
|
80
|
+
value: text,
|
|
81
|
+
onChange: (event) => setText(event.target.value),
|
|
82
|
+
onCompositionStart: () => setIsComposing(true),
|
|
83
|
+
onCompositionEnd: () => setIsComposing(false),
|
|
84
|
+
onKeyDown: (event) => {
|
|
85
|
+
if (event.key === "Enter" && !event.shiftKey && !isComposing) {
|
|
86
|
+
event.preventDefault();
|
|
87
|
+
if (canSend) {
|
|
88
|
+
send();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
),
|
|
94
|
+
/* @__PURE__ */ jsxs("div", { className: "copilotKitInputControls", children: [
|
|
95
|
+
onUpload && /* @__PURE__ */ jsx("button", { onClick: onUpload, className: "copilotKitInputControlButton", children: context.icons.uploadIcon }),
|
|
96
|
+
/* @__PURE__ */ jsx("div", { style: { flexGrow: 1 } }),
|
|
97
|
+
showPushToTalk && /* @__PURE__ */ jsx(
|
|
98
|
+
"button",
|
|
99
|
+
{
|
|
100
|
+
onClick: () => setPushToTalkState(pushToTalkState === "idle" ? "recording" : "transcribing"),
|
|
101
|
+
className: pushToTalkState === "recording" ? "copilotKitInputControlButton copilotKitPushToTalkRecording" : "copilotKitInputControlButton",
|
|
102
|
+
children: context.icons.pushToTalkIcon
|
|
103
|
+
}
|
|
104
|
+
),
|
|
105
|
+
/* @__PURE__ */ jsx(
|
|
106
|
+
"button",
|
|
107
|
+
{
|
|
108
|
+
disabled: sendDisabled,
|
|
109
|
+
onClick: isInProgress && !hideStopButton ? onStop : send,
|
|
110
|
+
"data-copilotkit-in-progress": inProgress,
|
|
111
|
+
"data-test-id": inProgress ? "copilot-chat-request-in-progress" : "copilot-chat-ready",
|
|
112
|
+
className: "copilotKitInputControlButton",
|
|
113
|
+
"aria-label": buttonAlt,
|
|
114
|
+
children: buttonIcon
|
|
115
|
+
}
|
|
116
|
+
)
|
|
117
|
+
] })
|
|
118
|
+
] }),
|
|
119
|
+
/* @__PURE__ */ jsx(PoweredByTag, { showPoweredBy })
|
|
120
|
+
] });
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export {
|
|
124
|
+
Input
|
|
125
|
+
};
|
|
126
|
+
//# sourceMappingURL=chunk-3W6J75HS.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/Input.tsx"],"sourcesContent":["import React, { useMemo, useRef, useState } from \"react\";\nimport { InputProps } from \"./props\";\nimport { useChatContext } from \"./ChatContext\";\nimport AutoResizingTextarea from \"./Textarea\";\nimport { usePushToTalk } from \"../../hooks/use-push-to-talk\";\nimport { useCopilotContext, useCopilotChatInternal } from \"@copilotkit/react-core\";\nimport { PoweredByTag } from \"./PoweredByTag\";\n\nconst MAX_NEWLINES = 6;\n\nexport const Input = ({\n inProgress,\n onSend,\n chatReady = false,\n onStop,\n onUpload,\n hideStopButton = false,\n}: InputProps) => {\n const context = useChatContext();\n const copilotContext = useCopilotContext();\n\n const showPoweredBy = !copilotContext.copilotApiConfig?.publicApiKey;\n\n const pushToTalkConfigured =\n copilotContext.copilotApiConfig.textToSpeechUrl !== undefined &&\n copilotContext.copilotApiConfig.transcribeAudioUrl !== undefined;\n\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const [isComposing, setIsComposing] = useState(false);\n\n const handleDivClick = (event: React.MouseEvent<HTMLDivElement>) => {\n const target = event.target as HTMLElement;\n\n // If the user clicked a button or inside a button, don't focus the textarea\n if (target.closest(\"button\")) return;\n\n // If the user clicked the textarea, do nothing (it's already focused)\n if (target.tagName === \"TEXTAREA\") return;\n\n // Otherwise, focus the textarea\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 // tylerslaton:\n //\n // This scrolls CopilotKit into view always. Reading the commit history, it was likely\n // added to fix a bug but it is causing issues now.\n //\n // For the future, if we want this behavior again, we will need to find a way to do it without\n // forcing CopilotKit to always be in view. This code causes this because focusing an element\n // in most browsers will scroll that element into view.\n //\n // useEffect(() => {\n // if (isVisible) {\n // textareaRef.current?.focus();\n // }\n // }, [isVisible]);\n\n const { pushToTalkState, setPushToTalkState } = usePushToTalk({\n sendFunction: onSend,\n inProgress,\n });\n\n const isInProgress = inProgress || pushToTalkState === \"transcribing\";\n const { buttonIcon, buttonAlt } = useMemo(() => {\n if (!chatReady) return { buttonIcon: context.icons.spinnerIcon, buttonAlt: \"Loading\" };\n return isInProgress && !hideStopButton && chatReady\n ? { buttonIcon: context.icons.stopIcon, buttonAlt: \"Stop\" }\n : { buttonIcon: context.icons.sendIcon, buttonAlt: \"Send\" };\n }, [isInProgress, chatReady, hideStopButton, context.icons.stopIcon, context.icons.sendIcon]);\n const showPushToTalk =\n pushToTalkConfigured &&\n (pushToTalkState === \"idle\" || pushToTalkState === \"recording\") &&\n !inProgress;\n\n const { interrupt } = useCopilotChatInternal();\n\n const canSend = useMemo(() => {\n return !isInProgress && text.trim().length > 0 && pushToTalkState === \"idle\" && !interrupt;\n }, [interrupt, isInProgress, text, pushToTalkState]);\n\n const canStop = useMemo(() => {\n return isInProgress && !hideStopButton;\n }, [isInProgress, hideStopButton]);\n\n const sendDisabled = !canSend && !canStop;\n\n return (\n <div className={`copilotKitInputContainer ${showPoweredBy ? \"poweredByContainer\" : \"\"}`}>\n <div className=\"copilotKitInput\" onClick={handleDivClick}>\n <AutoResizingTextarea\n ref={textareaRef}\n placeholder={context.labels.placeholder}\n autoFocus={false}\n maxRows={MAX_NEWLINES}\n value={text}\n onChange={(event) => setText(event.target.value)}\n onCompositionStart={() => setIsComposing(true)}\n onCompositionEnd={() => setIsComposing(false)}\n onKeyDown={(event) => {\n if (event.key === \"Enter\" && !event.shiftKey && !isComposing) {\n event.preventDefault();\n if (canSend) {\n send();\n }\n }\n }}\n />\n <div className=\"copilotKitInputControls\">\n {onUpload && (\n <button onClick={onUpload} className=\"copilotKitInputControlButton\">\n {context.icons.uploadIcon}\n </button>\n )}\n\n <div style={{ flexGrow: 1 }} />\n\n {showPushToTalk && (\n <button\n onClick={() =>\n setPushToTalkState(pushToTalkState === \"idle\" ? \"recording\" : \"transcribing\")\n }\n className={\n pushToTalkState === \"recording\"\n ? \"copilotKitInputControlButton copilotKitPushToTalkRecording\"\n : \"copilotKitInputControlButton\"\n }\n >\n {context.icons.pushToTalkIcon}\n </button>\n )}\n <button\n disabled={sendDisabled}\n onClick={isInProgress && !hideStopButton ? onStop : send}\n data-copilotkit-in-progress={inProgress}\n data-test-id={inProgress ? \"copilot-chat-request-in-progress\" : \"copilot-chat-ready\"}\n className=\"copilotKitInputControlButton\"\n aria-label={buttonAlt}\n >\n {buttonIcon}\n </button>\n </div>\n </div>\n <PoweredByTag showPoweredBy={showPoweredBy} />\n </div>\n );\n};\n"],"mappings":"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","names":["_a"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotModal
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-HKZL4P3F.mjs";
|
|
4
4
|
import {
|
|
5
5
|
__spreadProps,
|
|
6
6
|
__spreadValues
|
|
@@ -27,4 +27,4 @@ function CopilotSidebar(props) {
|
|
|
27
27
|
export {
|
|
28
28
|
CopilotSidebar
|
|
29
29
|
};
|
|
30
|
-
//# sourceMappingURL=chunk-
|
|
30
|
+
//# sourceMappingURL=chunk-4S4ZEKE6.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/Sidebar.tsx"],"sourcesContent":["/**\n * <br/>\n * <img src=\"https://cdn.copilotkit.ai/docs/copilotkit/images/CopilotSidebar.gif\" width=\"500\" />\n *\n * A chatbot sidebar component for the CopilotKit framework. Highly customizable through various props and custom CSS.\n *\n * See [CopilotPopup](/reference/components/chat/CopilotPopup) for a popup version of this component.\n *\n * ## Install Dependencies\n *\n * This component is part of the [@copilotkit/react-ui](https://npmjs.com/package/@copilotkit/react-ui) package.\n *\n * ```shell npm2yarn \\\"@copilotkit/react-ui\"\\\n * npm install @copilotkit/react-core @copilotkit/react-ui\n * ```\n *\n * ## Usage\n *\n * ```tsx\n * import { CopilotSidebar } from \"@copilotkit/react-ui\";\n * import \"@copilotkit/react-ui/styles.css\";\n *\n * <CopilotSidebar\n * labels={{\n * title: \"Your Assistant\",\n * initial: \"Hi! 👋 How can I assist you today?\",\n * }}\n * >\n * <YourApp/>\n * </CopilotSidebar>\n * ```\n *\n * ### With Observability Hooks\n *\n * To monitor user interactions, provide the `observabilityHooks` prop.\n * **Note:** This requires a `publicApiKey` in the `<CopilotKit>` provider.\n *\n * ```tsx\n * <CopilotKit publicApiKey=\"YOUR_PUBLIC_API_KEY\">\n * <CopilotSidebar\n * observabilityHooks={{\n * onChatExpanded: () => {\n * console.log(\"Sidebar opened\");\n * },\n * onChatMinimized: () => {\n * console.log(\"Sidebar closed\");\n * },\n * }}\n * >\n * <YourApp/>\n * </CopilotSidebar>\n * </CopilotKit>\n * ```\n *\n * ### Look & Feel\n *\n * By default, CopilotKit components do not have any styles. You can import CopilotKit's stylesheet at the root of your project:\n * ```tsx title=\"YourRootComponent.tsx\"\n * ...\n * import \"@copilotkit/react-ui/styles.css\"; // [!code highlight]\n *\n * export function YourRootComponent() {\n * return (\n * <CopilotKit>\n * ...\n * </CopilotKit>\n * );\n * }\n * ```\n * For more information about how to customize the styles, check out the [Customize Look & Feel](/guides/custom-look-and-feel/customize-built-in-ui-components) guide.\n */\nimport React, { useState } from \"react\";\nimport { CopilotModal, CopilotModalProps } from \"./Modal\";\n\nexport function CopilotSidebar(props: CopilotModalProps) {\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 <CopilotModal {...props} {...{ onSetOpen }}>\n {props.children}\n </CopilotModal>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAuEA,SAAgB,gBAAgB;AAmB1B;AAhBC,SAAS,eAAe,OAA0B;AACvD,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;AAnFvC;AAoFI,gBAAM,cAAN,+BAAkB;AAClB,yBAAqB,OAAO,oBAAoB,EAAE;AAAA,EACpD;AAEA,SACE,oBAAC,SAAI,WAAW,mCAAmC,qBACjD,8BAAC,8DAAiB,QAAW,EAAE,UAAU,IAAxC,EACE,gBAAM,WACT,GACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SmallSpinnerIcon
|
|
3
|
+
} from "./chunk-XWG3L6QC.mjs";
|
|
4
|
+
|
|
5
|
+
// src/components/chat/Suggestion.tsx
|
|
6
|
+
import { useCopilotChatInternal } from "@copilotkit/react-core";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
function Suggestion({ title, onClick, partial, className }) {
|
|
9
|
+
const { isLoading } = useCopilotChatInternal();
|
|
10
|
+
if (!title)
|
|
11
|
+
return null;
|
|
12
|
+
return /* @__PURE__ */ jsx(
|
|
13
|
+
"button",
|
|
14
|
+
{
|
|
15
|
+
disabled: partial || isLoading,
|
|
16
|
+
onClick: (e) => {
|
|
17
|
+
e.preventDefault();
|
|
18
|
+
onClick();
|
|
19
|
+
},
|
|
20
|
+
className: `suggestion ${className != null ? className : ""} ${partial ? "loading" : ""}`,
|
|
21
|
+
"data-test-id": "suggestion",
|
|
22
|
+
type: "button",
|
|
23
|
+
children: partial ? SmallSpinnerIcon : /* @__PURE__ */ jsx("span", { children: title })
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export {
|
|
29
|
+
Suggestion
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=chunk-6TWQUA2Q.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/Suggestion.tsx"],"sourcesContent":["import { useCopilotChatInternal } from \"@copilotkit/react-core\";\nimport { SmallSpinnerIcon } from \"./Icons\";\n\ninterface SuggestionsProps {\n title: string;\n message: string;\n partial?: boolean;\n className?: string;\n onClick: () => void;\n}\n\nexport function Suggestion({ title, onClick, partial, className }: SuggestionsProps) {\n const { isLoading } = useCopilotChatInternal();\n if (!title) return null;\n\n return (\n <button\n disabled={partial || isLoading}\n onClick={(e) => {\n e.preventDefault();\n onClick();\n }}\n className={`suggestion ${className ?? \"\"} ${partial ? \"loading\" : \"\"}`}\n data-test-id=\"suggestion\"\n type=\"button\"\n >\n {partial ? SmallSpinnerIcon : <span>{title}</span>}\n </button>\n );\n}\n"],"mappings":";;;;;AAAA,SAAS,8BAA8B;AA0BH;AAf7B,SAAS,WAAW,EAAE,OAAO,SAAS,SAAS,UAAU,GAAqB;AACnF,QAAM,EAAE,UAAU,IAAI,uBAAuB;AAC7C,MAAI,CAAC;AAAO,WAAO;AAEnB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,UAAU,WAAW;AAAA,MACrB,SAAS,CAAC,MAAM;AACd,UAAE,eAAe;AACjB,gBAAQ;AAAA,MACV;AAAA,MACA,WAAW,cAAc,gCAAa,MAAM,UAAU,YAAY;AAAA,MAClE,gBAAa;AAAA,MACb,MAAK;AAAA,MAEJ,oBAAU,mBAAmB,oBAAC,UAAM,iBAAM;AAAA;AAAA,EAC7C;AAEJ;","names":[]}
|
|
@@ -1,31 +1,28 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useChatContext
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import {
|
|
5
|
-
useDarkMode
|
|
6
|
-
} from "./chunk-JGMFJZMG.mjs";
|
|
3
|
+
} from "./chunk-IEMQ2SQW.mjs";
|
|
7
4
|
|
|
8
5
|
// src/components/chat/Window.tsx
|
|
9
6
|
import React, { useCallback, useEffect } from "react";
|
|
10
7
|
import { useCopilotContext } from "@copilotkit/react-core";
|
|
11
|
-
import {
|
|
8
|
+
import { isMacOS } from "@copilotkit/shared";
|
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
|
12
10
|
var Window = ({
|
|
13
11
|
children,
|
|
14
12
|
clickOutsideToClose,
|
|
15
13
|
shortcut,
|
|
16
14
|
hitEscapeToClose
|
|
17
15
|
}) => {
|
|
18
|
-
var _a;
|
|
19
16
|
const windowRef = React.useRef(null);
|
|
20
17
|
const context = useCopilotContext();
|
|
21
18
|
const { open, setOpen } = useChatContext();
|
|
22
19
|
const handleClickOutside = useCallback(
|
|
23
20
|
(event) => {
|
|
24
|
-
var
|
|
21
|
+
var _a;
|
|
25
22
|
if (!clickOutsideToClose) {
|
|
26
23
|
return;
|
|
27
24
|
}
|
|
28
|
-
const parentElement = (
|
|
25
|
+
const parentElement = (_a = windowRef.current) == null ? void 0 : _a.parentElement;
|
|
29
26
|
let className = "";
|
|
30
27
|
if (event.target instanceof HTMLElement) {
|
|
31
28
|
className = event.target.className;
|
|
@@ -39,10 +36,10 @@ var Window = ({
|
|
|
39
36
|
);
|
|
40
37
|
const handleKeyDown = useCallback(
|
|
41
38
|
(event) => {
|
|
42
|
-
var
|
|
39
|
+
var _a;
|
|
43
40
|
const target = event.target;
|
|
44
41
|
const isInput = target.tagName === "INPUT" || target.tagName === "SELECT" || target.tagName === "TEXTAREA" || target.isContentEditable;
|
|
45
|
-
const isDescendantOfWrapper = (
|
|
42
|
+
const isDescendantOfWrapper = (_a = windowRef.current) == null ? void 0 : _a.contains(target);
|
|
46
43
|
if (open && event.key === "Escape" && (!isInput || isDescendantOfWrapper) && hitEscapeToClose) {
|
|
47
44
|
setOpen(false);
|
|
48
45
|
} else if (event.key === shortcut && (isMacOS() && event.metaKey || !isMacOS() && event.ctrlKey) && (!isInput || isDescendantOfWrapper)) {
|
|
@@ -97,29 +94,7 @@ var Window = ({
|
|
|
97
94
|
}
|
|
98
95
|
};
|
|
99
96
|
}, [adjustForMobile, handleClickOutside, handleKeyDown]);
|
|
100
|
-
|
|
101
|
-
const showPoweredBy = !((_a = context.copilotApiConfig) == null ? void 0 : _a.publicApiKey);
|
|
102
|
-
const poweredByStyle = {
|
|
103
|
-
visibility: "visible",
|
|
104
|
-
display: "block",
|
|
105
|
-
position: "static",
|
|
106
|
-
textAlign: "center",
|
|
107
|
-
fontSize: "12px",
|
|
108
|
-
padding: "3px 0",
|
|
109
|
-
color: isDark ? "rgb(69, 69, 69)" : "rgb(214, 214, 214)"
|
|
110
|
-
};
|
|
111
|
-
return /* @__PURE__ */ jsxs(
|
|
112
|
-
"div",
|
|
113
|
-
{
|
|
114
|
-
className: `copilotKitWindow ${showPoweredBy ? " poweredByContainer" : ""} ${open ? " open" : ""}`,
|
|
115
|
-
ref: windowRef,
|
|
116
|
-
children: [
|
|
117
|
-
children,
|
|
118
|
-
showPoweredBy && // @ts-expect-error -- expecting position not to be a string, but it can be.
|
|
119
|
-
/* @__PURE__ */ jsx("p", { className: "poweredBy", style: poweredByStyle, children: "Powered by CopilotKit" })
|
|
120
|
-
]
|
|
121
|
-
}
|
|
122
|
-
);
|
|
97
|
+
return /* @__PURE__ */ jsx("div", { className: `copilotKitWindow ${open ? " open" : ""}`, ref: windowRef, children });
|
|
123
98
|
};
|
|
124
99
|
var preventScroll = (event) => {
|
|
125
100
|
let targetElement = event.target;
|
|
@@ -136,11 +111,8 @@ var preventScroll = (event) => {
|
|
|
136
111
|
event.preventDefault();
|
|
137
112
|
}
|
|
138
113
|
};
|
|
139
|
-
function isMacOS() {
|
|
140
|
-
return /Mac|iMac|Macintosh/i.test(navigator.userAgent);
|
|
141
|
-
}
|
|
142
114
|
|
|
143
115
|
export {
|
|
144
116
|
Window
|
|
145
117
|
};
|
|
146
|
-
//# sourceMappingURL=chunk-
|
|
118
|
+
//# sourceMappingURL=chunk-C3GSYRC3.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/Window.tsx"],"sourcesContent":["import React, { useCallback, useEffect } from \"react\";\nimport { WindowProps } from \"./props\";\nimport { useChatContext } from \"./ChatContext\";\nimport { useCopilotContext } from \"@copilotkit/react-core\";\nimport { isMacOS } from \"@copilotkit/shared\";\n\nexport const Window = ({\n children,\n clickOutsideToClose,\n shortcut,\n hitEscapeToClose,\n}: WindowProps) => {\n const windowRef = React.useRef<HTMLDivElement>(null);\n const context = useCopilotContext();\n\n const { open, setOpen } = useChatContext();\n\n const handleClickOutside = useCallback(\n (event: MouseEvent) => {\n if (!clickOutsideToClose) {\n return;\n }\n\n const parentElement = windowRef.current?.parentElement;\n\n let className = \"\";\n if (event.target instanceof HTMLElement) {\n className = event.target.className;\n }\n\n if (\n open &&\n parentElement &&\n !parentElement.contains(event.target as any) &&\n // prevent closing the window when clicking on the debug menu\n !className.includes(\"copilotKitDebugMenu\")\n ) {\n setOpen(false);\n }\n },\n [clickOutsideToClose, open, setOpen],\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent) => {\n const target = event.target as HTMLElement;\n const isInput =\n target.tagName === \"INPUT\" ||\n target.tagName === \"SELECT\" ||\n target.tagName === \"TEXTAREA\" ||\n target.isContentEditable;\n\n const isDescendantOfWrapper = windowRef.current?.contains(target);\n\n if (\n open &&\n event.key === \"Escape\" &&\n (!isInput || isDescendantOfWrapper) &&\n hitEscapeToClose\n ) {\n setOpen(false);\n } else if (\n event.key === shortcut &&\n ((isMacOS() && event.metaKey) || (!isMacOS() && event.ctrlKey)) &&\n (!isInput || isDescendantOfWrapper)\n ) {\n setOpen(!open);\n }\n },\n [hitEscapeToClose, shortcut, open, setOpen],\n );\n\n const adjustForMobile = useCallback(() => {\n const copilotKitWindow = windowRef.current;\n const vv = window.visualViewport;\n if (!copilotKitWindow || !vv) {\n return;\n }\n\n if (window.innerWidth < 640 && open) {\n copilotKitWindow.style.height = `${vv.height}px`;\n copilotKitWindow.style.left = `${vv.offsetLeft}px`;\n copilotKitWindow.style.top = `${vv.offsetTop}px`;\n\n document.body.style.position = \"fixed\";\n document.body.style.width = \"100%\";\n document.body.style.height = `${window.innerHeight}px`;\n document.body.style.overflow = \"hidden\";\n document.body.style.touchAction = \"none\";\n\n // Prevent scrolling on iOS\n document.body.addEventListener(\"touchmove\", preventScroll, {\n passive: false,\n });\n } else {\n copilotKitWindow.style.height = \"\";\n copilotKitWindow.style.left = \"\";\n copilotKitWindow.style.top = \"\";\n document.body.style.position = \"\";\n document.body.style.height = \"\";\n document.body.style.width = \"\";\n document.body.style.overflow = \"\";\n document.body.style.top = \"\";\n document.body.style.touchAction = \"\";\n\n document.body.removeEventListener(\"touchmove\", preventScroll);\n }\n }, [open]);\n\n useEffect(() => {\n document.addEventListener(\"mousedown\", handleClickOutside);\n document.addEventListener(\"keydown\", handleKeyDown);\n if (window.visualViewport) {\n window.visualViewport.addEventListener(\"resize\", adjustForMobile);\n adjustForMobile();\n }\n\n return () => {\n document.removeEventListener(\"mousedown\", handleClickOutside);\n document.removeEventListener(\"keydown\", handleKeyDown);\n if (window.visualViewport) {\n window.visualViewport.removeEventListener(\"resize\", adjustForMobile);\n }\n };\n }, [adjustForMobile, handleClickOutside, handleKeyDown]);\n\n return (\n <div className={`copilotKitWindow ${open ? \" open\" : \"\"}`} ref={windowRef}>\n {children}\n </div>\n );\n};\n\nconst preventScroll = (event: TouchEvent): void => {\n let targetElement = event.target as Element;\n\n // Function to check if the target has the parent with a given class\n const hasParentWithClass = (element: Element, className: string): boolean => {\n while (element && element !== document.body) {\n if (element.classList.contains(className)) {\n return true;\n }\n element = element.parentElement!;\n }\n return false;\n };\n\n // Check if the target of the touch event is inside an element with the 'copilotKitMessages' class\n if (!hasParentWithClass(targetElement, \"copilotKitMessages\")) {\n event.preventDefault();\n }\n};\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// src/components/chat/messages/ImageRenderer.tsx
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
var ImageRenderer = ({ image, content, className = "" }) => {
|
|
5
|
+
const [imageError, setImageError] = useState(false);
|
|
6
|
+
const imageSrc = `data:image/${image.format};base64,${image.bytes}`;
|
|
7
|
+
const altText = content || "User uploaded image";
|
|
8
|
+
const handleImageError = () => {
|
|
9
|
+
setImageError(true);
|
|
10
|
+
};
|
|
11
|
+
if (imageError) {
|
|
12
|
+
return /* @__PURE__ */ jsxs("div", { className: `copilotKitImageRendering copilotKitImageRenderingError ${className}`, children: [
|
|
13
|
+
/* @__PURE__ */ jsx("div", { className: "copilotKitImageRenderingErrorMessage", children: "Failed to load image" }),
|
|
14
|
+
content && /* @__PURE__ */ jsx("div", { className: "copilotKitImageRenderingContent", children: content })
|
|
15
|
+
] });
|
|
16
|
+
}
|
|
17
|
+
return /* @__PURE__ */ jsxs("div", { className: `copilotKitImageRendering ${className}`, children: [
|
|
18
|
+
/* @__PURE__ */ jsx(
|
|
19
|
+
"img",
|
|
20
|
+
{
|
|
21
|
+
src: imageSrc,
|
|
22
|
+
alt: altText,
|
|
23
|
+
className: "copilotKitImageRenderingImage",
|
|
24
|
+
onError: handleImageError
|
|
25
|
+
}
|
|
26
|
+
),
|
|
27
|
+
content && /* @__PURE__ */ jsx("div", { className: "copilotKitImageRenderingContent", children: content })
|
|
28
|
+
] });
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export {
|
|
32
|
+
ImageRenderer
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=chunk-DBKRAOH7.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/messages/ImageRenderer.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport { ImageRendererProps } from \"../props\";\n\n/**\n * Default image rendering component that can be customized by users.\n * Uses CSS classes for styling so users can override styles.\n */\nexport const ImageRenderer: React.FC<ImageRendererProps> = ({ image, content, className = \"\" }) => {\n const [imageError, setImageError] = useState(false);\n const imageSrc = `data:image/${image.format};base64,${image.bytes}`;\n const altText = content || \"User uploaded image\";\n\n const handleImageError = () => {\n setImageError(true);\n };\n\n if (imageError) {\n return (\n <div className={`copilotKitImageRendering copilotKitImageRenderingError ${className}`}>\n <div className=\"copilotKitImageRenderingErrorMessage\">Failed to load image</div>\n {content && <div className=\"copilotKitImageRenderingContent\">{content}</div>}\n </div>\n );\n }\n\n return (\n <div className={`copilotKitImageRendering ${className}`}>\n <img\n src={imageSrc}\n alt={altText}\n className=\"copilotKitImageRenderingImage\"\n onError={handleImageError}\n />\n {content && <div className=\"copilotKitImageRenderingContent\">{content}</div>}\n </div>\n );\n};\n"],"mappings":";AAAA,SAAgB,gBAAgB;AAkB1B,SACE,KADF;AAXC,IAAM,gBAA8C,CAAC,EAAE,OAAO,SAAS,YAAY,GAAG,MAAM;AACjG,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAClD,QAAM,WAAW,cAAc,MAAM,iBAAiB,MAAM;AAC5D,QAAM,UAAU,WAAW;AAE3B,QAAM,mBAAmB,MAAM;AAC7B,kBAAc,IAAI;AAAA,EACpB;AAEA,MAAI,YAAY;AACd,WACE,qBAAC,SAAI,WAAW,0DAA0D,aACxE;AAAA,0BAAC,SAAI,WAAU,wCAAuC,kCAAoB;AAAA,MACzE,WAAW,oBAAC,SAAI,WAAU,mCAAmC,mBAAQ;AAAA,OACxE;AAAA,EAEJ;AAEA,SACE,qBAAC,SAAI,WAAW,4BAA4B,aAC1C;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,KAAK;AAAA,QACL,KAAK;AAAA,QACL,WAAU;AAAA,QACV,SAAS;AAAA;AAAA,IACX;AAAA,IACC,WAAW,oBAAC,SAAI,WAAU,mCAAmC,mBAAQ;AAAA,KACxE;AAEJ;","names":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useDarkMode
|
|
3
|
+
} from "./chunk-JGMFJZMG.mjs";
|
|
4
|
+
|
|
5
|
+
// src/components/chat/PoweredByTag.tsx
|
|
6
|
+
import { useState, useEffect } from "react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
function PoweredByTag({ showPoweredBy = true }) {
|
|
9
|
+
const [mounted, setMounted] = useState(false);
|
|
10
|
+
const isDark = useDarkMode();
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
setMounted(true);
|
|
13
|
+
}, []);
|
|
14
|
+
if (!showPoweredBy) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
const poweredByStyle = {
|
|
18
|
+
visibility: "visible",
|
|
19
|
+
display: "block",
|
|
20
|
+
position: "static",
|
|
21
|
+
textAlign: "center",
|
|
22
|
+
fontSize: "12px",
|
|
23
|
+
padding: "3px 0",
|
|
24
|
+
color: mounted && isDark ? "rgb(69, 69, 69)" : "rgb(214, 214, 214)"
|
|
25
|
+
};
|
|
26
|
+
return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("p", { className: "poweredBy", style: poweredByStyle, children: "Powered by CopilotKit" }) });
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
PoweredByTag
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=chunk-ELGRNEAO.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/PoweredByTag.tsx"],"sourcesContent":["import React, { useState, useEffect } from \"react\";\nimport { useDarkMode } from \"../../hooks/use-dark-mode\";\n\nexport function PoweredByTag({ showPoweredBy = true }: { showPoweredBy?: boolean }) {\n const [mounted, setMounted] = useState(false);\n const isDark = useDarkMode();\n\n /*\n note(tylerslaton):\n\n Ensure we only use the isDark computed value after client-side mount.\n This prevents hydration mismatches by using a default color on the\n server and initial client render, then updating to the correct\n dark mode color after hydration is complete.\n */\n useEffect(() => {\n setMounted(true);\n }, []);\n\n if (!showPoweredBy) {\n return null;\n }\n\n const poweredByStyle = {\n visibility: \"visible\",\n display: \"block\",\n position: \"static\",\n textAlign: \"center\",\n fontSize: \"12px\",\n padding: \"3px 0\",\n color: mounted && isDark ? \"rgb(69, 69, 69)\" : \"rgb(214, 214, 214)\",\n };\n\n return (\n <div>\n {/*@ts-expect-error -- expecting position not to be a string, but it can be.*/}\n <p className=\"poweredBy\" style={poweredByStyle}>\n Powered by CopilotKit\n </p>\n </div>\n );\n}\n"],"mappings":";;;;;AAAA,SAAgB,UAAU,iBAAiB;AAoCrC;AAjCC,SAAS,aAAa,EAAE,gBAAgB,KAAK,GAAgC;AAClF,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,KAAK;AAC5C,QAAM,SAAS,YAAY;AAU3B,YAAU,MAAM;AACd,eAAW,IAAI;AAAA,EACjB,GAAG,CAAC,CAAC;AAEL,MAAI,CAAC,eAAe;AAClB,WAAO;AAAA,EACT;AAEA,QAAM,iBAAiB;AAAA,IACrB,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,UAAU;AAAA,IACV,WAAW;AAAA,IACX,UAAU;AAAA,IACV,SAAS;AAAA,IACT,OAAO,WAAW,SAAS,oBAAoB;AAAA,EACjD;AAEA,SACE,oBAAC,SAEC,8BAAC,OAAE,WAAU,aAAY,OAAO,gBAAgB,mCAEhD,GACF;AAEJ;","names":[]}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CheckIcon,
|
|
3
|
+
ChevronDownIcon,
|
|
4
|
+
ExclamationMarkIcon,
|
|
5
|
+
ExclamationMarkTriangleIcon
|
|
6
|
+
} from "./chunk-Q5V6S67N.mjs";
|
|
1
7
|
import {
|
|
2
8
|
getPublishedCopilotKitVersion,
|
|
3
9
|
logActions,
|
|
4
10
|
logMessages,
|
|
5
11
|
logReadables,
|
|
6
12
|
shouldShowDevConsole
|
|
7
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-JY2CSDKN.mjs";
|
|
8
14
|
import {
|
|
9
15
|
CopilotKitHelpModal
|
|
10
16
|
} from "./chunk-NRA3CFEE.mjs";
|
|
11
|
-
import {
|
|
12
|
-
CheckIcon,
|
|
13
|
-
ChevronDownIcon,
|
|
14
|
-
ExclamationMarkIcon,
|
|
15
|
-
ExclamationMarkTriangleIcon
|
|
16
|
-
} from "./chunk-Q5V6S67N.mjs";
|
|
17
17
|
import {
|
|
18
18
|
SmallSpinnerIcon
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-XWG3L6QC.mjs";
|
|
20
20
|
|
|
21
21
|
// src/components/dev-console/console.tsx
|
|
22
22
|
import { useCopilotContext, useCopilotMessagesContext } from "@copilotkit/react-core";
|
|
@@ -122,10 +122,8 @@ function VersionInfo({
|
|
|
122
122
|
currentVersionLabel = `${currentVersion} \u2192 ${latestVersion}`;
|
|
123
123
|
}
|
|
124
124
|
let asideLabel = "";
|
|
125
|
-
if (showDevConsole ===
|
|
126
|
-
asideLabel = "(
|
|
127
|
-
} else if (showDevConsole === true) {
|
|
128
|
-
asideLabel = "(always on)";
|
|
125
|
+
if (showDevConsole === true) {
|
|
126
|
+
asideLabel = "(enabled)";
|
|
129
127
|
}
|
|
130
128
|
const installCommand = [
|
|
131
129
|
`npm install`,
|
|
@@ -201,4 +199,4 @@ export {
|
|
|
201
199
|
CopilotDevConsole,
|
|
202
200
|
DebugMenuButton
|
|
203
201
|
};
|
|
204
|
-
//# sourceMappingURL=chunk-
|
|
202
|
+
//# sourceMappingURL=chunk-FFJHOZX6.mjs.map
|