@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
|
@@ -2,15 +2,18 @@ import {
|
|
|
2
2
|
CopilotChat,
|
|
3
3
|
WrappedCopilotChat,
|
|
4
4
|
useCopilotChatLogic
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-DHGDU64D.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";
|
|
@@ -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,7 +2198,7 @@ function DebugMenuButton({
|
|
|
2090
2198
|
}
|
|
2091
2199
|
|
|
2092
2200
|
// src/components/chat/Chat.tsx
|
|
2093
|
-
var
|
|
2201
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2094
2202
|
function CopilotChat({
|
|
2095
2203
|
instructions,
|
|
2096
2204
|
onSubmitMessage,
|
|
@@ -2109,7 +2217,7 @@ function CopilotChat({
|
|
|
2109
2217
|
labels
|
|
2110
2218
|
}) {
|
|
2111
2219
|
const context = (0, import_react_core8.useCopilotContext)();
|
|
2112
|
-
(0,
|
|
2220
|
+
(0, import_react12.useEffect)(() => {
|
|
2113
2221
|
context.setChatInstructions(instructions || "");
|
|
2114
2222
|
}, [instructions]);
|
|
2115
2223
|
const {
|
|
@@ -2120,11 +2228,11 @@ function CopilotChat({
|
|
|
2120
2228
|
stopGeneration,
|
|
2121
2229
|
reloadMessages
|
|
2122
2230
|
} = useCopilotChatLogic(makeSystemMessage, onInProgress, onSubmitMessage);
|
|
2123
|
-
const chatContext =
|
|
2231
|
+
const chatContext = import_react12.default.useContext(ChatContext);
|
|
2124
2232
|
const isVisible = chatContext ? chatContext.open : true;
|
|
2125
|
-
return /* @__PURE__ */ (0,
|
|
2126
|
-
/* @__PURE__ */ (0,
|
|
2127
|
-
/* @__PURE__ */ (0,
|
|
2233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
|
|
2234
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CopilotDevConsole, {}),
|
|
2235
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2128
2236
|
Messages2,
|
|
2129
2237
|
{
|
|
2130
2238
|
RenderTextMessage: RenderTextMessage2,
|
|
@@ -2134,9 +2242,9 @@ function CopilotChat({
|
|
|
2134
2242
|
messages: visibleMessages,
|
|
2135
2243
|
inProgress: isLoading,
|
|
2136
2244
|
children: [
|
|
2137
|
-
currentSuggestions.length > 0 && /* @__PURE__ */ (0,
|
|
2138
|
-
/* @__PURE__ */ (0,
|
|
2139
|
-
/* @__PURE__ */ (0,
|
|
2245
|
+
currentSuggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
2246
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h6", { children: "Suggested:" }),
|
|
2247
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "suggestions", children: currentSuggestions.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2140
2248
|
Suggestion,
|
|
2141
2249
|
{
|
|
2142
2250
|
title: suggestion.title,
|
|
@@ -2148,7 +2256,7 @@ function CopilotChat({
|
|
|
2148
2256
|
index
|
|
2149
2257
|
)) })
|
|
2150
2258
|
] }),
|
|
2151
|
-
showResponseButton && visibleMessages.length > 0 && /* @__PURE__ */ (0,
|
|
2259
|
+
showResponseButton && visibleMessages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2152
2260
|
ResponseButton2,
|
|
2153
2261
|
{
|
|
2154
2262
|
onClick: isLoading ? stopGeneration : reloadMessages,
|
|
@@ -2158,7 +2266,7 @@ function CopilotChat({
|
|
|
2158
2266
|
]
|
|
2159
2267
|
}
|
|
2160
2268
|
),
|
|
2161
|
-
/* @__PURE__ */ (0,
|
|
2269
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Input2, { inProgress: isLoading, onSend: sendMessage, isVisible })
|
|
2162
2270
|
] });
|
|
2163
2271
|
}
|
|
2164
2272
|
function WrappedCopilotChat({
|
|
@@ -2167,12 +2275,12 @@ function WrappedCopilotChat({
|
|
|
2167
2275
|
labels,
|
|
2168
2276
|
className
|
|
2169
2277
|
}) {
|
|
2170
|
-
const chatContext =
|
|
2278
|
+
const chatContext = import_react12.default.useContext(ChatContext);
|
|
2171
2279
|
if (!chatContext) {
|
|
2172
|
-
return /* @__PURE__ */ (0,
|
|
2173
|
-
}, children: /* @__PURE__ */ (0,
|
|
2280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ChatContextProvider, { icons, labels, open: true, setOpen: () => {
|
|
2281
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: `copilotKitChat ${className}`, children }) });
|
|
2174
2282
|
}
|
|
2175
|
-
return /* @__PURE__ */ (0,
|
|
2283
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children });
|
|
2176
2284
|
}
|
|
2177
2285
|
var SUGGESTIONS_DEBOUNCE_TIMEOUT = 1e3;
|
|
2178
2286
|
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) => {
|
|
@@ -2180,9 +2288,9 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
2180
2288
|
id: (0, import_shared3.randomId)(),
|
|
2181
2289
|
makeSystemMessage
|
|
2182
2290
|
});
|
|
2183
|
-
const [currentSuggestions, setCurrentSuggestions] = (0,
|
|
2184
|
-
const suggestionsAbortControllerRef = (0,
|
|
2185
|
-
const debounceTimerRef = (0,
|
|
2291
|
+
const [currentSuggestions, setCurrentSuggestions] = (0, import_react12.useState)([]);
|
|
2292
|
+
const suggestionsAbortControllerRef = (0, import_react12.useRef)(null);
|
|
2293
|
+
const debounceTimerRef = (0, import_react12.useRef)();
|
|
2186
2294
|
const abortSuggestions = () => {
|
|
2187
2295
|
var _a;
|
|
2188
2296
|
(_a = suggestionsAbortControllerRef.current) == null ? void 0 : _a.abort();
|
|
@@ -2191,7 +2299,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
2191
2299
|
const generalContext = (0, import_react_core8.useCopilotContext)();
|
|
2192
2300
|
const messagesContext = (0, import_react_core8.useCopilotMessagesContext)();
|
|
2193
2301
|
const context = __spreadValues(__spreadValues({}, generalContext), messagesContext);
|
|
2194
|
-
(0,
|
|
2302
|
+
(0, import_react12.useEffect)(() => {
|
|
2195
2303
|
onInProgress == null ? void 0 : onInProgress(isLoading);
|
|
2196
2304
|
abortSuggestions();
|
|
2197
2305
|
debounceTimerRef.current = setTimeout(
|
|
@@ -2240,7 +2348,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
2240
2348
|
};
|
|
2241
2349
|
|
|
2242
2350
|
// src/components/chat/Modal.tsx
|
|
2243
|
-
var
|
|
2351
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2244
2352
|
var CopilotModal = ({
|
|
2245
2353
|
instructions,
|
|
2246
2354
|
defaultOpen = false,
|
|
@@ -2263,24 +2371,24 @@ var CopilotModal = ({
|
|
|
2263
2371
|
className,
|
|
2264
2372
|
children
|
|
2265
2373
|
}) => {
|
|
2266
|
-
const [openState, setOpenState] =
|
|
2374
|
+
const [openState, setOpenState] = import_react13.default.useState(defaultOpen);
|
|
2267
2375
|
const setOpen = (open) => {
|
|
2268
2376
|
onSetOpen == null ? void 0 : onSetOpen(open);
|
|
2269
2377
|
setOpenState(open);
|
|
2270
2378
|
};
|
|
2271
|
-
return /* @__PURE__ */ (0,
|
|
2379
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(ChatContextProvider, { icons, labels, open: openState, setOpen, children: [
|
|
2272
2380
|
children,
|
|
2273
|
-
/* @__PURE__ */ (0,
|
|
2274
|
-
/* @__PURE__ */ (0,
|
|
2275
|
-
/* @__PURE__ */ (0,
|
|
2381
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className, children: [
|
|
2382
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Button2, {}),
|
|
2383
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2276
2384
|
Window2,
|
|
2277
2385
|
{
|
|
2278
2386
|
clickOutsideToClose,
|
|
2279
2387
|
shortcut,
|
|
2280
2388
|
hitEscapeToClose,
|
|
2281
2389
|
children: [
|
|
2282
|
-
/* @__PURE__ */ (0,
|
|
2283
|
-
/* @__PURE__ */ (0,
|
|
2390
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Header2, {}),
|
|
2391
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2284
2392
|
CopilotChat,
|
|
2285
2393
|
{
|
|
2286
2394
|
instructions,
|