@copilotkit/react-ui 1.5.1-next.1 → 1.5.1-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 +22 -0
- package/dist/{chunk-F2W5FD7L.mjs → chunk-2B57NCBA.mjs} +3 -3
- package/dist/{chunk-PNQVKBPN.mjs → chunk-4FIGRRFS.mjs} +2 -2
- package/dist/{chunk-PNQVKBPN.mjs.map → chunk-4FIGRRFS.mjs.map} +1 -1
- package/dist/{chunk-EMQEEXUB.mjs → chunk-4LUMV4YO.mjs} +3 -8
- package/dist/chunk-4LUMV4YO.mjs.map +1 -0
- package/dist/{chunk-BH6PCAAL.mjs → chunk-4T3TMQNJ.mjs} +2 -38
- package/dist/chunk-4T3TMQNJ.mjs.map +1 -0
- package/dist/{chunk-UWVGLGFQ.mjs → chunk-63ZKP62F.mjs} +4 -8
- package/dist/chunk-63ZKP62F.mjs.map +1 -0
- package/dist/{chunk-DCNCY2PL.mjs → chunk-DHGDU64D.mjs} +11 -114
- package/dist/chunk-DHGDU64D.mjs.map +1 -0
- package/dist/{chunk-3E7HY2UN.mjs → chunk-OMTPWC7T.mjs} +4 -5
- package/dist/chunk-OMTPWC7T.mjs.map +1 -0
- package/dist/{chunk-7II4YL7R.mjs → chunk-RKPANT3F.mjs} +6 -2
- package/dist/chunk-RKPANT3F.mjs.map +1 -0
- package/dist/{chunk-WSMMTZCM.mjs → chunk-TKFQ7VQR.mjs} +2 -2
- package/dist/{chunk-375NVWZM.mjs → chunk-VYKDFXGS.mjs} +2 -2
- package/dist/chunk-WOUWNTAV.mjs +72 -0
- package/dist/chunk-WOUWNTAV.mjs.map +1 -0
- package/dist/components/chat/Chat.d.ts +5 -50
- package/dist/components/chat/Chat.js +41 -249
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +8 -8
- package/dist/components/chat/Input.js +2 -7
- package/dist/components/chat/Input.js.map +1 -1
- package/dist/components/chat/Input.mjs +1 -1
- package/dist/components/chat/Messages.d.ts +3 -3
- package/dist/components/chat/Messages.js.map +1 -1
- package/dist/components/chat/Messages.mjs +1 -1
- package/dist/components/chat/Modal.d.ts +1 -1
- package/dist/components/chat/Modal.js +41 -253
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +9 -9
- package/dist/components/chat/Popup.js +41 -253
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +10 -10
- package/dist/components/chat/Sidebar.js +41 -253
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +10 -10
- package/dist/components/chat/index.js +41 -253
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +11 -11
- package/dist/components/chat/messages/RenderActionExecutionMessage.js +3 -4
- package/dist/components/chat/messages/RenderActionExecutionMessage.js.map +1 -1
- package/dist/components/chat/messages/RenderActionExecutionMessage.mjs +1 -1
- package/dist/components/dev-console/console.js +28 -128
- 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.js +28 -128
- 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.js +1 -1
- package/dist/components/dev-console/utils.js.map +1 -1
- package/dist/components/dev-console/utils.mjs +1 -1
- package/dist/components/help-modal/icons.d.ts +1 -4
- package/dist/components/help-modal/icons.js +2 -39
- package/dist/components/help-modal/icons.js.map +1 -1
- package/dist/components/help-modal/icons.mjs +3 -5
- package/dist/components/help-modal/index.js +27 -147
- package/dist/components/help-modal/index.js.map +1 -1
- package/dist/components/help-modal/index.mjs +2 -2
- package/dist/components/help-modal/modal.js +27 -147
- package/dist/components/help-modal/modal.js.map +1 -1
- package/dist/components/help-modal/modal.mjs +2 -2
- package/dist/components/index.js +41 -253
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +11 -11
- package/dist/index.js +43 -255
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -11
- package/package.json +4 -4
- package/dist/chunk-3E7HY2UN.mjs.map +0 -1
- package/dist/chunk-7II4YL7R.mjs.map +0 -1
- package/dist/chunk-BH6PCAAL.mjs.map +0 -1
- package/dist/chunk-DCNCY2PL.mjs.map +0 -1
- package/dist/chunk-EMQEEXUB.mjs.map +0 -1
- package/dist/chunk-TI7SY2RI.mjs +0 -164
- package/dist/chunk-TI7SY2RI.mjs.map +0 -1
- package/dist/chunk-UWVGLGFQ.mjs.map +0 -1
- /package/dist/{chunk-F2W5FD7L.mjs.map → chunk-2B57NCBA.mjs.map} +0 -0
- /package/dist/{chunk-WSMMTZCM.mjs.map → chunk-TKFQ7VQR.mjs.map} +0 -0
- /package/dist/{chunk-375NVWZM.mjs.map → chunk-VYKDFXGS.mjs.map} +0 -0
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotModal
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-63ZKP62F.mjs";
|
|
4
4
|
import "../../chunk-YAGE7RCE.mjs";
|
|
5
5
|
import "../../chunk-VEC45H6Q.mjs";
|
|
6
6
|
import "../../chunk-RQNJNK2W.mjs";
|
|
7
|
-
import "../../chunk-
|
|
7
|
+
import "../../chunk-DHGDU64D.mjs";
|
|
8
8
|
import "../../chunk-6INMITFA.mjs";
|
|
9
9
|
import "../../chunk-RU73BEZM.mjs";
|
|
10
10
|
import "../../chunk-V7W6IM2V.mjs";
|
|
11
|
-
import "../../chunk-
|
|
11
|
+
import "../../chunk-OMTPWC7T.mjs";
|
|
12
12
|
import "../../chunk-ZABXREBH.mjs";
|
|
13
13
|
import "../../chunk-RJCZRKTV.mjs";
|
|
14
|
-
import "../../chunk-
|
|
15
|
-
import "../../chunk-
|
|
14
|
+
import "../../chunk-2B57NCBA.mjs";
|
|
15
|
+
import "../../chunk-4FIGRRFS.mjs";
|
|
16
16
|
import "../../chunk-KXE2JCUH.mjs";
|
|
17
|
-
import "../../chunk-
|
|
18
|
-
import "../../chunk-
|
|
17
|
+
import "../../chunk-WOUWNTAV.mjs";
|
|
18
|
+
import "../../chunk-4T3TMQNJ.mjs";
|
|
19
19
|
import "../../chunk-OTPAZXVR.mjs";
|
|
20
|
-
import "../../chunk-
|
|
20
|
+
import "../../chunk-4LUMV4YO.mjs";
|
|
21
21
|
import "../../chunk-YQFVRDNC.mjs";
|
|
22
22
|
import "../../chunk-YQ3D5IQV.mjs";
|
|
23
|
-
import "../../chunk-
|
|
23
|
+
import "../../chunk-RKPANT3F.mjs";
|
|
24
24
|
import "../../chunk-3XAXY2Z3.mjs";
|
|
25
25
|
import "../../chunk-CBBFRI3Q.mjs";
|
|
26
26
|
import "../../chunk-UPTB2MVO.mjs";
|
|
@@ -877,10 +877,7 @@ var Input = ({ inProgress, onSend, isVisible = false }) => {
|
|
|
877
877
|
});
|
|
878
878
|
const sendIcon = inProgress || pushToTalkState === "transcribing" ? context.icons.activityIcon : context.icons.sendIcon;
|
|
879
879
|
const showPushToTalk = pushToTalkConfigured && (pushToTalkState === "idle" || pushToTalkState === "recording") && !inProgress;
|
|
880
|
-
const
|
|
881
|
-
return !inProgress && text.trim().length > 0 && pushToTalkState === "idle";
|
|
882
|
-
};
|
|
883
|
-
const sendDisabled = !canSend();
|
|
880
|
+
const sendDisabled = inProgress || text.length === 0 || pushToTalkState !== "idle";
|
|
884
881
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
|
|
885
882
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
886
883
|
Textarea_default,
|
|
@@ -894,9 +891,7 @@ var Input = ({ inProgress, onSend, isVisible = false }) => {
|
|
|
894
891
|
onKeyDown: (event) => {
|
|
895
892
|
if (event.key === "Enter" && !event.shiftKey) {
|
|
896
893
|
event.preventDefault();
|
|
897
|
-
|
|
898
|
-
send();
|
|
899
|
-
}
|
|
894
|
+
send();
|
|
900
895
|
}
|
|
901
896
|
}
|
|
902
897
|
}
|
|
@@ -943,9 +938,9 @@ var import_react7 = require("react");
|
|
|
943
938
|
var import_react_syntax_highlighter = require("react-syntax-highlighter");
|
|
944
939
|
|
|
945
940
|
// src/hooks/use-copy-to-clipboard.tsx
|
|
946
|
-
var
|
|
941
|
+
var React6 = __toESM(require("react"));
|
|
947
942
|
function useCopyToClipboard({ timeout = 2e3 }) {
|
|
948
|
-
const [isCopied, setIsCopied] =
|
|
943
|
+
const [isCopied, setIsCopied] = React6.useState(false);
|
|
949
944
|
const copyToClipboard = (value) => {
|
|
950
945
|
var _a;
|
|
951
946
|
if (typeof window === "undefined" || !((_a = navigator.clipboard) == null ? void 0 : _a.writeText)) {
|
|
@@ -1441,8 +1436,8 @@ function RenderActionExecutionMessage(props) {
|
|
|
1441
1436
|
const { chatComponentsCache } = (0, import_react_core3.useCopilotContext)();
|
|
1442
1437
|
const { icons } = useChatContext();
|
|
1443
1438
|
if (message.isActionExecutionMessage()) {
|
|
1444
|
-
if (chatComponentsCache.current !== null &&
|
|
1445
|
-
const render = chatComponentsCache.current.actions[message.name]
|
|
1439
|
+
if (chatComponentsCache.current !== null && chatComponentsCache.current.actions[message.name]) {
|
|
1440
|
+
const render = chatComponentsCache.current.actions[message.name];
|
|
1446
1441
|
if (typeof render === "string") {
|
|
1447
1442
|
if (isCurrentMessage && inProgress) {
|
|
1448
1443
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: [
|
|
@@ -1465,8 +1460,7 @@ function RenderActionExecutionMessage(props) {
|
|
|
1465
1460
|
const toRender = render({
|
|
1466
1461
|
status,
|
|
1467
1462
|
args,
|
|
1468
|
-
result: actionResult
|
|
1469
|
-
name: message.name
|
|
1463
|
+
result: actionResult
|
|
1470
1464
|
});
|
|
1471
1465
|
if (!toRender && status === "complete") {
|
|
1472
1466
|
return null;
|
|
@@ -1780,7 +1774,7 @@ function logMessages(context) {
|
|
|
1780
1774
|
type: "ActionExecutionMessage",
|
|
1781
1775
|
role: void 0,
|
|
1782
1776
|
name: message.name,
|
|
1783
|
-
scope: message.
|
|
1777
|
+
scope: message.scope,
|
|
1784
1778
|
content: message.arguments
|
|
1785
1779
|
};
|
|
1786
1780
|
} else if (message.isResultMessage()) {
|
|
@@ -1903,52 +1897,41 @@ var import_react9 = require("react");
|
|
|
1903
1897
|
|
|
1904
1898
|
// src/components/help-modal/icons.tsx
|
|
1905
1899
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1906
|
-
var
|
|
1900
|
+
var LifeBuoyIcon = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1907
1901
|
"svg",
|
|
1908
1902
|
{
|
|
1909
1903
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1910
|
-
|
|
1904
|
+
width: "24",
|
|
1905
|
+
height: "24",
|
|
1911
1906
|
viewBox: "0 0 24 24",
|
|
1912
|
-
|
|
1907
|
+
fill: "none",
|
|
1913
1908
|
stroke: "currentColor",
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1909
|
+
strokeWidth: "2",
|
|
1910
|
+
strokeLinecap: "round",
|
|
1911
|
+
strokeLinejoin: "round",
|
|
1912
|
+
className: "icon icon-tabler icons-tabler-outline icon-tabler-lifebuoy",
|
|
1913
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("g", { transform: "translate(0, -1)", children: [
|
|
1914
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
1915
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M12 12m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0" }),
|
|
1916
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" }),
|
|
1917
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M15 15l3.35 3.35" }),
|
|
1918
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M9 15l-3.35 3.35" }),
|
|
1919
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M5.65 5.65l3.35 3.35" }),
|
|
1920
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M18.35 5.65l-3.35 3.35" })
|
|
1921
|
+
] })
|
|
1917
1922
|
}
|
|
1918
1923
|
);
|
|
1919
|
-
var
|
|
1924
|
+
var CloseIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1920
1925
|
"svg",
|
|
1921
1926
|
{
|
|
1922
|
-
style: {
|
|
1923
|
-
animation: "copilotKitSpinAnimation 1s linear infinite",
|
|
1924
|
-
color
|
|
1925
|
-
},
|
|
1926
|
-
width: "24",
|
|
1927
|
-
height: "24",
|
|
1928
1927
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1929
1928
|
fill: "none",
|
|
1930
1929
|
viewBox: "0 0 24 24",
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
cx: "12",
|
|
1937
|
-
cy: "12",
|
|
1938
|
-
r: "10",
|
|
1939
|
-
stroke: "currentColor",
|
|
1940
|
-
strokeWidth: "4"
|
|
1941
|
-
}
|
|
1942
|
-
),
|
|
1943
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1944
|
-
"path",
|
|
1945
|
-
{
|
|
1946
|
-
style: { opacity: 0.75 },
|
|
1947
|
-
fill: "currentColor",
|
|
1948
|
-
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
1949
|
-
}
|
|
1950
|
-
)
|
|
1951
|
-
]
|
|
1930
|
+
strokeWidth: "1.5",
|
|
1931
|
+
stroke: "currentColor",
|
|
1932
|
+
width: "20",
|
|
1933
|
+
height: "20",
|
|
1934
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
|
|
1952
1935
|
}
|
|
1953
1936
|
);
|
|
1954
1937
|
|
|
@@ -1957,52 +1940,18 @@ var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
|
1957
1940
|
function CopilotKitHelpModal() {
|
|
1958
1941
|
const [showHelpModal, setShowHelpModal] = (0, import_react9.useState)(false);
|
|
1959
1942
|
const [issueDescription, setIssueDescription] = (0, import_react9.useState)("");
|
|
1960
|
-
const
|
|
1961
|
-
const [emailError, setEmailError] = (0, import_react9.useState)("");
|
|
1962
|
-
const [submitting, setSubmitting] = (0, import_react9.useState)(false);
|
|
1963
|
-
const validateEmail = (email2) => {
|
|
1964
|
-
const re = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
1965
|
-
return re.test(email2);
|
|
1966
|
-
};
|
|
1967
|
-
const handleSubmit = (e) => __async(this, null, function* () {
|
|
1968
|
-
e.preventDefault();
|
|
1969
|
-
if ((email == null ? void 0 : email.length) > 0 && !validateEmail(email)) {
|
|
1970
|
-
setEmailError("Please enter a valid email address");
|
|
1971
|
-
return;
|
|
1972
|
-
}
|
|
1973
|
-
setSubmitting(true);
|
|
1974
|
-
yield fetch("https://api.segment.io/v1/track", {
|
|
1975
|
-
method: "POST",
|
|
1976
|
-
headers: {
|
|
1977
|
-
"Content-Type": "application/json"
|
|
1978
|
-
},
|
|
1979
|
-
body: JSON.stringify({
|
|
1980
|
-
event: "oss.dev-console.help",
|
|
1981
|
-
anonymousId: window.crypto.randomUUID(),
|
|
1982
|
-
properties: { email, text: issueDescription },
|
|
1983
|
-
writeKey: "q0gQqvGYyw9pNyhIocNzefSYKGO1aiwW"
|
|
1984
|
-
})
|
|
1985
|
-
});
|
|
1986
|
-
setEmailError("");
|
|
1987
|
-
setEmail("");
|
|
1988
|
-
setIssueDescription("");
|
|
1989
|
-
setSubmitting(false);
|
|
1943
|
+
const handleSubmit = () => {
|
|
1990
1944
|
setShowHelpModal(false);
|
|
1991
|
-
}
|
|
1945
|
+
};
|
|
1992
1946
|
const HelpButton = () => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1993
1947
|
"button",
|
|
1994
1948
|
{
|
|
1995
1949
|
onClick: () => setShowHelpModal(true),
|
|
1996
|
-
|
|
1997
|
-
className: "text-sm p-0 bg-transparent rounded border border-blue-500",
|
|
1950
|
+
className: "p-2 bg-transparent rounded-full shadow-lg hover:shadow-xl transition-shadow duration-300 focus:outline-none focus:ring-2 focus:ring-blue-500",
|
|
1998
1951
|
"aria-label": "Open Help",
|
|
1999
|
-
children:
|
|
1952
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(LifeBuoyIcon, {})
|
|
2000
1953
|
}
|
|
2001
1954
|
);
|
|
2002
|
-
const submitButtonDisabled = (0, import_react9.useMemo)(
|
|
2003
|
-
() => submitting || !!emailError || issueDescription == null || (issueDescription == null ? void 0 : issueDescription.length) == 0,
|
|
2004
|
-
[submitting, emailError, issueDescription]
|
|
2005
|
-
);
|
|
2006
1955
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
2007
1956
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(HelpButton, {}),
|
|
2008
1957
|
showHelpModal && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
@@ -2023,15 +1972,6 @@ function CopilotKitHelpModal() {
|
|
|
2023
1972
|
),
|
|
2024
1973
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "w-full flex mb-6 justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h2", { className: "text-2xl font-bold", children: "Help Options" }) }),
|
|
2025
1974
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-4 mb-4", children: [
|
|
2026
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "block w-full text-center py-2 px-4 bg-blue-500 text-white rounded hover:bg-blue-600 transition duration-150 text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2027
|
-
"a",
|
|
2028
|
-
{
|
|
2029
|
-
href: "https://docs.copilotkit.ai/coagents/troubleshooting/common-issues",
|
|
2030
|
-
target: "_blank",
|
|
2031
|
-
rel: "noopener noreferrer",
|
|
2032
|
-
children: "Visit the Troubleshooting and FAQ section in the docs"
|
|
2033
|
-
}
|
|
2034
|
-
) }),
|
|
2035
1975
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "block w-full text-center py-2 px-4 bg-blue-500 text-white rounded hover:bg-blue-600 transition duration-150 text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2036
1976
|
"a",
|
|
2037
1977
|
{
|
|
@@ -2050,52 +1990,6 @@ function CopilotKitHelpModal() {
|
|
|
2050
1990
|
children: "Apply for Priority Direct Slack Support"
|
|
2051
1991
|
}
|
|
2052
1992
|
) })
|
|
2053
|
-
] }),
|
|
2054
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("form", { onSubmit: handleSubmit, className: "flex flex-col space-y-2", children: [
|
|
2055
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { children: [
|
|
2056
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("label", { htmlFor: "feedback", className: "block text-sm font-medium text-gray-700 mb-1", children: "Let us know what your issue is:" }),
|
|
2057
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2058
|
-
"textarea",
|
|
2059
|
-
{
|
|
2060
|
-
id: "feedback",
|
|
2061
|
-
rows: 4,
|
|
2062
|
-
className: "w-full px-3 py-2 text-gray-700 border rounded-lg focus:outline-none focus:border-blue-500",
|
|
2063
|
-
placeholder: "A Loom link / screen recording is always great!",
|
|
2064
|
-
onChange: (e) => setIssueDescription(e.target.value),
|
|
2065
|
-
value: issueDescription,
|
|
2066
|
-
required: true
|
|
2067
|
-
}
|
|
2068
|
-
)
|
|
2069
|
-
] }),
|
|
2070
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { children: [
|
|
2071
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("label", { htmlFor: "email", className: "block text-sm font-medium text-gray-700 mb-1", children: "Email (optional):" }),
|
|
2072
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2073
|
-
"input",
|
|
2074
|
-
{
|
|
2075
|
-
type: "email",
|
|
2076
|
-
id: "email",
|
|
2077
|
-
className: `w-full px-3 py-2 text-gray-700 border rounded-lg focus:outline-none focus:border-blue-500 ${emailError ? "border-red-500" : ""}`,
|
|
2078
|
-
placeholder: "Enter your email for follow-up",
|
|
2079
|
-
onChange: (e) => {
|
|
2080
|
-
setEmail(e.target.value);
|
|
2081
|
-
setEmailError("");
|
|
2082
|
-
},
|
|
2083
|
-
value: email
|
|
2084
|
-
}
|
|
2085
|
-
),
|
|
2086
|
-
emailError && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-red-500 text-sm mt-1", children: emailError })
|
|
2087
|
-
] }),
|
|
2088
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "bg-gray-50 px-4 py-4 sm:px-6 sm:flex sm:flex-row-reverse rounded-b-lg", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2089
|
-
"button",
|
|
2090
|
-
{
|
|
2091
|
-
type: "submit",
|
|
2092
|
-
onClick: handleSubmit,
|
|
2093
|
-
disabled: submitButtonDisabled,
|
|
2094
|
-
style: submitButtonDisabled ? { backgroundColor: "rgb(216, 216, 216)", color: "rgb(129, 129, 129)" } : void 0,
|
|
2095
|
-
className: "w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-500 text-base font-medium text-white hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm disabled:shadow-none",
|
|
2096
|
-
children: submitting ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(LoadingSpinnerIcon, { color: "white" }) : "Submit"
|
|
2097
|
-
}
|
|
2098
|
-
) })
|
|
2099
1993
|
] })
|
|
2100
1994
|
] })
|
|
2101
1995
|
}
|
|
@@ -2306,7 +2200,6 @@ function DebugMenuButton({
|
|
|
2306
2200
|
}
|
|
2307
2201
|
|
|
2308
2202
|
// src/components/chat/Chat.tsx
|
|
2309
|
-
var import_react_core9 = require("@copilotkit/react-core");
|
|
2310
2203
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2311
2204
|
function CopilotChat({
|
|
2312
2205
|
instructions,
|
|
@@ -2314,8 +2207,6 @@ function CopilotChat({
|
|
|
2314
2207
|
makeSystemMessage,
|
|
2315
2208
|
showResponseButton = true,
|
|
2316
2209
|
onInProgress,
|
|
2317
|
-
onStopGeneration,
|
|
2318
|
-
onReloadMessages,
|
|
2319
2210
|
Messages: Messages2 = Messages,
|
|
2320
2211
|
RenderTextMessage: RenderTextMessage2 = RenderTextMessage,
|
|
2321
2212
|
RenderActionExecutionMessage: RenderActionExecutionMessage2 = RenderActionExecutionMessage,
|
|
@@ -2338,13 +2229,7 @@ function CopilotChat({
|
|
|
2338
2229
|
sendMessage,
|
|
2339
2230
|
stopGeneration,
|
|
2340
2231
|
reloadMessages
|
|
2341
|
-
} = useCopilotChatLogic(
|
|
2342
|
-
makeSystemMessage,
|
|
2343
|
-
onInProgress,
|
|
2344
|
-
onSubmitMessage,
|
|
2345
|
-
onStopGeneration,
|
|
2346
|
-
onReloadMessages
|
|
2347
|
-
);
|
|
2232
|
+
} = useCopilotChatLogic(makeSystemMessage, onInProgress, onSubmitMessage);
|
|
2348
2233
|
const chatContext = import_react12.default.useContext(ChatContext);
|
|
2349
2234
|
const isVisible = chatContext ? chatContext.open : true;
|
|
2350
2235
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
|
|
@@ -2400,16 +2285,8 @@ function WrappedCopilotChat({
|
|
|
2400
2285
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children });
|
|
2401
2286
|
}
|
|
2402
2287
|
var SUGGESTIONS_DEBOUNCE_TIMEOUT = 1e3;
|
|
2403
|
-
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage
|
|
2404
|
-
|
|
2405
|
-
const {
|
|
2406
|
-
visibleMessages,
|
|
2407
|
-
appendMessage,
|
|
2408
|
-
reloadMessages: defaultReloadMessages,
|
|
2409
|
-
stopGeneration: defaultStopGeneration,
|
|
2410
|
-
runChatCompletion,
|
|
2411
|
-
isLoading
|
|
2412
|
-
} = (0, import_react_core8.useCopilotChat)({
|
|
2288
|
+
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) => {
|
|
2289
|
+
const { visibleMessages, appendMessage, reloadMessages, stopGeneration, isLoading } = (0, import_react_core8.useCopilotChat)({
|
|
2413
2290
|
id: (0, import_shared3.randomId)(),
|
|
2414
2291
|
makeSystemMessage
|
|
2415
2292
|
});
|
|
@@ -2417,8 +2294,8 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2417
2294
|
const suggestionsAbortControllerRef = (0, import_react12.useRef)(null);
|
|
2418
2295
|
const debounceTimerRef = (0, import_react12.useRef)();
|
|
2419
2296
|
const abortSuggestions = () => {
|
|
2420
|
-
var
|
|
2421
|
-
(
|
|
2297
|
+
var _a;
|
|
2298
|
+
(_a = suggestionsAbortControllerRef.current) == null ? void 0 : _a.abort();
|
|
2422
2299
|
suggestionsAbortControllerRef.current = null;
|
|
2423
2300
|
};
|
|
2424
2301
|
const generalContext = (0, import_react_core8.useCopilotContext)();
|
|
@@ -2444,13 +2321,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2444
2321
|
return () => {
|
|
2445
2322
|
clearTimeout(debounceTimerRef.current);
|
|
2446
2323
|
};
|
|
2447
|
-
}, [
|
|
2448
|
-
isLoading,
|
|
2449
|
-
context.chatSuggestionConfiguration,
|
|
2450
|
-
// hackish way to trigger suggestions reload on reset, but better than moving suggestions to the
|
|
2451
|
-
// global context
|
|
2452
|
-
visibleMessages.length == 0
|
|
2453
|
-
]);
|
|
2324
|
+
}, [isLoading, context.chatSuggestionConfiguration]);
|
|
2454
2325
|
const sendMessage = (messageContent) => __async(void 0, null, function* () {
|
|
2455
2326
|
abortSuggestions();
|
|
2456
2327
|
setCurrentSuggestions([]);
|
|
@@ -2468,85 +2339,6 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2468
2339
|
appendMessage(message);
|
|
2469
2340
|
return message;
|
|
2470
2341
|
});
|
|
2471
|
-
const messages = visibleMessages;
|
|
2472
|
-
const { setMessages } = messagesContext;
|
|
2473
|
-
const currentAgentName = (_a = generalContext.agentSession) == null ? void 0 : _a.agentName;
|
|
2474
|
-
const restartCurrentAgent = (hint) => __async(void 0, null, function* () {
|
|
2475
|
-
if (generalContext.agentSession) {
|
|
2476
|
-
generalContext.setAgentSession(__spreadProps(__spreadValues({}, generalContext.agentSession), {
|
|
2477
|
-
nodeName: void 0,
|
|
2478
|
-
threadId: void 0
|
|
2479
|
-
}));
|
|
2480
|
-
generalContext.setCoagentStates((prevAgentStates) => {
|
|
2481
|
-
return __spreadProps(__spreadValues({}, prevAgentStates), {
|
|
2482
|
-
[generalContext.agentSession.agentName]: __spreadProps(__spreadValues({}, prevAgentStates[generalContext.agentSession.agentName]), {
|
|
2483
|
-
threadId: void 0,
|
|
2484
|
-
nodeName: void 0,
|
|
2485
|
-
runId: void 0
|
|
2486
|
-
})
|
|
2487
|
-
});
|
|
2488
|
-
});
|
|
2489
|
-
}
|
|
2490
|
-
});
|
|
2491
|
-
const runCurrentAgent = (hint) => __async(void 0, null, function* () {
|
|
2492
|
-
if (generalContext.agentSession) {
|
|
2493
|
-
yield (0, import_react_core9.runAgent)(
|
|
2494
|
-
generalContext.agentSession.agentName,
|
|
2495
|
-
context,
|
|
2496
|
-
appendMessage,
|
|
2497
|
-
runChatCompletion,
|
|
2498
|
-
hint
|
|
2499
|
-
);
|
|
2500
|
-
}
|
|
2501
|
-
});
|
|
2502
|
-
const stopCurrentAgent = () => {
|
|
2503
|
-
if (generalContext.agentSession) {
|
|
2504
|
-
(0, import_react_core9.stopAgent)(generalContext.agentSession.agentName, context);
|
|
2505
|
-
}
|
|
2506
|
-
};
|
|
2507
|
-
const setCurrentAgentState = (state) => {
|
|
2508
|
-
if (generalContext.agentSession) {
|
|
2509
|
-
generalContext.setCoagentStates((prevAgentStates) => {
|
|
2510
|
-
return __spreadProps(__spreadValues({}, prevAgentStates), {
|
|
2511
|
-
[generalContext.agentSession.agentName]: {
|
|
2512
|
-
state
|
|
2513
|
-
}
|
|
2514
|
-
});
|
|
2515
|
-
});
|
|
2516
|
-
}
|
|
2517
|
-
};
|
|
2518
|
-
function stopGeneration() {
|
|
2519
|
-
if (onStopGeneration) {
|
|
2520
|
-
onStopGeneration({
|
|
2521
|
-
messages,
|
|
2522
|
-
setMessages,
|
|
2523
|
-
stopGeneration: defaultStopGeneration,
|
|
2524
|
-
currentAgentName,
|
|
2525
|
-
restartCurrentAgent,
|
|
2526
|
-
stopCurrentAgent,
|
|
2527
|
-
runCurrentAgent,
|
|
2528
|
-
setCurrentAgentState
|
|
2529
|
-
});
|
|
2530
|
-
} else {
|
|
2531
|
-
defaultStopGeneration();
|
|
2532
|
-
}
|
|
2533
|
-
}
|
|
2534
|
-
function reloadMessages() {
|
|
2535
|
-
if (onReloadMessages) {
|
|
2536
|
-
onReloadMessages({
|
|
2537
|
-
messages,
|
|
2538
|
-
setMessages,
|
|
2539
|
-
stopGeneration: defaultStopGeneration,
|
|
2540
|
-
currentAgentName,
|
|
2541
|
-
restartCurrentAgent,
|
|
2542
|
-
stopCurrentAgent,
|
|
2543
|
-
runCurrentAgent,
|
|
2544
|
-
setCurrentAgentState
|
|
2545
|
-
});
|
|
2546
|
-
} else {
|
|
2547
|
-
defaultReloadMessages();
|
|
2548
|
-
}
|
|
2549
|
-
}
|
|
2550
2342
|
return {
|
|
2551
2343
|
visibleMessages,
|
|
2552
2344
|
isLoading,
|
|
@@ -2566,8 +2358,6 @@ var CopilotModal = ({
|
|
|
2566
2358
|
hitEscapeToClose = true,
|
|
2567
2359
|
onSetOpen,
|
|
2568
2360
|
onSubmitMessage,
|
|
2569
|
-
onStopGeneration,
|
|
2570
|
-
onReloadMessages,
|
|
2571
2361
|
shortcut = "/",
|
|
2572
2362
|
icons,
|
|
2573
2363
|
labels,
|
|
@@ -2605,8 +2395,6 @@ var CopilotModal = ({
|
|
|
2605
2395
|
{
|
|
2606
2396
|
instructions,
|
|
2607
2397
|
onSubmitMessage,
|
|
2608
|
-
onStopGeneration,
|
|
2609
|
-
onReloadMessages,
|
|
2610
2398
|
makeSystemMessage,
|
|
2611
2399
|
showResponseButton,
|
|
2612
2400
|
onInProgress,
|