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