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