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