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