@copilotkit/react-ui 1.3.16-mme-reset-chat.11 → 1.4.0-alpha.18
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 +231 -37
- package/dist/{chunk-OG2XHQQM.mjs → chunk-H5CXJBR5.mjs} +2 -6
- package/dist/chunk-H5CXJBR5.mjs.map +1 -0
- package/dist/{chunk-5XQEL3WQ.mjs → chunk-M2NVAJQA.mjs} +2 -2
- package/dist/{chunk-2BAND4IT.mjs → chunk-ORHE7FYT.mjs} +7 -103
- package/dist/chunk-ORHE7FYT.mjs.map +1 -0
- package/dist/{chunk-DXMPY4SG.mjs → chunk-PY7YBFPA.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 +7 -166
- package/src/components/chat/Modal.tsx +0 -4
- package/dist/chunk-2BAND4IT.mjs.map +0 -1
- package/dist/chunk-OG2XHQQM.mjs.map +0 -1
- /package/dist/{chunk-5XQEL3WQ.mjs.map → chunk-M2NVAJQA.mjs.map} +0 -0
- /package/dist/{chunk-DXMPY4SG.mjs.map → chunk-PY7YBFPA.mjs.map} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotPopup
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-PY7YBFPA.mjs";
|
|
4
|
+
import "../../chunk-H5CXJBR5.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-ORHE7FYT.mjs";
|
|
9
9
|
import "../../chunk-V7W6IM2V.mjs";
|
|
10
10
|
import "../../chunk-OMTPWC7T.mjs";
|
|
11
11
|
import "../../chunk-ZABXREBH.mjs";
|
|
@@ -2093,7 +2093,6 @@ function DebugMenuButton({
|
|
|
2093
2093
|
}
|
|
2094
2094
|
|
|
2095
2095
|
// src/components/chat/Chat.tsx
|
|
2096
|
-
var import_react_core9 = require("@copilotkit/react-core");
|
|
2097
2096
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2098
2097
|
function CopilotChat({
|
|
2099
2098
|
instructions,
|
|
@@ -2101,8 +2100,6 @@ function CopilotChat({
|
|
|
2101
2100
|
makeSystemMessage,
|
|
2102
2101
|
showResponseButton = true,
|
|
2103
2102
|
onInProgress,
|
|
2104
|
-
onStopGeneration,
|
|
2105
|
-
onReloadMessages,
|
|
2106
2103
|
Messages: Messages2 = Messages,
|
|
2107
2104
|
RenderTextMessage: RenderTextMessage2 = RenderTextMessage,
|
|
2108
2105
|
RenderActionExecutionMessage: RenderActionExecutionMessage2 = RenderActionExecutionMessage,
|
|
@@ -2125,13 +2122,7 @@ function CopilotChat({
|
|
|
2125
2122
|
sendMessage,
|
|
2126
2123
|
stopGeneration,
|
|
2127
2124
|
reloadMessages
|
|
2128
|
-
} = useCopilotChatLogic(
|
|
2129
|
-
makeSystemMessage,
|
|
2130
|
-
onInProgress,
|
|
2131
|
-
onSubmitMessage,
|
|
2132
|
-
onStopGeneration,
|
|
2133
|
-
onReloadMessages
|
|
2134
|
-
);
|
|
2125
|
+
} = useCopilotChatLogic(makeSystemMessage, onInProgress, onSubmitMessage);
|
|
2135
2126
|
const chatContext = import_react11.default.useContext(ChatContext);
|
|
2136
2127
|
const isVisible = chatContext ? chatContext.open : true;
|
|
2137
2128
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
|
|
@@ -2187,15 +2178,8 @@ function WrappedCopilotChat({
|
|
|
2187
2178
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, { children });
|
|
2188
2179
|
}
|
|
2189
2180
|
var SUGGESTIONS_DEBOUNCE_TIMEOUT = 1e3;
|
|
2190
|
-
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage
|
|
2191
|
-
|
|
2192
|
-
const {
|
|
2193
|
-
visibleMessages,
|
|
2194
|
-
appendMessage,
|
|
2195
|
-
reloadMessages: defaultReloadMessages,
|
|
2196
|
-
stopGeneration: defaultStopGeneration,
|
|
2197
|
-
isLoading
|
|
2198
|
-
} = (0, import_react_core8.useCopilotChat)({
|
|
2181
|
+
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) => {
|
|
2182
|
+
const { visibleMessages, appendMessage, reloadMessages, stopGeneration, isLoading } = (0, import_react_core8.useCopilotChat)({
|
|
2199
2183
|
id: (0, import_shared3.randomId)(),
|
|
2200
2184
|
makeSystemMessage
|
|
2201
2185
|
});
|
|
@@ -2203,8 +2187,8 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2203
2187
|
const suggestionsAbortControllerRef = (0, import_react11.useRef)(null);
|
|
2204
2188
|
const debounceTimerRef = (0, import_react11.useRef)();
|
|
2205
2189
|
const abortSuggestions = () => {
|
|
2206
|
-
var
|
|
2207
|
-
(
|
|
2190
|
+
var _a;
|
|
2191
|
+
(_a = suggestionsAbortControllerRef.current) == null ? void 0 : _a.abort();
|
|
2208
2192
|
suggestionsAbortControllerRef.current = null;
|
|
2209
2193
|
};
|
|
2210
2194
|
const generalContext = (0, import_react_core8.useCopilotContext)();
|
|
@@ -2230,13 +2214,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2230
2214
|
return () => {
|
|
2231
2215
|
clearTimeout(debounceTimerRef.current);
|
|
2232
2216
|
};
|
|
2233
|
-
}, [
|
|
2234
|
-
isLoading,
|
|
2235
|
-
context.chatSuggestionConfiguration,
|
|
2236
|
-
// hackish way to trigger suggestions reload on reset, but better than moving suggestions to the
|
|
2237
|
-
// global context
|
|
2238
|
-
visibleMessages.length == 0
|
|
2239
|
-
]);
|
|
2217
|
+
}, [isLoading, context.chatSuggestionConfiguration]);
|
|
2240
2218
|
const sendMessage = (messageContent) => __async(void 0, null, function* () {
|
|
2241
2219
|
abortSuggestions();
|
|
2242
2220
|
setCurrentSuggestions([]);
|
|
@@ -2254,79 +2232,6 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2254
2232
|
appendMessage(message);
|
|
2255
2233
|
return message;
|
|
2256
2234
|
});
|
|
2257
|
-
const messages = visibleMessages;
|
|
2258
|
-
const { setMessages } = messagesContext;
|
|
2259
|
-
const currentAgentName = (_a = generalContext.agentSession) == null ? void 0 : _a.agentName;
|
|
2260
|
-
const restartCurrentAgent = (hint) => __async(void 0, null, function* () {
|
|
2261
|
-
if (generalContext.agentSession) {
|
|
2262
|
-
generalContext.setAgentSession(__spreadProps(__spreadValues({}, generalContext.agentSession), {
|
|
2263
|
-
nodeName: void 0,
|
|
2264
|
-
threadId: void 0
|
|
2265
|
-
}));
|
|
2266
|
-
generalContext.setCoagentStates((prevAgentStates) => {
|
|
2267
|
-
return __spreadProps(__spreadValues({}, prevAgentStates), {
|
|
2268
|
-
[generalContext.agentSession.agentName]: __spreadProps(__spreadValues({}, prevAgentStates[generalContext.agentSession.agentName]), {
|
|
2269
|
-
threadId: void 0,
|
|
2270
|
-
nodeName: void 0,
|
|
2271
|
-
runId: void 0
|
|
2272
|
-
})
|
|
2273
|
-
});
|
|
2274
|
-
});
|
|
2275
|
-
}
|
|
2276
|
-
});
|
|
2277
|
-
const runCurrentAgent = (hint) => __async(void 0, null, function* () {
|
|
2278
|
-
if (generalContext.agentSession) {
|
|
2279
|
-
yield (0, import_react_core9.runAgent)(generalContext.agentSession.agentName, context, appendMessage, hint);
|
|
2280
|
-
}
|
|
2281
|
-
});
|
|
2282
|
-
const stopCurrentAgent = () => {
|
|
2283
|
-
if (generalContext.agentSession) {
|
|
2284
|
-
(0, import_react_core9.stopAgent)(generalContext.agentSession.agentName, context);
|
|
2285
|
-
}
|
|
2286
|
-
};
|
|
2287
|
-
const setCurrentAgentState = (state) => {
|
|
2288
|
-
if (generalContext.agentSession) {
|
|
2289
|
-
generalContext.setCoagentStates((prevAgentStates) => {
|
|
2290
|
-
return __spreadProps(__spreadValues({}, prevAgentStates), {
|
|
2291
|
-
[generalContext.agentSession.agentName]: {
|
|
2292
|
-
state
|
|
2293
|
-
}
|
|
2294
|
-
});
|
|
2295
|
-
});
|
|
2296
|
-
}
|
|
2297
|
-
};
|
|
2298
|
-
function stopGeneration() {
|
|
2299
|
-
if (onStopGeneration) {
|
|
2300
|
-
onStopGeneration({
|
|
2301
|
-
messages,
|
|
2302
|
-
setMessages,
|
|
2303
|
-
stopGeneration: defaultStopGeneration,
|
|
2304
|
-
currentAgentName,
|
|
2305
|
-
restartCurrentAgent,
|
|
2306
|
-
stopCurrentAgent,
|
|
2307
|
-
runCurrentAgent,
|
|
2308
|
-
setCurrentAgentState
|
|
2309
|
-
});
|
|
2310
|
-
} else {
|
|
2311
|
-
defaultStopGeneration();
|
|
2312
|
-
}
|
|
2313
|
-
}
|
|
2314
|
-
function reloadMessages() {
|
|
2315
|
-
if (onReloadMessages) {
|
|
2316
|
-
onReloadMessages({
|
|
2317
|
-
messages,
|
|
2318
|
-
setMessages,
|
|
2319
|
-
stopGeneration: defaultStopGeneration,
|
|
2320
|
-
currentAgentName,
|
|
2321
|
-
restartCurrentAgent,
|
|
2322
|
-
stopCurrentAgent,
|
|
2323
|
-
runCurrentAgent,
|
|
2324
|
-
setCurrentAgentState
|
|
2325
|
-
});
|
|
2326
|
-
} else {
|
|
2327
|
-
defaultReloadMessages();
|
|
2328
|
-
}
|
|
2329
|
-
}
|
|
2330
2235
|
return {
|
|
2331
2236
|
visibleMessages,
|
|
2332
2237
|
isLoading,
|
|
@@ -2346,8 +2251,6 @@ var CopilotModal = ({
|
|
|
2346
2251
|
hitEscapeToClose = true,
|
|
2347
2252
|
onSetOpen,
|
|
2348
2253
|
onSubmitMessage,
|
|
2349
|
-
onStopGeneration,
|
|
2350
|
-
onReloadMessages,
|
|
2351
2254
|
shortcut = "/",
|
|
2352
2255
|
icons,
|
|
2353
2256
|
labels,
|
|
@@ -2385,8 +2288,6 @@ var CopilotModal = ({
|
|
|
2385
2288
|
{
|
|
2386
2289
|
instructions,
|
|
2387
2290
|
onSubmitMessage,
|
|
2388
|
-
onStopGeneration,
|
|
2389
|
-
onReloadMessages,
|
|
2390
2291
|
makeSystemMessage,
|
|
2391
2292
|
showResponseButton,
|
|
2392
2293
|
onInProgress,
|