@copilotkit/react-ui 1.4.1-pre.5 → 1.4.1
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 +65 -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-63ZKP62F.mjs} +2 -2
- package/dist/{chunk-ORHE7FYT.mjs → chunk-DHGDU64D.mjs} +8 -8
- package/dist/chunk-KXE2JCUH.mjs +1 -0
- package/dist/chunk-MMVDU6DF.mjs +1 -0
- package/dist/chunk-MMVDU6DF.mjs.map +1 -0
- package/dist/{chunk-ECPBML4L.mjs → chunk-TKFQ7VQR.mjs} +2 -2
- package/dist/{chunk-TSIFZ5N5.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.js +159 -51
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +7 -4
- package/dist/components/chat/Modal.js +168 -60
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +8 -5
- package/dist/components/chat/Popup.js +170 -62
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +9 -6
- package/dist/components/chat/Sidebar.js +172 -64
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +9 -6
- package/dist/components/chat/index.js +174 -66
- 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.d.ts +3 -0
- package/dist/components/index.js +178 -66
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +18 -9
- package/dist/index.css +4 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +180 -68
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -9
- package/package.json +7 -7
- 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/src/components/index.ts +1 -0
- package/src/css/markdown.css +5 -0
- package/dist/chunk-JD7BAH7U.mjs +0 -1
- package/dist/chunk-RS6UPR5N.mjs.map +0 -1
- /package/dist/{chunk-H5CXJBR5.mjs.map → chunk-63ZKP62F.mjs.map} +0 -0
- /package/dist/{chunk-ORHE7FYT.mjs.map → chunk-DHGDU64D.mjs.map} +0 -0
- /package/dist/{chunk-JD7BAH7U.mjs.map → chunk-KXE2JCUH.mjs.map} +0 -0
- /package/dist/{chunk-ECPBML4L.mjs.map → chunk-TKFQ7VQR.mjs.map} +0 -0
- /package/dist/{chunk-TSIFZ5N5.mjs.map → chunk-VYKDFXGS.mjs.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -81,15 +81,17 @@ var __async = (__this, __arguments, generator) => {
|
|
|
81
81
|
var src_exports = {};
|
|
82
82
|
__export(src_exports, {
|
|
83
83
|
CopilotChat: () => CopilotChat,
|
|
84
|
+
CopilotDevConsole: () => CopilotDevConsole,
|
|
84
85
|
CopilotPopup: () => CopilotPopup,
|
|
85
86
|
CopilotSidebar: () => CopilotSidebar,
|
|
87
|
+
shouldShowDevConsole: () => shouldShowDevConsole,
|
|
86
88
|
useChatContext: () => useChatContext,
|
|
87
89
|
useCopilotChatSuggestions: () => useCopilotChatSuggestions
|
|
88
90
|
});
|
|
89
91
|
module.exports = __toCommonJS(src_exports);
|
|
90
92
|
|
|
91
93
|
// src/components/chat/Modal.tsx
|
|
92
|
-
var
|
|
94
|
+
var import_react13 = __toESM(require("react"));
|
|
93
95
|
|
|
94
96
|
// src/components/chat/ChatContext.tsx
|
|
95
97
|
var import_react = __toESM(require("react"));
|
|
@@ -1668,7 +1670,7 @@ var reloadSuggestions = (context, chatSuggestionConfiguration, setCurrentSuggest
|
|
|
1668
1670
|
});
|
|
1669
1671
|
|
|
1670
1672
|
// src/components/chat/Chat.tsx
|
|
1671
|
-
var
|
|
1673
|
+
var import_react12 = __toESM(require("react"));
|
|
1672
1674
|
var import_react_core8 = require("@copilotkit/react-core");
|
|
1673
1675
|
var import_runtime_client_gql4 = require("@copilotkit/runtime-client-gql");
|
|
1674
1676
|
var import_shared3 = require("@copilotkit/shared");
|
|
@@ -1807,7 +1809,7 @@ function logMessages(context) {
|
|
|
1807
1809
|
|
|
1808
1810
|
// src/components/dev-console/console.tsx
|
|
1809
1811
|
var import_react_core7 = require("@copilotkit/react-core");
|
|
1810
|
-
var
|
|
1812
|
+
var import_react10 = require("react");
|
|
1811
1813
|
|
|
1812
1814
|
// src/components/dev-console/icons.tsx
|
|
1813
1815
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
@@ -1894,21 +1896,128 @@ var CopilotKitIcon = /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
|
1894
1896
|
);
|
|
1895
1897
|
|
|
1896
1898
|
// src/components/dev-console/console.tsx
|
|
1897
|
-
var
|
|
1899
|
+
var import_react11 = require("@headlessui/react");
|
|
1898
1900
|
var import_shared2 = require("@copilotkit/shared");
|
|
1901
|
+
|
|
1902
|
+
// src/components/help-modal/modal.tsx
|
|
1903
|
+
var import_react9 = require("react");
|
|
1904
|
+
|
|
1905
|
+
// src/components/help-modal/icons.tsx
|
|
1899
1906
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1907
|
+
var LifeBuoyIcon = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1908
|
+
"svg",
|
|
1909
|
+
{
|
|
1910
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1911
|
+
width: "24",
|
|
1912
|
+
height: "24",
|
|
1913
|
+
viewBox: "0 0 24 24",
|
|
1914
|
+
fill: "none",
|
|
1915
|
+
stroke: "currentColor",
|
|
1916
|
+
strokeWidth: "2",
|
|
1917
|
+
strokeLinecap: "round",
|
|
1918
|
+
strokeLinejoin: "round",
|
|
1919
|
+
className: "icon icon-tabler icons-tabler-outline icon-tabler-lifebuoy",
|
|
1920
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("g", { transform: "translate(0, -1)", children: [
|
|
1921
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
1922
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M12 12m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0" }),
|
|
1923
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" }),
|
|
1924
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M15 15l3.35 3.35" }),
|
|
1925
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M9 15l-3.35 3.35" }),
|
|
1926
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M5.65 5.65l3.35 3.35" }),
|
|
1927
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M18.35 5.65l-3.35 3.35" })
|
|
1928
|
+
] })
|
|
1929
|
+
}
|
|
1930
|
+
);
|
|
1931
|
+
var CloseIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1932
|
+
"svg",
|
|
1933
|
+
{
|
|
1934
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1935
|
+
fill: "none",
|
|
1936
|
+
viewBox: "0 0 24 24",
|
|
1937
|
+
strokeWidth: "1.5",
|
|
1938
|
+
stroke: "currentColor",
|
|
1939
|
+
width: "20",
|
|
1940
|
+
height: "20",
|
|
1941
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
|
|
1942
|
+
}
|
|
1943
|
+
);
|
|
1944
|
+
|
|
1945
|
+
// src/components/help-modal/modal.tsx
|
|
1946
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1947
|
+
function CopilotKitHelpModal() {
|
|
1948
|
+
const [showHelpModal, setShowHelpModal] = (0, import_react9.useState)(false);
|
|
1949
|
+
const [issueDescription, setIssueDescription] = (0, import_react9.useState)("");
|
|
1950
|
+
const handleSubmit = () => {
|
|
1951
|
+
setShowHelpModal(false);
|
|
1952
|
+
};
|
|
1953
|
+
const HelpButton = () => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1954
|
+
"button",
|
|
1955
|
+
{
|
|
1956
|
+
onClick: () => setShowHelpModal(true),
|
|
1957
|
+
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",
|
|
1958
|
+
"aria-label": "Open Help",
|
|
1959
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(LifeBuoyIcon, {})
|
|
1960
|
+
}
|
|
1961
|
+
);
|
|
1962
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
1963
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(HelpButton, {}),
|
|
1964
|
+
showHelpModal && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1965
|
+
"div",
|
|
1966
|
+
{
|
|
1967
|
+
className: "fixed inset-0 flex items-center justify-center p-4",
|
|
1968
|
+
style: { backgroundColor: "rgba(11, 15, 26, 0.5)", zIndex: 99 },
|
|
1969
|
+
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: [
|
|
1970
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1971
|
+
"button",
|
|
1972
|
+
{
|
|
1973
|
+
className: "absolute text-gray-400 hover:text-gray-600 focus:outline-none",
|
|
1974
|
+
style: { top: "10px", right: "10px" },
|
|
1975
|
+
onClick: () => setShowHelpModal(false),
|
|
1976
|
+
"aria-label": "Close",
|
|
1977
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CloseIcon2, {})
|
|
1978
|
+
}
|
|
1979
|
+
),
|
|
1980
|
+
/* @__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" }) }),
|
|
1981
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-4 mb-4", children: [
|
|
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-discord",
|
|
1986
|
+
target: "_blank",
|
|
1987
|
+
rel: "noopener noreferrer",
|
|
1988
|
+
children: "Go to Discord Support Channel (Community Support)"
|
|
1989
|
+
}
|
|
1990
|
+
) }),
|
|
1991
|
+
/* @__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)(
|
|
1992
|
+
"a",
|
|
1993
|
+
{
|
|
1994
|
+
href: "https://go.copilotkit.ai/dev-console-support-slack",
|
|
1995
|
+
target: "_blank",
|
|
1996
|
+
rel: "noopener noreferrer",
|
|
1997
|
+
children: "Apply for Priority Direct Slack Support"
|
|
1998
|
+
}
|
|
1999
|
+
) })
|
|
2000
|
+
] })
|
|
2001
|
+
] })
|
|
2002
|
+
}
|
|
2003
|
+
)
|
|
2004
|
+
] });
|
|
2005
|
+
}
|
|
2006
|
+
|
|
2007
|
+
// src/components/dev-console/console.tsx
|
|
2008
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1900
2009
|
function CopilotDevConsole() {
|
|
1901
2010
|
const currentVersion = import_shared2.COPILOTKIT_VERSION;
|
|
1902
2011
|
const context = (0, import_react_core7.useCopilotContext)();
|
|
1903
|
-
const [showDevConsole, setShowDevConsole] = (0,
|
|
1904
|
-
(0,
|
|
2012
|
+
const [showDevConsole, setShowDevConsole] = (0, import_react10.useState)(false);
|
|
2013
|
+
(0, import_react10.useEffect)(() => {
|
|
1905
2014
|
setShowDevConsole(shouldShowDevConsole(context.showDevConsole));
|
|
1906
2015
|
}, [context.showDevConsole]);
|
|
1907
|
-
const dontRunTwiceInDevMode = (0,
|
|
1908
|
-
const [versionStatus, setVersionStatus] = (0,
|
|
1909
|
-
const [latestVersion, setLatestVersion] = (0,
|
|
1910
|
-
const consoleRef = (0,
|
|
1911
|
-
const [debugButtonMode, setDebugButtonMode] = (0,
|
|
2016
|
+
const dontRunTwiceInDevMode = (0, import_react10.useRef)(false);
|
|
2017
|
+
const [versionStatus, setVersionStatus] = (0, import_react10.useState)("unknown");
|
|
2018
|
+
const [latestVersion, setLatestVersion] = (0, import_react10.useState)("");
|
|
2019
|
+
const consoleRef = (0, import_react10.useRef)(null);
|
|
2020
|
+
const [debugButtonMode, setDebugButtonMode] = (0, import_react10.useState)("full");
|
|
1912
2021
|
const checkForUpdates = (force = false) => {
|
|
1913
2022
|
setVersionStatus("checking");
|
|
1914
2023
|
getPublishedCopilotKitVersion(currentVersion, force).then((v) => {
|
|
@@ -1931,14 +2040,14 @@ function CopilotDevConsole() {
|
|
|
1931
2040
|
setVersionStatus("unknown");
|
|
1932
2041
|
});
|
|
1933
2042
|
};
|
|
1934
|
-
(0,
|
|
2043
|
+
(0, import_react10.useEffect)(() => {
|
|
1935
2044
|
if (dontRunTwiceInDevMode.current === true) {
|
|
1936
2045
|
return;
|
|
1937
2046
|
}
|
|
1938
2047
|
dontRunTwiceInDevMode.current = true;
|
|
1939
2048
|
checkForUpdates();
|
|
1940
2049
|
}, []);
|
|
1941
|
-
(0,
|
|
2050
|
+
(0, import_react10.useEffect)(() => {
|
|
1942
2051
|
const handleResize = (entries) => {
|
|
1943
2052
|
for (let entry of entries) {
|
|
1944
2053
|
if (entry.target === consoleRef.current) {
|
|
@@ -1970,14 +2079,14 @@ function CopilotDevConsole() {
|
|
|
1970
2079
|
if (!showDevConsole) {
|
|
1971
2080
|
return null;
|
|
1972
2081
|
}
|
|
1973
|
-
return /* @__PURE__ */ (0,
|
|
2082
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1974
2083
|
"div",
|
|
1975
2084
|
{
|
|
1976
2085
|
ref: consoleRef,
|
|
1977
2086
|
className: "copilotKitDevConsole " + (versionStatus === "update-available" ? "copilotKitDevConsoleUpgrade" : "") + (versionStatus === "outdated" ? "copilotKitDevConsoleWarnOutdated" : ""),
|
|
1978
2087
|
children: [
|
|
1979
|
-
/* @__PURE__ */ (0,
|
|
1980
|
-
/* @__PURE__ */ (0,
|
|
2088
|
+
/* @__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 }) }),
|
|
2089
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1981
2090
|
VersionInfo,
|
|
1982
2091
|
{
|
|
1983
2092
|
showDevConsole: context.showDevConsole,
|
|
@@ -1986,7 +2095,8 @@ function CopilotDevConsole() {
|
|
|
1986
2095
|
latestVersion
|
|
1987
2096
|
}
|
|
1988
2097
|
),
|
|
1989
|
-
/* @__PURE__ */ (0,
|
|
2098
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CopilotKitHelpModal, {}),
|
|
2099
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1990
2100
|
DebugMenuButton,
|
|
1991
2101
|
{
|
|
1992
2102
|
setShowDevConsole,
|
|
@@ -2004,7 +2114,7 @@ function VersionInfo({
|
|
|
2004
2114
|
currentVersion,
|
|
2005
2115
|
latestVersion
|
|
2006
2116
|
}) {
|
|
2007
|
-
const [copyStatus, setCopyStatus] = (0,
|
|
2117
|
+
const [copyStatus, setCopyStatus] = (0, import_react10.useState)("");
|
|
2008
2118
|
let versionLabel = "";
|
|
2009
2119
|
let versionIcon = "";
|
|
2010
2120
|
let currentVersionLabel = currentVersion;
|
|
@@ -2041,12 +2151,12 @@ function VersionInfo({
|
|
|
2041
2151
|
setTimeout(() => setCopyStatus(""), 1e3);
|
|
2042
2152
|
});
|
|
2043
2153
|
};
|
|
2044
|
-
return /* @__PURE__ */ (0,
|
|
2045
|
-
/* @__PURE__ */ (0,
|
|
2154
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "copilotKitVersionInfo", children: [
|
|
2155
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("header", { children: [
|
|
2046
2156
|
"COPILOTKIT DEV CONSOLE",
|
|
2047
|
-
showDevConsole === "auto" && /* @__PURE__ */ (0,
|
|
2157
|
+
showDevConsole === "auto" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("aside", { children: asideLabel })
|
|
2048
2158
|
] }),
|
|
2049
|
-
/* @__PURE__ */ (0,
|
|
2159
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("section", { children: [
|
|
2050
2160
|
"Version: ",
|
|
2051
2161
|
versionLabel,
|
|
2052
2162
|
" (",
|
|
@@ -2054,7 +2164,7 @@ function VersionInfo({
|
|
|
2054
2164
|
") ",
|
|
2055
2165
|
versionIcon
|
|
2056
2166
|
] }),
|
|
2057
|
-
(versionStatus === "update-available" || versionStatus === "outdated") && /* @__PURE__ */ (0,
|
|
2167
|
+
(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 }) })
|
|
2058
2168
|
] });
|
|
2059
2169
|
}
|
|
2060
2170
|
function DebugMenuButton({
|
|
@@ -2064,22 +2174,22 @@ function DebugMenuButton({
|
|
|
2064
2174
|
}) {
|
|
2065
2175
|
const context = (0, import_react_core7.useCopilotContext)();
|
|
2066
2176
|
const messagesContext = (0, import_react_core7.useCopilotMessagesContext)();
|
|
2067
|
-
return /* @__PURE__ */ (0,
|
|
2068
|
-
/* @__PURE__ */ (0,
|
|
2177
|
+
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: [
|
|
2178
|
+
/* @__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: [
|
|
2069
2179
|
"Debug ",
|
|
2070
2180
|
ChevronDownIcon
|
|
2071
2181
|
] }) }),
|
|
2072
|
-
/* @__PURE__ */ (0,
|
|
2073
|
-
|
|
2182
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2183
|
+
import_react11.MenuItems,
|
|
2074
2184
|
{
|
|
2075
2185
|
transition: true,
|
|
2076
2186
|
anchor: "bottom end",
|
|
2077
2187
|
className: "copilotKitDebugMenu",
|
|
2078
2188
|
style: { zIndex: 40 },
|
|
2079
2189
|
children: [
|
|
2080
|
-
/* @__PURE__ */ (0,
|
|
2081
|
-
/* @__PURE__ */ (0,
|
|
2082
|
-
/* @__PURE__ */ (0,
|
|
2190
|
+
/* @__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" }) }),
|
|
2191
|
+
/* @__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" }) }),
|
|
2192
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react11.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2083
2193
|
"button",
|
|
2084
2194
|
{
|
|
2085
2195
|
className: "copilotKitDebugMenuItem",
|
|
@@ -2087,9 +2197,9 @@ function DebugMenuButton({
|
|
|
2087
2197
|
children: "Log Messages"
|
|
2088
2198
|
}
|
|
2089
2199
|
) }),
|
|
2090
|
-
/* @__PURE__ */ (0,
|
|
2091
|
-
/* @__PURE__ */ (0,
|
|
2092
|
-
/* @__PURE__ */ (0,
|
|
2200
|
+
/* @__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" }) }),
|
|
2201
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("hr", {}),
|
|
2202
|
+
/* @__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" }) })
|
|
2093
2203
|
]
|
|
2094
2204
|
}
|
|
2095
2205
|
)
|
|
@@ -2097,7 +2207,7 @@ function DebugMenuButton({
|
|
|
2097
2207
|
}
|
|
2098
2208
|
|
|
2099
2209
|
// src/components/chat/Chat.tsx
|
|
2100
|
-
var
|
|
2210
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2101
2211
|
function CopilotChat({
|
|
2102
2212
|
instructions,
|
|
2103
2213
|
onSubmitMessage,
|
|
@@ -2116,7 +2226,7 @@ function CopilotChat({
|
|
|
2116
2226
|
labels
|
|
2117
2227
|
}) {
|
|
2118
2228
|
const context = (0, import_react_core8.useCopilotContext)();
|
|
2119
|
-
(0,
|
|
2229
|
+
(0, import_react12.useEffect)(() => {
|
|
2120
2230
|
context.setChatInstructions(instructions || "");
|
|
2121
2231
|
}, [instructions]);
|
|
2122
2232
|
const {
|
|
@@ -2127,11 +2237,11 @@ function CopilotChat({
|
|
|
2127
2237
|
stopGeneration,
|
|
2128
2238
|
reloadMessages
|
|
2129
2239
|
} = useCopilotChatLogic(makeSystemMessage, onInProgress, onSubmitMessage);
|
|
2130
|
-
const chatContext =
|
|
2240
|
+
const chatContext = import_react12.default.useContext(ChatContext);
|
|
2131
2241
|
const isVisible = chatContext ? chatContext.open : true;
|
|
2132
|
-
return /* @__PURE__ */ (0,
|
|
2133
|
-
/* @__PURE__ */ (0,
|
|
2134
|
-
/* @__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)(
|
|
2135
2245
|
Messages2,
|
|
2136
2246
|
{
|
|
2137
2247
|
RenderTextMessage: RenderTextMessage2,
|
|
@@ -2141,9 +2251,9 @@ function CopilotChat({
|
|
|
2141
2251
|
messages: visibleMessages,
|
|
2142
2252
|
inProgress: isLoading,
|
|
2143
2253
|
children: [
|
|
2144
|
-
currentSuggestions.length > 0 && /* @__PURE__ */ (0,
|
|
2145
|
-
/* @__PURE__ */ (0,
|
|
2146
|
-
/* @__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)(
|
|
2147
2257
|
Suggestion,
|
|
2148
2258
|
{
|
|
2149
2259
|
title: suggestion.title,
|
|
@@ -2155,7 +2265,7 @@ function CopilotChat({
|
|
|
2155
2265
|
index
|
|
2156
2266
|
)) })
|
|
2157
2267
|
] }),
|
|
2158
|
-
showResponseButton && visibleMessages.length > 0 && /* @__PURE__ */ (0,
|
|
2268
|
+
showResponseButton && visibleMessages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2159
2269
|
ResponseButton2,
|
|
2160
2270
|
{
|
|
2161
2271
|
onClick: isLoading ? stopGeneration : reloadMessages,
|
|
@@ -2165,7 +2275,7 @@ function CopilotChat({
|
|
|
2165
2275
|
]
|
|
2166
2276
|
}
|
|
2167
2277
|
),
|
|
2168
|
-
/* @__PURE__ */ (0,
|
|
2278
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Input2, { inProgress: isLoading, onSend: sendMessage, isVisible })
|
|
2169
2279
|
] });
|
|
2170
2280
|
}
|
|
2171
2281
|
function WrappedCopilotChat({
|
|
@@ -2174,12 +2284,12 @@ function WrappedCopilotChat({
|
|
|
2174
2284
|
labels,
|
|
2175
2285
|
className
|
|
2176
2286
|
}) {
|
|
2177
|
-
const chatContext =
|
|
2287
|
+
const chatContext = import_react12.default.useContext(ChatContext);
|
|
2178
2288
|
if (!chatContext) {
|
|
2179
|
-
return /* @__PURE__ */ (0,
|
|
2180
|
-
}, 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 }) });
|
|
2181
2291
|
}
|
|
2182
|
-
return /* @__PURE__ */ (0,
|
|
2292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children });
|
|
2183
2293
|
}
|
|
2184
2294
|
var SUGGESTIONS_DEBOUNCE_TIMEOUT = 1e3;
|
|
2185
2295
|
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) => {
|
|
@@ -2187,9 +2297,9 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
2187
2297
|
id: (0, import_shared3.randomId)(),
|
|
2188
2298
|
makeSystemMessage
|
|
2189
2299
|
});
|
|
2190
|
-
const [currentSuggestions, setCurrentSuggestions] = (0,
|
|
2191
|
-
const suggestionsAbortControllerRef = (0,
|
|
2192
|
-
const debounceTimerRef = (0,
|
|
2300
|
+
const [currentSuggestions, setCurrentSuggestions] = (0, import_react12.useState)([]);
|
|
2301
|
+
const suggestionsAbortControllerRef = (0, import_react12.useRef)(null);
|
|
2302
|
+
const debounceTimerRef = (0, import_react12.useRef)();
|
|
2193
2303
|
const abortSuggestions = () => {
|
|
2194
2304
|
var _a;
|
|
2195
2305
|
(_a = suggestionsAbortControllerRef.current) == null ? void 0 : _a.abort();
|
|
@@ -2198,7 +2308,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
2198
2308
|
const generalContext = (0, import_react_core8.useCopilotContext)();
|
|
2199
2309
|
const messagesContext = (0, import_react_core8.useCopilotMessagesContext)();
|
|
2200
2310
|
const context = __spreadValues(__spreadValues({}, generalContext), messagesContext);
|
|
2201
|
-
(0,
|
|
2311
|
+
(0, import_react12.useEffect)(() => {
|
|
2202
2312
|
onInProgress == null ? void 0 : onInProgress(isLoading);
|
|
2203
2313
|
abortSuggestions();
|
|
2204
2314
|
debounceTimerRef.current = setTimeout(
|
|
@@ -2247,7 +2357,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
2247
2357
|
};
|
|
2248
2358
|
|
|
2249
2359
|
// src/components/chat/Modal.tsx
|
|
2250
|
-
var
|
|
2360
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2251
2361
|
var CopilotModal = ({
|
|
2252
2362
|
instructions,
|
|
2253
2363
|
defaultOpen = false,
|
|
@@ -2270,24 +2380,24 @@ var CopilotModal = ({
|
|
|
2270
2380
|
className,
|
|
2271
2381
|
children
|
|
2272
2382
|
}) => {
|
|
2273
|
-
const [openState, setOpenState] =
|
|
2383
|
+
const [openState, setOpenState] = import_react13.default.useState(defaultOpen);
|
|
2274
2384
|
const setOpen = (open) => {
|
|
2275
2385
|
onSetOpen == null ? void 0 : onSetOpen(open);
|
|
2276
2386
|
setOpenState(open);
|
|
2277
2387
|
};
|
|
2278
|
-
return /* @__PURE__ */ (0,
|
|
2388
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(ChatContextProvider, { icons, labels, open: openState, setOpen, children: [
|
|
2279
2389
|
children,
|
|
2280
|
-
/* @__PURE__ */ (0,
|
|
2281
|
-
/* @__PURE__ */ (0,
|
|
2282
|
-
/* @__PURE__ */ (0,
|
|
2390
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className, children: [
|
|
2391
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Button2, {}),
|
|
2392
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2283
2393
|
Window2,
|
|
2284
2394
|
{
|
|
2285
2395
|
clickOutsideToClose,
|
|
2286
2396
|
shortcut,
|
|
2287
2397
|
hitEscapeToClose,
|
|
2288
2398
|
children: [
|
|
2289
|
-
/* @__PURE__ */ (0,
|
|
2290
|
-
/* @__PURE__ */ (0,
|
|
2399
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Header2, {}),
|
|
2400
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2291
2401
|
CopilotChat,
|
|
2292
2402
|
{
|
|
2293
2403
|
instructions,
|
|
@@ -2308,22 +2418,22 @@ var CopilotModal = ({
|
|
|
2308
2418
|
};
|
|
2309
2419
|
|
|
2310
2420
|
// src/components/chat/Popup.tsx
|
|
2311
|
-
var
|
|
2421
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2312
2422
|
function CopilotPopup(props) {
|
|
2313
2423
|
props = __spreadProps(__spreadValues({}, props), {
|
|
2314
2424
|
className: props.className ? props.className + " copilotKitPopup" : "copilotKitPopup"
|
|
2315
2425
|
});
|
|
2316
|
-
return /* @__PURE__ */ (0,
|
|
2426
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CopilotModal, __spreadProps(__spreadValues({}, props), { children: props.children }));
|
|
2317
2427
|
}
|
|
2318
2428
|
|
|
2319
2429
|
// src/components/chat/Sidebar.tsx
|
|
2320
|
-
var
|
|
2321
|
-
var
|
|
2430
|
+
var import_react14 = require("react");
|
|
2431
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2322
2432
|
function CopilotSidebar(props) {
|
|
2323
2433
|
props = __spreadProps(__spreadValues({}, props), {
|
|
2324
2434
|
className: props.className ? props.className + " copilotKitSidebar" : "copilotKitSidebar"
|
|
2325
2435
|
});
|
|
2326
|
-
const [expandedClassName, setExpandedClassName] = (0,
|
|
2436
|
+
const [expandedClassName, setExpandedClassName] = (0, import_react14.useState)(
|
|
2327
2437
|
props.defaultOpen ? "sidebarExpanded" : ""
|
|
2328
2438
|
);
|
|
2329
2439
|
const onSetOpen = (open) => {
|
|
@@ -2331,11 +2441,11 @@ function CopilotSidebar(props) {
|
|
|
2331
2441
|
(_a = props.onSetOpen) == null ? void 0 : _a.call(props, open);
|
|
2332
2442
|
setExpandedClassName(open ? "sidebarExpanded" : "");
|
|
2333
2443
|
};
|
|
2334
|
-
return /* @__PURE__ */ (0,
|
|
2444
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: `copilotKitSidebarContentWrapper ${expandedClassName}`, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CopilotModal, __spreadProps(__spreadValues(__spreadValues({}, props), { onSetOpen }), { children: props.children })) });
|
|
2335
2445
|
}
|
|
2336
2446
|
|
|
2337
2447
|
// src/hooks/use-copilot-chat-suggestions.tsx
|
|
2338
|
-
var
|
|
2448
|
+
var import_react15 = require("react");
|
|
2339
2449
|
var import_react_core9 = require("@copilotkit/react-core");
|
|
2340
2450
|
var import_shared4 = require("@copilotkit/shared");
|
|
2341
2451
|
function useCopilotChatSuggestions({
|
|
@@ -2345,7 +2455,7 @@ function useCopilotChatSuggestions({
|
|
|
2345
2455
|
maxSuggestions = 3
|
|
2346
2456
|
}, dependencies = []) {
|
|
2347
2457
|
const context = (0, import_react_core9.useCopilotContext)();
|
|
2348
|
-
(0,
|
|
2458
|
+
(0, import_react15.useEffect)(() => {
|
|
2349
2459
|
const id = (0, import_shared4.randomId)();
|
|
2350
2460
|
context.addChatSuggestionConfiguration(id, {
|
|
2351
2461
|
instructions,
|
|
@@ -2361,8 +2471,10 @@ function useCopilotChatSuggestions({
|
|
|
2361
2471
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2362
2472
|
0 && (module.exports = {
|
|
2363
2473
|
CopilotChat,
|
|
2474
|
+
CopilotDevConsole,
|
|
2364
2475
|
CopilotPopup,
|
|
2365
2476
|
CopilotSidebar,
|
|
2477
|
+
shouldShowDevConsole,
|
|
2366
2478
|
useChatContext,
|
|
2367
2479
|
useCopilotChatSuggestions
|
|
2368
2480
|
});
|