@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
|
@@ -2,18 +2,18 @@ import "../chunk-JD7BAH7U.mjs";
|
|
|
2
2
|
import "../chunk-MRFF7GSQ.mjs";
|
|
3
3
|
import {
|
|
4
4
|
CopilotSidebar
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-P54DK2TL.mjs";
|
|
6
6
|
import "../chunk-WB3YULQ4.mjs";
|
|
7
7
|
import {
|
|
8
8
|
CopilotPopup
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import "../chunk-
|
|
9
|
+
} from "../chunk-SEY3XSCD.mjs";
|
|
10
|
+
import "../chunk-H7LLXN6X.mjs";
|
|
11
11
|
import "../chunk-YAGE7RCE.mjs";
|
|
12
12
|
import "../chunk-VEC45H6Q.mjs";
|
|
13
13
|
import "../chunk-RQNJNK2W.mjs";
|
|
14
14
|
import {
|
|
15
15
|
CopilotChat
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-3QOICFXX.mjs";
|
|
17
17
|
import "../chunk-V7W6IM2V.mjs";
|
|
18
18
|
import "../chunk-OMTPWC7T.mjs";
|
|
19
19
|
import "../chunk-ZABXREBH.mjs";
|
package/dist/index.js
CHANGED
|
@@ -2048,6 +2048,7 @@ function DebugMenuButton({
|
|
|
2048
2048
|
}
|
|
2049
2049
|
|
|
2050
2050
|
// src/components/chat/Chat.tsx
|
|
2051
|
+
var import_react_core9 = require("@copilotkit/react-core");
|
|
2051
2052
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2052
2053
|
function CopilotChat({
|
|
2053
2054
|
instructions,
|
|
@@ -2055,6 +2056,8 @@ function CopilotChat({
|
|
|
2055
2056
|
makeSystemMessage,
|
|
2056
2057
|
showResponseButton = true,
|
|
2057
2058
|
onInProgress,
|
|
2059
|
+
onStopGeneration,
|
|
2060
|
+
onReloadMessages,
|
|
2058
2061
|
Messages: Messages2 = Messages,
|
|
2059
2062
|
RenderTextMessage: RenderTextMessage2 = RenderTextMessage,
|
|
2060
2063
|
RenderActionExecutionMessage: RenderActionExecutionMessage2 = RenderActionExecutionMessage,
|
|
@@ -2077,7 +2080,13 @@ function CopilotChat({
|
|
|
2077
2080
|
sendMessage,
|
|
2078
2081
|
stopGeneration,
|
|
2079
2082
|
reloadMessages
|
|
2080
|
-
} = useCopilotChatLogic(
|
|
2083
|
+
} = useCopilotChatLogic(
|
|
2084
|
+
makeSystemMessage,
|
|
2085
|
+
onInProgress,
|
|
2086
|
+
onSubmitMessage,
|
|
2087
|
+
onStopGeneration,
|
|
2088
|
+
onReloadMessages
|
|
2089
|
+
);
|
|
2081
2090
|
const chatContext = import_react11.default.useContext(ChatContext);
|
|
2082
2091
|
const isVisible = chatContext ? chatContext.open : true;
|
|
2083
2092
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
|
|
@@ -2133,8 +2142,15 @@ function WrappedCopilotChat({
|
|
|
2133
2142
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, { children });
|
|
2134
2143
|
}
|
|
2135
2144
|
var SUGGESTIONS_DEBOUNCE_TIMEOUT = 1e3;
|
|
2136
|
-
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) => {
|
|
2137
|
-
|
|
2145
|
+
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onStopGeneration, onReloadMessages) => {
|
|
2146
|
+
var _a;
|
|
2147
|
+
const {
|
|
2148
|
+
visibleMessages,
|
|
2149
|
+
appendMessage,
|
|
2150
|
+
reloadMessages: defaultReloadMessages,
|
|
2151
|
+
stopGeneration: defaultStopGeneration,
|
|
2152
|
+
isLoading
|
|
2153
|
+
} = (0, import_react_core8.useCopilotChat)({
|
|
2138
2154
|
id: (0, import_shared3.randomId)(),
|
|
2139
2155
|
makeSystemMessage
|
|
2140
2156
|
});
|
|
@@ -2142,8 +2158,8 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
2142
2158
|
const suggestionsAbortControllerRef = (0, import_react11.useRef)(null);
|
|
2143
2159
|
const debounceTimerRef = (0, import_react11.useRef)();
|
|
2144
2160
|
const abortSuggestions = () => {
|
|
2145
|
-
var
|
|
2146
|
-
(
|
|
2161
|
+
var _a2;
|
|
2162
|
+
(_a2 = suggestionsAbortControllerRef.current) == null ? void 0 : _a2.abort();
|
|
2147
2163
|
suggestionsAbortControllerRef.current = null;
|
|
2148
2164
|
};
|
|
2149
2165
|
const generalContext = (0, import_react_core8.useCopilotContext)();
|
|
@@ -2169,7 +2185,13 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
2169
2185
|
return () => {
|
|
2170
2186
|
clearTimeout(debounceTimerRef.current);
|
|
2171
2187
|
};
|
|
2172
|
-
}, [
|
|
2188
|
+
}, [
|
|
2189
|
+
isLoading,
|
|
2190
|
+
context.chatSuggestionConfiguration,
|
|
2191
|
+
// hackish way to trigger suggestions reload on reset, but better than moving suggestions to the
|
|
2192
|
+
// global context
|
|
2193
|
+
visibleMessages.length == 0
|
|
2194
|
+
]);
|
|
2173
2195
|
const sendMessage = (messageContent) => __async(void 0, null, function* () {
|
|
2174
2196
|
abortSuggestions();
|
|
2175
2197
|
setCurrentSuggestions([]);
|
|
@@ -2187,6 +2209,79 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
2187
2209
|
appendMessage(message);
|
|
2188
2210
|
return message;
|
|
2189
2211
|
});
|
|
2212
|
+
const messages = visibleMessages;
|
|
2213
|
+
const { setMessages } = messagesContext;
|
|
2214
|
+
const currentAgentName = (_a = generalContext.agentSession) == null ? void 0 : _a.agentName;
|
|
2215
|
+
const restartCurrentAgent = (hint) => __async(void 0, null, function* () {
|
|
2216
|
+
if (generalContext.agentSession) {
|
|
2217
|
+
generalContext.setAgentSession(__spreadProps(__spreadValues({}, generalContext.agentSession), {
|
|
2218
|
+
nodeName: void 0,
|
|
2219
|
+
threadId: void 0
|
|
2220
|
+
}));
|
|
2221
|
+
generalContext.setCoagentStates((prevAgentStates) => {
|
|
2222
|
+
return __spreadProps(__spreadValues({}, prevAgentStates), {
|
|
2223
|
+
[generalContext.agentSession.agentName]: __spreadProps(__spreadValues({}, prevAgentStates[generalContext.agentSession.agentName]), {
|
|
2224
|
+
threadId: void 0,
|
|
2225
|
+
nodeName: void 0,
|
|
2226
|
+
runId: void 0
|
|
2227
|
+
})
|
|
2228
|
+
});
|
|
2229
|
+
});
|
|
2230
|
+
}
|
|
2231
|
+
});
|
|
2232
|
+
const runCurrentAgent = (hint) => __async(void 0, null, function* () {
|
|
2233
|
+
if (generalContext.agentSession) {
|
|
2234
|
+
yield (0, import_react_core9.runAgent)(generalContext.agentSession.agentName, context, appendMessage, hint);
|
|
2235
|
+
}
|
|
2236
|
+
});
|
|
2237
|
+
const stopCurrentAgent = () => {
|
|
2238
|
+
if (generalContext.agentSession) {
|
|
2239
|
+
(0, import_react_core9.stopAgent)(generalContext.agentSession.agentName, context);
|
|
2240
|
+
}
|
|
2241
|
+
};
|
|
2242
|
+
const setCurrentAgentState = (state) => {
|
|
2243
|
+
if (generalContext.agentSession) {
|
|
2244
|
+
generalContext.setCoagentStates((prevAgentStates) => {
|
|
2245
|
+
return __spreadProps(__spreadValues({}, prevAgentStates), {
|
|
2246
|
+
[generalContext.agentSession.agentName]: {
|
|
2247
|
+
state
|
|
2248
|
+
}
|
|
2249
|
+
});
|
|
2250
|
+
});
|
|
2251
|
+
}
|
|
2252
|
+
};
|
|
2253
|
+
function stopGeneration() {
|
|
2254
|
+
if (onStopGeneration) {
|
|
2255
|
+
onStopGeneration({
|
|
2256
|
+
messages,
|
|
2257
|
+
setMessages,
|
|
2258
|
+
stopGeneration: defaultStopGeneration,
|
|
2259
|
+
currentAgentName,
|
|
2260
|
+
restartCurrentAgent,
|
|
2261
|
+
stopCurrentAgent,
|
|
2262
|
+
runCurrentAgent,
|
|
2263
|
+
setCurrentAgentState
|
|
2264
|
+
});
|
|
2265
|
+
} else {
|
|
2266
|
+
defaultStopGeneration();
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
function reloadMessages() {
|
|
2270
|
+
if (onReloadMessages) {
|
|
2271
|
+
onReloadMessages({
|
|
2272
|
+
messages,
|
|
2273
|
+
setMessages,
|
|
2274
|
+
stopGeneration: defaultStopGeneration,
|
|
2275
|
+
currentAgentName,
|
|
2276
|
+
restartCurrentAgent,
|
|
2277
|
+
stopCurrentAgent,
|
|
2278
|
+
runCurrentAgent,
|
|
2279
|
+
setCurrentAgentState
|
|
2280
|
+
});
|
|
2281
|
+
} else {
|
|
2282
|
+
defaultReloadMessages();
|
|
2283
|
+
}
|
|
2284
|
+
}
|
|
2190
2285
|
return {
|
|
2191
2286
|
visibleMessages,
|
|
2192
2287
|
isLoading,
|
|
@@ -2206,6 +2301,8 @@ var CopilotModal = ({
|
|
|
2206
2301
|
hitEscapeToClose = true,
|
|
2207
2302
|
onSetOpen,
|
|
2208
2303
|
onSubmitMessage,
|
|
2304
|
+
onStopGeneration,
|
|
2305
|
+
onReloadMessages,
|
|
2209
2306
|
shortcut = "/",
|
|
2210
2307
|
icons,
|
|
2211
2308
|
labels,
|
|
@@ -2243,6 +2340,8 @@ var CopilotModal = ({
|
|
|
2243
2340
|
{
|
|
2244
2341
|
instructions,
|
|
2245
2342
|
onSubmitMessage,
|
|
2343
|
+
onStopGeneration,
|
|
2344
|
+
onReloadMessages,
|
|
2246
2345
|
makeSystemMessage,
|
|
2247
2346
|
showResponseButton,
|
|
2248
2347
|
onInProgress,
|
|
@@ -2287,7 +2386,7 @@ function CopilotSidebar(props) {
|
|
|
2287
2386
|
|
|
2288
2387
|
// src/hooks/use-copilot-chat-suggestions.tsx
|
|
2289
2388
|
var import_react14 = require("react");
|
|
2290
|
-
var
|
|
2389
|
+
var import_react_core10 = require("@copilotkit/react-core");
|
|
2291
2390
|
var import_shared4 = require("@copilotkit/shared");
|
|
2292
2391
|
function useCopilotChatSuggestions({
|
|
2293
2392
|
instructions,
|
|
@@ -2295,7 +2394,7 @@ function useCopilotChatSuggestions({
|
|
|
2295
2394
|
minSuggestions = 1,
|
|
2296
2395
|
maxSuggestions = 3
|
|
2297
2396
|
}, dependencies = []) {
|
|
2298
|
-
const context = (0,
|
|
2397
|
+
const context = (0, import_react_core10.useCopilotContext)();
|
|
2299
2398
|
(0, import_react14.useEffect)(() => {
|
|
2300
2399
|
const id = (0, import_shared4.randomId)();
|
|
2301
2400
|
context.addChatSuggestionConfiguration(id, {
|