@copilotkit/react-ui 1.4.2-tyler-reset-chat.0 → 1.4.2
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 +6 -5
- package/dist/{chunk-B6A6OMIG.mjs → chunk-63ZKP62F.mjs} +2 -6
- package/dist/chunk-63ZKP62F.mjs.map +1 -0
- package/dist/{chunk-OI5EKZPO.mjs → chunk-DHGDU64D.mjs} +7 -103
- package/dist/chunk-DHGDU64D.mjs.map +1 -0
- package/dist/{chunk-RQRK6DEW.mjs → chunk-TKFQ7VQR.mjs} +2 -2
- package/dist/{chunk-Z2RXDT7O.mjs → chunk-VYKDFXGS.mjs} +2 -2
- package/dist/components/chat/Chat.d.ts +5 -50
- package/dist/components/chat/Chat.js +6 -101
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +1 -1
- package/dist/components/chat/Modal.d.ts +1 -1
- package/dist/components/chat/Modal.js +6 -105
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +2 -2
- package/dist/components/chat/Popup.js +6 -105
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +3 -3
- package/dist/components/chat/Sidebar.js +6 -105
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +3 -3
- package/dist/components/chat/index.js +6 -105
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +4 -4
- package/dist/components/index.js +6 -105
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +4 -4
- package/dist/index.js +8 -107
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/package.json +7 -7
- package/src/components/chat/Chat.tsx +8 -167
- package/src/components/chat/Modal.tsx +0 -4
- package/dist/chunk-B6A6OMIG.mjs.map +0 -1
- package/dist/chunk-OI5EKZPO.mjs.map +0 -1
- /package/dist/{chunk-RQRK6DEW.mjs.map → chunk-TKFQ7VQR.mjs.map} +0 -0
- /package/dist/{chunk-Z2RXDT7O.mjs.map → chunk-VYKDFXGS.mjs.map} +0 -0
|
@@ -2,18 +2,18 @@ import "../chunk-MMVDU6DF.mjs";
|
|
|
2
2
|
import "../chunk-MRFF7GSQ.mjs";
|
|
3
3
|
import {
|
|
4
4
|
CopilotSidebar
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-TKFQ7VQR.mjs";
|
|
6
6
|
import "../chunk-WB3YULQ4.mjs";
|
|
7
7
|
import {
|
|
8
8
|
CopilotPopup
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import "../chunk-
|
|
9
|
+
} from "../chunk-VYKDFXGS.mjs";
|
|
10
|
+
import "../chunk-63ZKP62F.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-DHGDU64D.mjs";
|
|
17
17
|
import "../chunk-6INMITFA.mjs";
|
|
18
18
|
import "../chunk-RU73BEZM.mjs";
|
|
19
19
|
import "../chunk-V7W6IM2V.mjs";
|
package/dist/index.js
CHANGED
|
@@ -2207,7 +2207,6 @@ function DebugMenuButton({
|
|
|
2207
2207
|
}
|
|
2208
2208
|
|
|
2209
2209
|
// src/components/chat/Chat.tsx
|
|
2210
|
-
var import_react_core9 = require("@copilotkit/react-core");
|
|
2211
2210
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2212
2211
|
function CopilotChat({
|
|
2213
2212
|
instructions,
|
|
@@ -2215,8 +2214,6 @@ function CopilotChat({
|
|
|
2215
2214
|
makeSystemMessage,
|
|
2216
2215
|
showResponseButton = true,
|
|
2217
2216
|
onInProgress,
|
|
2218
|
-
onStopGeneration,
|
|
2219
|
-
onReloadMessages,
|
|
2220
2217
|
Messages: Messages2 = Messages,
|
|
2221
2218
|
RenderTextMessage: RenderTextMessage2 = RenderTextMessage,
|
|
2222
2219
|
RenderActionExecutionMessage: RenderActionExecutionMessage2 = RenderActionExecutionMessage,
|
|
@@ -2239,13 +2236,7 @@ function CopilotChat({
|
|
|
2239
2236
|
sendMessage,
|
|
2240
2237
|
stopGeneration,
|
|
2241
2238
|
reloadMessages
|
|
2242
|
-
} = useCopilotChatLogic(
|
|
2243
|
-
makeSystemMessage,
|
|
2244
|
-
onInProgress,
|
|
2245
|
-
onSubmitMessage,
|
|
2246
|
-
onStopGeneration,
|
|
2247
|
-
onReloadMessages
|
|
2248
|
-
);
|
|
2239
|
+
} = useCopilotChatLogic(makeSystemMessage, onInProgress, onSubmitMessage);
|
|
2249
2240
|
const chatContext = import_react12.default.useContext(ChatContext);
|
|
2250
2241
|
const isVisible = chatContext ? chatContext.open : true;
|
|
2251
2242
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
|
|
@@ -2301,15 +2292,8 @@ function WrappedCopilotChat({
|
|
|
2301
2292
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children });
|
|
2302
2293
|
}
|
|
2303
2294
|
var SUGGESTIONS_DEBOUNCE_TIMEOUT = 1e3;
|
|
2304
|
-
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage
|
|
2305
|
-
|
|
2306
|
-
const {
|
|
2307
|
-
visibleMessages,
|
|
2308
|
-
appendMessage,
|
|
2309
|
-
reloadMessages: defaultReloadMessages,
|
|
2310
|
-
stopGeneration: defaultStopGeneration,
|
|
2311
|
-
isLoading
|
|
2312
|
-
} = (0, import_react_core8.useCopilotChat)({
|
|
2295
|
+
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) => {
|
|
2296
|
+
const { visibleMessages, appendMessage, reloadMessages, stopGeneration, isLoading } = (0, import_react_core8.useCopilotChat)({
|
|
2313
2297
|
id: (0, import_shared3.randomId)(),
|
|
2314
2298
|
makeSystemMessage
|
|
2315
2299
|
});
|
|
@@ -2317,8 +2301,8 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2317
2301
|
const suggestionsAbortControllerRef = (0, import_react12.useRef)(null);
|
|
2318
2302
|
const debounceTimerRef = (0, import_react12.useRef)();
|
|
2319
2303
|
const abortSuggestions = () => {
|
|
2320
|
-
var
|
|
2321
|
-
(
|
|
2304
|
+
var _a;
|
|
2305
|
+
(_a = suggestionsAbortControllerRef.current) == null ? void 0 : _a.abort();
|
|
2322
2306
|
suggestionsAbortControllerRef.current = null;
|
|
2323
2307
|
};
|
|
2324
2308
|
const generalContext = (0, import_react_core8.useCopilotContext)();
|
|
@@ -2344,13 +2328,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2344
2328
|
return () => {
|
|
2345
2329
|
clearTimeout(debounceTimerRef.current);
|
|
2346
2330
|
};
|
|
2347
|
-
}, [
|
|
2348
|
-
isLoading,
|
|
2349
|
-
context.chatSuggestionConfiguration,
|
|
2350
|
-
// hackish way to trigger suggestions reload on reset, but better than moving suggestions to the
|
|
2351
|
-
// global context
|
|
2352
|
-
visibleMessages.length == 0
|
|
2353
|
-
]);
|
|
2331
|
+
}, [isLoading, context.chatSuggestionConfiguration]);
|
|
2354
2332
|
const sendMessage = (messageContent) => __async(void 0, null, function* () {
|
|
2355
2333
|
abortSuggestions();
|
|
2356
2334
|
setCurrentSuggestions([]);
|
|
@@ -2368,79 +2346,6 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2368
2346
|
appendMessage(message);
|
|
2369
2347
|
return message;
|
|
2370
2348
|
});
|
|
2371
|
-
const messages = visibleMessages;
|
|
2372
|
-
const { setMessages } = messagesContext;
|
|
2373
|
-
const currentAgentName = (_a = generalContext.agentSession) == null ? void 0 : _a.agentName;
|
|
2374
|
-
const restartCurrentAgent = (hint) => __async(void 0, null, function* () {
|
|
2375
|
-
if (generalContext.agentSession) {
|
|
2376
|
-
generalContext.setAgentSession(__spreadProps(__spreadValues({}, generalContext.agentSession), {
|
|
2377
|
-
nodeName: void 0,
|
|
2378
|
-
threadId: void 0
|
|
2379
|
-
}));
|
|
2380
|
-
generalContext.setCoagentStates((prevAgentStates) => {
|
|
2381
|
-
return __spreadProps(__spreadValues({}, prevAgentStates), {
|
|
2382
|
-
[generalContext.agentSession.agentName]: __spreadProps(__spreadValues({}, prevAgentStates[generalContext.agentSession.agentName]), {
|
|
2383
|
-
threadId: void 0,
|
|
2384
|
-
nodeName: void 0,
|
|
2385
|
-
runId: void 0
|
|
2386
|
-
})
|
|
2387
|
-
});
|
|
2388
|
-
});
|
|
2389
|
-
}
|
|
2390
|
-
});
|
|
2391
|
-
const runCurrentAgent = (hint) => __async(void 0, null, function* () {
|
|
2392
|
-
if (generalContext.agentSession) {
|
|
2393
|
-
yield (0, import_react_core9.runAgent)(generalContext.agentSession.agentName, context, appendMessage, hint);
|
|
2394
|
-
}
|
|
2395
|
-
});
|
|
2396
|
-
const stopCurrentAgent = () => {
|
|
2397
|
-
if (generalContext.agentSession) {
|
|
2398
|
-
(0, import_react_core9.stopAgent)(generalContext.agentSession.agentName, context);
|
|
2399
|
-
}
|
|
2400
|
-
};
|
|
2401
|
-
const setCurrentAgentState = (state) => {
|
|
2402
|
-
if (generalContext.agentSession) {
|
|
2403
|
-
generalContext.setCoagentStates((prevAgentStates) => {
|
|
2404
|
-
return __spreadProps(__spreadValues({}, prevAgentStates), {
|
|
2405
|
-
[generalContext.agentSession.agentName]: {
|
|
2406
|
-
state
|
|
2407
|
-
}
|
|
2408
|
-
});
|
|
2409
|
-
});
|
|
2410
|
-
}
|
|
2411
|
-
};
|
|
2412
|
-
function stopGeneration() {
|
|
2413
|
-
if (onStopGeneration) {
|
|
2414
|
-
onStopGeneration({
|
|
2415
|
-
messages,
|
|
2416
|
-
setMessages,
|
|
2417
|
-
stopGeneration: defaultStopGeneration,
|
|
2418
|
-
currentAgentName,
|
|
2419
|
-
restartCurrentAgent,
|
|
2420
|
-
stopCurrentAgent,
|
|
2421
|
-
runCurrentAgent,
|
|
2422
|
-
setCurrentAgentState
|
|
2423
|
-
});
|
|
2424
|
-
} else {
|
|
2425
|
-
defaultStopGeneration();
|
|
2426
|
-
}
|
|
2427
|
-
}
|
|
2428
|
-
function reloadMessages() {
|
|
2429
|
-
if (onReloadMessages) {
|
|
2430
|
-
onReloadMessages({
|
|
2431
|
-
messages,
|
|
2432
|
-
setMessages,
|
|
2433
|
-
stopGeneration: defaultStopGeneration,
|
|
2434
|
-
currentAgentName,
|
|
2435
|
-
restartCurrentAgent,
|
|
2436
|
-
stopCurrentAgent,
|
|
2437
|
-
runCurrentAgent,
|
|
2438
|
-
setCurrentAgentState
|
|
2439
|
-
});
|
|
2440
|
-
} else {
|
|
2441
|
-
defaultReloadMessages();
|
|
2442
|
-
}
|
|
2443
|
-
}
|
|
2444
2349
|
return {
|
|
2445
2350
|
visibleMessages,
|
|
2446
2351
|
isLoading,
|
|
@@ -2460,8 +2365,6 @@ var CopilotModal = ({
|
|
|
2460
2365
|
hitEscapeToClose = true,
|
|
2461
2366
|
onSetOpen,
|
|
2462
2367
|
onSubmitMessage,
|
|
2463
|
-
onStopGeneration,
|
|
2464
|
-
onReloadMessages,
|
|
2465
2368
|
shortcut = "/",
|
|
2466
2369
|
icons,
|
|
2467
2370
|
labels,
|
|
@@ -2499,8 +2402,6 @@ var CopilotModal = ({
|
|
|
2499
2402
|
{
|
|
2500
2403
|
instructions,
|
|
2501
2404
|
onSubmitMessage,
|
|
2502
|
-
onStopGeneration,
|
|
2503
|
-
onReloadMessages,
|
|
2504
2405
|
makeSystemMessage,
|
|
2505
2406
|
showResponseButton,
|
|
2506
2407
|
onInProgress,
|
|
@@ -2545,7 +2446,7 @@ function CopilotSidebar(props) {
|
|
|
2545
2446
|
|
|
2546
2447
|
// src/hooks/use-copilot-chat-suggestions.tsx
|
|
2547
2448
|
var import_react15 = require("react");
|
|
2548
|
-
var
|
|
2449
|
+
var import_react_core9 = require("@copilotkit/react-core");
|
|
2549
2450
|
var import_shared4 = require("@copilotkit/shared");
|
|
2550
2451
|
function useCopilotChatSuggestions({
|
|
2551
2452
|
instructions,
|
|
@@ -2553,7 +2454,7 @@ function useCopilotChatSuggestions({
|
|
|
2553
2454
|
minSuggestions = 1,
|
|
2554
2455
|
maxSuggestions = 3
|
|
2555
2456
|
}, dependencies = []) {
|
|
2556
|
-
const context = (0,
|
|
2457
|
+
const context = (0, import_react_core9.useCopilotContext)();
|
|
2557
2458
|
(0, import_react15.useEffect)(() => {
|
|
2558
2459
|
const id = (0, import_shared4.randomId)();
|
|
2559
2460
|
context.addChatSuggestionConfiguration(id, {
|