@copilotkit/react-ui 1.4.2-tyler-reset-chat.1 → 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 -15
- 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 +5 -5
- 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
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotModal
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-63ZKP62F.mjs";
|
|
4
4
|
import "../../chunk-YAGE7RCE.mjs";
|
|
5
5
|
import "../../chunk-VEC45H6Q.mjs";
|
|
6
6
|
import "../../chunk-RQNJNK2W.mjs";
|
|
7
|
-
import "../../chunk-
|
|
7
|
+
import "../../chunk-DHGDU64D.mjs";
|
|
8
8
|
import "../../chunk-6INMITFA.mjs";
|
|
9
9
|
import "../../chunk-RU73BEZM.mjs";
|
|
10
10
|
import "../../chunk-V7W6IM2V.mjs";
|
|
@@ -2200,7 +2200,6 @@ function DebugMenuButton({
|
|
|
2200
2200
|
}
|
|
2201
2201
|
|
|
2202
2202
|
// src/components/chat/Chat.tsx
|
|
2203
|
-
var import_react_core9 = require("@copilotkit/react-core");
|
|
2204
2203
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2205
2204
|
function CopilotChat({
|
|
2206
2205
|
instructions,
|
|
@@ -2208,8 +2207,6 @@ function CopilotChat({
|
|
|
2208
2207
|
makeSystemMessage,
|
|
2209
2208
|
showResponseButton = true,
|
|
2210
2209
|
onInProgress,
|
|
2211
|
-
onStopGeneration,
|
|
2212
|
-
onReloadMessages,
|
|
2213
2210
|
Messages: Messages2 = Messages,
|
|
2214
2211
|
RenderTextMessage: RenderTextMessage2 = RenderTextMessage,
|
|
2215
2212
|
RenderActionExecutionMessage: RenderActionExecutionMessage2 = RenderActionExecutionMessage,
|
|
@@ -2232,13 +2229,7 @@ function CopilotChat({
|
|
|
2232
2229
|
sendMessage,
|
|
2233
2230
|
stopGeneration,
|
|
2234
2231
|
reloadMessages
|
|
2235
|
-
} = useCopilotChatLogic(
|
|
2236
|
-
makeSystemMessage,
|
|
2237
|
-
onInProgress,
|
|
2238
|
-
onSubmitMessage,
|
|
2239
|
-
onStopGeneration,
|
|
2240
|
-
onReloadMessages
|
|
2241
|
-
);
|
|
2232
|
+
} = useCopilotChatLogic(makeSystemMessage, onInProgress, onSubmitMessage);
|
|
2242
2233
|
const chatContext = import_react12.default.useContext(ChatContext);
|
|
2243
2234
|
const isVisible = chatContext ? chatContext.open : true;
|
|
2244
2235
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
|
|
@@ -2294,15 +2285,8 @@ function WrappedCopilotChat({
|
|
|
2294
2285
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children });
|
|
2295
2286
|
}
|
|
2296
2287
|
var SUGGESTIONS_DEBOUNCE_TIMEOUT = 1e3;
|
|
2297
|
-
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage
|
|
2298
|
-
|
|
2299
|
-
const {
|
|
2300
|
-
visibleMessages,
|
|
2301
|
-
appendMessage,
|
|
2302
|
-
reloadMessages: defaultReloadMessages,
|
|
2303
|
-
stopGeneration: defaultStopGeneration,
|
|
2304
|
-
isLoading
|
|
2305
|
-
} = (0, import_react_core8.useCopilotChat)({
|
|
2288
|
+
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) => {
|
|
2289
|
+
const { visibleMessages, appendMessage, reloadMessages, stopGeneration, isLoading } = (0, import_react_core8.useCopilotChat)({
|
|
2306
2290
|
id: (0, import_shared3.randomId)(),
|
|
2307
2291
|
makeSystemMessage
|
|
2308
2292
|
});
|
|
@@ -2310,8 +2294,8 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2310
2294
|
const suggestionsAbortControllerRef = (0, import_react12.useRef)(null);
|
|
2311
2295
|
const debounceTimerRef = (0, import_react12.useRef)();
|
|
2312
2296
|
const abortSuggestions = () => {
|
|
2313
|
-
var
|
|
2314
|
-
(
|
|
2297
|
+
var _a;
|
|
2298
|
+
(_a = suggestionsAbortControllerRef.current) == null ? void 0 : _a.abort();
|
|
2315
2299
|
suggestionsAbortControllerRef.current = null;
|
|
2316
2300
|
};
|
|
2317
2301
|
const generalContext = (0, import_react_core8.useCopilotContext)();
|
|
@@ -2337,13 +2321,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2337
2321
|
return () => {
|
|
2338
2322
|
clearTimeout(debounceTimerRef.current);
|
|
2339
2323
|
};
|
|
2340
|
-
}, [
|
|
2341
|
-
isLoading,
|
|
2342
|
-
context.chatSuggestionConfiguration,
|
|
2343
|
-
// hackish way to trigger suggestions reload on reset, but better than moving suggestions to the
|
|
2344
|
-
// global context
|
|
2345
|
-
visibleMessages.length == 0
|
|
2346
|
-
]);
|
|
2324
|
+
}, [isLoading, context.chatSuggestionConfiguration]);
|
|
2347
2325
|
const sendMessage = (messageContent) => __async(void 0, null, function* () {
|
|
2348
2326
|
abortSuggestions();
|
|
2349
2327
|
setCurrentSuggestions([]);
|
|
@@ -2361,79 +2339,6 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2361
2339
|
appendMessage(message);
|
|
2362
2340
|
return message;
|
|
2363
2341
|
});
|
|
2364
|
-
const messages = visibleMessages;
|
|
2365
|
-
const { setMessages } = messagesContext;
|
|
2366
|
-
const currentAgentName = (_a = generalContext.agentSession) == null ? void 0 : _a.agentName;
|
|
2367
|
-
const restartCurrentAgent = (hint) => __async(void 0, null, function* () {
|
|
2368
|
-
if (generalContext.agentSession) {
|
|
2369
|
-
generalContext.setAgentSession(__spreadProps(__spreadValues({}, generalContext.agentSession), {
|
|
2370
|
-
nodeName: void 0,
|
|
2371
|
-
threadId: void 0
|
|
2372
|
-
}));
|
|
2373
|
-
generalContext.setCoagentStates((prevAgentStates) => {
|
|
2374
|
-
return __spreadProps(__spreadValues({}, prevAgentStates), {
|
|
2375
|
-
[generalContext.agentSession.agentName]: __spreadProps(__spreadValues({}, prevAgentStates[generalContext.agentSession.agentName]), {
|
|
2376
|
-
threadId: void 0,
|
|
2377
|
-
nodeName: void 0,
|
|
2378
|
-
runId: void 0
|
|
2379
|
-
})
|
|
2380
|
-
});
|
|
2381
|
-
});
|
|
2382
|
-
}
|
|
2383
|
-
});
|
|
2384
|
-
const runCurrentAgent = (hint) => __async(void 0, null, function* () {
|
|
2385
|
-
if (generalContext.agentSession) {
|
|
2386
|
-
yield (0, import_react_core9.runAgent)(generalContext.agentSession.agentName, context, appendMessage, hint);
|
|
2387
|
-
}
|
|
2388
|
-
});
|
|
2389
|
-
const stopCurrentAgent = () => {
|
|
2390
|
-
if (generalContext.agentSession) {
|
|
2391
|
-
(0, import_react_core9.stopAgent)(generalContext.agentSession.agentName, context);
|
|
2392
|
-
}
|
|
2393
|
-
};
|
|
2394
|
-
const setCurrentAgentState = (state) => {
|
|
2395
|
-
if (generalContext.agentSession) {
|
|
2396
|
-
generalContext.setCoagentStates((prevAgentStates) => {
|
|
2397
|
-
return __spreadProps(__spreadValues({}, prevAgentStates), {
|
|
2398
|
-
[generalContext.agentSession.agentName]: {
|
|
2399
|
-
state
|
|
2400
|
-
}
|
|
2401
|
-
});
|
|
2402
|
-
});
|
|
2403
|
-
}
|
|
2404
|
-
};
|
|
2405
|
-
function stopGeneration() {
|
|
2406
|
-
if (onStopGeneration) {
|
|
2407
|
-
onStopGeneration({
|
|
2408
|
-
messages,
|
|
2409
|
-
setMessages,
|
|
2410
|
-
stopGeneration: defaultStopGeneration,
|
|
2411
|
-
currentAgentName,
|
|
2412
|
-
restartCurrentAgent,
|
|
2413
|
-
stopCurrentAgent,
|
|
2414
|
-
runCurrentAgent,
|
|
2415
|
-
setCurrentAgentState
|
|
2416
|
-
});
|
|
2417
|
-
} else {
|
|
2418
|
-
defaultStopGeneration();
|
|
2419
|
-
}
|
|
2420
|
-
}
|
|
2421
|
-
function reloadMessages() {
|
|
2422
|
-
if (onReloadMessages) {
|
|
2423
|
-
onReloadMessages({
|
|
2424
|
-
messages,
|
|
2425
|
-
setMessages,
|
|
2426
|
-
stopGeneration: defaultStopGeneration,
|
|
2427
|
-
currentAgentName,
|
|
2428
|
-
restartCurrentAgent,
|
|
2429
|
-
stopCurrentAgent,
|
|
2430
|
-
runCurrentAgent,
|
|
2431
|
-
setCurrentAgentState
|
|
2432
|
-
});
|
|
2433
|
-
} else {
|
|
2434
|
-
defaultReloadMessages();
|
|
2435
|
-
}
|
|
2436
|
-
}
|
|
2437
2342
|
return {
|
|
2438
2343
|
visibleMessages,
|
|
2439
2344
|
isLoading,
|
|
@@ -2453,8 +2358,6 @@ var CopilotModal = ({
|
|
|
2453
2358
|
hitEscapeToClose = true,
|
|
2454
2359
|
onSetOpen,
|
|
2455
2360
|
onSubmitMessage,
|
|
2456
|
-
onStopGeneration,
|
|
2457
|
-
onReloadMessages,
|
|
2458
2361
|
shortcut = "/",
|
|
2459
2362
|
icons,
|
|
2460
2363
|
labels,
|
|
@@ -2492,8 +2395,6 @@ var CopilotModal = ({
|
|
|
2492
2395
|
{
|
|
2493
2396
|
instructions,
|
|
2494
2397
|
onSubmitMessage,
|
|
2495
|
-
onStopGeneration,
|
|
2496
|
-
onReloadMessages,
|
|
2497
2398
|
makeSystemMessage,
|
|
2498
2399
|
showResponseButton,
|
|
2499
2400
|
onInProgress,
|