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