@copilotkit/react-ui 1.4.8-no-pino-redact.1 → 1.5.0-coagents-v0-3.0
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 +37 -4
- package/dist/{chunk-FUDBUYBG.mjs → chunk-375NVWZM.mjs} +2 -2
- package/dist/{chunk-OMTPWC7T.mjs → chunk-3E7HY2UN.mjs} +5 -4
- package/dist/chunk-3E7HY2UN.mjs.map +1 -0
- package/dist/{chunk-RKPANT3F.mjs → chunk-7II4YL7R.mjs} +2 -6
- package/dist/chunk-7II4YL7R.mjs.map +1 -0
- package/dist/{chunk-T35X2SFE.mjs → chunk-DCNCY2PL.mjs} +113 -10
- package/dist/chunk-DCNCY2PL.mjs.map +1 -0
- package/dist/{chunk-TTYR7XPN.mjs → chunk-F2W5FD7L.mjs} +3 -3
- package/dist/{chunk-4FIGRRFS.mjs → chunk-PNQVKBPN.mjs} +2 -2
- package/dist/{chunk-4FIGRRFS.mjs.map → chunk-PNQVKBPN.mjs.map} +1 -1
- package/dist/{chunk-ICGZEGHQ.mjs → chunk-TI7SY2RI.mjs} +13 -4
- package/dist/chunk-TI7SY2RI.mjs.map +1 -0
- package/dist/{chunk-E5SSVET3.mjs → chunk-UWVGLGFQ.mjs} +7 -3
- package/dist/chunk-UWVGLGFQ.mjs.map +1 -0
- package/dist/{chunk-ZQFKJLQ6.mjs → chunk-WSMMTZCM.mjs} +2 -2
- package/dist/components/chat/Chat.d.ts +50 -5
- package/dist/components/chat/Chat.js +127 -38
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +6 -6
- package/dist/components/chat/Messages.d.ts +3 -3
- package/dist/components/chat/Messages.js.map +1 -1
- package/dist/components/chat/Messages.mjs +1 -1
- package/dist/components/chat/Modal.d.ts +1 -1
- package/dist/components/chat/Modal.js +131 -38
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +7 -7
- package/dist/components/chat/Popup.js +131 -38
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +8 -8
- package/dist/components/chat/Sidebar.js +131 -38
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +8 -8
- package/dist/components/chat/index.js +131 -38
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +9 -9
- package/dist/components/chat/messages/RenderActionExecutionMessage.js +4 -3
- package/dist/components/chat/messages/RenderActionExecutionMessage.js.map +1 -1
- package/dist/components/chat/messages/RenderActionExecutionMessage.mjs +1 -1
- package/dist/components/dev-console/console.js +13 -27
- package/dist/components/dev-console/console.js.map +1 -1
- package/dist/components/dev-console/console.mjs +3 -3
- package/dist/components/dev-console/index.js +13 -27
- package/dist/components/dev-console/index.js.map +1 -1
- package/dist/components/dev-console/index.mjs +3 -3
- package/dist/components/dev-console/utils.js +1 -1
- package/dist/components/dev-console/utils.js.map +1 -1
- package/dist/components/dev-console/utils.mjs +1 -1
- package/dist/components/help-modal/index.js +12 -26
- package/dist/components/help-modal/index.js.map +1 -1
- package/dist/components/help-modal/index.mjs +1 -1
- package/dist/components/help-modal/modal.js +12 -26
- package/dist/components/help-modal/modal.js.map +1 -1
- package/dist/components/help-modal/modal.mjs +1 -1
- package/dist/components/index.js +131 -38
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +9 -9
- package/dist/index.js +133 -40
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -9
- package/package.json +4 -4
- package/src/components/chat/Chat.tsx +173 -7
- package/src/components/chat/Messages.tsx +2 -9
- package/src/components/chat/Modal.tsx +4 -0
- package/src/components/chat/messages/RenderActionExecutionMessage.tsx +10 -3
- package/src/components/dev-console/utils.ts +1 -1
- package/src/components/help-modal/modal.tsx +12 -2
- package/dist/chunk-E5SSVET3.mjs.map +0 -1
- package/dist/chunk-ICGZEGHQ.mjs.map +0 -1
- package/dist/chunk-OMTPWC7T.mjs.map +0 -1
- package/dist/chunk-RKPANT3F.mjs.map +0 -1
- package/dist/chunk-T35X2SFE.mjs.map +0 -1
- /package/dist/{chunk-FUDBUYBG.mjs.map → chunk-375NVWZM.mjs.map} +0 -0
- /package/dist/{chunk-TTYR7XPN.mjs.map → chunk-F2W5FD7L.mjs.map} +0 -0
- /package/dist/{chunk-ZQFKJLQ6.mjs.map → chunk-WSMMTZCM.mjs.map} +0 -0
|
@@ -2,38 +2,38 @@ import "../chunk-MMVDU6DF.mjs";
|
|
|
2
2
|
import "../chunk-MRFF7GSQ.mjs";
|
|
3
3
|
import {
|
|
4
4
|
CopilotSidebar
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-WSMMTZCM.mjs";
|
|
6
6
|
import "../chunk-WB3YULQ4.mjs";
|
|
7
7
|
import {
|
|
8
8
|
CopilotPopup
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import "../chunk-
|
|
9
|
+
} from "../chunk-375NVWZM.mjs";
|
|
10
|
+
import "../chunk-UWVGLGFQ.mjs";
|
|
11
11
|
import "../chunk-YAGE7RCE.mjs";
|
|
12
12
|
import "../chunk-VEC45H6Q.mjs";
|
|
13
13
|
import "../chunk-RQNJNK2W.mjs";
|
|
14
14
|
import {
|
|
15
15
|
CopilotChat
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-DCNCY2PL.mjs";
|
|
17
17
|
import "../chunk-6INMITFA.mjs";
|
|
18
18
|
import "../chunk-RU73BEZM.mjs";
|
|
19
19
|
import "../chunk-V7W6IM2V.mjs";
|
|
20
|
-
import "../chunk-
|
|
20
|
+
import "../chunk-3E7HY2UN.mjs";
|
|
21
21
|
import "../chunk-ZABXREBH.mjs";
|
|
22
22
|
import "../chunk-RJCZRKTV.mjs";
|
|
23
23
|
import {
|
|
24
24
|
CopilotDevConsole
|
|
25
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-F2W5FD7L.mjs";
|
|
26
26
|
import {
|
|
27
27
|
shouldShowDevConsole
|
|
28
|
-
} from "../chunk-
|
|
28
|
+
} from "../chunk-PNQVKBPN.mjs";
|
|
29
29
|
import "../chunk-KXE2JCUH.mjs";
|
|
30
|
-
import "../chunk-
|
|
30
|
+
import "../chunk-TI7SY2RI.mjs";
|
|
31
31
|
import "../chunk-BH6PCAAL.mjs";
|
|
32
32
|
import "../chunk-OTPAZXVR.mjs";
|
|
33
33
|
import "../chunk-EMQEEXUB.mjs";
|
|
34
34
|
import "../chunk-YQFVRDNC.mjs";
|
|
35
35
|
import "../chunk-YQ3D5IQV.mjs";
|
|
36
|
-
import "../chunk-
|
|
36
|
+
import "../chunk-7II4YL7R.mjs";
|
|
37
37
|
import "../chunk-3XAXY2Z3.mjs";
|
|
38
38
|
import {
|
|
39
39
|
useChatContext
|
package/dist/index.js
CHANGED
|
@@ -950,9 +950,9 @@ var import_react7 = require("react");
|
|
|
950
950
|
var import_react_syntax_highlighter = require("react-syntax-highlighter");
|
|
951
951
|
|
|
952
952
|
// src/hooks/use-copy-to-clipboard.tsx
|
|
953
|
-
var
|
|
953
|
+
var React5 = __toESM(require("react"));
|
|
954
954
|
function useCopyToClipboard({ timeout = 2e3 }) {
|
|
955
|
-
const [isCopied, setIsCopied] =
|
|
955
|
+
const [isCopied, setIsCopied] = React5.useState(false);
|
|
956
956
|
const copyToClipboard = (value) => {
|
|
957
957
|
var _a;
|
|
958
958
|
if (typeof window === "undefined" || !((_a = navigator.clipboard) == null ? void 0 : _a.writeText)) {
|
|
@@ -1448,8 +1448,8 @@ function RenderActionExecutionMessage(props) {
|
|
|
1448
1448
|
const { chatComponentsCache } = (0, import_react_core3.useCopilotContext)();
|
|
1449
1449
|
const { icons } = useChatContext();
|
|
1450
1450
|
if (message.isActionExecutionMessage()) {
|
|
1451
|
-
if (chatComponentsCache.current !== null && chatComponentsCache.current.actions[message.name]) {
|
|
1452
|
-
const render = chatComponentsCache.current.actions[message.name];
|
|
1451
|
+
if (chatComponentsCache.current !== null && (chatComponentsCache.current.actions[message.name] || chatComponentsCache.current.actions["*"])) {
|
|
1452
|
+
const render = chatComponentsCache.current.actions[message.name] || chatComponentsCache.current.actions["*"];
|
|
1453
1453
|
if (typeof render === "string") {
|
|
1454
1454
|
if (isCurrentMessage && inProgress) {
|
|
1455
1455
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: [
|
|
@@ -1472,7 +1472,8 @@ function RenderActionExecutionMessage(props) {
|
|
|
1472
1472
|
const toRender = render({
|
|
1473
1473
|
status,
|
|
1474
1474
|
args,
|
|
1475
|
-
result: actionResult
|
|
1475
|
+
result: actionResult,
|
|
1476
|
+
name: message.name
|
|
1476
1477
|
});
|
|
1477
1478
|
if (!toRender && status === "complete") {
|
|
1478
1479
|
return null;
|
|
@@ -1786,7 +1787,7 @@ function logMessages(context) {
|
|
|
1786
1787
|
type: "ActionExecutionMessage",
|
|
1787
1788
|
role: void 0,
|
|
1788
1789
|
name: message.name,
|
|
1789
|
-
scope: message.
|
|
1790
|
+
scope: message.parentMessageId,
|
|
1790
1791
|
content: message.arguments
|
|
1791
1792
|
};
|
|
1792
1793
|
} else if (message.isResultMessage()) {
|
|
@@ -1909,30 +1910,6 @@ var import_react9 = require("react");
|
|
|
1909
1910
|
|
|
1910
1911
|
// src/components/help-modal/icons.tsx
|
|
1911
1912
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1912
|
-
var LifeBuoyIcon = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1913
|
-
"svg",
|
|
1914
|
-
{
|
|
1915
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1916
|
-
width: "24",
|
|
1917
|
-
height: "24",
|
|
1918
|
-
viewBox: "0 0 24 24",
|
|
1919
|
-
fill: "none",
|
|
1920
|
-
stroke: "currentColor",
|
|
1921
|
-
strokeWidth: "2",
|
|
1922
|
-
strokeLinecap: "round",
|
|
1923
|
-
strokeLinejoin: "round",
|
|
1924
|
-
className: "icon icon-tabler icons-tabler-outline icon-tabler-lifebuoy",
|
|
1925
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("g", { transform: "translate(0, -1)", children: [
|
|
1926
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
1927
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M12 12m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0" }),
|
|
1928
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" }),
|
|
1929
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M15 15l3.35 3.35" }),
|
|
1930
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M9 15l-3.35 3.35" }),
|
|
1931
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M5.65 5.65l3.35 3.35" }),
|
|
1932
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M18.35 5.65l-3.35 3.35" })
|
|
1933
|
-
] })
|
|
1934
|
-
}
|
|
1935
|
-
);
|
|
1936
1913
|
var CloseIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1937
1914
|
"svg",
|
|
1938
1915
|
{
|
|
@@ -2023,9 +2000,10 @@ function CopilotKitHelpModal() {
|
|
|
2023
2000
|
"button",
|
|
2024
2001
|
{
|
|
2025
2002
|
onClick: () => setShowHelpModal(true),
|
|
2026
|
-
|
|
2003
|
+
style: { width: "50px", height: "30px", marginRight: "0.25rem" },
|
|
2004
|
+
className: "text-sm p-0 bg-transparent rounded border border-blue-500",
|
|
2027
2005
|
"aria-label": "Open Help",
|
|
2028
|
-
children:
|
|
2006
|
+
children: "Help"
|
|
2029
2007
|
}
|
|
2030
2008
|
);
|
|
2031
2009
|
const submitButtonDisabled = (0, import_react9.useMemo)(
|
|
@@ -2052,6 +2030,15 @@ function CopilotKitHelpModal() {
|
|
|
2052
2030
|
),
|
|
2053
2031
|
/* @__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" }) }),
|
|
2054
2032
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-4 mb-4", children: [
|
|
2033
|
+
/* @__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)(
|
|
2034
|
+
"a",
|
|
2035
|
+
{
|
|
2036
|
+
href: "https://docs.copilotkit.ai/coagents/troubleshooting/common-issues",
|
|
2037
|
+
target: "_blank",
|
|
2038
|
+
rel: "noopener noreferrer",
|
|
2039
|
+
children: "Visit the Troubleshooting and FAQ section in the docs"
|
|
2040
|
+
}
|
|
2041
|
+
) }),
|
|
2055
2042
|
/* @__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)(
|
|
2056
2043
|
"a",
|
|
2057
2044
|
{
|
|
@@ -2326,6 +2313,7 @@ function DebugMenuButton({
|
|
|
2326
2313
|
}
|
|
2327
2314
|
|
|
2328
2315
|
// src/components/chat/Chat.tsx
|
|
2316
|
+
var import_react_core9 = require("@copilotkit/react-core");
|
|
2329
2317
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2330
2318
|
function CopilotChat({
|
|
2331
2319
|
instructions,
|
|
@@ -2333,6 +2321,8 @@ function CopilotChat({
|
|
|
2333
2321
|
makeSystemMessage,
|
|
2334
2322
|
showResponseButton = true,
|
|
2335
2323
|
onInProgress,
|
|
2324
|
+
onStopGeneration,
|
|
2325
|
+
onReloadMessages,
|
|
2336
2326
|
Messages: Messages2 = Messages,
|
|
2337
2327
|
RenderTextMessage: RenderTextMessage2 = RenderTextMessage,
|
|
2338
2328
|
RenderActionExecutionMessage: RenderActionExecutionMessage2 = RenderActionExecutionMessage,
|
|
@@ -2355,7 +2345,13 @@ function CopilotChat({
|
|
|
2355
2345
|
sendMessage,
|
|
2356
2346
|
stopGeneration,
|
|
2357
2347
|
reloadMessages
|
|
2358
|
-
} = useCopilotChatLogic(
|
|
2348
|
+
} = useCopilotChatLogic(
|
|
2349
|
+
makeSystemMessage,
|
|
2350
|
+
onInProgress,
|
|
2351
|
+
onSubmitMessage,
|
|
2352
|
+
onStopGeneration,
|
|
2353
|
+
onReloadMessages
|
|
2354
|
+
);
|
|
2359
2355
|
const chatContext = import_react12.default.useContext(ChatContext);
|
|
2360
2356
|
const isVisible = chatContext ? chatContext.open : true;
|
|
2361
2357
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
|
|
@@ -2411,8 +2407,16 @@ function WrappedCopilotChat({
|
|
|
2411
2407
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children });
|
|
2412
2408
|
}
|
|
2413
2409
|
var SUGGESTIONS_DEBOUNCE_TIMEOUT = 1e3;
|
|
2414
|
-
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) => {
|
|
2415
|
-
|
|
2410
|
+
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onStopGeneration, onReloadMessages) => {
|
|
2411
|
+
var _a;
|
|
2412
|
+
const {
|
|
2413
|
+
visibleMessages,
|
|
2414
|
+
appendMessage,
|
|
2415
|
+
reloadMessages: defaultReloadMessages,
|
|
2416
|
+
stopGeneration: defaultStopGeneration,
|
|
2417
|
+
runChatCompletion,
|
|
2418
|
+
isLoading
|
|
2419
|
+
} = (0, import_react_core8.useCopilotChat)({
|
|
2416
2420
|
id: (0, import_shared3.randomId)(),
|
|
2417
2421
|
makeSystemMessage
|
|
2418
2422
|
});
|
|
@@ -2420,8 +2424,8 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
2420
2424
|
const suggestionsAbortControllerRef = (0, import_react12.useRef)(null);
|
|
2421
2425
|
const debounceTimerRef = (0, import_react12.useRef)();
|
|
2422
2426
|
const abortSuggestions = () => {
|
|
2423
|
-
var
|
|
2424
|
-
(
|
|
2427
|
+
var _a2;
|
|
2428
|
+
(_a2 = suggestionsAbortControllerRef.current) == null ? void 0 : _a2.abort();
|
|
2425
2429
|
suggestionsAbortControllerRef.current = null;
|
|
2426
2430
|
};
|
|
2427
2431
|
const generalContext = (0, import_react_core8.useCopilotContext)();
|
|
@@ -2447,7 +2451,13 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
2447
2451
|
return () => {
|
|
2448
2452
|
clearTimeout(debounceTimerRef.current);
|
|
2449
2453
|
};
|
|
2450
|
-
}, [
|
|
2454
|
+
}, [
|
|
2455
|
+
isLoading,
|
|
2456
|
+
context.chatSuggestionConfiguration,
|
|
2457
|
+
// hackish way to trigger suggestions reload on reset, but better than moving suggestions to the
|
|
2458
|
+
// global context
|
|
2459
|
+
visibleMessages.length == 0
|
|
2460
|
+
]);
|
|
2451
2461
|
const sendMessage = (messageContent) => __async(void 0, null, function* () {
|
|
2452
2462
|
abortSuggestions();
|
|
2453
2463
|
setCurrentSuggestions([]);
|
|
@@ -2465,6 +2475,85 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
2465
2475
|
appendMessage(message);
|
|
2466
2476
|
return message;
|
|
2467
2477
|
});
|
|
2478
|
+
const messages = visibleMessages;
|
|
2479
|
+
const { setMessages } = messagesContext;
|
|
2480
|
+
const currentAgentName = (_a = generalContext.agentSession) == null ? void 0 : _a.agentName;
|
|
2481
|
+
const restartCurrentAgent = (hint) => __async(void 0, null, function* () {
|
|
2482
|
+
if (generalContext.agentSession) {
|
|
2483
|
+
generalContext.setAgentSession(__spreadProps(__spreadValues({}, generalContext.agentSession), {
|
|
2484
|
+
nodeName: void 0,
|
|
2485
|
+
threadId: void 0
|
|
2486
|
+
}));
|
|
2487
|
+
generalContext.setCoagentStates((prevAgentStates) => {
|
|
2488
|
+
return __spreadProps(__spreadValues({}, prevAgentStates), {
|
|
2489
|
+
[generalContext.agentSession.agentName]: __spreadProps(__spreadValues({}, prevAgentStates[generalContext.agentSession.agentName]), {
|
|
2490
|
+
threadId: void 0,
|
|
2491
|
+
nodeName: void 0,
|
|
2492
|
+
runId: void 0
|
|
2493
|
+
})
|
|
2494
|
+
});
|
|
2495
|
+
});
|
|
2496
|
+
}
|
|
2497
|
+
});
|
|
2498
|
+
const runCurrentAgent = (hint) => __async(void 0, null, function* () {
|
|
2499
|
+
if (generalContext.agentSession) {
|
|
2500
|
+
yield (0, import_react_core9.runAgent)(
|
|
2501
|
+
generalContext.agentSession.agentName,
|
|
2502
|
+
context,
|
|
2503
|
+
appendMessage,
|
|
2504
|
+
runChatCompletion,
|
|
2505
|
+
hint
|
|
2506
|
+
);
|
|
2507
|
+
}
|
|
2508
|
+
});
|
|
2509
|
+
const stopCurrentAgent = () => {
|
|
2510
|
+
if (generalContext.agentSession) {
|
|
2511
|
+
(0, import_react_core9.stopAgent)(generalContext.agentSession.agentName, context);
|
|
2512
|
+
}
|
|
2513
|
+
};
|
|
2514
|
+
const setCurrentAgentState = (state) => {
|
|
2515
|
+
if (generalContext.agentSession) {
|
|
2516
|
+
generalContext.setCoagentStates((prevAgentStates) => {
|
|
2517
|
+
return __spreadProps(__spreadValues({}, prevAgentStates), {
|
|
2518
|
+
[generalContext.agentSession.agentName]: {
|
|
2519
|
+
state
|
|
2520
|
+
}
|
|
2521
|
+
});
|
|
2522
|
+
});
|
|
2523
|
+
}
|
|
2524
|
+
};
|
|
2525
|
+
function stopGeneration() {
|
|
2526
|
+
if (onStopGeneration) {
|
|
2527
|
+
onStopGeneration({
|
|
2528
|
+
messages,
|
|
2529
|
+
setMessages,
|
|
2530
|
+
stopGeneration: defaultStopGeneration,
|
|
2531
|
+
currentAgentName,
|
|
2532
|
+
restartCurrentAgent,
|
|
2533
|
+
stopCurrentAgent,
|
|
2534
|
+
runCurrentAgent,
|
|
2535
|
+
setCurrentAgentState
|
|
2536
|
+
});
|
|
2537
|
+
} else {
|
|
2538
|
+
defaultStopGeneration();
|
|
2539
|
+
}
|
|
2540
|
+
}
|
|
2541
|
+
function reloadMessages() {
|
|
2542
|
+
if (onReloadMessages) {
|
|
2543
|
+
onReloadMessages({
|
|
2544
|
+
messages,
|
|
2545
|
+
setMessages,
|
|
2546
|
+
stopGeneration: defaultStopGeneration,
|
|
2547
|
+
currentAgentName,
|
|
2548
|
+
restartCurrentAgent,
|
|
2549
|
+
stopCurrentAgent,
|
|
2550
|
+
runCurrentAgent,
|
|
2551
|
+
setCurrentAgentState
|
|
2552
|
+
});
|
|
2553
|
+
} else {
|
|
2554
|
+
defaultReloadMessages();
|
|
2555
|
+
}
|
|
2556
|
+
}
|
|
2468
2557
|
return {
|
|
2469
2558
|
visibleMessages,
|
|
2470
2559
|
isLoading,
|
|
@@ -2484,6 +2573,8 @@ var CopilotModal = ({
|
|
|
2484
2573
|
hitEscapeToClose = true,
|
|
2485
2574
|
onSetOpen,
|
|
2486
2575
|
onSubmitMessage,
|
|
2576
|
+
onStopGeneration,
|
|
2577
|
+
onReloadMessages,
|
|
2487
2578
|
shortcut = "/",
|
|
2488
2579
|
icons,
|
|
2489
2580
|
labels,
|
|
@@ -2521,6 +2612,8 @@ var CopilotModal = ({
|
|
|
2521
2612
|
{
|
|
2522
2613
|
instructions,
|
|
2523
2614
|
onSubmitMessage,
|
|
2615
|
+
onStopGeneration,
|
|
2616
|
+
onReloadMessages,
|
|
2524
2617
|
makeSystemMessage,
|
|
2525
2618
|
showResponseButton,
|
|
2526
2619
|
onInProgress,
|
|
@@ -2565,7 +2658,7 @@ function CopilotSidebar(props) {
|
|
|
2565
2658
|
|
|
2566
2659
|
// src/hooks/use-copilot-chat-suggestions.tsx
|
|
2567
2660
|
var import_react15 = require("react");
|
|
2568
|
-
var
|
|
2661
|
+
var import_react_core10 = require("@copilotkit/react-core");
|
|
2569
2662
|
var import_shared4 = require("@copilotkit/shared");
|
|
2570
2663
|
function useCopilotChatSuggestions({
|
|
2571
2664
|
instructions,
|
|
@@ -2573,7 +2666,7 @@ function useCopilotChatSuggestions({
|
|
|
2573
2666
|
minSuggestions = 1,
|
|
2574
2667
|
maxSuggestions = 3
|
|
2575
2668
|
}, dependencies = []) {
|
|
2576
|
-
const context = (0,
|
|
2669
|
+
const context = (0, import_react_core10.useCopilotContext)();
|
|
2577
2670
|
(0, import_react15.useEffect)(() => {
|
|
2578
2671
|
const id = (0, import_shared4.randomId)();
|
|
2579
2672
|
context.addChatSuggestionConfiguration(id, {
|