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