@copilotkit/react-ui 1.3.16-mme-lgc-langgraph-package.11 → 1.3.16-mme-reset-chat.10
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 +55 -95
- package/dist/{chunk-C5KOJ3IH.mjs → chunk-3QOICFXX.mjs} +103 -7
- package/dist/chunk-3QOICFXX.mjs.map +1 -0
- package/dist/{chunk-QK6XA3PL.mjs → chunk-H7LLXN6X.mjs} +6 -2
- package/dist/chunk-H7LLXN6X.mjs.map +1 -0
- package/dist/{chunk-TEZWY2BL.mjs → chunk-P54DK2TL.mjs} +2 -2
- package/dist/{chunk-OJ5NVSTU.mjs → chunk-SEY3XSCD.mjs} +2 -2
- package/dist/components/chat/Chat.d.ts +50 -5
- package/dist/components/chat/Chat.js +101 -6
- 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 +105 -6
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +2 -2
- package/dist/components/chat/Popup.js +105 -6
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +3 -3
- package/dist/components/chat/Sidebar.js +105 -6
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +3 -3
- package/dist/components/chat/index.js +105 -6
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +4 -4
- package/dist/components/index.js +105 -6
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +4 -4
- package/dist/index.js +107 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/package.json +7 -7
- package/src/components/chat/Chat.tsx +166 -7
- package/src/components/chat/Modal.tsx +4 -0
- package/dist/chunk-C5KOJ3IH.mjs.map +0 -1
- package/dist/chunk-QK6XA3PL.mjs.map +0 -1
- /package/dist/{chunk-TEZWY2BL.mjs.map → chunk-P54DK2TL.mjs.map} +0 -0
- /package/dist/{chunk-OJ5NVSTU.mjs.map → chunk-SEY3XSCD.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-P54DK2TL.mjs";
|
|
5
5
|
import "../../chunk-WB3YULQ4.mjs";
|
|
6
6
|
import {
|
|
7
7
|
CopilotPopup
|
|
8
|
-
} from "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
8
|
+
} from "../../chunk-SEY3XSCD.mjs";
|
|
9
|
+
import "../../chunk-H7LLXN6X.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-3QOICFXX.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
|
@@ -2046,6 +2046,7 @@ function DebugMenuButton({
|
|
|
2046
2046
|
}
|
|
2047
2047
|
|
|
2048
2048
|
// src/components/chat/Chat.tsx
|
|
2049
|
+
var import_react_core9 = require("@copilotkit/react-core");
|
|
2049
2050
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2050
2051
|
function CopilotChat({
|
|
2051
2052
|
instructions,
|
|
@@ -2053,6 +2054,8 @@ function CopilotChat({
|
|
|
2053
2054
|
makeSystemMessage,
|
|
2054
2055
|
showResponseButton = true,
|
|
2055
2056
|
onInProgress,
|
|
2057
|
+
onStopGeneration,
|
|
2058
|
+
onReloadMessages,
|
|
2056
2059
|
Messages: Messages2 = Messages,
|
|
2057
2060
|
RenderTextMessage: RenderTextMessage2 = RenderTextMessage,
|
|
2058
2061
|
RenderActionExecutionMessage: RenderActionExecutionMessage2 = RenderActionExecutionMessage,
|
|
@@ -2075,7 +2078,13 @@ function CopilotChat({
|
|
|
2075
2078
|
sendMessage,
|
|
2076
2079
|
stopGeneration,
|
|
2077
2080
|
reloadMessages
|
|
2078
|
-
} = useCopilotChatLogic(
|
|
2081
|
+
} = useCopilotChatLogic(
|
|
2082
|
+
makeSystemMessage,
|
|
2083
|
+
onInProgress,
|
|
2084
|
+
onSubmitMessage,
|
|
2085
|
+
onStopGeneration,
|
|
2086
|
+
onReloadMessages
|
|
2087
|
+
);
|
|
2079
2088
|
const chatContext = import_react11.default.useContext(ChatContext);
|
|
2080
2089
|
const isVisible = chatContext ? chatContext.open : true;
|
|
2081
2090
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
|
|
@@ -2131,8 +2140,15 @@ function WrappedCopilotChat({
|
|
|
2131
2140
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, { children });
|
|
2132
2141
|
}
|
|
2133
2142
|
var SUGGESTIONS_DEBOUNCE_TIMEOUT = 1e3;
|
|
2134
|
-
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) => {
|
|
2135
|
-
|
|
2143
|
+
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onStopGeneration, onReloadMessages) => {
|
|
2144
|
+
var _a;
|
|
2145
|
+
const {
|
|
2146
|
+
visibleMessages,
|
|
2147
|
+
appendMessage,
|
|
2148
|
+
reloadMessages: defaultReloadMessages,
|
|
2149
|
+
stopGeneration: defaultStopGeneration,
|
|
2150
|
+
isLoading
|
|
2151
|
+
} = (0, import_react_core8.useCopilotChat)({
|
|
2136
2152
|
id: (0, import_shared3.randomId)(),
|
|
2137
2153
|
makeSystemMessage
|
|
2138
2154
|
});
|
|
@@ -2140,8 +2156,8 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
2140
2156
|
const suggestionsAbortControllerRef = (0, import_react11.useRef)(null);
|
|
2141
2157
|
const debounceTimerRef = (0, import_react11.useRef)();
|
|
2142
2158
|
const abortSuggestions = () => {
|
|
2143
|
-
var
|
|
2144
|
-
(
|
|
2159
|
+
var _a2;
|
|
2160
|
+
(_a2 = suggestionsAbortControllerRef.current) == null ? void 0 : _a2.abort();
|
|
2145
2161
|
suggestionsAbortControllerRef.current = null;
|
|
2146
2162
|
};
|
|
2147
2163
|
const generalContext = (0, import_react_core8.useCopilotContext)();
|
|
@@ -2167,7 +2183,13 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
2167
2183
|
return () => {
|
|
2168
2184
|
clearTimeout(debounceTimerRef.current);
|
|
2169
2185
|
};
|
|
2170
|
-
}, [
|
|
2186
|
+
}, [
|
|
2187
|
+
isLoading,
|
|
2188
|
+
context.chatSuggestionConfiguration,
|
|
2189
|
+
// hackish way to trigger suggestions reload on reset, but better than moving suggestions to the
|
|
2190
|
+
// global context
|
|
2191
|
+
visibleMessages.length == 0
|
|
2192
|
+
]);
|
|
2171
2193
|
const sendMessage = (messageContent) => __async(void 0, null, function* () {
|
|
2172
2194
|
abortSuggestions();
|
|
2173
2195
|
setCurrentSuggestions([]);
|
|
@@ -2185,6 +2207,79 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
2185
2207
|
appendMessage(message);
|
|
2186
2208
|
return message;
|
|
2187
2209
|
});
|
|
2210
|
+
const messages = visibleMessages;
|
|
2211
|
+
const { setMessages } = messagesContext;
|
|
2212
|
+
const currentAgentName = (_a = generalContext.agentSession) == null ? void 0 : _a.agentName;
|
|
2213
|
+
const restartCurrentAgent = (hint) => __async(void 0, null, function* () {
|
|
2214
|
+
if (generalContext.agentSession) {
|
|
2215
|
+
generalContext.setAgentSession(__spreadProps(__spreadValues({}, generalContext.agentSession), {
|
|
2216
|
+
nodeName: void 0,
|
|
2217
|
+
threadId: void 0
|
|
2218
|
+
}));
|
|
2219
|
+
generalContext.setCoagentStates((prevAgentStates) => {
|
|
2220
|
+
return __spreadProps(__spreadValues({}, prevAgentStates), {
|
|
2221
|
+
[generalContext.agentSession.agentName]: __spreadProps(__spreadValues({}, prevAgentStates[generalContext.agentSession.agentName]), {
|
|
2222
|
+
threadId: void 0,
|
|
2223
|
+
nodeName: void 0,
|
|
2224
|
+
runId: void 0
|
|
2225
|
+
})
|
|
2226
|
+
});
|
|
2227
|
+
});
|
|
2228
|
+
}
|
|
2229
|
+
});
|
|
2230
|
+
const runCurrentAgent = (hint) => __async(void 0, null, function* () {
|
|
2231
|
+
if (generalContext.agentSession) {
|
|
2232
|
+
yield (0, import_react_core9.runAgent)(generalContext.agentSession.agentName, context, appendMessage, hint);
|
|
2233
|
+
}
|
|
2234
|
+
});
|
|
2235
|
+
const stopCurrentAgent = () => {
|
|
2236
|
+
if (generalContext.agentSession) {
|
|
2237
|
+
(0, import_react_core9.stopAgent)(generalContext.agentSession.agentName, context);
|
|
2238
|
+
}
|
|
2239
|
+
};
|
|
2240
|
+
const setCurrentAgentState = (state) => {
|
|
2241
|
+
if (generalContext.agentSession) {
|
|
2242
|
+
generalContext.setCoagentStates((prevAgentStates) => {
|
|
2243
|
+
return __spreadProps(__spreadValues({}, prevAgentStates), {
|
|
2244
|
+
[generalContext.agentSession.agentName]: {
|
|
2245
|
+
state
|
|
2246
|
+
}
|
|
2247
|
+
});
|
|
2248
|
+
});
|
|
2249
|
+
}
|
|
2250
|
+
};
|
|
2251
|
+
function stopGeneration() {
|
|
2252
|
+
if (onStopGeneration) {
|
|
2253
|
+
onStopGeneration({
|
|
2254
|
+
messages,
|
|
2255
|
+
setMessages,
|
|
2256
|
+
stopGeneration: defaultStopGeneration,
|
|
2257
|
+
currentAgentName,
|
|
2258
|
+
restartCurrentAgent,
|
|
2259
|
+
stopCurrentAgent,
|
|
2260
|
+
runCurrentAgent,
|
|
2261
|
+
setCurrentAgentState
|
|
2262
|
+
});
|
|
2263
|
+
} else {
|
|
2264
|
+
defaultStopGeneration();
|
|
2265
|
+
}
|
|
2266
|
+
}
|
|
2267
|
+
function reloadMessages() {
|
|
2268
|
+
if (onReloadMessages) {
|
|
2269
|
+
onReloadMessages({
|
|
2270
|
+
messages,
|
|
2271
|
+
setMessages,
|
|
2272
|
+
stopGeneration: defaultStopGeneration,
|
|
2273
|
+
currentAgentName,
|
|
2274
|
+
restartCurrentAgent,
|
|
2275
|
+
stopCurrentAgent,
|
|
2276
|
+
runCurrentAgent,
|
|
2277
|
+
setCurrentAgentState
|
|
2278
|
+
});
|
|
2279
|
+
} else {
|
|
2280
|
+
defaultReloadMessages();
|
|
2281
|
+
}
|
|
2282
|
+
}
|
|
2188
2283
|
return {
|
|
2189
2284
|
visibleMessages,
|
|
2190
2285
|
isLoading,
|
|
@@ -2204,6 +2299,8 @@ var CopilotModal = ({
|
|
|
2204
2299
|
hitEscapeToClose = true,
|
|
2205
2300
|
onSetOpen,
|
|
2206
2301
|
onSubmitMessage,
|
|
2302
|
+
onStopGeneration,
|
|
2303
|
+
onReloadMessages,
|
|
2207
2304
|
shortcut = "/",
|
|
2208
2305
|
icons,
|
|
2209
2306
|
labels,
|
|
@@ -2241,6 +2338,8 @@ var CopilotModal = ({
|
|
|
2241
2338
|
{
|
|
2242
2339
|
instructions,
|
|
2243
2340
|
onSubmitMessage,
|
|
2341
|
+
onStopGeneration,
|
|
2342
|
+
onReloadMessages,
|
|
2244
2343
|
makeSystemMessage,
|
|
2245
2344
|
showResponseButton,
|
|
2246
2345
|
onInProgress,
|