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