@copilotkit/react-ui 1.7.2-next.1 → 1.8.0-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/{chunk-QXTRFMPM.mjs → chunk-2LRE4W6A.mjs} +13 -11
- package/dist/chunk-2LRE4W6A.mjs.map +1 -0
- package/dist/{chunk-2C3ANQCY.mjs → chunk-5GNYGURH.mjs} +53 -42
- package/dist/chunk-5GNYGURH.mjs.map +1 -0
- package/dist/{chunk-CBBFRI3Q.mjs → chunk-5JY5QJ2W.mjs} +9 -5
- package/dist/chunk-5JY5QJ2W.mjs.map +1 -0
- package/dist/{chunk-OFYI4UU4.mjs → chunk-7RIBDD4K.mjs} +19 -3
- package/dist/chunk-7RIBDD4K.mjs.map +1 -0
- package/dist/{chunk-YAGE7RCE.mjs → chunk-CGVOCLHN.mjs} +2 -2
- package/dist/chunk-EJG6RRSX.mjs +138 -0
- package/dist/chunk-EJG6RRSX.mjs.map +1 -0
- package/dist/chunk-FBYETUFL.mjs +118 -0
- package/dist/chunk-FBYETUFL.mjs.map +1 -0
- package/dist/chunk-GDJAAFIK.mjs +24 -0
- package/dist/chunk-GDJAAFIK.mjs.map +1 -0
- package/dist/{chunk-6FTRYYR5.mjs → chunk-GJME6MK4.mjs} +72 -62
- package/dist/chunk-GJME6MK4.mjs.map +1 -0
- package/dist/{chunk-AZU4QOV5.mjs → chunk-KG6DW6R2.mjs} +12 -12
- package/dist/{chunk-3PJA5MFR.mjs → chunk-LKCAF2HG.mjs} +2 -2
- package/dist/{chunk-ADTTDBLB.mjs → chunk-LXCH2BIB.mjs} +2 -2
- package/dist/chunk-MCO235PS.mjs +164 -0
- package/dist/chunk-MCO235PS.mjs.map +1 -0
- package/dist/chunk-MWC5OV7Z.mjs +1 -0
- package/dist/chunk-N7LTE54T.mjs +1 -0
- package/dist/chunk-N7LTE54T.mjs.map +1 -0
- package/dist/chunk-ORSMX3SE.mjs +244 -0
- package/dist/chunk-ORSMX3SE.mjs.map +1 -0
- package/dist/{chunk-UPTB2MVO.mjs → chunk-PCTCOQK2.mjs} +4 -10
- package/dist/chunk-PCTCOQK2.mjs.map +1 -0
- package/dist/{chunk-22K5DDPF.mjs → chunk-QGK5GOSC.mjs} +31 -60
- package/dist/chunk-QGK5GOSC.mjs.map +1 -0
- package/dist/{chunk-WGAZXTUA.mjs → chunk-TOQ7P4DO.mjs} +6 -9
- package/dist/chunk-TOQ7P4DO.mjs.map +1 -0
- package/dist/chunk-UCVCAGU7.mjs +1 -0
- package/dist/chunk-UCVCAGU7.mjs.map +1 -0
- package/dist/{chunk-3XAXY2Z3.mjs → chunk-UZTZXMYS.mjs} +2 -2
- package/dist/{chunk-RQNJNK2W.mjs → chunk-VC4NO5QZ.mjs} +2 -2
- package/dist/{chunk-YQ3D5IQV.mjs → chunk-XNQO5AZZ.mjs} +2 -5
- package/dist/chunk-XNQO5AZZ.mjs.map +1 -0
- package/dist/chunk-YC4NBUGE.mjs +97 -0
- package/dist/chunk-YC4NBUGE.mjs.map +1 -0
- package/dist/components/chat/Button.js.map +1 -1
- package/dist/components/chat/Button.mjs +3 -3
- package/dist/components/chat/Chat.d.ts +17 -1
- package/dist/components/chat/Chat.js +378 -905
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +12 -19
- package/dist/components/chat/ChatContext.d.ts +20 -0
- package/dist/components/chat/ChatContext.js +44 -74
- package/dist/components/chat/ChatContext.js.map +1 -1
- package/dist/components/chat/ChatContext.mjs +2 -2
- package/dist/components/chat/CodeBlock.js +58 -82
- package/dist/components/chat/CodeBlock.js.map +1 -1
- package/dist/components/chat/CodeBlock.mjs +2 -2
- package/dist/components/chat/Header.js +516 -4
- package/dist/components/chat/Header.js.map +1 -1
- package/dist/components/chat/Header.mjs +10 -3
- package/dist/components/chat/Icons.d.ts +10 -9
- package/dist/components/chat/Icons.js +125 -164
- package/dist/components/chat/Icons.js.map +1 -1
- package/dist/components/chat/Icons.mjs +9 -5
- package/dist/components/chat/Input.d.ts +1 -1
- package/dist/components/chat/Input.js +11 -9
- package/dist/components/chat/Input.js.map +1 -1
- package/dist/components/chat/Input.mjs +3 -3
- package/dist/components/chat/Markdown.js +58 -56
- package/dist/components/chat/Markdown.js.map +1 -1
- package/dist/components/chat/Markdown.mjs +3 -3
- package/dist/components/chat/Messages.d.ts +1 -1
- package/dist/components/chat/Messages.js +70 -60
- package/dist/components/chat/Messages.js.map +1 -1
- package/dist/components/chat/Messages.mjs +3 -3
- package/dist/components/chat/Modal.js +1708 -1749
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +23 -23
- package/dist/components/chat/Popup.js +1708 -1749
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +24 -24
- package/dist/components/chat/Response.js.map +1 -1
- package/dist/components/chat/Response.mjs +3 -3
- package/dist/components/chat/Sidebar.js +1710 -1751
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +24 -24
- package/dist/components/chat/Suggestion.js +4 -40
- package/dist/components/chat/Suggestion.js.map +1 -1
- package/dist/components/chat/Suggestion.mjs +2 -2
- package/dist/components/chat/Window.js.map +1 -1
- package/dist/components/chat/Window.mjs +3 -3
- package/dist/components/chat/index.js +1710 -1751
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +27 -27
- package/dist/components/chat/messages/AssistantMessage.js +211 -59
- package/dist/components/chat/messages/AssistantMessage.js.map +1 -1
- package/dist/components/chat/messages/AssistantMessage.mjs +5 -5
- package/dist/components/chat/messages/RenderTextMessage.js +18 -2
- package/dist/components/chat/messages/RenderTextMessage.js.map +1 -1
- package/dist/components/chat/messages/RenderTextMessage.mjs +1 -1
- package/dist/components/chat/props.d.ts +53 -0
- package/dist/components/chat/props.js.map +1 -1
- package/dist/components/crew/DefaultResponseRenderer.d.ts +110 -0
- package/dist/components/crew/DefaultResponseRenderer.js +175 -0
- package/dist/components/crew/DefaultResponseRenderer.js.map +1 -0
- package/dist/components/crew/DefaultResponseRenderer.mjs +10 -0
- package/dist/components/crew/DefaultResponseRenderer.mjs.map +1 -0
- package/dist/components/crew/DefaultStateRenderer.d.ts +88 -0
- package/dist/components/crew/DefaultStateRenderer.js +198 -0
- package/dist/components/crew/DefaultStateRenderer.js.map +1 -0
- package/dist/components/crew/DefaultStateRenderer.mjs +8 -0
- package/dist/components/crew/DefaultStateRenderer.mjs.map +1 -0
- package/dist/components/crew/index.d.ts +4 -0
- package/dist/components/crew/index.js +335 -0
- package/dist/components/crew/index.js.map +1 -0
- package/dist/components/crew/index.mjs +16 -0
- package/dist/components/crew/index.mjs.map +1 -0
- package/dist/components/crew/types.d.ts +340 -0
- package/dist/components/crew/types.js +19 -0
- package/dist/components/crew/types.js.map +1 -0
- package/dist/components/crew/types.mjs +2 -0
- package/dist/components/crew/types.mjs.map +1 -0
- package/dist/components/dev-console/console.js +51 -233
- package/dist/components/dev-console/console.js.map +1 -1
- package/dist/components/dev-console/console.mjs +5 -5
- package/dist/components/dev-console/index.js +51 -233
- package/dist/components/dev-console/index.js.map +1 -1
- package/dist/components/dev-console/index.mjs +5 -5
- package/dist/components/help-modal/index.js +29 -147
- package/dist/components/help-modal/index.js.map +1 -1
- package/dist/components/help-modal/index.mjs +1 -1
- package/dist/components/help-modal/modal.js +29 -147
- package/dist/components/help-modal/modal.js.map +1 -1
- package/dist/components/help-modal/modal.mjs +1 -1
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +2191 -1942
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +43 -31
- package/dist/index.css +481 -90
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2192 -1943
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +43 -31
- package/dist/types/css.d.ts +7 -1
- package/dist/types/css.js.map +1 -1
- package/package.json +4 -4
- package/src/components/chat/Chat.tsx +59 -22
- package/src/components/chat/ChatContext.tsx +29 -1
- package/src/components/chat/CodeBlock.tsx +2 -4
- package/src/components/chat/Header.tsx +8 -3
- package/src/components/chat/Icons.tsx +108 -108
- package/src/components/chat/Input.tsx +42 -38
- package/src/components/chat/Markdown.tsx +0 -3
- package/src/components/chat/Messages.tsx +68 -56
- package/src/components/chat/Suggestion.tsx +2 -3
- package/src/components/chat/messages/AssistantMessage.tsx +95 -3
- package/src/components/chat/messages/RenderTextMessage.tsx +17 -1
- package/src/components/chat/props.ts +66 -0
- package/src/components/crew/DefaultResponseRenderer.tsx +298 -0
- package/src/components/crew/DefaultStateRenderer.tsx +326 -0
- package/src/components/crew/index.ts +3 -0
- package/src/components/crew/types.ts +398 -0
- package/src/components/dev-console/console.tsx +16 -54
- package/src/components/help-modal/modal.tsx +38 -101
- package/src/components/index.ts +1 -0
- package/src/css/button.css +15 -4
- package/src/css/colors.css +27 -6
- package/src/css/console.css +46 -39
- package/src/css/crew.css +277 -0
- package/src/css/header.css +22 -5
- package/src/css/input.css +24 -17
- package/src/css/markdown.css +2 -1
- package/src/css/messages.css +125 -15
- package/src/css/panel.css +1 -0
- package/src/css/suggestions.css +14 -6
- package/src/styles.css +1 -0
- package/src/types/css.ts +7 -1
- package/dist/chunk-22K5DDPF.mjs.map +0 -1
- package/dist/chunk-2C3ANQCY.mjs.map +0 -1
- package/dist/chunk-3VNMQWGT.mjs +0 -25
- package/dist/chunk-3VNMQWGT.mjs.map +0 -1
- package/dist/chunk-6FTRYYR5.mjs.map +0 -1
- package/dist/chunk-CBBFRI3Q.mjs.map +0 -1
- package/dist/chunk-FZC7X5PK.mjs +0 -262
- package/dist/chunk-FZC7X5PK.mjs.map +0 -1
- package/dist/chunk-MMVDU6DF.mjs +0 -1
- package/dist/chunk-OFYI4UU4.mjs.map +0 -1
- package/dist/chunk-QXTRFMPM.mjs.map +0 -1
- package/dist/chunk-TI7SY2RI.mjs +0 -164
- package/dist/chunk-TI7SY2RI.mjs.map +0 -1
- package/dist/chunk-UPTB2MVO.mjs.map +0 -1
- package/dist/chunk-VEC45H6Q.mjs +0 -18
- package/dist/chunk-VEC45H6Q.mjs.map +0 -1
- package/dist/chunk-WGAZXTUA.mjs.map +0 -1
- package/dist/chunk-YQ3D5IQV.mjs.map +0 -1
- /package/dist/{chunk-YAGE7RCE.mjs.map → chunk-CGVOCLHN.mjs.map} +0 -0
- /package/dist/{chunk-AZU4QOV5.mjs.map → chunk-KG6DW6R2.mjs.map} +0 -0
- /package/dist/{chunk-3PJA5MFR.mjs.map → chunk-LKCAF2HG.mjs.map} +0 -0
- /package/dist/{chunk-ADTTDBLB.mjs.map → chunk-LXCH2BIB.mjs.map} +0 -0
- /package/dist/{chunk-MMVDU6DF.mjs.map → chunk-MWC5OV7Z.mjs.map} +0 -0
- /package/dist/{chunk-3XAXY2Z3.mjs.map → chunk-UZTZXMYS.mjs.map} +0 -0
- /package/dist/{chunk-RQNJNK2W.mjs.map → chunk-VC4NO5QZ.mjs.map} +0 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CloseIcon
|
|
3
|
+
} from "./chunk-BH6PCAAL.mjs";
|
|
4
|
+
|
|
5
|
+
// src/components/help-modal/modal.tsx
|
|
6
|
+
import { useState, useRef, useEffect } from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
function CopilotKitHelpModal() {
|
|
9
|
+
const [showHelpModal, setShowHelpModal] = useState(false);
|
|
10
|
+
const buttonRef = useRef(null);
|
|
11
|
+
const popoverRef = useRef(null);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const handleClickOutside = (event) => {
|
|
14
|
+
if (popoverRef.current && !popoverRef.current.contains(event.target) && buttonRef.current && !buttonRef.current.contains(event.target)) {
|
|
15
|
+
setShowHelpModal(false);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
if (showHelpModal) {
|
|
19
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
20
|
+
}
|
|
21
|
+
return () => {
|
|
22
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
23
|
+
};
|
|
24
|
+
}, [showHelpModal]);
|
|
25
|
+
const HelpButton = () => /* @__PURE__ */ jsx(
|
|
26
|
+
"button",
|
|
27
|
+
{
|
|
28
|
+
ref: buttonRef,
|
|
29
|
+
onClick: () => setShowHelpModal(!showHelpModal),
|
|
30
|
+
className: "copilotKitDebugMenuTriggerButton relative",
|
|
31
|
+
"aria-label": "Open Help",
|
|
32
|
+
children: "Help"
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
36
|
+
/* @__PURE__ */ jsx(HelpButton, {}),
|
|
37
|
+
showHelpModal && /* @__PURE__ */ jsx(
|
|
38
|
+
"div",
|
|
39
|
+
{
|
|
40
|
+
ref: popoverRef,
|
|
41
|
+
className: "absolute mt-2 z-50",
|
|
42
|
+
style: {
|
|
43
|
+
top: "100%",
|
|
44
|
+
right: "-120px",
|
|
45
|
+
width: "380px"
|
|
46
|
+
},
|
|
47
|
+
children: /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg shadow-xl w-full p-4 flex-col relative", children: [
|
|
48
|
+
/* @__PURE__ */ jsx(
|
|
49
|
+
"button",
|
|
50
|
+
{
|
|
51
|
+
className: "absolute text-gray-400 hover:text-gray-600 focus:outline-none",
|
|
52
|
+
style: { top: "10px", right: "10px" },
|
|
53
|
+
onClick: () => setShowHelpModal(false),
|
|
54
|
+
"aria-label": "Close",
|
|
55
|
+
children: /* @__PURE__ */ jsx(CloseIcon, {})
|
|
56
|
+
}
|
|
57
|
+
),
|
|
58
|
+
/* @__PURE__ */ jsx("div", { className: "w-full flex mb-6 justify-center", children: /* @__PURE__ */ jsx("h2", { className: "text-2xl font-bold", children: "Help Options" }) }),
|
|
59
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-4 mb-4", children: [
|
|
60
|
+
/* @__PURE__ */ jsx("div", { className: "copilotKitHelpItemButton", children: /* @__PURE__ */ jsx(
|
|
61
|
+
"a",
|
|
62
|
+
{
|
|
63
|
+
href: "https://docs.copilotkit.ai/coagents/troubleshooting/common-issues",
|
|
64
|
+
target: "_blank",
|
|
65
|
+
rel: "noopener noreferrer",
|
|
66
|
+
children: "Visit the Troubleshooting and FAQ section in the docs"
|
|
67
|
+
}
|
|
68
|
+
) }),
|
|
69
|
+
/* @__PURE__ */ jsx("div", { className: "copilotKitHelpItemButton", children: /* @__PURE__ */ jsx(
|
|
70
|
+
"a",
|
|
71
|
+
{
|
|
72
|
+
href: "https://go.copilotkit.ai/dev-console-support-discord",
|
|
73
|
+
target: "_blank",
|
|
74
|
+
rel: "noopener noreferrer",
|
|
75
|
+
children: "Go to Discord Support Channel (Community Support)"
|
|
76
|
+
}
|
|
77
|
+
) }),
|
|
78
|
+
/* @__PURE__ */ jsx("div", { className: "copilotKitHelpItemButton", children: /* @__PURE__ */ jsx(
|
|
79
|
+
"a",
|
|
80
|
+
{
|
|
81
|
+
href: "https://go.copilotkit.ai/dev-console-support-slack",
|
|
82
|
+
target: "_blank",
|
|
83
|
+
rel: "noopener noreferrer",
|
|
84
|
+
children: "Apply for Priority Direct Slack Support"
|
|
85
|
+
}
|
|
86
|
+
) })
|
|
87
|
+
] })
|
|
88
|
+
] })
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
] });
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export {
|
|
95
|
+
CopilotKitHelpModal
|
|
96
|
+
};
|
|
97
|
+
//# sourceMappingURL=chunk-YC4NBUGE.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/help-modal/modal.tsx"],"sourcesContent":["import React, { useMemo, useState, useRef, useEffect } from \"react\";\nimport { CloseIcon } from \"./icons\";\n\nexport function CopilotKitHelpModal() {\n const [showHelpModal, setShowHelpModal] = useState(false);\n const buttonRef = useRef<HTMLButtonElement>(null);\n const popoverRef = useRef<HTMLDivElement>(null);\n\n // Close popover when clicking outside\n useEffect(() => {\n const handleClickOutside = (event: MouseEvent) => {\n if (\n popoverRef.current &&\n !popoverRef.current.contains(event.target as Node) &&\n buttonRef.current &&\n !buttonRef.current.contains(event.target as Node)\n ) {\n setShowHelpModal(false);\n }\n };\n\n if (showHelpModal) {\n document.addEventListener(\"mousedown\", handleClickOutside);\n }\n\n return () => {\n document.removeEventListener(\"mousedown\", handleClickOutside);\n };\n }, [showHelpModal]);\n\n const HelpButton = () => (\n <button\n ref={buttonRef}\n onClick={() => setShowHelpModal(!showHelpModal)}\n className=\"copilotKitDebugMenuTriggerButton relative\"\n aria-label=\"Open Help\"\n >\n Help\n </button>\n );\n\n return (\n <div className=\"relative\">\n <HelpButton />\n {showHelpModal && (\n <div\n ref={popoverRef}\n className=\"absolute mt-2 z-50\"\n style={{\n top: \"100%\",\n right: \"-120px\",\n width: \"380px\",\n }}\n >\n <div className=\"bg-white rounded-lg shadow-xl w-full p-4 flex-col relative\">\n <button\n className=\"absolute text-gray-400 hover:text-gray-600 focus:outline-none\"\n style={{ top: \"10px\", right: \"10px\" }}\n onClick={() => setShowHelpModal(false)}\n aria-label=\"Close\"\n >\n <CloseIcon />\n </button>\n <div className=\"w-full flex mb-6 justify-center\">\n <h2 className=\"text-2xl font-bold\">Help Options</h2>\n </div>\n <div className=\"space-y-4 mb-4\">\n <div className=\"copilotKitHelpItemButton\">\n <a\n href=\"https://docs.copilotkit.ai/coagents/troubleshooting/common-issues\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n Visit the Troubleshooting and FAQ section in the docs\n </a>\n </div>\n <div className=\"copilotKitHelpItemButton\">\n <a\n href=\"https://go.copilotkit.ai/dev-console-support-discord\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n Go to Discord Support Channel (Community Support)\n </a>\n </div>\n <div className=\"copilotKitHelpItemButton\">\n <a\n href=\"https://go.copilotkit.ai/dev-console-support-slack\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n Apply for Priority Direct Slack Support\n </a>\n </div>\n </div>\n </div>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;AAAA,SAAyB,UAAU,QAAQ,iBAAiB;AA+BxD,cAmCQ,YAnCR;AA5BG,SAAS,sBAAsB;AACpC,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAS,KAAK;AACxD,QAAM,YAAY,OAA0B,IAAI;AAChD,QAAM,aAAa,OAAuB,IAAI;AAG9C,YAAU,MAAM;AACd,UAAM,qBAAqB,CAAC,UAAsB;AAChD,UACE,WAAW,WACX,CAAC,WAAW,QAAQ,SAAS,MAAM,MAAc,KACjD,UAAU,WACV,CAAC,UAAU,QAAQ,SAAS,MAAM,MAAc,GAChD;AACA,yBAAiB,KAAK;AAAA,MACxB;AAAA,IACF;AAEA,QAAI,eAAe;AACjB,eAAS,iBAAiB,aAAa,kBAAkB;AAAA,IAC3D;AAEA,WAAO,MAAM;AACX,eAAS,oBAAoB,aAAa,kBAAkB;AAAA,IAC9D;AAAA,EACF,GAAG,CAAC,aAAa,CAAC;AAElB,QAAM,aAAa,MACjB;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL,SAAS,MAAM,iBAAiB,CAAC,aAAa;AAAA,MAC9C,WAAU;AAAA,MACV,cAAW;AAAA,MACZ;AAAA;AAAA,EAED;AAGF,SACE,qBAAC,SAAI,WAAU,YACb;AAAA,wBAAC,cAAW;AAAA,IACX,iBACC;AAAA,MAAC;AAAA;AAAA,QACC,KAAK;AAAA,QACL,WAAU;AAAA,QACV,OAAO;AAAA,UACL,KAAK;AAAA,UACL,OAAO;AAAA,UACP,OAAO;AAAA,QACT;AAAA,QAEA,+BAAC,SAAI,WAAU,8DACb;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,WAAU;AAAA,cACV,OAAO,EAAE,KAAK,QAAQ,OAAO,OAAO;AAAA,cACpC,SAAS,MAAM,iBAAiB,KAAK;AAAA,cACrC,cAAW;AAAA,cAEX,8BAAC,aAAU;AAAA;AAAA,UACb;AAAA,UACA,oBAAC,SAAI,WAAU,mCACb,8BAAC,QAAG,WAAU,sBAAqB,0BAAY,GACjD;AAAA,UACA,qBAAC,SAAI,WAAU,kBACb;AAAA,gCAAC,SAAI,WAAU,4BACb;AAAA,cAAC;AAAA;AAAA,gBACC,MAAK;AAAA,gBACL,QAAO;AAAA,gBACP,KAAI;AAAA,gBACL;AAAA;AAAA,YAED,GACF;AAAA,YACA,oBAAC,SAAI,WAAU,4BACb;AAAA,cAAC;AAAA;AAAA,gBACC,MAAK;AAAA,gBACL,QAAO;AAAA,gBACP,KAAI;AAAA,gBACL;AAAA;AAAA,YAED,GACF;AAAA,YACA,oBAAC,SAAI,WAAU,4BACb;AAAA,cAAC;AAAA;AAAA,gBACC,MAAK;AAAA,gBACL,QAAO;AAAA,gBACP,KAAI;AAAA,gBACL;AAAA;AAAA,YAED,GACF;AAAA,aACF;AAAA,WACF;AAAA;AAAA,IACF;AAAA,KAEJ;AAEJ;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/chat/Button.tsx","../../../src/components/chat/ChatContext.tsx"],"sourcesContent":["import { ButtonProps } from \"./props\";\nimport { useChatContext } from \"./ChatContext\";\n\nexport const Button = ({}: ButtonProps) => {\n const { open, setOpen, icons } = useChatContext();\n\n return (\n <div onClick={() => setOpen(!open)}>\n <button\n className={`copilotKitButton ${open ? \"open\" : \"\"}`}\n aria-label={open ? \"Close Chat\" : \"Open Chat\"}\n >\n <div className=\"copilotKitButtonIcon copilotKitButtonIconOpen\">{icons.openIcon}</div>\n <div className=\"copilotKitButtonIcon copilotKitButtonIconClose\">{icons.closeIcon}</div>\n </button>\n </div>\n );\n};\n","import React, { useMemo, useState } from \"react\";\nimport * as DefaultIcons from \"./Icons\";\n\n/**\n * Icons for CopilotChat component.\n */\nexport interface CopilotChatIcons {\n /**\n * The icon to use for the open chat button.\n * @default <OpenIcon />\n */\n openIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button.\n * @default <CloseIcon />\n */\n closeIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button in the header.\n * @default <HeaderCloseIcon />\n */\n headerCloseIcon?: React.ReactNode;\n\n /**\n * The icon to use for the send button.\n * @default <SendIcon />\n */\n sendIcon?: React.ReactNode;\n\n /**\n * The icon to use for the activity indicator.\n * @default <ActivityIcon />\n */\n activityIcon?: React.ReactNode;\n\n /**\n * The icon to use for the spinner.\n * @default <SpinnerIcon />\n */\n spinnerIcon?: React.ReactNode;\n\n /**\n * The icon to use for the stop button.\n * @default <StopIcon />\n */\n stopIcon?: React.ReactNode;\n\n /**\n * The icon to use for the regenerate button.\n * @default <RegenerateIcon />\n */\n regenerateIcon?: React.ReactNode;\n\n /**\n * The icons to use for push to talk.\n * @default <PushToTalkIcon />\n */\n\n pushToTalkIcon?: React.ReactNode;\n}\n\n/**\n * Labels for CopilotChat component.\n */\nexport interface CopilotChatLabels {\n /**\n * The initial message(s) to display in the chat window.\n */\n initial?: string | string[];\n\n /**\n * The title to display in the header.\n * @default \"CopilotKit\"\n */\n title?: string;\n\n /**\n * The placeholder to display in the input.\n * @default \"Type a message...\"\n */\n placeholder?: string;\n\n /**\n * The message to display when an error occurs.\n * @default \"❌ An error occurred. Please try again.\"\n */\n error?: string;\n\n /**\n * The label to display on the stop button.\n * @default \"Stop generating\"\n */\n stopGenerating?: string;\n\n /**\n * The label to display on the regenerate button.\n * @default \"Regenerate response\"\n */\n regenerateResponse?: string;\n}\n\ninterface ChatContext {\n labels: Required<CopilotChatLabels>;\n icons: Required<CopilotChatIcons>;\n open: boolean;\n setOpen: (open: boolean) => void;\n}\n\nexport const ChatContext = React.createContext<ChatContext | undefined>(undefined);\n\nexport function useChatContext(): ChatContext {\n const context = React.useContext(ChatContext);\n if (context === undefined) {\n throw new Error(\n \"Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?\",\n );\n }\n return context;\n}\n\ninterface ChatContextProps {\n // temperature?: number;\n // instructions?: string;\n // maxFeedback?: number;\n labels?: CopilotChatLabels;\n icons?: CopilotChatIcons;\n children?: React.ReactNode;\n open: boolean;\n setOpen: (open: boolean) => void;\n}\n\nexport const ChatContextProvider = ({\n // temperature,\n // instructions,\n // maxFeedback,\n labels,\n icons,\n children,\n open,\n setOpen,\n}: ChatContextProps) => {\n const memoizedLabels = useMemo(\n () => ({\n ...{\n initial: \"\",\n title: \"CopilotKit\",\n placeholder: \"Type a message...\",\n error: \"❌ An error occurred. Please try again.\",\n stopGenerating: \"Stop generating\",\n regenerateResponse: \"Regenerate response\",\n },\n ...labels,\n }),\n [labels],\n );\n\n const memoizedIcons = useMemo(\n () => ({\n ...{\n openIcon: DefaultIcons.OpenIcon,\n closeIcon: DefaultIcons.CloseIcon,\n headerCloseIcon: DefaultIcons.HeaderCloseIcon,\n sendIcon: DefaultIcons.SendIcon,\n activityIcon: DefaultIcons.ActivityIcon,\n spinnerIcon: DefaultIcons.SpinnerIcon,\n stopIcon: DefaultIcons.StopIcon,\n regenerateIcon: DefaultIcons.RegenerateIcon,\n pushToTalkIcon: DefaultIcons.
|
|
1
|
+
{"version":3,"sources":["../../../src/components/chat/Button.tsx","../../../src/components/chat/ChatContext.tsx"],"sourcesContent":["import { ButtonProps } from \"./props\";\nimport { useChatContext } from \"./ChatContext\";\n\nexport const Button = ({}: ButtonProps) => {\n const { open, setOpen, icons } = useChatContext();\n\n return (\n <div onClick={() => setOpen(!open)}>\n <button\n className={`copilotKitButton ${open ? \"open\" : \"\"}`}\n aria-label={open ? \"Close Chat\" : \"Open Chat\"}\n >\n <div className=\"copilotKitButtonIcon copilotKitButtonIconOpen\">{icons.openIcon}</div>\n <div className=\"copilotKitButtonIcon copilotKitButtonIconClose\">{icons.closeIcon}</div>\n </button>\n </div>\n );\n};\n","import React, { useMemo, useState } from \"react\";\nimport * as DefaultIcons from \"./Icons\";\n\n/**\n * Icons for CopilotChat component.\n */\nexport interface CopilotChatIcons {\n /**\n * The icon to use for the open chat button.\n * @default <OpenIcon />\n */\n openIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button.\n * @default <CloseIcon />\n */\n closeIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button in the header.\n * @default <HeaderCloseIcon />\n */\n headerCloseIcon?: React.ReactNode;\n\n /**\n * The icon to use for the send button.\n * @default <SendIcon />\n */\n sendIcon?: React.ReactNode;\n\n /**\n * The icon to use for the activity indicator.\n * @default <ActivityIcon />\n */\n activityIcon?: React.ReactNode;\n\n /**\n * The icon to use for the spinner.\n * @default <SpinnerIcon />\n */\n spinnerIcon?: React.ReactNode;\n\n /**\n * The icon to use for the stop button.\n * @default <StopIcon />\n */\n stopIcon?: React.ReactNode;\n\n /**\n * The icon to use for the regenerate button.\n * @default <RegenerateIcon />\n */\n regenerateIcon?: React.ReactNode;\n\n /**\n * The icons to use for push to talk.\n * @default <PushToTalkIcon />\n */\n\n pushToTalkIcon?: React.ReactNode;\n}\n\n/**\n * Labels for CopilotChat component.\n */\nexport interface CopilotChatLabels {\n /**\n * The initial message(s) to display in the chat window.\n */\n initial?: string | string[];\n\n /**\n * The title to display in the header.\n * @default \"CopilotKit\"\n */\n title?: string;\n\n /**\n * The placeholder to display in the input.\n * @default \"Type a message...\"\n */\n placeholder?: string;\n\n /**\n * The message to display when an error occurs.\n * @default \"❌ An error occurred. Please try again.\"\n */\n error?: string;\n\n /**\n * The label to display on the stop button.\n * @default \"Stop generating\"\n */\n stopGenerating?: string;\n\n /**\n * The label to display on the regenerate button.\n * @default \"Regenerate response\"\n */\n regenerateResponse?: string;\n\n /**\n * The label for the copy button.\n * @default \"Copy to clipboard\"\n */\n copyToClipboard?: string;\n\n /**\n * The label for the thumbs up button.\n * @default \"Thumbs up\"\n */\n thumbsUp?: string;\n\n /**\n * The label for the thumbs down button.\n * @default \"Thumbs down\"\n */\n thumbsDown?: string;\n\n /**\n * The text to display when content is copied.\n * @default \"Copied!\"\n */\n copied?: string;\n}\n\ninterface ChatContext {\n labels: Required<CopilotChatLabels>;\n icons: Required<CopilotChatIcons>;\n open: boolean;\n setOpen: (open: boolean) => void;\n}\n\nexport const ChatContext = React.createContext<ChatContext | undefined>(undefined);\n\nexport function useChatContext(): ChatContext {\n const context = React.useContext(ChatContext);\n if (context === undefined) {\n throw new Error(\n \"Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?\",\n );\n }\n return context;\n}\n\ninterface ChatContextProps {\n // temperature?: number;\n // instructions?: string;\n // maxFeedback?: number;\n labels?: CopilotChatLabels;\n icons?: CopilotChatIcons;\n children?: React.ReactNode;\n open: boolean;\n setOpen: (open: boolean) => void;\n}\n\nexport const ChatContextProvider = ({\n // temperature,\n // instructions,\n // maxFeedback,\n labels,\n icons,\n children,\n open,\n setOpen,\n}: ChatContextProps) => {\n const memoizedLabels = useMemo(\n () => ({\n ...{\n initial: \"\",\n title: \"CopilotKit\",\n placeholder: \"Type a message...\",\n error: \"❌ An error occurred. Please try again.\",\n stopGenerating: \"Stop generating\",\n regenerateResponse: \"Regenerate response\",\n copyToClipboard: \"Copy to clipboard\",\n thumbsUp: \"Thumbs up\",\n thumbsDown: \"Thumbs down\",\n copied: \"Copied!\",\n },\n ...labels,\n }),\n [labels],\n );\n\n const memoizedIcons = useMemo(\n () => ({\n ...{\n openIcon: DefaultIcons.OpenIcon,\n closeIcon: DefaultIcons.CloseIcon,\n headerCloseIcon: DefaultIcons.HeaderCloseIcon,\n sendIcon: DefaultIcons.SendIcon,\n activityIcon: DefaultIcons.ActivityIcon,\n spinnerIcon: DefaultIcons.SpinnerIcon,\n stopIcon: DefaultIcons.StopIcon,\n regenerateIcon: DefaultIcons.RegenerateIcon,\n pushToTalkIcon: DefaultIcons.MicrophoneIcon,\n },\n ...icons,\n }),\n [icons],\n );\n\n const context = useMemo(\n () => ({\n labels: memoizedLabels,\n icons: memoizedIcons,\n open,\n setOpen,\n }),\n [memoizedLabels, memoizedIcons, open, setOpen],\n );\n\n return <ChatContext.Provider value={context}>{children}</ChatContext.Provider>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAyC;AAsNhC;AAhFF,IAAM,cAAc,aAAAA,QAAM,cAAuC,MAAS;AAE1E,SAAS,iBAA8B;AAC5C,QAAM,UAAU,aAAAA,QAAM,WAAW,WAAW;AAC5C,MAAI,YAAY,QAAW;AACzB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;;;ADxIM,IAAAC,sBAAA;AALC,IAAM,SAAS,CAAC,CAAC,MAAmB;AACzC,QAAM,EAAE,MAAM,SAAS,MAAM,IAAI,eAAe;AAEhD,SACE,6CAAC,SAAI,SAAS,MAAM,QAAQ,CAAC,IAAI,GAC/B;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,oBAAoB,OAAO,SAAS;AAAA,MAC/C,cAAY,OAAO,eAAe;AAAA,MAElC;AAAA,qDAAC,SAAI,WAAU,iDAAiD,gBAAM,UAAS;AAAA,QAC/E,6CAAC,SAAI,WAAU,kDAAkD,gBAAM,WAAU;AAAA;AAAA;AAAA,EACnF,GACF;AAEJ;","names":["React","import_jsx_runtime"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Button
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-VC4NO5QZ.mjs";
|
|
4
|
+
import "../../chunk-5JY5QJ2W.mjs";
|
|
5
|
+
import "../../chunk-ORSMX3SE.mjs";
|
|
6
6
|
import "../../chunk-MRXNTQOX.mjs";
|
|
7
7
|
export {
|
|
8
8
|
Button
|
|
@@ -35,6 +35,22 @@ interface CopilotChatProps {
|
|
|
35
35
|
* A custom reload messages function.
|
|
36
36
|
*/
|
|
37
37
|
onReloadMessages?: OnReloadMessages;
|
|
38
|
+
/**
|
|
39
|
+
* A callback function to regenerate the assistant's response
|
|
40
|
+
*/
|
|
41
|
+
onRegenerate?: () => void;
|
|
42
|
+
/**
|
|
43
|
+
* A callback function when the message is copied
|
|
44
|
+
*/
|
|
45
|
+
onCopy?: (message: string) => void;
|
|
46
|
+
/**
|
|
47
|
+
* A callback function for thumbs up feedback
|
|
48
|
+
*/
|
|
49
|
+
onThumbsUp?: (message: string) => void;
|
|
50
|
+
/**
|
|
51
|
+
* A callback function for thumbs down feedback
|
|
52
|
+
*/
|
|
53
|
+
onThumbsDown?: (message: string) => void;
|
|
38
54
|
/**
|
|
39
55
|
* Icons can be used to set custom icons for the chat window.
|
|
40
56
|
*/
|
|
@@ -137,7 +153,7 @@ interface OnStopGenerationArguments {
|
|
|
137
153
|
type OnReloadMessagesArguments = OnStopGenerationArguments;
|
|
138
154
|
type OnStopGeneration = (args: OnStopGenerationArguments) => void;
|
|
139
155
|
type OnReloadMessages = (args: OnReloadMessagesArguments) => void;
|
|
140
|
-
declare function CopilotChat({ instructions, onSubmitMessage, makeSystemMessage, showResponseButton, onInProgress, onStopGeneration, onReloadMessages, Messages, RenderTextMessage, RenderActionExecutionMessage, RenderAgentStateMessage, RenderResultMessage, Input, ResponseButton, className, icons, labels, AssistantMessage, UserMessage, }: CopilotChatProps): react_jsx_runtime.JSX.Element;
|
|
156
|
+
declare function CopilotChat({ instructions, onSubmitMessage, makeSystemMessage, showResponseButton, onInProgress, onStopGeneration, onReloadMessages, onRegenerate, onCopy, onThumbsUp, onThumbsDown, Messages, RenderTextMessage, RenderActionExecutionMessage, RenderAgentStateMessage, RenderResultMessage, Input, ResponseButton, className, icons, labels, AssistantMessage, UserMessage, }: CopilotChatProps): react_jsx_runtime.JSX.Element;
|
|
141
157
|
declare function WrappedCopilotChat({ children, icons, labels, className, }: {
|
|
142
158
|
children: React__default.ReactNode;
|
|
143
159
|
icons?: CopilotChatIcons;
|