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