@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
package/dist/index.js
CHANGED
|
@@ -393,6 +393,16 @@ var ChatContextProvider = ({
|
|
|
393
393
|
|
|
394
394
|
// src/components/chat/Window.tsx
|
|
395
395
|
var import_react2 = __toESM(require("react"));
|
|
396
|
+
var import_react_core = require("@copilotkit/react-core");
|
|
397
|
+
|
|
398
|
+
// src/hooks/use-dark-mode.ts
|
|
399
|
+
var useDarkMode = () => {
|
|
400
|
+
if (typeof window === "undefined")
|
|
401
|
+
return false;
|
|
402
|
+
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;
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
// src/components/chat/Window.tsx
|
|
396
406
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
397
407
|
var Window = ({
|
|
398
408
|
children,
|
|
@@ -400,15 +410,17 @@ var Window = ({
|
|
|
400
410
|
shortcut,
|
|
401
411
|
hitEscapeToClose
|
|
402
412
|
}) => {
|
|
413
|
+
var _a;
|
|
403
414
|
const windowRef = import_react2.default.useRef(null);
|
|
415
|
+
const context = (0, import_react_core.useCopilotContext)();
|
|
404
416
|
const { open, setOpen } = useChatContext();
|
|
405
417
|
const handleClickOutside = (0, import_react2.useCallback)(
|
|
406
418
|
(event) => {
|
|
407
|
-
var
|
|
419
|
+
var _a2;
|
|
408
420
|
if (!clickOutsideToClose) {
|
|
409
421
|
return;
|
|
410
422
|
}
|
|
411
|
-
const parentElement = (
|
|
423
|
+
const parentElement = (_a2 = windowRef.current) == null ? void 0 : _a2.parentElement;
|
|
412
424
|
let className = "";
|
|
413
425
|
if (event.target instanceof HTMLElement) {
|
|
414
426
|
className = event.target.className;
|
|
@@ -422,10 +434,10 @@ var Window = ({
|
|
|
422
434
|
);
|
|
423
435
|
const handleKeyDown = (0, import_react2.useCallback)(
|
|
424
436
|
(event) => {
|
|
425
|
-
var
|
|
437
|
+
var _a2;
|
|
426
438
|
const target = event.target;
|
|
427
439
|
const isInput = target.tagName === "INPUT" || target.tagName === "SELECT" || target.tagName === "TEXTAREA" || target.isContentEditable;
|
|
428
|
-
const isDescendantOfWrapper = (
|
|
440
|
+
const isDescendantOfWrapper = (_a2 = windowRef.current) == null ? void 0 : _a2.contains(target);
|
|
429
441
|
if (open && event.key === "Escape" && (!isInput || isDescendantOfWrapper) && hitEscapeToClose) {
|
|
430
442
|
setOpen(false);
|
|
431
443
|
} else if (event.key === shortcut && (isMacOS() && event.metaKey || !isMacOS() && event.ctrlKey) && (!isInput || isDescendantOfWrapper)) {
|
|
@@ -480,7 +492,29 @@ var Window = ({
|
|
|
480
492
|
}
|
|
481
493
|
};
|
|
482
494
|
}, [adjustForMobile, handleClickOutside, handleKeyDown]);
|
|
483
|
-
|
|
495
|
+
const isDark = useDarkMode();
|
|
496
|
+
const showPoweredBy = !((_a = context.copilotApiConfig) == null ? void 0 : _a.publicApiKey);
|
|
497
|
+
const poweredByStyle = {
|
|
498
|
+
visibility: "visible",
|
|
499
|
+
display: "block",
|
|
500
|
+
position: "static",
|
|
501
|
+
textAlign: "center",
|
|
502
|
+
fontSize: "12px",
|
|
503
|
+
padding: "3px 0",
|
|
504
|
+
color: isDark ? "rgb(69, 69, 69)" : "rgb(214, 214, 214)"
|
|
505
|
+
};
|
|
506
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
507
|
+
"div",
|
|
508
|
+
{
|
|
509
|
+
className: `copilotKitWindow ${showPoweredBy ? " poweredByContainer" : ""} ${open ? " open" : ""}`,
|
|
510
|
+
ref: windowRef,
|
|
511
|
+
children: [
|
|
512
|
+
children,
|
|
513
|
+
showPoweredBy && // @ts-expect-error -- expecting position not to be a string, but it can be.
|
|
514
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "poweredBy", style: poweredByStyle, children: "Powered by CopilotKit" })
|
|
515
|
+
]
|
|
516
|
+
}
|
|
517
|
+
);
|
|
484
518
|
};
|
|
485
519
|
var preventScroll = (event) => {
|
|
486
520
|
let targetElement = event.target;
|
|
@@ -519,7 +553,7 @@ var Button = ({}) => {
|
|
|
519
553
|
};
|
|
520
554
|
|
|
521
555
|
// src/components/dev-console/utils.ts
|
|
522
|
-
var
|
|
556
|
+
var import_react_core2 = require("@copilotkit/react-core");
|
|
523
557
|
function shouldShowDevConsole(showDevConsole) {
|
|
524
558
|
if (typeof showDevConsole === "boolean") {
|
|
525
559
|
return showDevConsole;
|
|
@@ -581,7 +615,7 @@ function getPublishedCopilotKitVersion(current, forceCheck = false) {
|
|
|
581
615
|
}
|
|
582
616
|
function logReadables(context) {
|
|
583
617
|
console.log("%cCurrent Readables:", "font-size: 16px; font-weight: bold;");
|
|
584
|
-
const readables = context.getContextString([],
|
|
618
|
+
const readables = context.getContextString([], import_react_core2.defaultCopilotContextCategories).trim();
|
|
585
619
|
if (readables.length === 0) {
|
|
586
620
|
console.log("No readables found");
|
|
587
621
|
return;
|
|
@@ -651,7 +685,7 @@ function logMessages(context) {
|
|
|
651
685
|
}
|
|
652
686
|
|
|
653
687
|
// src/components/dev-console/console.tsx
|
|
654
|
-
var
|
|
688
|
+
var import_react_core3 = require("@copilotkit/react-core");
|
|
655
689
|
var import_react4 = require("react");
|
|
656
690
|
|
|
657
691
|
// src/components/dev-console/icons.tsx
|
|
@@ -841,7 +875,7 @@ function CopilotKitHelpModal() {
|
|
|
841
875
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
842
876
|
function CopilotDevConsole() {
|
|
843
877
|
const currentVersion = import_shared.COPILOTKIT_VERSION;
|
|
844
|
-
const context = (0,
|
|
878
|
+
const context = (0, import_react_core3.useCopilotContext)();
|
|
845
879
|
const [showDevConsole, setShowDevConsole] = (0, import_react4.useState)(false);
|
|
846
880
|
(0, import_react4.useEffect)(() => {
|
|
847
881
|
setShowDevConsole(shouldShowDevConsole(context.showDevConsole));
|
|
@@ -972,8 +1006,8 @@ function DebugMenuButton({
|
|
|
972
1006
|
checkForUpdates,
|
|
973
1007
|
mode
|
|
974
1008
|
}) {
|
|
975
|
-
const context = (0,
|
|
976
|
-
const messagesContext = (0,
|
|
1009
|
+
const context = (0, import_react_core3.useCopilotContext)();
|
|
1010
|
+
const messagesContext = (0, import_react_core3.useCopilotMessagesContext)();
|
|
977
1011
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react5.Menu, { children: [
|
|
978
1012
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
979
1013
|
import_react5.MenuButton,
|
|
@@ -1036,7 +1070,7 @@ var Header = ({}) => {
|
|
|
1036
1070
|
// src/components/chat/Messages.tsx
|
|
1037
1071
|
var import_react6 = require("react");
|
|
1038
1072
|
var import_runtime_client_gql = require("@copilotkit/runtime-client-gql");
|
|
1039
|
-
var
|
|
1073
|
+
var import_react_core4 = require("@copilotkit/react-core");
|
|
1040
1074
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1041
1075
|
var Messages = ({
|
|
1042
1076
|
messages,
|
|
@@ -1072,7 +1106,7 @@ var Messages = ({
|
|
|
1072
1106
|
}
|
|
1073
1107
|
}
|
|
1074
1108
|
const { messagesEndRef, messagesContainerRef } = useScrollToBottom(messages);
|
|
1075
|
-
const interrupt = (0,
|
|
1109
|
+
const interrupt = (0, import_react_core4.useLangGraphInterruptRender)();
|
|
1076
1110
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "copilotKitMessages", ref: messagesContainerRef, children: [
|
|
1077
1111
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "copilotKitMessagesContainer", children: [
|
|
1078
1112
|
messages.map((message, index) => {
|
|
@@ -1270,7 +1304,7 @@ var AutoResizingTextarea = (0, import_react7.forwardRef)(
|
|
|
1270
1304
|
var Textarea_default = AutoResizingTextarea;
|
|
1271
1305
|
|
|
1272
1306
|
// src/hooks/use-push-to-talk.tsx
|
|
1273
|
-
var
|
|
1307
|
+
var import_react_core5 = require("@copilotkit/react-core");
|
|
1274
1308
|
var import_react8 = require("react");
|
|
1275
1309
|
var startRecording = (mediaStreamRef, mediaRecorderRef, audioContextRef, recordedChunks, onStop) => __async(void 0, null, function* () {
|
|
1276
1310
|
if (!mediaStreamRef.current || !audioContextRef.current) {
|
|
@@ -1325,8 +1359,8 @@ var usePushToTalk = ({
|
|
|
1325
1359
|
const audioContextRef = (0, import_react8.useRef)(null);
|
|
1326
1360
|
const mediaRecorderRef = (0, import_react8.useRef)(null);
|
|
1327
1361
|
const recordedChunks = (0, import_react8.useRef)([]);
|
|
1328
|
-
const generalContext = (0,
|
|
1329
|
-
const messagesContext = (0,
|
|
1362
|
+
const generalContext = (0, import_react_core5.useCopilotContext)();
|
|
1363
|
+
const messagesContext = (0, import_react_core5.useCopilotMessagesContext)();
|
|
1330
1364
|
const context = __spreadValues(__spreadValues({}, generalContext), messagesContext);
|
|
1331
1365
|
const [startReadingFromMessageId, setStartReadingFromMessageId] = (0, import_react8.useState)(null);
|
|
1332
1366
|
(0, import_react8.useEffect)(() => {
|
|
@@ -1374,11 +1408,11 @@ var usePushToTalk = ({
|
|
|
1374
1408
|
};
|
|
1375
1409
|
|
|
1376
1410
|
// src/components/chat/Input.tsx
|
|
1377
|
-
var
|
|
1411
|
+
var import_react_core6 = require("@copilotkit/react-core");
|
|
1378
1412
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1379
1413
|
var Input = ({ inProgress, onSend, isVisible = false, onStop }) => {
|
|
1380
1414
|
const context = useChatContext();
|
|
1381
|
-
const copilotContext = (0,
|
|
1415
|
+
const copilotContext = (0, import_react_core6.useCopilotContext)();
|
|
1382
1416
|
const pushToTalkConfigured = copilotContext.copilotApiConfig.textToSpeechUrl !== void 0 && copilotContext.copilotApiConfig.transcribeAudioUrl !== void 0;
|
|
1383
1417
|
const textareaRef = (0, import_react9.useRef)(null);
|
|
1384
1418
|
const handleDivClick = (event) => {
|
|
@@ -2084,7 +2118,7 @@ function RenderTextMessage(_a) {
|
|
|
2084
2118
|
|
|
2085
2119
|
// src/components/chat/messages/RenderActionExecutionMessage.tsx
|
|
2086
2120
|
var import_runtime_client_gql2 = require("@copilotkit/runtime-client-gql");
|
|
2087
|
-
var
|
|
2121
|
+
var import_react_core7 = require("@copilotkit/react-core");
|
|
2088
2122
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2089
2123
|
function RenderActionExecutionMessage(_a) {
|
|
2090
2124
|
var _b = _a, {
|
|
@@ -2092,7 +2126,7 @@ function RenderActionExecutionMessage(_a) {
|
|
|
2092
2126
|
} = _b, props = __objRest(_b, [
|
|
2093
2127
|
"AssistantMessage"
|
|
2094
2128
|
]);
|
|
2095
|
-
const { chatComponentsCache } = (0,
|
|
2129
|
+
const { chatComponentsCache } = (0, import_react_core7.useCopilotContext)();
|
|
2096
2130
|
const { message, inProgress, index, isCurrentMessage, actionResult } = props;
|
|
2097
2131
|
if (message.isActionExecutionMessage()) {
|
|
2098
2132
|
if (chatComponentsCache.current !== null && (chatComponentsCache.current.actions[message.name] || chatComponentsCache.current.actions["*"])) {
|
|
@@ -2221,7 +2255,7 @@ function RenderResultMessage(_a) {
|
|
|
2221
2255
|
}
|
|
2222
2256
|
|
|
2223
2257
|
// src/components/chat/messages/RenderAgentStateMessage.tsx
|
|
2224
|
-
var
|
|
2258
|
+
var import_react_core8 = require("@copilotkit/react-core");
|
|
2225
2259
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2226
2260
|
function RenderAgentStateMessage(_a) {
|
|
2227
2261
|
var _b = _a, {
|
|
@@ -2229,7 +2263,7 @@ function RenderAgentStateMessage(_a) {
|
|
|
2229
2263
|
} = _b, props = __objRest(_b, [
|
|
2230
2264
|
"AssistantMessage"
|
|
2231
2265
|
]);
|
|
2232
|
-
const { chatComponentsCache } = (0,
|
|
2266
|
+
const { chatComponentsCache } = (0, import_react_core8.useCopilotContext)();
|
|
2233
2267
|
const { message, inProgress, index, isCurrentMessage } = props;
|
|
2234
2268
|
if (message.isAgentStateMessage()) {
|
|
2235
2269
|
let render;
|
|
@@ -2322,7 +2356,7 @@ function RenderAgentStateMessage(_a) {
|
|
|
2322
2356
|
}
|
|
2323
2357
|
|
|
2324
2358
|
// src/components/chat/Suggestion.tsx
|
|
2325
|
-
var
|
|
2359
|
+
var import_react_core9 = require("@copilotkit/react-core");
|
|
2326
2360
|
var import_shared2 = require("@copilotkit/shared");
|
|
2327
2361
|
var import_runtime_client_gql3 = require("@copilotkit/runtime-client-gql");
|
|
2328
2362
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
@@ -2354,7 +2388,7 @@ var reloadSuggestions = (context, chatSuggestionConfiguration, setCurrentSuggest
|
|
|
2354
2388
|
for (const config of Object.values(chatSuggestionConfiguration)) {
|
|
2355
2389
|
try {
|
|
2356
2390
|
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.`;
|
|
2357
|
-
const result = yield (0,
|
|
2391
|
+
const result = yield (0, import_react_core9.extract)({
|
|
2358
2392
|
context,
|
|
2359
2393
|
instructions: "Suggest what the user could say next. Provide clear, highly relevant suggestions. Do not literally suggest function calls. ",
|
|
2360
2394
|
data: config.instructions + "\n\n" + numOfSuggestionsInstructions + "\n\nAvailable tools: " + tools + "\n\n",
|
|
@@ -2413,10 +2447,10 @@ var reloadSuggestions = (context, chatSuggestionConfiguration, setCurrentSuggest
|
|
|
2413
2447
|
|
|
2414
2448
|
// src/components/chat/Chat.tsx
|
|
2415
2449
|
var import_react13 = __toESM(require("react"));
|
|
2416
|
-
var
|
|
2450
|
+
var import_react_core10 = require("@copilotkit/react-core");
|
|
2417
2451
|
var import_runtime_client_gql4 = require("@copilotkit/runtime-client-gql");
|
|
2418
2452
|
var import_shared3 = require("@copilotkit/shared");
|
|
2419
|
-
var
|
|
2453
|
+
var import_react_core11 = require("@copilotkit/react-core");
|
|
2420
2454
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2421
2455
|
function CopilotChat({
|
|
2422
2456
|
instructions,
|
|
@@ -2441,7 +2475,7 @@ function CopilotChat({
|
|
|
2441
2475
|
AssistantMessage: AssistantMessage2 = AssistantMessage,
|
|
2442
2476
|
UserMessage: UserMessage2 = UserMessage
|
|
2443
2477
|
}) {
|
|
2444
|
-
const { additionalInstructions, setChatInstructions } = (0,
|
|
2478
|
+
const { additionalInstructions, setChatInstructions } = (0, import_react_core10.useCopilotContext)();
|
|
2445
2479
|
(0, import_react13.useEffect)(() => {
|
|
2446
2480
|
if (!(additionalInstructions == null ? void 0 : additionalInstructions.length)) {
|
|
2447
2481
|
setChatInstructions(instructions || "");
|
|
@@ -2545,7 +2579,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2545
2579
|
stopGeneration: defaultStopGeneration,
|
|
2546
2580
|
runChatCompletion,
|
|
2547
2581
|
isLoading
|
|
2548
|
-
} = (0,
|
|
2582
|
+
} = (0, import_react_core10.useCopilotChat)({
|
|
2549
2583
|
id: (0, import_shared3.randomId)(),
|
|
2550
2584
|
makeSystemMessage
|
|
2551
2585
|
});
|
|
@@ -2557,8 +2591,8 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2557
2591
|
(_a2 = suggestionsAbortControllerRef.current) == null ? void 0 : _a2.abort();
|
|
2558
2592
|
suggestionsAbortControllerRef.current = null;
|
|
2559
2593
|
};
|
|
2560
|
-
const generalContext = (0,
|
|
2561
|
-
const messagesContext = (0,
|
|
2594
|
+
const generalContext = (0, import_react_core10.useCopilotContext)();
|
|
2595
|
+
const messagesContext = (0, import_react_core10.useCopilotMessagesContext)();
|
|
2562
2596
|
const context = __spreadValues(__spreadValues({}, generalContext), messagesContext);
|
|
2563
2597
|
(0, import_react13.useEffect)(() => {
|
|
2564
2598
|
onInProgress == null ? void 0 : onInProgress(isLoading);
|
|
@@ -2626,7 +2660,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2626
2660
|
});
|
|
2627
2661
|
const runCurrentAgent = (hint) => __async(void 0, null, function* () {
|
|
2628
2662
|
if (generalContext.agentSession) {
|
|
2629
|
-
yield (0,
|
|
2663
|
+
yield (0, import_react_core11.runAgent)(
|
|
2630
2664
|
generalContext.agentSession.agentName,
|
|
2631
2665
|
context,
|
|
2632
2666
|
appendMessage,
|
|
@@ -2637,7 +2671,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2637
2671
|
});
|
|
2638
2672
|
const stopCurrentAgent = () => {
|
|
2639
2673
|
if (generalContext.agentSession) {
|
|
2640
|
-
(0,
|
|
2674
|
+
(0, import_react_core11.stopAgent)(generalContext.agentSession.agentName, context);
|
|
2641
2675
|
}
|
|
2642
2676
|
};
|
|
2643
2677
|
const setCurrentAgentState = (state) => {
|
|
@@ -2796,7 +2830,7 @@ function CopilotSidebar(props) {
|
|
|
2796
2830
|
|
|
2797
2831
|
// src/hooks/use-copilot-chat-suggestions.tsx
|
|
2798
2832
|
var import_react16 = require("react");
|
|
2799
|
-
var
|
|
2833
|
+
var import_react_core12 = require("@copilotkit/react-core");
|
|
2800
2834
|
var import_shared4 = require("@copilotkit/shared");
|
|
2801
2835
|
function useCopilotChatSuggestions({
|
|
2802
2836
|
available = "enabled",
|
|
@@ -2805,7 +2839,7 @@ function useCopilotChatSuggestions({
|
|
|
2805
2839
|
minSuggestions = 1,
|
|
2806
2840
|
maxSuggestions = 3
|
|
2807
2841
|
}, dependencies = []) {
|
|
2808
|
-
const context = (0,
|
|
2842
|
+
const context = (0, import_react_core12.useCopilotContext)();
|
|
2809
2843
|
(0, import_react16.useEffect)(() => {
|
|
2810
2844
|
if (available === "disabled")
|
|
2811
2845
|
return;
|