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