@copilotkit/react-ui 1.4.1-pre.6 → 1.4.2-tyler-reset-chat.0
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 +59 -0
- package/dist/{chunk-RS6UPR5N.mjs → chunk-2B57NCBA.mjs} +5 -1
- package/dist/chunk-2B57NCBA.mjs.map +1 -0
- package/dist/chunk-4T3TMQNJ.mjs +45 -0
- package/dist/chunk-4T3TMQNJ.mjs.map +1 -0
- package/dist/{chunk-H5CXJBR5.mjs → chunk-B6A6OMIG.mjs} +6 -2
- package/dist/chunk-B6A6OMIG.mjs.map +1 -0
- package/dist/chunk-KXE2JCUH.mjs +1 -0
- package/dist/chunk-KXE2JCUH.mjs.map +1 -0
- package/dist/{chunk-ORHE7FYT.mjs → chunk-OI5EKZPO.mjs} +110 -14
- package/dist/chunk-OI5EKZPO.mjs.map +1 -0
- package/dist/{chunk-ECPBML4L.mjs → chunk-RQRK6DEW.mjs} +2 -2
- package/dist/chunk-WOUWNTAV.mjs +72 -0
- package/dist/chunk-WOUWNTAV.mjs.map +1 -0
- package/dist/{chunk-TSIFZ5N5.mjs → chunk-Z2RXDT7O.mjs} +2 -2
- package/dist/components/chat/Chat.d.ts +50 -5
- package/dist/components/chat/Chat.js +260 -57
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +7 -4
- package/dist/components/chat/Modal.d.ts +1 -1
- package/dist/components/chat/Modal.js +273 -66
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +8 -5
- package/dist/components/chat/Popup.js +275 -68
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +9 -6
- package/dist/components/chat/Sidebar.js +277 -70
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +9 -6
- package/dist/components/chat/index.js +279 -72
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +10 -7
- package/dist/components/dev-console/console.js +138 -32
- package/dist/components/dev-console/console.js.map +1 -1
- package/dist/components/dev-console/console.mjs +4 -1
- package/dist/components/dev-console/index.js +138 -32
- package/dist/components/dev-console/index.js.map +1 -1
- package/dist/components/dev-console/index.mjs +4 -1
- package/dist/components/help-modal/icons.d.ts +6 -0
- package/dist/components/help-modal/icons.js +70 -0
- package/dist/components/help-modal/icons.js.map +1 -0
- package/dist/components/help-modal/icons.mjs +10 -0
- package/dist/components/help-modal/icons.mjs.map +1 -0
- package/dist/components/help-modal/index.d.ts +2 -0
- package/dist/components/help-modal/index.js +135 -0
- package/dist/components/help-modal/index.js.map +1 -0
- package/dist/components/help-modal/index.mjs +10 -0
- package/dist/components/help-modal/index.mjs.map +1 -0
- package/dist/components/help-modal/modal.d.ts +5 -0
- package/dist/components/help-modal/modal.js +133 -0
- package/dist/components/help-modal/modal.js.map +1 -0
- package/dist/components/help-modal/modal.mjs +9 -0
- package/dist/components/help-modal/modal.mjs.map +1 -0
- package/dist/components/index.js +279 -72
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +10 -7
- package/dist/index.js +283 -76
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -7
- package/package.json +7 -7
- package/src/components/chat/Chat.tsx +167 -8
- package/src/components/chat/Modal.tsx +4 -0
- package/src/components/dev-console/console.tsx +4 -1
- package/src/components/help-modal/icons.tsx +40 -0
- package/src/components/help-modal/index.tsx +1 -0
- package/src/components/help-modal/modal.tsx +91 -0
- package/dist/chunk-H5CXJBR5.mjs.map +0 -1
- package/dist/chunk-ORHE7FYT.mjs.map +0 -1
- package/dist/chunk-RS6UPR5N.mjs.map +0 -1
- /package/dist/{chunk-ECPBML4L.mjs.map → chunk-RQRK6DEW.mjs.map} +0 -0
- /package/dist/{chunk-TSIFZ5N5.mjs.map → chunk-Z2RXDT7O.mjs.map} +0 -0
|
@@ -2,15 +2,18 @@ import {
|
|
|
2
2
|
CopilotChat,
|
|
3
3
|
WrappedCopilotChat,
|
|
4
4
|
useCopilotChatLogic
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-OI5EKZPO.mjs";
|
|
6
|
+
import "../../chunk-6INMITFA.mjs";
|
|
7
|
+
import "../../chunk-RU73BEZM.mjs";
|
|
6
8
|
import "../../chunk-V7W6IM2V.mjs";
|
|
7
9
|
import "../../chunk-OMTPWC7T.mjs";
|
|
8
10
|
import "../../chunk-ZABXREBH.mjs";
|
|
9
|
-
import "../../chunk-6INMITFA.mjs";
|
|
10
|
-
import "../../chunk-RU73BEZM.mjs";
|
|
11
11
|
import "../../chunk-RJCZRKTV.mjs";
|
|
12
|
-
import "../../chunk-
|
|
12
|
+
import "../../chunk-2B57NCBA.mjs";
|
|
13
13
|
import "../../chunk-4FIGRRFS.mjs";
|
|
14
|
+
import "../../chunk-KXE2JCUH.mjs";
|
|
15
|
+
import "../../chunk-WOUWNTAV.mjs";
|
|
16
|
+
import "../../chunk-4T3TMQNJ.mjs";
|
|
14
17
|
import "../../chunk-OTPAZXVR.mjs";
|
|
15
18
|
import "../../chunk-4LUMV4YO.mjs";
|
|
16
19
|
import "../../chunk-YQFVRDNC.mjs";
|
|
@@ -46,6 +46,6 @@ interface CopilotModalProps extends CopilotChatProps {
|
|
|
46
46
|
*/
|
|
47
47
|
Header?: React__default.ComponentType<HeaderProps>;
|
|
48
48
|
}
|
|
49
|
-
declare const CopilotModal: ({ instructions, defaultOpen, clickOutsideToClose, hitEscapeToClose, onSetOpen, onSubmitMessage, shortcut, icons, labels, makeSystemMessage, showResponseButton, onInProgress, Window, Button, Header, Messages, Input, ResponseButton, className, children, }: CopilotModalProps) => react_jsx_runtime.JSX.Element;
|
|
49
|
+
declare const CopilotModal: ({ instructions, defaultOpen, clickOutsideToClose, hitEscapeToClose, onSetOpen, onSubmitMessage, onStopGeneration, onReloadMessages, shortcut, icons, labels, makeSystemMessage, showResponseButton, onInProgress, Window, Button, Header, Messages, Input, ResponseButton, className, children, }: CopilotModalProps) => react_jsx_runtime.JSX.Element;
|
|
50
50
|
|
|
51
51
|
export { CopilotModal, CopilotModalProps };
|
|
@@ -82,7 +82,7 @@ __export(Modal_exports, {
|
|
|
82
82
|
CopilotModal: () => CopilotModal
|
|
83
83
|
});
|
|
84
84
|
module.exports = __toCommonJS(Modal_exports);
|
|
85
|
-
var
|
|
85
|
+
var import_react13 = __toESM(require("react"));
|
|
86
86
|
|
|
87
87
|
// src/components/chat/ChatContext.tsx
|
|
88
88
|
var import_react = __toESM(require("react"));
|
|
@@ -1661,7 +1661,7 @@ var reloadSuggestions = (context, chatSuggestionConfiguration, setCurrentSuggest
|
|
|
1661
1661
|
});
|
|
1662
1662
|
|
|
1663
1663
|
// src/components/chat/Chat.tsx
|
|
1664
|
-
var
|
|
1664
|
+
var import_react12 = __toESM(require("react"));
|
|
1665
1665
|
var import_react_core8 = require("@copilotkit/react-core");
|
|
1666
1666
|
var import_runtime_client_gql4 = require("@copilotkit/runtime-client-gql");
|
|
1667
1667
|
var import_shared3 = require("@copilotkit/shared");
|
|
@@ -1800,7 +1800,7 @@ function logMessages(context) {
|
|
|
1800
1800
|
|
|
1801
1801
|
// src/components/dev-console/console.tsx
|
|
1802
1802
|
var import_react_core7 = require("@copilotkit/react-core");
|
|
1803
|
-
var
|
|
1803
|
+
var import_react10 = require("react");
|
|
1804
1804
|
|
|
1805
1805
|
// src/components/dev-console/icons.tsx
|
|
1806
1806
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
@@ -1887,21 +1887,128 @@ var CopilotKitIcon = /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
|
1887
1887
|
);
|
|
1888
1888
|
|
|
1889
1889
|
// src/components/dev-console/console.tsx
|
|
1890
|
-
var
|
|
1890
|
+
var import_react11 = require("@headlessui/react");
|
|
1891
1891
|
var import_shared2 = require("@copilotkit/shared");
|
|
1892
|
+
|
|
1893
|
+
// src/components/help-modal/modal.tsx
|
|
1894
|
+
var import_react9 = require("react");
|
|
1895
|
+
|
|
1896
|
+
// src/components/help-modal/icons.tsx
|
|
1892
1897
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1898
|
+
var LifeBuoyIcon = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1899
|
+
"svg",
|
|
1900
|
+
{
|
|
1901
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1902
|
+
width: "24",
|
|
1903
|
+
height: "24",
|
|
1904
|
+
viewBox: "0 0 24 24",
|
|
1905
|
+
fill: "none",
|
|
1906
|
+
stroke: "currentColor",
|
|
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
|
+
] })
|
|
1920
|
+
}
|
|
1921
|
+
);
|
|
1922
|
+
var CloseIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1923
|
+
"svg",
|
|
1924
|
+
{
|
|
1925
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1926
|
+
fill: "none",
|
|
1927
|
+
viewBox: "0 0 24 24",
|
|
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" })
|
|
1933
|
+
}
|
|
1934
|
+
);
|
|
1935
|
+
|
|
1936
|
+
// src/components/help-modal/modal.tsx
|
|
1937
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1938
|
+
function CopilotKitHelpModal() {
|
|
1939
|
+
const [showHelpModal, setShowHelpModal] = (0, import_react9.useState)(false);
|
|
1940
|
+
const [issueDescription, setIssueDescription] = (0, import_react9.useState)("");
|
|
1941
|
+
const handleSubmit = () => {
|
|
1942
|
+
setShowHelpModal(false);
|
|
1943
|
+
};
|
|
1944
|
+
const HelpButton = () => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1945
|
+
"button",
|
|
1946
|
+
{
|
|
1947
|
+
onClick: () => setShowHelpModal(true),
|
|
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",
|
|
1949
|
+
"aria-label": "Open Help",
|
|
1950
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(LifeBuoyIcon, {})
|
|
1951
|
+
}
|
|
1952
|
+
);
|
|
1953
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
1954
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(HelpButton, {}),
|
|
1955
|
+
showHelpModal && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1956
|
+
"div",
|
|
1957
|
+
{
|
|
1958
|
+
className: "fixed inset-0 flex items-center justify-center p-4",
|
|
1959
|
+
style: { backgroundColor: "rgba(11, 15, 26, 0.5)", zIndex: 99 },
|
|
1960
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "bg-white rounded-lg shadow-xl max-w-md w-full p-4 flex-col relative", children: [
|
|
1961
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1962
|
+
"button",
|
|
1963
|
+
{
|
|
1964
|
+
className: "absolute text-gray-400 hover:text-gray-600 focus:outline-none",
|
|
1965
|
+
style: { top: "10px", right: "10px" },
|
|
1966
|
+
onClick: () => setShowHelpModal(false),
|
|
1967
|
+
"aria-label": "Close",
|
|
1968
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CloseIcon2, {})
|
|
1969
|
+
}
|
|
1970
|
+
),
|
|
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" }) }),
|
|
1972
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-4 mb-4", children: [
|
|
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)(
|
|
1974
|
+
"a",
|
|
1975
|
+
{
|
|
1976
|
+
href: "https://go.copilotkit.ai/dev-console-support-discord",
|
|
1977
|
+
target: "_blank",
|
|
1978
|
+
rel: "noopener noreferrer",
|
|
1979
|
+
children: "Go to Discord Support Channel (Community Support)"
|
|
1980
|
+
}
|
|
1981
|
+
) }),
|
|
1982
|
+
/* @__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)(
|
|
1983
|
+
"a",
|
|
1984
|
+
{
|
|
1985
|
+
href: "https://go.copilotkit.ai/dev-console-support-slack",
|
|
1986
|
+
target: "_blank",
|
|
1987
|
+
rel: "noopener noreferrer",
|
|
1988
|
+
children: "Apply for Priority Direct Slack Support"
|
|
1989
|
+
}
|
|
1990
|
+
) })
|
|
1991
|
+
] })
|
|
1992
|
+
] })
|
|
1993
|
+
}
|
|
1994
|
+
)
|
|
1995
|
+
] });
|
|
1996
|
+
}
|
|
1997
|
+
|
|
1998
|
+
// src/components/dev-console/console.tsx
|
|
1999
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1893
2000
|
function CopilotDevConsole() {
|
|
1894
2001
|
const currentVersion = import_shared2.COPILOTKIT_VERSION;
|
|
1895
2002
|
const context = (0, import_react_core7.useCopilotContext)();
|
|
1896
|
-
const [showDevConsole, setShowDevConsole] = (0,
|
|
1897
|
-
(0,
|
|
2003
|
+
const [showDevConsole, setShowDevConsole] = (0, import_react10.useState)(false);
|
|
2004
|
+
(0, import_react10.useEffect)(() => {
|
|
1898
2005
|
setShowDevConsole(shouldShowDevConsole(context.showDevConsole));
|
|
1899
2006
|
}, [context.showDevConsole]);
|
|
1900
|
-
const dontRunTwiceInDevMode = (0,
|
|
1901
|
-
const [versionStatus, setVersionStatus] = (0,
|
|
1902
|
-
const [latestVersion, setLatestVersion] = (0,
|
|
1903
|
-
const consoleRef = (0,
|
|
1904
|
-
const [debugButtonMode, setDebugButtonMode] = (0,
|
|
2007
|
+
const dontRunTwiceInDevMode = (0, import_react10.useRef)(false);
|
|
2008
|
+
const [versionStatus, setVersionStatus] = (0, import_react10.useState)("unknown");
|
|
2009
|
+
const [latestVersion, setLatestVersion] = (0, import_react10.useState)("");
|
|
2010
|
+
const consoleRef = (0, import_react10.useRef)(null);
|
|
2011
|
+
const [debugButtonMode, setDebugButtonMode] = (0, import_react10.useState)("full");
|
|
1905
2012
|
const checkForUpdates = (force = false) => {
|
|
1906
2013
|
setVersionStatus("checking");
|
|
1907
2014
|
getPublishedCopilotKitVersion(currentVersion, force).then((v) => {
|
|
@@ -1924,14 +2031,14 @@ function CopilotDevConsole() {
|
|
|
1924
2031
|
setVersionStatus("unknown");
|
|
1925
2032
|
});
|
|
1926
2033
|
};
|
|
1927
|
-
(0,
|
|
2034
|
+
(0, import_react10.useEffect)(() => {
|
|
1928
2035
|
if (dontRunTwiceInDevMode.current === true) {
|
|
1929
2036
|
return;
|
|
1930
2037
|
}
|
|
1931
2038
|
dontRunTwiceInDevMode.current = true;
|
|
1932
2039
|
checkForUpdates();
|
|
1933
2040
|
}, []);
|
|
1934
|
-
(0,
|
|
2041
|
+
(0, import_react10.useEffect)(() => {
|
|
1935
2042
|
const handleResize = (entries) => {
|
|
1936
2043
|
for (let entry of entries) {
|
|
1937
2044
|
if (entry.target === consoleRef.current) {
|
|
@@ -1963,14 +2070,14 @@ function CopilotDevConsole() {
|
|
|
1963
2070
|
if (!showDevConsole) {
|
|
1964
2071
|
return null;
|
|
1965
2072
|
}
|
|
1966
|
-
return /* @__PURE__ */ (0,
|
|
2073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1967
2074
|
"div",
|
|
1968
2075
|
{
|
|
1969
2076
|
ref: consoleRef,
|
|
1970
2077
|
className: "copilotKitDevConsole " + (versionStatus === "update-available" ? "copilotKitDevConsoleUpgrade" : "") + (versionStatus === "outdated" ? "copilotKitDevConsoleWarnOutdated" : ""),
|
|
1971
2078
|
children: [
|
|
1972
|
-
/* @__PURE__ */ (0,
|
|
1973
|
-
/* @__PURE__ */ (0,
|
|
2079
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "copilotKitDevConsoleLogo", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("a", { href: "https://copilotkit.ai", target: "_blank", children: CopilotKitIcon }) }),
|
|
2080
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1974
2081
|
VersionInfo,
|
|
1975
2082
|
{
|
|
1976
2083
|
showDevConsole: context.showDevConsole,
|
|
@@ -1979,7 +2086,8 @@ function CopilotDevConsole() {
|
|
|
1979
2086
|
latestVersion
|
|
1980
2087
|
}
|
|
1981
2088
|
),
|
|
1982
|
-
/* @__PURE__ */ (0,
|
|
2089
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CopilotKitHelpModal, {}),
|
|
2090
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1983
2091
|
DebugMenuButton,
|
|
1984
2092
|
{
|
|
1985
2093
|
setShowDevConsole,
|
|
@@ -1997,7 +2105,7 @@ function VersionInfo({
|
|
|
1997
2105
|
currentVersion,
|
|
1998
2106
|
latestVersion
|
|
1999
2107
|
}) {
|
|
2000
|
-
const [copyStatus, setCopyStatus] = (0,
|
|
2108
|
+
const [copyStatus, setCopyStatus] = (0, import_react10.useState)("");
|
|
2001
2109
|
let versionLabel = "";
|
|
2002
2110
|
let versionIcon = "";
|
|
2003
2111
|
let currentVersionLabel = currentVersion;
|
|
@@ -2034,12 +2142,12 @@ function VersionInfo({
|
|
|
2034
2142
|
setTimeout(() => setCopyStatus(""), 1e3);
|
|
2035
2143
|
});
|
|
2036
2144
|
};
|
|
2037
|
-
return /* @__PURE__ */ (0,
|
|
2038
|
-
/* @__PURE__ */ (0,
|
|
2145
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "copilotKitVersionInfo", children: [
|
|
2146
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("header", { children: [
|
|
2039
2147
|
"COPILOTKIT DEV CONSOLE",
|
|
2040
|
-
showDevConsole === "auto" && /* @__PURE__ */ (0,
|
|
2148
|
+
showDevConsole === "auto" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("aside", { children: asideLabel })
|
|
2041
2149
|
] }),
|
|
2042
|
-
/* @__PURE__ */ (0,
|
|
2150
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("section", { children: [
|
|
2043
2151
|
"Version: ",
|
|
2044
2152
|
versionLabel,
|
|
2045
2153
|
" (",
|
|
@@ -2047,7 +2155,7 @@ function VersionInfo({
|
|
|
2047
2155
|
") ",
|
|
2048
2156
|
versionIcon
|
|
2049
2157
|
] }),
|
|
2050
|
-
(versionStatus === "update-available" || versionStatus === "outdated") && /* @__PURE__ */ (0,
|
|
2158
|
+
(versionStatus === "update-available" || versionStatus === "outdated") && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("footer", { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { onClick: handleCopyClick, children: copyStatus || installCommand }) })
|
|
2051
2159
|
] });
|
|
2052
2160
|
}
|
|
2053
2161
|
function DebugMenuButton({
|
|
@@ -2057,22 +2165,22 @@ function DebugMenuButton({
|
|
|
2057
2165
|
}) {
|
|
2058
2166
|
const context = (0, import_react_core7.useCopilotContext)();
|
|
2059
2167
|
const messagesContext = (0, import_react_core7.useCopilotMessagesContext)();
|
|
2060
|
-
return /* @__PURE__ */ (0,
|
|
2061
|
-
/* @__PURE__ */ (0,
|
|
2168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "bg-black top-24 w-52 text-right", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react11.Menu, { children: [
|
|
2169
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react11.MenuButton, { className: `copilotKitDebugMenuButton ${mode === "compact" ? "compact" : ""}`, children: mode == "compact" ? "Debug" : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
2062
2170
|
"Debug ",
|
|
2063
2171
|
ChevronDownIcon
|
|
2064
2172
|
] }) }),
|
|
2065
|
-
/* @__PURE__ */ (0,
|
|
2066
|
-
|
|
2173
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2174
|
+
import_react11.MenuItems,
|
|
2067
2175
|
{
|
|
2068
2176
|
transition: true,
|
|
2069
2177
|
anchor: "bottom end",
|
|
2070
2178
|
className: "copilotKitDebugMenu",
|
|
2071
2179
|
style: { zIndex: 40 },
|
|
2072
2180
|
children: [
|
|
2073
|
-
/* @__PURE__ */ (0,
|
|
2074
|
-
/* @__PURE__ */ (0,
|
|
2075
|
-
/* @__PURE__ */ (0,
|
|
2181
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react11.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => logReadables(context), children: "Log Readables" }) }),
|
|
2182
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react11.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => logActions(context), children: "Log Actions" }) }),
|
|
2183
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react11.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2076
2184
|
"button",
|
|
2077
2185
|
{
|
|
2078
2186
|
className: "copilotKitDebugMenuItem",
|
|
@@ -2080,9 +2188,9 @@ function DebugMenuButton({
|
|
|
2080
2188
|
children: "Log Messages"
|
|
2081
2189
|
}
|
|
2082
2190
|
) }),
|
|
2083
|
-
/* @__PURE__ */ (0,
|
|
2084
|
-
/* @__PURE__ */ (0,
|
|
2085
|
-
/* @__PURE__ */ (0,
|
|
2191
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react11.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => checkForUpdates(true), children: "Check for Updates" }) }),
|
|
2192
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("hr", {}),
|
|
2193
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react11.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => setShowDevConsole(false), children: "Hide Dev Console" }) })
|
|
2086
2194
|
]
|
|
2087
2195
|
}
|
|
2088
2196
|
)
|
|
@@ -2090,13 +2198,16 @@ function DebugMenuButton({
|
|
|
2090
2198
|
}
|
|
2091
2199
|
|
|
2092
2200
|
// src/components/chat/Chat.tsx
|
|
2093
|
-
var
|
|
2201
|
+
var import_react_core9 = require("@copilotkit/react-core");
|
|
2202
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2094
2203
|
function CopilotChat({
|
|
2095
2204
|
instructions,
|
|
2096
2205
|
onSubmitMessage,
|
|
2097
2206
|
makeSystemMessage,
|
|
2098
2207
|
showResponseButton = true,
|
|
2099
2208
|
onInProgress,
|
|
2209
|
+
onStopGeneration,
|
|
2210
|
+
onReloadMessages,
|
|
2100
2211
|
Messages: Messages2 = Messages,
|
|
2101
2212
|
RenderTextMessage: RenderTextMessage2 = RenderTextMessage,
|
|
2102
2213
|
RenderActionExecutionMessage: RenderActionExecutionMessage2 = RenderActionExecutionMessage,
|
|
@@ -2109,7 +2220,7 @@ function CopilotChat({
|
|
|
2109
2220
|
labels
|
|
2110
2221
|
}) {
|
|
2111
2222
|
const context = (0, import_react_core8.useCopilotContext)();
|
|
2112
|
-
(0,
|
|
2223
|
+
(0, import_react12.useEffect)(() => {
|
|
2113
2224
|
context.setChatInstructions(instructions || "");
|
|
2114
2225
|
}, [instructions]);
|
|
2115
2226
|
const {
|
|
@@ -2119,12 +2230,18 @@ function CopilotChat({
|
|
|
2119
2230
|
sendMessage,
|
|
2120
2231
|
stopGeneration,
|
|
2121
2232
|
reloadMessages
|
|
2122
|
-
} = useCopilotChatLogic(
|
|
2123
|
-
|
|
2233
|
+
} = useCopilotChatLogic(
|
|
2234
|
+
makeSystemMessage,
|
|
2235
|
+
onInProgress,
|
|
2236
|
+
onSubmitMessage,
|
|
2237
|
+
onStopGeneration,
|
|
2238
|
+
onReloadMessages
|
|
2239
|
+
);
|
|
2240
|
+
const chatContext = import_react12.default.useContext(ChatContext);
|
|
2124
2241
|
const isVisible = chatContext ? chatContext.open : true;
|
|
2125
|
-
return /* @__PURE__ */ (0,
|
|
2126
|
-
/* @__PURE__ */ (0,
|
|
2127
|
-
/* @__PURE__ */ (0,
|
|
2242
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
|
|
2243
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CopilotDevConsole, {}),
|
|
2244
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2128
2245
|
Messages2,
|
|
2129
2246
|
{
|
|
2130
2247
|
RenderTextMessage: RenderTextMessage2,
|
|
@@ -2134,9 +2251,9 @@ function CopilotChat({
|
|
|
2134
2251
|
messages: visibleMessages,
|
|
2135
2252
|
inProgress: isLoading,
|
|
2136
2253
|
children: [
|
|
2137
|
-
currentSuggestions.length > 0 && /* @__PURE__ */ (0,
|
|
2138
|
-
/* @__PURE__ */ (0,
|
|
2139
|
-
/* @__PURE__ */ (0,
|
|
2254
|
+
currentSuggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
2255
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h6", { children: "Suggested:" }),
|
|
2256
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "suggestions", children: currentSuggestions.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2140
2257
|
Suggestion,
|
|
2141
2258
|
{
|
|
2142
2259
|
title: suggestion.title,
|
|
@@ -2148,7 +2265,7 @@ function CopilotChat({
|
|
|
2148
2265
|
index
|
|
2149
2266
|
)) })
|
|
2150
2267
|
] }),
|
|
2151
|
-
showResponseButton && visibleMessages.length > 0 && /* @__PURE__ */ (0,
|
|
2268
|
+
showResponseButton && visibleMessages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2152
2269
|
ResponseButton2,
|
|
2153
2270
|
{
|
|
2154
2271
|
onClick: isLoading ? stopGeneration : reloadMessages,
|
|
@@ -2158,7 +2275,7 @@ function CopilotChat({
|
|
|
2158
2275
|
]
|
|
2159
2276
|
}
|
|
2160
2277
|
),
|
|
2161
|
-
/* @__PURE__ */ (0,
|
|
2278
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Input2, { inProgress: isLoading, onSend: sendMessage, isVisible })
|
|
2162
2279
|
] });
|
|
2163
2280
|
}
|
|
2164
2281
|
function WrappedCopilotChat({
|
|
@@ -2167,31 +2284,38 @@ function WrappedCopilotChat({
|
|
|
2167
2284
|
labels,
|
|
2168
2285
|
className
|
|
2169
2286
|
}) {
|
|
2170
|
-
const chatContext =
|
|
2287
|
+
const chatContext = import_react12.default.useContext(ChatContext);
|
|
2171
2288
|
if (!chatContext) {
|
|
2172
|
-
return /* @__PURE__ */ (0,
|
|
2173
|
-
}, children: /* @__PURE__ */ (0,
|
|
2289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ChatContextProvider, { icons, labels, open: true, setOpen: () => {
|
|
2290
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: `copilotKitChat ${className}`, children }) });
|
|
2174
2291
|
}
|
|
2175
|
-
return /* @__PURE__ */ (0,
|
|
2292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children });
|
|
2176
2293
|
}
|
|
2177
2294
|
var SUGGESTIONS_DEBOUNCE_TIMEOUT = 1e3;
|
|
2178
|
-
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) => {
|
|
2179
|
-
|
|
2295
|
+
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onStopGeneration, onReloadMessages) => {
|
|
2296
|
+
var _a;
|
|
2297
|
+
const {
|
|
2298
|
+
visibleMessages,
|
|
2299
|
+
appendMessage,
|
|
2300
|
+
reloadMessages: defaultReloadMessages,
|
|
2301
|
+
stopGeneration: defaultStopGeneration,
|
|
2302
|
+
isLoading
|
|
2303
|
+
} = (0, import_react_core8.useCopilotChat)({
|
|
2180
2304
|
id: (0, import_shared3.randomId)(),
|
|
2181
2305
|
makeSystemMessage
|
|
2182
2306
|
});
|
|
2183
|
-
const [currentSuggestions, setCurrentSuggestions] = (0,
|
|
2184
|
-
const suggestionsAbortControllerRef = (0,
|
|
2185
|
-
const debounceTimerRef = (0,
|
|
2307
|
+
const [currentSuggestions, setCurrentSuggestions] = (0, import_react12.useState)([]);
|
|
2308
|
+
const suggestionsAbortControllerRef = (0, import_react12.useRef)(null);
|
|
2309
|
+
const debounceTimerRef = (0, import_react12.useRef)();
|
|
2186
2310
|
const abortSuggestions = () => {
|
|
2187
|
-
var
|
|
2188
|
-
(
|
|
2311
|
+
var _a2;
|
|
2312
|
+
(_a2 = suggestionsAbortControllerRef.current) == null ? void 0 : _a2.abort();
|
|
2189
2313
|
suggestionsAbortControllerRef.current = null;
|
|
2190
2314
|
};
|
|
2191
2315
|
const generalContext = (0, import_react_core8.useCopilotContext)();
|
|
2192
2316
|
const messagesContext = (0, import_react_core8.useCopilotMessagesContext)();
|
|
2193
2317
|
const context = __spreadValues(__spreadValues({}, generalContext), messagesContext);
|
|
2194
|
-
(0,
|
|
2318
|
+
(0, import_react12.useEffect)(() => {
|
|
2195
2319
|
onInProgress == null ? void 0 : onInProgress(isLoading);
|
|
2196
2320
|
abortSuggestions();
|
|
2197
2321
|
debounceTimerRef.current = setTimeout(
|
|
@@ -2211,7 +2335,13 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
2211
2335
|
return () => {
|
|
2212
2336
|
clearTimeout(debounceTimerRef.current);
|
|
2213
2337
|
};
|
|
2214
|
-
}, [
|
|
2338
|
+
}, [
|
|
2339
|
+
isLoading,
|
|
2340
|
+
context.chatSuggestionConfiguration,
|
|
2341
|
+
// hackish way to trigger suggestions reload on reset, but better than moving suggestions to the
|
|
2342
|
+
// global context
|
|
2343
|
+
visibleMessages.length == 0
|
|
2344
|
+
]);
|
|
2215
2345
|
const sendMessage = (messageContent) => __async(void 0, null, function* () {
|
|
2216
2346
|
abortSuggestions();
|
|
2217
2347
|
setCurrentSuggestions([]);
|
|
@@ -2229,6 +2359,79 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
2229
2359
|
appendMessage(message);
|
|
2230
2360
|
return message;
|
|
2231
2361
|
});
|
|
2362
|
+
const messages = visibleMessages;
|
|
2363
|
+
const { setMessages } = messagesContext;
|
|
2364
|
+
const currentAgentName = (_a = generalContext.agentSession) == null ? void 0 : _a.agentName;
|
|
2365
|
+
const restartCurrentAgent = (hint) => __async(void 0, null, function* () {
|
|
2366
|
+
if (generalContext.agentSession) {
|
|
2367
|
+
generalContext.setAgentSession(__spreadProps(__spreadValues({}, generalContext.agentSession), {
|
|
2368
|
+
nodeName: void 0,
|
|
2369
|
+
threadId: void 0
|
|
2370
|
+
}));
|
|
2371
|
+
generalContext.setCoagentStates((prevAgentStates) => {
|
|
2372
|
+
return __spreadProps(__spreadValues({}, prevAgentStates), {
|
|
2373
|
+
[generalContext.agentSession.agentName]: __spreadProps(__spreadValues({}, prevAgentStates[generalContext.agentSession.agentName]), {
|
|
2374
|
+
threadId: void 0,
|
|
2375
|
+
nodeName: void 0,
|
|
2376
|
+
runId: void 0
|
|
2377
|
+
})
|
|
2378
|
+
});
|
|
2379
|
+
});
|
|
2380
|
+
}
|
|
2381
|
+
});
|
|
2382
|
+
const runCurrentAgent = (hint) => __async(void 0, null, function* () {
|
|
2383
|
+
if (generalContext.agentSession) {
|
|
2384
|
+
yield (0, import_react_core9.runAgent)(generalContext.agentSession.agentName, context, appendMessage, hint);
|
|
2385
|
+
}
|
|
2386
|
+
});
|
|
2387
|
+
const stopCurrentAgent = () => {
|
|
2388
|
+
if (generalContext.agentSession) {
|
|
2389
|
+
(0, import_react_core9.stopAgent)(generalContext.agentSession.agentName, context);
|
|
2390
|
+
}
|
|
2391
|
+
};
|
|
2392
|
+
const setCurrentAgentState = (state) => {
|
|
2393
|
+
if (generalContext.agentSession) {
|
|
2394
|
+
generalContext.setCoagentStates((prevAgentStates) => {
|
|
2395
|
+
return __spreadProps(__spreadValues({}, prevAgentStates), {
|
|
2396
|
+
[generalContext.agentSession.agentName]: {
|
|
2397
|
+
state
|
|
2398
|
+
}
|
|
2399
|
+
});
|
|
2400
|
+
});
|
|
2401
|
+
}
|
|
2402
|
+
};
|
|
2403
|
+
function stopGeneration() {
|
|
2404
|
+
if (onStopGeneration) {
|
|
2405
|
+
onStopGeneration({
|
|
2406
|
+
messages,
|
|
2407
|
+
setMessages,
|
|
2408
|
+
stopGeneration: defaultStopGeneration,
|
|
2409
|
+
currentAgentName,
|
|
2410
|
+
restartCurrentAgent,
|
|
2411
|
+
stopCurrentAgent,
|
|
2412
|
+
runCurrentAgent,
|
|
2413
|
+
setCurrentAgentState
|
|
2414
|
+
});
|
|
2415
|
+
} else {
|
|
2416
|
+
defaultStopGeneration();
|
|
2417
|
+
}
|
|
2418
|
+
}
|
|
2419
|
+
function reloadMessages() {
|
|
2420
|
+
if (onReloadMessages) {
|
|
2421
|
+
onReloadMessages({
|
|
2422
|
+
messages,
|
|
2423
|
+
setMessages,
|
|
2424
|
+
stopGeneration: defaultStopGeneration,
|
|
2425
|
+
currentAgentName,
|
|
2426
|
+
restartCurrentAgent,
|
|
2427
|
+
stopCurrentAgent,
|
|
2428
|
+
runCurrentAgent,
|
|
2429
|
+
setCurrentAgentState
|
|
2430
|
+
});
|
|
2431
|
+
} else {
|
|
2432
|
+
defaultReloadMessages();
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2232
2435
|
return {
|
|
2233
2436
|
visibleMessages,
|
|
2234
2437
|
isLoading,
|
|
@@ -2240,7 +2443,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
2240
2443
|
};
|
|
2241
2444
|
|
|
2242
2445
|
// src/components/chat/Modal.tsx
|
|
2243
|
-
var
|
|
2446
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2244
2447
|
var CopilotModal = ({
|
|
2245
2448
|
instructions,
|
|
2246
2449
|
defaultOpen = false,
|
|
@@ -2248,6 +2451,8 @@ var CopilotModal = ({
|
|
|
2248
2451
|
hitEscapeToClose = true,
|
|
2249
2452
|
onSetOpen,
|
|
2250
2453
|
onSubmitMessage,
|
|
2454
|
+
onStopGeneration,
|
|
2455
|
+
onReloadMessages,
|
|
2251
2456
|
shortcut = "/",
|
|
2252
2457
|
icons,
|
|
2253
2458
|
labels,
|
|
@@ -2263,28 +2468,30 @@ var CopilotModal = ({
|
|
|
2263
2468
|
className,
|
|
2264
2469
|
children
|
|
2265
2470
|
}) => {
|
|
2266
|
-
const [openState, setOpenState] =
|
|
2471
|
+
const [openState, setOpenState] = import_react13.default.useState(defaultOpen);
|
|
2267
2472
|
const setOpen = (open) => {
|
|
2268
2473
|
onSetOpen == null ? void 0 : onSetOpen(open);
|
|
2269
2474
|
setOpenState(open);
|
|
2270
2475
|
};
|
|
2271
|
-
return /* @__PURE__ */ (0,
|
|
2476
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(ChatContextProvider, { icons, labels, open: openState, setOpen, children: [
|
|
2272
2477
|
children,
|
|
2273
|
-
/* @__PURE__ */ (0,
|
|
2274
|
-
/* @__PURE__ */ (0,
|
|
2275
|
-
/* @__PURE__ */ (0,
|
|
2478
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className, children: [
|
|
2479
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Button2, {}),
|
|
2480
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2276
2481
|
Window2,
|
|
2277
2482
|
{
|
|
2278
2483
|
clickOutsideToClose,
|
|
2279
2484
|
shortcut,
|
|
2280
2485
|
hitEscapeToClose,
|
|
2281
2486
|
children: [
|
|
2282
|
-
/* @__PURE__ */ (0,
|
|
2283
|
-
/* @__PURE__ */ (0,
|
|
2487
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Header2, {}),
|
|
2488
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2284
2489
|
CopilotChat,
|
|
2285
2490
|
{
|
|
2286
2491
|
instructions,
|
|
2287
2492
|
onSubmitMessage,
|
|
2493
|
+
onStopGeneration,
|
|
2494
|
+
onReloadMessages,
|
|
2288
2495
|
makeSystemMessage,
|
|
2289
2496
|
showResponseButton,
|
|
2290
2497
|
onInProgress,
|