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