@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
|
@@ -1525,7 +1525,7 @@ var reloadSuggestions = (context, chatSuggestionConfiguration, setCurrentSuggest
|
|
|
1525
1525
|
});
|
|
1526
1526
|
|
|
1527
1527
|
// src/components/chat/Chat.tsx
|
|
1528
|
-
var
|
|
1528
|
+
var import_react11 = __toESM(require("react"));
|
|
1529
1529
|
var import_react_core8 = require("@copilotkit/react-core");
|
|
1530
1530
|
var import_runtime_client_gql4 = require("@copilotkit/runtime-client-gql");
|
|
1531
1531
|
var import_shared3 = require("@copilotkit/shared");
|
|
@@ -1664,7 +1664,7 @@ function logMessages(context) {
|
|
|
1664
1664
|
|
|
1665
1665
|
// src/components/dev-console/console.tsx
|
|
1666
1666
|
var import_react_core7 = require("@copilotkit/react-core");
|
|
1667
|
-
var
|
|
1667
|
+
var import_react9 = require("react");
|
|
1668
1668
|
|
|
1669
1669
|
// src/components/dev-console/icons.tsx
|
|
1670
1670
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
@@ -1751,21 +1751,128 @@ var CopilotKitIcon = /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
|
1751
1751
|
);
|
|
1752
1752
|
|
|
1753
1753
|
// src/components/dev-console/console.tsx
|
|
1754
|
-
var
|
|
1754
|
+
var import_react10 = require("@headlessui/react");
|
|
1755
1755
|
var import_shared2 = require("@copilotkit/shared");
|
|
1756
|
+
|
|
1757
|
+
// src/components/help-modal/modal.tsx
|
|
1758
|
+
var import_react8 = require("react");
|
|
1759
|
+
|
|
1760
|
+
// src/components/help-modal/icons.tsx
|
|
1756
1761
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1762
|
+
var LifeBuoyIcon = () => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1763
|
+
"svg",
|
|
1764
|
+
{
|
|
1765
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1766
|
+
width: "24",
|
|
1767
|
+
height: "24",
|
|
1768
|
+
viewBox: "0 0 24 24",
|
|
1769
|
+
fill: "none",
|
|
1770
|
+
stroke: "currentColor",
|
|
1771
|
+
strokeWidth: "2",
|
|
1772
|
+
strokeLinecap: "round",
|
|
1773
|
+
strokeLinejoin: "round",
|
|
1774
|
+
className: "icon icon-tabler icons-tabler-outline icon-tabler-lifebuoy",
|
|
1775
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("g", { transform: "translate(0, -1)", children: [
|
|
1776
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
1777
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "M12 12m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0" }),
|
|
1778
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" }),
|
|
1779
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "M15 15l3.35 3.35" }),
|
|
1780
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "M9 15l-3.35 3.35" }),
|
|
1781
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "M5.65 5.65l3.35 3.35" }),
|
|
1782
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "M18.35 5.65l-3.35 3.35" })
|
|
1783
|
+
] })
|
|
1784
|
+
}
|
|
1785
|
+
);
|
|
1786
|
+
var CloseIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1787
|
+
"svg",
|
|
1788
|
+
{
|
|
1789
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1790
|
+
fill: "none",
|
|
1791
|
+
viewBox: "0 0 24 24",
|
|
1792
|
+
strokeWidth: "1.5",
|
|
1793
|
+
stroke: "currentColor",
|
|
1794
|
+
width: "20",
|
|
1795
|
+
height: "20",
|
|
1796
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
|
|
1797
|
+
}
|
|
1798
|
+
);
|
|
1799
|
+
|
|
1800
|
+
// src/components/help-modal/modal.tsx
|
|
1801
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1802
|
+
function CopilotKitHelpModal() {
|
|
1803
|
+
const [showHelpModal, setShowHelpModal] = (0, import_react8.useState)(false);
|
|
1804
|
+
const [issueDescription, setIssueDescription] = (0, import_react8.useState)("");
|
|
1805
|
+
const handleSubmit = () => {
|
|
1806
|
+
setShowHelpModal(false);
|
|
1807
|
+
};
|
|
1808
|
+
const HelpButton = () => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1809
|
+
"button",
|
|
1810
|
+
{
|
|
1811
|
+
onClick: () => setShowHelpModal(true),
|
|
1812
|
+
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",
|
|
1813
|
+
"aria-label": "Open Help",
|
|
1814
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(LifeBuoyIcon, {})
|
|
1815
|
+
}
|
|
1816
|
+
);
|
|
1817
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
1818
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(HelpButton, {}),
|
|
1819
|
+
showHelpModal && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1820
|
+
"div",
|
|
1821
|
+
{
|
|
1822
|
+
className: "fixed inset-0 flex items-center justify-center p-4",
|
|
1823
|
+
style: { backgroundColor: "rgba(11, 15, 26, 0.5)", zIndex: 99 },
|
|
1824
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "bg-white rounded-lg shadow-xl max-w-md w-full p-4 flex-col relative", children: [
|
|
1825
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1826
|
+
"button",
|
|
1827
|
+
{
|
|
1828
|
+
className: "absolute text-gray-400 hover:text-gray-600 focus:outline-none",
|
|
1829
|
+
style: { top: "10px", right: "10px" },
|
|
1830
|
+
onClick: () => setShowHelpModal(false),
|
|
1831
|
+
"aria-label": "Close",
|
|
1832
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CloseIcon2, {})
|
|
1833
|
+
}
|
|
1834
|
+
),
|
|
1835
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "w-full flex mb-6 justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h2", { className: "text-2xl font-bold", children: "Help Options" }) }),
|
|
1836
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-4 mb-4", children: [
|
|
1837
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.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_runtime16.jsx)(
|
|
1838
|
+
"a",
|
|
1839
|
+
{
|
|
1840
|
+
href: "https://go.copilotkit.ai/dev-console-support-discord",
|
|
1841
|
+
target: "_blank",
|
|
1842
|
+
rel: "noopener noreferrer",
|
|
1843
|
+
children: "Go to Discord Support Channel (Community Support)"
|
|
1844
|
+
}
|
|
1845
|
+
) }),
|
|
1846
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.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_runtime16.jsx)(
|
|
1847
|
+
"a",
|
|
1848
|
+
{
|
|
1849
|
+
href: "https://go.copilotkit.ai/dev-console-support-slack",
|
|
1850
|
+
target: "_blank",
|
|
1851
|
+
rel: "noopener noreferrer",
|
|
1852
|
+
children: "Apply for Priority Direct Slack Support"
|
|
1853
|
+
}
|
|
1854
|
+
) })
|
|
1855
|
+
] })
|
|
1856
|
+
] })
|
|
1857
|
+
}
|
|
1858
|
+
)
|
|
1859
|
+
] });
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
// src/components/dev-console/console.tsx
|
|
1863
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1757
1864
|
function CopilotDevConsole() {
|
|
1758
1865
|
const currentVersion = import_shared2.COPILOTKIT_VERSION;
|
|
1759
1866
|
const context = (0, import_react_core7.useCopilotContext)();
|
|
1760
|
-
const [showDevConsole, setShowDevConsole] = (0,
|
|
1761
|
-
(0,
|
|
1867
|
+
const [showDevConsole, setShowDevConsole] = (0, import_react9.useState)(false);
|
|
1868
|
+
(0, import_react9.useEffect)(() => {
|
|
1762
1869
|
setShowDevConsole(shouldShowDevConsole(context.showDevConsole));
|
|
1763
1870
|
}, [context.showDevConsole]);
|
|
1764
|
-
const dontRunTwiceInDevMode = (0,
|
|
1765
|
-
const [versionStatus, setVersionStatus] = (0,
|
|
1766
|
-
const [latestVersion, setLatestVersion] = (0,
|
|
1767
|
-
const consoleRef = (0,
|
|
1768
|
-
const [debugButtonMode, setDebugButtonMode] = (0,
|
|
1871
|
+
const dontRunTwiceInDevMode = (0, import_react9.useRef)(false);
|
|
1872
|
+
const [versionStatus, setVersionStatus] = (0, import_react9.useState)("unknown");
|
|
1873
|
+
const [latestVersion, setLatestVersion] = (0, import_react9.useState)("");
|
|
1874
|
+
const consoleRef = (0, import_react9.useRef)(null);
|
|
1875
|
+
const [debugButtonMode, setDebugButtonMode] = (0, import_react9.useState)("full");
|
|
1769
1876
|
const checkForUpdates = (force = false) => {
|
|
1770
1877
|
setVersionStatus("checking");
|
|
1771
1878
|
getPublishedCopilotKitVersion(currentVersion, force).then((v) => {
|
|
@@ -1788,14 +1895,14 @@ function CopilotDevConsole() {
|
|
|
1788
1895
|
setVersionStatus("unknown");
|
|
1789
1896
|
});
|
|
1790
1897
|
};
|
|
1791
|
-
(0,
|
|
1898
|
+
(0, import_react9.useEffect)(() => {
|
|
1792
1899
|
if (dontRunTwiceInDevMode.current === true) {
|
|
1793
1900
|
return;
|
|
1794
1901
|
}
|
|
1795
1902
|
dontRunTwiceInDevMode.current = true;
|
|
1796
1903
|
checkForUpdates();
|
|
1797
1904
|
}, []);
|
|
1798
|
-
(0,
|
|
1905
|
+
(0, import_react9.useEffect)(() => {
|
|
1799
1906
|
const handleResize = (entries) => {
|
|
1800
1907
|
for (let entry of entries) {
|
|
1801
1908
|
if (entry.target === consoleRef.current) {
|
|
@@ -1827,14 +1934,14 @@ function CopilotDevConsole() {
|
|
|
1827
1934
|
if (!showDevConsole) {
|
|
1828
1935
|
return null;
|
|
1829
1936
|
}
|
|
1830
|
-
return /* @__PURE__ */ (0,
|
|
1937
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1831
1938
|
"div",
|
|
1832
1939
|
{
|
|
1833
1940
|
ref: consoleRef,
|
|
1834
1941
|
className: "copilotKitDevConsole " + (versionStatus === "update-available" ? "copilotKitDevConsoleUpgrade" : "") + (versionStatus === "outdated" ? "copilotKitDevConsoleWarnOutdated" : ""),
|
|
1835
1942
|
children: [
|
|
1836
|
-
/* @__PURE__ */ (0,
|
|
1837
|
-
/* @__PURE__ */ (0,
|
|
1943
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "copilotKitDevConsoleLogo", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("a", { href: "https://copilotkit.ai", target: "_blank", children: CopilotKitIcon }) }),
|
|
1944
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1838
1945
|
VersionInfo,
|
|
1839
1946
|
{
|
|
1840
1947
|
showDevConsole: context.showDevConsole,
|
|
@@ -1843,7 +1950,8 @@ function CopilotDevConsole() {
|
|
|
1843
1950
|
latestVersion
|
|
1844
1951
|
}
|
|
1845
1952
|
),
|
|
1846
|
-
/* @__PURE__ */ (0,
|
|
1953
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CopilotKitHelpModal, {}),
|
|
1954
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1847
1955
|
DebugMenuButton,
|
|
1848
1956
|
{
|
|
1849
1957
|
setShowDevConsole,
|
|
@@ -1861,7 +1969,7 @@ function VersionInfo({
|
|
|
1861
1969
|
currentVersion,
|
|
1862
1970
|
latestVersion
|
|
1863
1971
|
}) {
|
|
1864
|
-
const [copyStatus, setCopyStatus] = (0,
|
|
1972
|
+
const [copyStatus, setCopyStatus] = (0, import_react9.useState)("");
|
|
1865
1973
|
let versionLabel = "";
|
|
1866
1974
|
let versionIcon = "";
|
|
1867
1975
|
let currentVersionLabel = currentVersion;
|
|
@@ -1898,12 +2006,12 @@ function VersionInfo({
|
|
|
1898
2006
|
setTimeout(() => setCopyStatus(""), 1e3);
|
|
1899
2007
|
});
|
|
1900
2008
|
};
|
|
1901
|
-
return /* @__PURE__ */ (0,
|
|
1902
|
-
/* @__PURE__ */ (0,
|
|
2009
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "copilotKitVersionInfo", children: [
|
|
2010
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("header", { children: [
|
|
1903
2011
|
"COPILOTKIT DEV CONSOLE",
|
|
1904
|
-
showDevConsole === "auto" && /* @__PURE__ */ (0,
|
|
2012
|
+
showDevConsole === "auto" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("aside", { children: asideLabel })
|
|
1905
2013
|
] }),
|
|
1906
|
-
/* @__PURE__ */ (0,
|
|
2014
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("section", { children: [
|
|
1907
2015
|
"Version: ",
|
|
1908
2016
|
versionLabel,
|
|
1909
2017
|
" (",
|
|
@@ -1911,7 +2019,7 @@ function VersionInfo({
|
|
|
1911
2019
|
") ",
|
|
1912
2020
|
versionIcon
|
|
1913
2021
|
] }),
|
|
1914
|
-
(versionStatus === "update-available" || versionStatus === "outdated") && /* @__PURE__ */ (0,
|
|
2022
|
+
(versionStatus === "update-available" || versionStatus === "outdated") && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("footer", { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { onClick: handleCopyClick, children: copyStatus || installCommand }) })
|
|
1915
2023
|
] });
|
|
1916
2024
|
}
|
|
1917
2025
|
function DebugMenuButton({
|
|
@@ -1921,22 +2029,22 @@ function DebugMenuButton({
|
|
|
1921
2029
|
}) {
|
|
1922
2030
|
const context = (0, import_react_core7.useCopilotContext)();
|
|
1923
2031
|
const messagesContext = (0, import_react_core7.useCopilotMessagesContext)();
|
|
1924
|
-
return /* @__PURE__ */ (0,
|
|
1925
|
-
/* @__PURE__ */ (0,
|
|
2032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "bg-black top-24 w-52 text-right", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react10.Menu, { children: [
|
|
2033
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react10.MenuButton, { className: `copilotKitDebugMenuButton ${mode === "compact" ? "compact" : ""}`, children: mode == "compact" ? "Debug" : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
1926
2034
|
"Debug ",
|
|
1927
2035
|
ChevronDownIcon
|
|
1928
2036
|
] }) }),
|
|
1929
|
-
/* @__PURE__ */ (0,
|
|
1930
|
-
|
|
2037
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2038
|
+
import_react10.MenuItems,
|
|
1931
2039
|
{
|
|
1932
2040
|
transition: true,
|
|
1933
2041
|
anchor: "bottom end",
|
|
1934
2042
|
className: "copilotKitDebugMenu",
|
|
1935
2043
|
style: { zIndex: 40 },
|
|
1936
2044
|
children: [
|
|
1937
|
-
/* @__PURE__ */ (0,
|
|
1938
|
-
/* @__PURE__ */ (0,
|
|
1939
|
-
/* @__PURE__ */ (0,
|
|
2045
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react10.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => logReadables(context), children: "Log Readables" }) }),
|
|
2046
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react10.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => logActions(context), children: "Log Actions" }) }),
|
|
2047
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react10.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1940
2048
|
"button",
|
|
1941
2049
|
{
|
|
1942
2050
|
className: "copilotKitDebugMenuItem",
|
|
@@ -1944,9 +2052,9 @@ function DebugMenuButton({
|
|
|
1944
2052
|
children: "Log Messages"
|
|
1945
2053
|
}
|
|
1946
2054
|
) }),
|
|
1947
|
-
/* @__PURE__ */ (0,
|
|
1948
|
-
/* @__PURE__ */ (0,
|
|
1949
|
-
/* @__PURE__ */ (0,
|
|
2055
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react10.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => checkForUpdates(true), children: "Check for Updates" }) }),
|
|
2056
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("hr", {}),
|
|
2057
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react10.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => setShowDevConsole(false), children: "Hide Dev Console" }) })
|
|
1950
2058
|
]
|
|
1951
2059
|
}
|
|
1952
2060
|
)
|
|
@@ -1954,7 +2062,7 @@ function DebugMenuButton({
|
|
|
1954
2062
|
}
|
|
1955
2063
|
|
|
1956
2064
|
// src/components/chat/Chat.tsx
|
|
1957
|
-
var
|
|
2065
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1958
2066
|
function CopilotChat({
|
|
1959
2067
|
instructions,
|
|
1960
2068
|
onSubmitMessage,
|
|
@@ -1973,7 +2081,7 @@ function CopilotChat({
|
|
|
1973
2081
|
labels
|
|
1974
2082
|
}) {
|
|
1975
2083
|
const context = (0, import_react_core8.useCopilotContext)();
|
|
1976
|
-
(0,
|
|
2084
|
+
(0, import_react11.useEffect)(() => {
|
|
1977
2085
|
context.setChatInstructions(instructions || "");
|
|
1978
2086
|
}, [instructions]);
|
|
1979
2087
|
const {
|
|
@@ -1984,11 +2092,11 @@ function CopilotChat({
|
|
|
1984
2092
|
stopGeneration,
|
|
1985
2093
|
reloadMessages
|
|
1986
2094
|
} = useCopilotChatLogic(makeSystemMessage, onInProgress, onSubmitMessage);
|
|
1987
|
-
const chatContext =
|
|
2095
|
+
const chatContext = import_react11.default.useContext(ChatContext);
|
|
1988
2096
|
const isVisible = chatContext ? chatContext.open : true;
|
|
1989
|
-
return /* @__PURE__ */ (0,
|
|
1990
|
-
/* @__PURE__ */ (0,
|
|
1991
|
-
/* @__PURE__ */ (0,
|
|
2097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
|
|
2098
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CopilotDevConsole, {}),
|
|
2099
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1992
2100
|
Messages2,
|
|
1993
2101
|
{
|
|
1994
2102
|
RenderTextMessage: RenderTextMessage2,
|
|
@@ -1998,9 +2106,9 @@ function CopilotChat({
|
|
|
1998
2106
|
messages: visibleMessages,
|
|
1999
2107
|
inProgress: isLoading,
|
|
2000
2108
|
children: [
|
|
2001
|
-
currentSuggestions.length > 0 && /* @__PURE__ */ (0,
|
|
2002
|
-
/* @__PURE__ */ (0,
|
|
2003
|
-
/* @__PURE__ */ (0,
|
|
2109
|
+
currentSuggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { children: [
|
|
2110
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h6", { children: "Suggested:" }),
|
|
2111
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "suggestions", children: currentSuggestions.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2004
2112
|
Suggestion,
|
|
2005
2113
|
{
|
|
2006
2114
|
title: suggestion.title,
|
|
@@ -2012,7 +2120,7 @@ function CopilotChat({
|
|
|
2012
2120
|
index
|
|
2013
2121
|
)) })
|
|
2014
2122
|
] }),
|
|
2015
|
-
showResponseButton && visibleMessages.length > 0 && /* @__PURE__ */ (0,
|
|
2123
|
+
showResponseButton && visibleMessages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2016
2124
|
ResponseButton2,
|
|
2017
2125
|
{
|
|
2018
2126
|
onClick: isLoading ? stopGeneration : reloadMessages,
|
|
@@ -2022,7 +2130,7 @@ function CopilotChat({
|
|
|
2022
2130
|
]
|
|
2023
2131
|
}
|
|
2024
2132
|
),
|
|
2025
|
-
/* @__PURE__ */ (0,
|
|
2133
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Input2, { inProgress: isLoading, onSend: sendMessage, isVisible })
|
|
2026
2134
|
] });
|
|
2027
2135
|
}
|
|
2028
2136
|
function WrappedCopilotChat({
|
|
@@ -2031,12 +2139,12 @@ function WrappedCopilotChat({
|
|
|
2031
2139
|
labels,
|
|
2032
2140
|
className
|
|
2033
2141
|
}) {
|
|
2034
|
-
const chatContext =
|
|
2142
|
+
const chatContext = import_react11.default.useContext(ChatContext);
|
|
2035
2143
|
if (!chatContext) {
|
|
2036
|
-
return /* @__PURE__ */ (0,
|
|
2037
|
-
}, children: /* @__PURE__ */ (0,
|
|
2144
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChatContextProvider, { icons, labels, open: true, setOpen: () => {
|
|
2145
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: `copilotKitChat ${className}`, children }) });
|
|
2038
2146
|
}
|
|
2039
|
-
return /* @__PURE__ */ (0,
|
|
2147
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jsx_runtime18.Fragment, { children });
|
|
2040
2148
|
}
|
|
2041
2149
|
var SUGGESTIONS_DEBOUNCE_TIMEOUT = 1e3;
|
|
2042
2150
|
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) => {
|
|
@@ -2044,9 +2152,9 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
2044
2152
|
id: (0, import_shared3.randomId)(),
|
|
2045
2153
|
makeSystemMessage
|
|
2046
2154
|
});
|
|
2047
|
-
const [currentSuggestions, setCurrentSuggestions] = (0,
|
|
2048
|
-
const suggestionsAbortControllerRef = (0,
|
|
2049
|
-
const debounceTimerRef = (0,
|
|
2155
|
+
const [currentSuggestions, setCurrentSuggestions] = (0, import_react11.useState)([]);
|
|
2156
|
+
const suggestionsAbortControllerRef = (0, import_react11.useRef)(null);
|
|
2157
|
+
const debounceTimerRef = (0, import_react11.useRef)();
|
|
2050
2158
|
const abortSuggestions = () => {
|
|
2051
2159
|
var _a;
|
|
2052
2160
|
(_a = suggestionsAbortControllerRef.current) == null ? void 0 : _a.abort();
|
|
@@ -2055,7 +2163,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
2055
2163
|
const generalContext = (0, import_react_core8.useCopilotContext)();
|
|
2056
2164
|
const messagesContext = (0, import_react_core8.useCopilotMessagesContext)();
|
|
2057
2165
|
const context = __spreadValues(__spreadValues({}, generalContext), messagesContext);
|
|
2058
|
-
(0,
|
|
2166
|
+
(0, import_react11.useEffect)(() => {
|
|
2059
2167
|
onInProgress == null ? void 0 : onInProgress(isLoading);
|
|
2060
2168
|
abortSuggestions();
|
|
2061
2169
|
debounceTimerRef.current = setTimeout(
|