@copilotkit/react-ui 1.8.5-next.1 → 1.8.5-next.3
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 +18 -0
- package/dist/{chunk-Q2YY2NX3.mjs → chunk-COZFHP6Y.mjs} +2 -2
- package/dist/{chunk-MYUOPOIL.mjs → chunk-DRAM4KIH.mjs} +13 -13
- package/dist/{chunk-PCTCOQK2.mjs → chunk-DYUT4CVD.mjs} +4 -4
- package/dist/{chunk-4TWPMWD4.mjs → chunk-GULJZORG.mjs} +8 -8
- package/dist/chunk-JGMFJZMG.mjs +11 -0
- package/dist/chunk-JGMFJZMG.mjs.map +1 -0
- package/dist/{chunk-XNQO5AZZ.mjs → chunk-KSW7FVYG.mjs} +2 -2
- package/dist/{chunk-5M7ODWKH.mjs → chunk-N7ZQXCKF.mjs} +2 -2
- package/dist/{chunk-6QV7AIIG.mjs → chunk-P53JYD5X.mjs} +2 -2
- package/dist/{chunk-D5XIJNXQ.mjs → chunk-Q6XB5B2M.mjs} +7 -7
- package/dist/{chunk-2OTVZXDX.mjs → chunk-QDC2Q7XX.mjs} +2 -2
- package/dist/{chunk-NMNC4ROZ.mjs → chunk-QMW2LYI3.mjs} +2 -2
- package/dist/{chunk-P7S3E5UW.mjs → chunk-QSUC3MKT.mjs} +35 -7
- package/dist/chunk-QSUC3MKT.mjs.map +1 -0
- package/dist/{chunk-QJKMOGWN.mjs → chunk-RXBEZZ5I.mjs} +4 -4
- package/dist/{chunk-U6ISBBRF.mjs → chunk-TYAYVE3X.mjs} +2 -2
- package/dist/{chunk-62QMTKMJ.mjs → chunk-USR5CBYD.mjs} +4 -4
- package/dist/{chunk-WNC6OCIB.mjs → chunk-YIQTTJAT.mjs} +2 -2
- package/dist/components/chat/Chat.mjs +11 -11
- package/dist/components/chat/CodeBlock.mjs +2 -2
- package/dist/components/chat/Header.mjs +3 -3
- package/dist/components/chat/Input.mjs +2 -2
- package/dist/components/chat/Markdown.mjs +3 -3
- package/dist/components/chat/Modal.js +66 -32
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +17 -16
- package/dist/components/chat/Popup.js +66 -32
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +18 -17
- package/dist/components/chat/Sidebar.js +66 -32
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +18 -17
- package/dist/components/chat/Window.js +39 -5
- package/dist/components/chat/Window.js.map +1 -1
- package/dist/components/chat/Window.mjs +2 -1
- package/dist/components/chat/index.js +66 -32
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +22 -21
- package/dist/components/chat/messages/AssistantMessage.mjs +4 -4
- package/dist/components/chat/messages/RenderActionExecutionMessage.mjs +5 -5
- package/dist/components/chat/messages/RenderAgentStateMessage.mjs +5 -5
- package/dist/components/chat/messages/RenderResultMessage.mjs +5 -5
- package/dist/components/chat/messages/RenderTextMessage.mjs +5 -5
- package/dist/components/dev-console/console.mjs +2 -2
- package/dist/components/dev-console/index.mjs +2 -2
- package/dist/components/index.js +66 -32
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +22 -21
- package/dist/hooks/use-dark-mode.d.ts +3 -0
- package/dist/hooks/use-dark-mode.js +35 -0
- package/dist/hooks/use-dark-mode.js.map +1 -0
- package/dist/hooks/use-dark-mode.mjs +8 -0
- package/dist/hooks/use-dark-mode.mjs.map +1 -0
- package/dist/index.css +25 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +68 -34
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -27
- package/package.json +4 -4
- package/src/components/chat/Window.tsx +26 -1
- package/src/css/input.css +1 -1
- package/src/css/window.css +27 -0
- package/src/hooks/use-dark-mode.ts +10 -0
- package/dist/chunk-P7S3E5UW.mjs.map +0 -1
- /package/dist/{chunk-Q2YY2NX3.mjs.map → chunk-COZFHP6Y.mjs.map} +0 -0
- /package/dist/{chunk-MYUOPOIL.mjs.map → chunk-DRAM4KIH.mjs.map} +0 -0
- /package/dist/{chunk-PCTCOQK2.mjs.map → chunk-DYUT4CVD.mjs.map} +0 -0
- /package/dist/{chunk-4TWPMWD4.mjs.map → chunk-GULJZORG.mjs.map} +0 -0
- /package/dist/{chunk-XNQO5AZZ.mjs.map → chunk-KSW7FVYG.mjs.map} +0 -0
- /package/dist/{chunk-5M7ODWKH.mjs.map → chunk-N7ZQXCKF.mjs.map} +0 -0
- /package/dist/{chunk-6QV7AIIG.mjs.map → chunk-P53JYD5X.mjs.map} +0 -0
- /package/dist/{chunk-D5XIJNXQ.mjs.map → chunk-Q6XB5B2M.mjs.map} +0 -0
- /package/dist/{chunk-2OTVZXDX.mjs.map → chunk-QDC2Q7XX.mjs.map} +0 -0
- /package/dist/{chunk-NMNC4ROZ.mjs.map → chunk-QMW2LYI3.mjs.map} +0 -0
- /package/dist/{chunk-QJKMOGWN.mjs.map → chunk-RXBEZZ5I.mjs.map} +0 -0
- /package/dist/{chunk-U6ISBBRF.mjs.map → chunk-TYAYVE3X.mjs.map} +0 -0
- /package/dist/{chunk-62QMTKMJ.mjs.map → chunk-USR5CBYD.mjs.map} +0 -0
- /package/dist/{chunk-WNC6OCIB.mjs.map → chunk-YIQTTJAT.mjs.map} +0 -0
|
@@ -1,34 +1,35 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotPopup
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-P53JYD5X.mjs";
|
|
4
|
+
import "../../chunk-GULJZORG.mjs";
|
|
5
|
+
import "../../chunk-QSUC3MKT.mjs";
|
|
6
|
+
import "../../chunk-JGMFJZMG.mjs";
|
|
7
|
+
import "../../chunk-QDC2Q7XX.mjs";
|
|
7
8
|
import "../../chunk-V7W6IM2V.mjs";
|
|
8
|
-
import "../../chunk-
|
|
9
|
+
import "../../chunk-Q6XB5B2M.mjs";
|
|
10
|
+
import "../../chunk-Q5V6S67N.mjs";
|
|
9
11
|
import "../../chunk-6TCUJ3B7.mjs";
|
|
10
12
|
import "../../chunk-KXE2JCUH.mjs";
|
|
11
13
|
import "../../chunk-NRA3CFEE.mjs";
|
|
12
14
|
import "../../chunk-BH6PCAAL.mjs";
|
|
13
|
-
import "../../chunk-Q5V6S67N.mjs";
|
|
14
15
|
import "../../chunk-YOEL33HG.mjs";
|
|
15
|
-
import "../../chunk-
|
|
16
|
-
import "../../chunk-
|
|
17
|
-
import "../../chunk-
|
|
16
|
+
import "../../chunk-DRAM4KIH.mjs";
|
|
17
|
+
import "../../chunk-QMW2LYI3.mjs";
|
|
18
|
+
import "../../chunk-COZFHP6Y.mjs";
|
|
19
|
+
import "../../chunk-YIQTTJAT.mjs";
|
|
20
|
+
import "../../chunk-USR5CBYD.mjs";
|
|
21
|
+
import "../../chunk-N7ZQXCKF.mjs";
|
|
18
22
|
import "../../chunk-HEIDCT7I.mjs";
|
|
19
|
-
import "../../chunk-NMNC4ROZ.mjs";
|
|
20
|
-
import "../../chunk-Q2YY2NX3.mjs";
|
|
21
|
-
import "../../chunk-5M7ODWKH.mjs";
|
|
22
23
|
import "../../chunk-TOQ7P4DO.mjs";
|
|
23
|
-
import "../../chunk-
|
|
24
|
+
import "../../chunk-RXBEZZ5I.mjs";
|
|
25
|
+
import "../../chunk-S5MBUNGN.mjs";
|
|
24
26
|
import "../../chunk-YQFVRDNC.mjs";
|
|
25
|
-
import "../../chunk-
|
|
27
|
+
import "../../chunk-KSW7FVYG.mjs";
|
|
28
|
+
import "../../chunk-DYUT4CVD.mjs";
|
|
29
|
+
import "../../chunk-54JAUBUJ.mjs";
|
|
26
30
|
import "../../chunk-ZY25LVYR.mjs";
|
|
27
31
|
import "../../chunk-UN2E3HCK.mjs";
|
|
28
|
-
import "../../chunk-PCTCOQK2.mjs";
|
|
29
32
|
import "../../chunk-ORSMX3SE.mjs";
|
|
30
|
-
import "../../chunk-54JAUBUJ.mjs";
|
|
31
|
-
import "../../chunk-S5MBUNGN.mjs";
|
|
32
33
|
import "../../chunk-MRXNTQOX.mjs";
|
|
33
34
|
export {
|
|
34
35
|
CopilotPopup
|
|
@@ -384,6 +384,16 @@ var ChatContextProvider = ({
|
|
|
384
384
|
|
|
385
385
|
// src/components/chat/Window.tsx
|
|
386
386
|
var import_react2 = __toESM(require("react"));
|
|
387
|
+
var import_react_core = require("@copilotkit/react-core");
|
|
388
|
+
|
|
389
|
+
// src/hooks/use-dark-mode.ts
|
|
390
|
+
var useDarkMode = () => {
|
|
391
|
+
if (typeof window === "undefined")
|
|
392
|
+
return false;
|
|
393
|
+
return document.documentElement.classList.contains("dark") || document.body.classList.contains("dark") || document.documentElement.getAttribute("data-theme") === "dark" || document.body.getAttribute("data-theme") === "dark" || window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
// src/components/chat/Window.tsx
|
|
387
397
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
388
398
|
var Window = ({
|
|
389
399
|
children,
|
|
@@ -391,15 +401,17 @@ var Window = ({
|
|
|
391
401
|
shortcut,
|
|
392
402
|
hitEscapeToClose
|
|
393
403
|
}) => {
|
|
404
|
+
var _a;
|
|
394
405
|
const windowRef = import_react2.default.useRef(null);
|
|
406
|
+
const context = (0, import_react_core.useCopilotContext)();
|
|
395
407
|
const { open, setOpen } = useChatContext();
|
|
396
408
|
const handleClickOutside = (0, import_react2.useCallback)(
|
|
397
409
|
(event) => {
|
|
398
|
-
var
|
|
410
|
+
var _a2;
|
|
399
411
|
if (!clickOutsideToClose) {
|
|
400
412
|
return;
|
|
401
413
|
}
|
|
402
|
-
const parentElement = (
|
|
414
|
+
const parentElement = (_a2 = windowRef.current) == null ? void 0 : _a2.parentElement;
|
|
403
415
|
let className = "";
|
|
404
416
|
if (event.target instanceof HTMLElement) {
|
|
405
417
|
className = event.target.className;
|
|
@@ -413,10 +425,10 @@ var Window = ({
|
|
|
413
425
|
);
|
|
414
426
|
const handleKeyDown = (0, import_react2.useCallback)(
|
|
415
427
|
(event) => {
|
|
416
|
-
var
|
|
428
|
+
var _a2;
|
|
417
429
|
const target = event.target;
|
|
418
430
|
const isInput = target.tagName === "INPUT" || target.tagName === "SELECT" || target.tagName === "TEXTAREA" || target.isContentEditable;
|
|
419
|
-
const isDescendantOfWrapper = (
|
|
431
|
+
const isDescendantOfWrapper = (_a2 = windowRef.current) == null ? void 0 : _a2.contains(target);
|
|
420
432
|
if (open && event.key === "Escape" && (!isInput || isDescendantOfWrapper) && hitEscapeToClose) {
|
|
421
433
|
setOpen(false);
|
|
422
434
|
} else if (event.key === shortcut && (isMacOS() && event.metaKey || !isMacOS() && event.ctrlKey) && (!isInput || isDescendantOfWrapper)) {
|
|
@@ -471,7 +483,29 @@ var Window = ({
|
|
|
471
483
|
}
|
|
472
484
|
};
|
|
473
485
|
}, [adjustForMobile, handleClickOutside, handleKeyDown]);
|
|
474
|
-
|
|
486
|
+
const isDark = useDarkMode();
|
|
487
|
+
const showPoweredBy = !((_a = context.copilotApiConfig) == null ? void 0 : _a.publicApiKey);
|
|
488
|
+
const poweredByStyle = {
|
|
489
|
+
visibility: "visible",
|
|
490
|
+
display: "block",
|
|
491
|
+
position: "static",
|
|
492
|
+
textAlign: "center",
|
|
493
|
+
fontSize: "12px",
|
|
494
|
+
padding: "3px 0",
|
|
495
|
+
color: isDark ? "rgb(69, 69, 69)" : "rgb(214, 214, 214)"
|
|
496
|
+
};
|
|
497
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
498
|
+
"div",
|
|
499
|
+
{
|
|
500
|
+
className: `copilotKitWindow ${showPoweredBy ? " poweredByContainer" : ""} ${open ? " open" : ""}`,
|
|
501
|
+
ref: windowRef,
|
|
502
|
+
children: [
|
|
503
|
+
children,
|
|
504
|
+
showPoweredBy && // @ts-expect-error -- expecting position not to be a string, but it can be.
|
|
505
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "poweredBy", style: poweredByStyle, children: "Powered by CopilotKit" })
|
|
506
|
+
]
|
|
507
|
+
}
|
|
508
|
+
);
|
|
475
509
|
};
|
|
476
510
|
var preventScroll = (event) => {
|
|
477
511
|
let targetElement = event.target;
|
|
@@ -510,7 +544,7 @@ var Button = ({}) => {
|
|
|
510
544
|
};
|
|
511
545
|
|
|
512
546
|
// src/components/dev-console/utils.ts
|
|
513
|
-
var
|
|
547
|
+
var import_react_core2 = require("@copilotkit/react-core");
|
|
514
548
|
function shouldShowDevConsole(showDevConsole) {
|
|
515
549
|
if (typeof showDevConsole === "boolean") {
|
|
516
550
|
return showDevConsole;
|
|
@@ -572,7 +606,7 @@ function getPublishedCopilotKitVersion(current, forceCheck = false) {
|
|
|
572
606
|
}
|
|
573
607
|
function logReadables(context) {
|
|
574
608
|
console.log("%cCurrent Readables:", "font-size: 16px; font-weight: bold;");
|
|
575
|
-
const readables = context.getContextString([],
|
|
609
|
+
const readables = context.getContextString([], import_react_core2.defaultCopilotContextCategories).trim();
|
|
576
610
|
if (readables.length === 0) {
|
|
577
611
|
console.log("No readables found");
|
|
578
612
|
return;
|
|
@@ -642,7 +676,7 @@ function logMessages(context) {
|
|
|
642
676
|
}
|
|
643
677
|
|
|
644
678
|
// src/components/dev-console/console.tsx
|
|
645
|
-
var
|
|
679
|
+
var import_react_core3 = require("@copilotkit/react-core");
|
|
646
680
|
var import_react4 = require("react");
|
|
647
681
|
|
|
648
682
|
// src/components/dev-console/icons.tsx
|
|
@@ -832,7 +866,7 @@ function CopilotKitHelpModal() {
|
|
|
832
866
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
833
867
|
function CopilotDevConsole() {
|
|
834
868
|
const currentVersion = import_shared.COPILOTKIT_VERSION;
|
|
835
|
-
const context = (0,
|
|
869
|
+
const context = (0, import_react_core3.useCopilotContext)();
|
|
836
870
|
const [showDevConsole, setShowDevConsole] = (0, import_react4.useState)(false);
|
|
837
871
|
(0, import_react4.useEffect)(() => {
|
|
838
872
|
setShowDevConsole(shouldShowDevConsole(context.showDevConsole));
|
|
@@ -963,8 +997,8 @@ function DebugMenuButton({
|
|
|
963
997
|
checkForUpdates,
|
|
964
998
|
mode
|
|
965
999
|
}) {
|
|
966
|
-
const context = (0,
|
|
967
|
-
const messagesContext = (0,
|
|
1000
|
+
const context = (0, import_react_core3.useCopilotContext)();
|
|
1001
|
+
const messagesContext = (0, import_react_core3.useCopilotMessagesContext)();
|
|
968
1002
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react5.Menu, { children: [
|
|
969
1003
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
970
1004
|
import_react5.MenuButton,
|
|
@@ -1027,7 +1061,7 @@ var Header = ({}) => {
|
|
|
1027
1061
|
// src/components/chat/Messages.tsx
|
|
1028
1062
|
var import_react6 = require("react");
|
|
1029
1063
|
var import_runtime_client_gql = require("@copilotkit/runtime-client-gql");
|
|
1030
|
-
var
|
|
1064
|
+
var import_react_core4 = require("@copilotkit/react-core");
|
|
1031
1065
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1032
1066
|
var Messages = ({
|
|
1033
1067
|
messages,
|
|
@@ -1063,7 +1097,7 @@ var Messages = ({
|
|
|
1063
1097
|
}
|
|
1064
1098
|
}
|
|
1065
1099
|
const { messagesEndRef, messagesContainerRef } = useScrollToBottom(messages);
|
|
1066
|
-
const interrupt = (0,
|
|
1100
|
+
const interrupt = (0, import_react_core4.useLangGraphInterruptRender)();
|
|
1067
1101
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "copilotKitMessages", ref: messagesContainerRef, children: [
|
|
1068
1102
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "copilotKitMessagesContainer", children: [
|
|
1069
1103
|
messages.map((message, index) => {
|
|
@@ -1261,7 +1295,7 @@ var AutoResizingTextarea = (0, import_react7.forwardRef)(
|
|
|
1261
1295
|
var Textarea_default = AutoResizingTextarea;
|
|
1262
1296
|
|
|
1263
1297
|
// src/hooks/use-push-to-talk.tsx
|
|
1264
|
-
var
|
|
1298
|
+
var import_react_core5 = require("@copilotkit/react-core");
|
|
1265
1299
|
var import_react8 = require("react");
|
|
1266
1300
|
var startRecording = (mediaStreamRef, mediaRecorderRef, audioContextRef, recordedChunks, onStop) => __async(void 0, null, function* () {
|
|
1267
1301
|
if (!mediaStreamRef.current || !audioContextRef.current) {
|
|
@@ -1316,8 +1350,8 @@ var usePushToTalk = ({
|
|
|
1316
1350
|
const audioContextRef = (0, import_react8.useRef)(null);
|
|
1317
1351
|
const mediaRecorderRef = (0, import_react8.useRef)(null);
|
|
1318
1352
|
const recordedChunks = (0, import_react8.useRef)([]);
|
|
1319
|
-
const generalContext = (0,
|
|
1320
|
-
const messagesContext = (0,
|
|
1353
|
+
const generalContext = (0, import_react_core5.useCopilotContext)();
|
|
1354
|
+
const messagesContext = (0, import_react_core5.useCopilotMessagesContext)();
|
|
1321
1355
|
const context = __spreadValues(__spreadValues({}, generalContext), messagesContext);
|
|
1322
1356
|
const [startReadingFromMessageId, setStartReadingFromMessageId] = (0, import_react8.useState)(null);
|
|
1323
1357
|
(0, import_react8.useEffect)(() => {
|
|
@@ -1365,11 +1399,11 @@ var usePushToTalk = ({
|
|
|
1365
1399
|
};
|
|
1366
1400
|
|
|
1367
1401
|
// src/components/chat/Input.tsx
|
|
1368
|
-
var
|
|
1402
|
+
var import_react_core6 = require("@copilotkit/react-core");
|
|
1369
1403
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1370
1404
|
var Input = ({ inProgress, onSend, isVisible = false, onStop }) => {
|
|
1371
1405
|
const context = useChatContext();
|
|
1372
|
-
const copilotContext = (0,
|
|
1406
|
+
const copilotContext = (0, import_react_core6.useCopilotContext)();
|
|
1373
1407
|
const pushToTalkConfigured = copilotContext.copilotApiConfig.textToSpeechUrl !== void 0 && copilotContext.copilotApiConfig.transcribeAudioUrl !== void 0;
|
|
1374
1408
|
const textareaRef = (0, import_react9.useRef)(null);
|
|
1375
1409
|
const handleDivClick = (event) => {
|
|
@@ -2075,7 +2109,7 @@ function RenderTextMessage(_a) {
|
|
|
2075
2109
|
|
|
2076
2110
|
// src/components/chat/messages/RenderActionExecutionMessage.tsx
|
|
2077
2111
|
var import_runtime_client_gql2 = require("@copilotkit/runtime-client-gql");
|
|
2078
|
-
var
|
|
2112
|
+
var import_react_core7 = require("@copilotkit/react-core");
|
|
2079
2113
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2080
2114
|
function RenderActionExecutionMessage(_a) {
|
|
2081
2115
|
var _b = _a, {
|
|
@@ -2083,7 +2117,7 @@ function RenderActionExecutionMessage(_a) {
|
|
|
2083
2117
|
} = _b, props = __objRest(_b, [
|
|
2084
2118
|
"AssistantMessage"
|
|
2085
2119
|
]);
|
|
2086
|
-
const { chatComponentsCache } = (0,
|
|
2120
|
+
const { chatComponentsCache } = (0, import_react_core7.useCopilotContext)();
|
|
2087
2121
|
const { message, inProgress, index, isCurrentMessage, actionResult } = props;
|
|
2088
2122
|
if (message.isActionExecutionMessage()) {
|
|
2089
2123
|
if (chatComponentsCache.current !== null && (chatComponentsCache.current.actions[message.name] || chatComponentsCache.current.actions["*"])) {
|
|
@@ -2212,7 +2246,7 @@ function RenderResultMessage(_a) {
|
|
|
2212
2246
|
}
|
|
2213
2247
|
|
|
2214
2248
|
// src/components/chat/messages/RenderAgentStateMessage.tsx
|
|
2215
|
-
var
|
|
2249
|
+
var import_react_core8 = require("@copilotkit/react-core");
|
|
2216
2250
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2217
2251
|
function RenderAgentStateMessage(_a) {
|
|
2218
2252
|
var _b = _a, {
|
|
@@ -2220,7 +2254,7 @@ function RenderAgentStateMessage(_a) {
|
|
|
2220
2254
|
} = _b, props = __objRest(_b, [
|
|
2221
2255
|
"AssistantMessage"
|
|
2222
2256
|
]);
|
|
2223
|
-
const { chatComponentsCache } = (0,
|
|
2257
|
+
const { chatComponentsCache } = (0, import_react_core8.useCopilotContext)();
|
|
2224
2258
|
const { message, inProgress, index, isCurrentMessage } = props;
|
|
2225
2259
|
if (message.isAgentStateMessage()) {
|
|
2226
2260
|
let render;
|
|
@@ -2313,7 +2347,7 @@ function RenderAgentStateMessage(_a) {
|
|
|
2313
2347
|
}
|
|
2314
2348
|
|
|
2315
2349
|
// src/components/chat/Suggestion.tsx
|
|
2316
|
-
var
|
|
2350
|
+
var import_react_core9 = require("@copilotkit/react-core");
|
|
2317
2351
|
var import_shared2 = require("@copilotkit/shared");
|
|
2318
2352
|
var import_runtime_client_gql3 = require("@copilotkit/runtime-client-gql");
|
|
2319
2353
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
@@ -2345,7 +2379,7 @@ var reloadSuggestions = (context, chatSuggestionConfiguration, setCurrentSuggest
|
|
|
2345
2379
|
for (const config of Object.values(chatSuggestionConfiguration)) {
|
|
2346
2380
|
try {
|
|
2347
2381
|
const numOfSuggestionsInstructions = config.minSuggestions === 0 ? `Produce up to ${config.maxSuggestions} suggestions. If there are no highly relevant suggestions you can think of, provide an empty array.` : `Produce between ${config.minSuggestions} and ${config.maxSuggestions} suggestions.`;
|
|
2348
|
-
const result = yield (0,
|
|
2382
|
+
const result = yield (0, import_react_core9.extract)({
|
|
2349
2383
|
context,
|
|
2350
2384
|
instructions: "Suggest what the user could say next. Provide clear, highly relevant suggestions. Do not literally suggest function calls. ",
|
|
2351
2385
|
data: config.instructions + "\n\n" + numOfSuggestionsInstructions + "\n\nAvailable tools: " + tools + "\n\n",
|
|
@@ -2404,10 +2438,10 @@ var reloadSuggestions = (context, chatSuggestionConfiguration, setCurrentSuggest
|
|
|
2404
2438
|
|
|
2405
2439
|
// src/components/chat/Chat.tsx
|
|
2406
2440
|
var import_react13 = __toESM(require("react"));
|
|
2407
|
-
var
|
|
2441
|
+
var import_react_core10 = require("@copilotkit/react-core");
|
|
2408
2442
|
var import_runtime_client_gql4 = require("@copilotkit/runtime-client-gql");
|
|
2409
2443
|
var import_shared3 = require("@copilotkit/shared");
|
|
2410
|
-
var
|
|
2444
|
+
var import_react_core11 = require("@copilotkit/react-core");
|
|
2411
2445
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2412
2446
|
function CopilotChat({
|
|
2413
2447
|
instructions,
|
|
@@ -2432,7 +2466,7 @@ function CopilotChat({
|
|
|
2432
2466
|
AssistantMessage: AssistantMessage2 = AssistantMessage,
|
|
2433
2467
|
UserMessage: UserMessage2 = UserMessage
|
|
2434
2468
|
}) {
|
|
2435
|
-
const { additionalInstructions, setChatInstructions } = (0,
|
|
2469
|
+
const { additionalInstructions, setChatInstructions } = (0, import_react_core10.useCopilotContext)();
|
|
2436
2470
|
(0, import_react13.useEffect)(() => {
|
|
2437
2471
|
if (!(additionalInstructions == null ? void 0 : additionalInstructions.length)) {
|
|
2438
2472
|
setChatInstructions(instructions || "");
|
|
@@ -2536,7 +2570,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2536
2570
|
stopGeneration: defaultStopGeneration,
|
|
2537
2571
|
runChatCompletion,
|
|
2538
2572
|
isLoading
|
|
2539
|
-
} = (0,
|
|
2573
|
+
} = (0, import_react_core10.useCopilotChat)({
|
|
2540
2574
|
id: (0, import_shared3.randomId)(),
|
|
2541
2575
|
makeSystemMessage
|
|
2542
2576
|
});
|
|
@@ -2548,8 +2582,8 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2548
2582
|
(_a2 = suggestionsAbortControllerRef.current) == null ? void 0 : _a2.abort();
|
|
2549
2583
|
suggestionsAbortControllerRef.current = null;
|
|
2550
2584
|
};
|
|
2551
|
-
const generalContext = (0,
|
|
2552
|
-
const messagesContext = (0,
|
|
2585
|
+
const generalContext = (0, import_react_core10.useCopilotContext)();
|
|
2586
|
+
const messagesContext = (0, import_react_core10.useCopilotMessagesContext)();
|
|
2553
2587
|
const context = __spreadValues(__spreadValues({}, generalContext), messagesContext);
|
|
2554
2588
|
(0, import_react13.useEffect)(() => {
|
|
2555
2589
|
onInProgress == null ? void 0 : onInProgress(isLoading);
|
|
@@ -2617,7 +2651,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2617
2651
|
});
|
|
2618
2652
|
const runCurrentAgent = (hint) => __async(void 0, null, function* () {
|
|
2619
2653
|
if (generalContext.agentSession) {
|
|
2620
|
-
yield (0,
|
|
2654
|
+
yield (0, import_react_core11.runAgent)(
|
|
2621
2655
|
generalContext.agentSession.agentName,
|
|
2622
2656
|
context,
|
|
2623
2657
|
appendMessage,
|
|
@@ -2628,7 +2662,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2628
2662
|
});
|
|
2629
2663
|
const stopCurrentAgent = () => {
|
|
2630
2664
|
if (generalContext.agentSession) {
|
|
2631
|
-
(0,
|
|
2665
|
+
(0, import_react_core11.stopAgent)(generalContext.agentSession.agentName, context);
|
|
2632
2666
|
}
|
|
2633
2667
|
};
|
|
2634
2668
|
const setCurrentAgentState = (state) => {
|