@copilotkit/react-ui 1.4.2-tyler-reset-chat.2 → 1.4.3-pre.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 +12 -20
- 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
|
@@ -46,6 +46,6 @@ interface CopilotModalProps extends CopilotChatProps {
|
|
|
46
46
|
*/
|
|
47
47
|
Header?: React__default.ComponentType<HeaderProps>;
|
|
48
48
|
}
|
|
49
|
-
declare const CopilotModal: ({ instructions, defaultOpen, clickOutsideToClose, hitEscapeToClose, onSetOpen, onSubmitMessage,
|
|
49
|
+
declare const CopilotModal: ({ instructions, defaultOpen, clickOutsideToClose, hitEscapeToClose, onSetOpen, onSubmitMessage, shortcut, icons, labels, makeSystemMessage, showResponseButton, onInProgress, Window, Button, Header, Messages, Input, ResponseButton, className, children, }: CopilotModalProps) => react_jsx_runtime.JSX.Element;
|
|
50
50
|
|
|
51
51
|
export { CopilotModal, CopilotModalProps };
|
|
@@ -2198,7 +2198,6 @@ function DebugMenuButton({
|
|
|
2198
2198
|
}
|
|
2199
2199
|
|
|
2200
2200
|
// src/components/chat/Chat.tsx
|
|
2201
|
-
var import_react_core9 = require("@copilotkit/react-core");
|
|
2202
2201
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2203
2202
|
function CopilotChat({
|
|
2204
2203
|
instructions,
|
|
@@ -2206,8 +2205,6 @@ function CopilotChat({
|
|
|
2206
2205
|
makeSystemMessage,
|
|
2207
2206
|
showResponseButton = true,
|
|
2208
2207
|
onInProgress,
|
|
2209
|
-
onStopGeneration,
|
|
2210
|
-
onReloadMessages,
|
|
2211
2208
|
Messages: Messages2 = Messages,
|
|
2212
2209
|
RenderTextMessage: RenderTextMessage2 = RenderTextMessage,
|
|
2213
2210
|
RenderActionExecutionMessage: RenderActionExecutionMessage2 = RenderActionExecutionMessage,
|
|
@@ -2230,13 +2227,7 @@ function CopilotChat({
|
|
|
2230
2227
|
sendMessage,
|
|
2231
2228
|
stopGeneration,
|
|
2232
2229
|
reloadMessages
|
|
2233
|
-
} = useCopilotChatLogic(
|
|
2234
|
-
makeSystemMessage,
|
|
2235
|
-
onInProgress,
|
|
2236
|
-
onSubmitMessage,
|
|
2237
|
-
onStopGeneration,
|
|
2238
|
-
onReloadMessages
|
|
2239
|
-
);
|
|
2230
|
+
} = useCopilotChatLogic(makeSystemMessage, onInProgress, onSubmitMessage);
|
|
2240
2231
|
const chatContext = import_react12.default.useContext(ChatContext);
|
|
2241
2232
|
const isVisible = chatContext ? chatContext.open : true;
|
|
2242
2233
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
|
|
@@ -2292,15 +2283,8 @@ function WrappedCopilotChat({
|
|
|
2292
2283
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children });
|
|
2293
2284
|
}
|
|
2294
2285
|
var SUGGESTIONS_DEBOUNCE_TIMEOUT = 1e3;
|
|
2295
|
-
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage
|
|
2296
|
-
|
|
2297
|
-
const {
|
|
2298
|
-
visibleMessages,
|
|
2299
|
-
appendMessage,
|
|
2300
|
-
reloadMessages: defaultReloadMessages,
|
|
2301
|
-
stopGeneration: defaultStopGeneration,
|
|
2302
|
-
isLoading
|
|
2303
|
-
} = (0, import_react_core8.useCopilotChat)({
|
|
2286
|
+
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) => {
|
|
2287
|
+
const { visibleMessages, appendMessage, reloadMessages, stopGeneration, isLoading } = (0, import_react_core8.useCopilotChat)({
|
|
2304
2288
|
id: (0, import_shared3.randomId)(),
|
|
2305
2289
|
makeSystemMessage
|
|
2306
2290
|
});
|
|
@@ -2308,8 +2292,8 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2308
2292
|
const suggestionsAbortControllerRef = (0, import_react12.useRef)(null);
|
|
2309
2293
|
const debounceTimerRef = (0, import_react12.useRef)();
|
|
2310
2294
|
const abortSuggestions = () => {
|
|
2311
|
-
var
|
|
2312
|
-
(
|
|
2295
|
+
var _a;
|
|
2296
|
+
(_a = suggestionsAbortControllerRef.current) == null ? void 0 : _a.abort();
|
|
2313
2297
|
suggestionsAbortControllerRef.current = null;
|
|
2314
2298
|
};
|
|
2315
2299
|
const generalContext = (0, import_react_core8.useCopilotContext)();
|
|
@@ -2335,13 +2319,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2335
2319
|
return () => {
|
|
2336
2320
|
clearTimeout(debounceTimerRef.current);
|
|
2337
2321
|
};
|
|
2338
|
-
}, [
|
|
2339
|
-
isLoading,
|
|
2340
|
-
context.chatSuggestionConfiguration,
|
|
2341
|
-
// hackish way to trigger suggestions reload on reset, but better than moving suggestions to the
|
|
2342
|
-
// global context
|
|
2343
|
-
visibleMessages.length == 0
|
|
2344
|
-
]);
|
|
2322
|
+
}, [isLoading, context.chatSuggestionConfiguration]);
|
|
2345
2323
|
const sendMessage = (messageContent) => __async(void 0, null, function* () {
|
|
2346
2324
|
abortSuggestions();
|
|
2347
2325
|
setCurrentSuggestions([]);
|
|
@@ -2359,79 +2337,6 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2359
2337
|
appendMessage(message);
|
|
2360
2338
|
return message;
|
|
2361
2339
|
});
|
|
2362
|
-
const messages = visibleMessages;
|
|
2363
|
-
const { setMessages } = messagesContext;
|
|
2364
|
-
const currentAgentName = (_a = generalContext.agentSession) == null ? void 0 : _a.agentName;
|
|
2365
|
-
const restartCurrentAgent = (hint) => __async(void 0, null, function* () {
|
|
2366
|
-
if (generalContext.agentSession) {
|
|
2367
|
-
generalContext.setAgentSession(__spreadProps(__spreadValues({}, generalContext.agentSession), {
|
|
2368
|
-
nodeName: void 0,
|
|
2369
|
-
threadId: void 0
|
|
2370
|
-
}));
|
|
2371
|
-
generalContext.setCoagentStates((prevAgentStates) => {
|
|
2372
|
-
return __spreadProps(__spreadValues({}, prevAgentStates), {
|
|
2373
|
-
[generalContext.agentSession.agentName]: __spreadProps(__spreadValues({}, prevAgentStates[generalContext.agentSession.agentName]), {
|
|
2374
|
-
threadId: void 0,
|
|
2375
|
-
nodeName: void 0,
|
|
2376
|
-
runId: void 0
|
|
2377
|
-
})
|
|
2378
|
-
});
|
|
2379
|
-
});
|
|
2380
|
-
}
|
|
2381
|
-
});
|
|
2382
|
-
const runCurrentAgent = (hint) => __async(void 0, null, function* () {
|
|
2383
|
-
if (generalContext.agentSession) {
|
|
2384
|
-
yield (0, import_react_core9.runAgent)(generalContext.agentSession.agentName, context, appendMessage, hint);
|
|
2385
|
-
}
|
|
2386
|
-
});
|
|
2387
|
-
const stopCurrentAgent = () => {
|
|
2388
|
-
if (generalContext.agentSession) {
|
|
2389
|
-
(0, import_react_core9.stopAgent)(generalContext.agentSession.agentName, context);
|
|
2390
|
-
}
|
|
2391
|
-
};
|
|
2392
|
-
const setCurrentAgentState = (state) => {
|
|
2393
|
-
if (generalContext.agentSession) {
|
|
2394
|
-
generalContext.setCoagentStates((prevAgentStates) => {
|
|
2395
|
-
return __spreadProps(__spreadValues({}, prevAgentStates), {
|
|
2396
|
-
[generalContext.agentSession.agentName]: {
|
|
2397
|
-
state
|
|
2398
|
-
}
|
|
2399
|
-
});
|
|
2400
|
-
});
|
|
2401
|
-
}
|
|
2402
|
-
};
|
|
2403
|
-
function stopGeneration() {
|
|
2404
|
-
if (onStopGeneration) {
|
|
2405
|
-
onStopGeneration({
|
|
2406
|
-
messages,
|
|
2407
|
-
setMessages,
|
|
2408
|
-
stopGeneration: defaultStopGeneration,
|
|
2409
|
-
currentAgentName,
|
|
2410
|
-
restartCurrentAgent,
|
|
2411
|
-
stopCurrentAgent,
|
|
2412
|
-
runCurrentAgent,
|
|
2413
|
-
setCurrentAgentState
|
|
2414
|
-
});
|
|
2415
|
-
} else {
|
|
2416
|
-
defaultStopGeneration();
|
|
2417
|
-
}
|
|
2418
|
-
}
|
|
2419
|
-
function reloadMessages() {
|
|
2420
|
-
if (onReloadMessages) {
|
|
2421
|
-
onReloadMessages({
|
|
2422
|
-
messages,
|
|
2423
|
-
setMessages,
|
|
2424
|
-
stopGeneration: defaultStopGeneration,
|
|
2425
|
-
currentAgentName,
|
|
2426
|
-
restartCurrentAgent,
|
|
2427
|
-
stopCurrentAgent,
|
|
2428
|
-
runCurrentAgent,
|
|
2429
|
-
setCurrentAgentState
|
|
2430
|
-
});
|
|
2431
|
-
} else {
|
|
2432
|
-
defaultReloadMessages();
|
|
2433
|
-
}
|
|
2434
|
-
}
|
|
2435
2340
|
return {
|
|
2436
2341
|
visibleMessages,
|
|
2437
2342
|
isLoading,
|
|
@@ -2451,8 +2356,6 @@ var CopilotModal = ({
|
|
|
2451
2356
|
hitEscapeToClose = true,
|
|
2452
2357
|
onSetOpen,
|
|
2453
2358
|
onSubmitMessage,
|
|
2454
|
-
onStopGeneration,
|
|
2455
|
-
onReloadMessages,
|
|
2456
2359
|
shortcut = "/",
|
|
2457
2360
|
icons,
|
|
2458
2361
|
labels,
|
|
@@ -2490,8 +2393,6 @@ var CopilotModal = ({
|
|
|
2490
2393
|
{
|
|
2491
2394
|
instructions,
|
|
2492
2395
|
onSubmitMessage,
|
|
2493
|
-
onStopGeneration,
|
|
2494
|
-
onReloadMessages,
|
|
2495
2396
|
makeSystemMessage,
|
|
2496
2397
|
showResponseButton,
|
|
2497
2398
|
onInProgress,
|