@copilotkit/react-ui 1.9.2-next.2 → 1.9.2-next.20
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 +166 -0
- package/dist/{chunk-RT4HE74K.mjs → chunk-4RAYX7ZX.mjs} +7 -5
- package/dist/chunk-4RAYX7ZX.mjs.map +1 -0
- package/dist/{chunk-UKCPOBQM.mjs → chunk-53CVDVS5.mjs} +5 -2
- package/dist/chunk-53CVDVS5.mjs.map +1 -0
- package/dist/{chunk-6HXS43LW.mjs → chunk-BP3RN6OE.mjs} +2 -2
- package/dist/{chunk-725PPN77.mjs → chunk-EQUUN7ZM.mjs} +8 -6
- package/dist/chunk-EQUUN7ZM.mjs.map +1 -0
- package/dist/{chunk-6JX4WIAX.mjs → chunk-TSDSBNOS.mjs} +2 -2
- package/dist/{chunk-EMIYIMQ6.mjs → chunk-X3LV7OXQ.mjs} +21 -11
- package/dist/chunk-X3LV7OXQ.mjs.map +1 -0
- package/dist/components/chat/Chat.d.ts +2 -1
- package/dist/components/chat/Chat.js +27 -12
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +4 -4
- package/dist/components/chat/Input.d.ts +1 -1
- package/dist/components/chat/Input.js +19 -9
- package/dist/components/chat/Input.js.map +1 -1
- package/dist/components/chat/Input.mjs +1 -1
- package/dist/components/chat/Modal.js +31 -14
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +5 -5
- package/dist/components/chat/Popup.js +31 -14
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +6 -6
- package/dist/components/chat/Sidebar.js +31 -14
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +6 -6
- package/dist/components/chat/index.js +31 -14
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +9 -9
- package/dist/components/chat/messages/AssistantMessage.mjs +1 -1
- package/dist/components/chat/messages/RenderActionExecutionMessage.js +4 -1
- package/dist/components/chat/messages/RenderActionExecutionMessage.js.map +1 -1
- package/dist/components/chat/messages/RenderActionExecutionMessage.mjs +2 -2
- package/dist/components/chat/messages/RenderAgentStateMessage.mjs +1 -1
- package/dist/components/chat/messages/RenderImageMessage.mjs +1 -1
- package/dist/components/chat/messages/RenderResultMessage.mjs +1 -1
- package/dist/components/chat/messages/RenderTextMessage.mjs +1 -1
- package/dist/components/chat/props.d.ts +1 -0
- package/dist/components/chat/props.js.map +1 -1
- package/dist/components/index.js +31 -14
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +9 -9
- package/dist/index.js +31 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -9
- package/package.json +4 -4
- package/src/components/chat/Chat.tsx +4 -0
- package/src/components/chat/Input.tsx +21 -11
- package/src/components/chat/Modal.tsx +6 -3
- package/src/components/chat/messages/RenderActionExecutionMessage.tsx +4 -2
- package/src/components/chat/props.ts +1 -0
- package/tsup.config.ts +1 -6
- package/dist/chunk-725PPN77.mjs.map +0 -1
- package/dist/chunk-EMIYIMQ6.mjs.map +0 -1
- package/dist/chunk-RT4HE74K.mjs.map +0 -1
- package/dist/chunk-UKCPOBQM.mjs.map +0 -1
- package/dist/lib/utils.test.d.ts +0 -2
- package/dist/lib/utils.test.js +0 -9
- package/dist/lib/utils.test.js.map +0 -1
- package/dist/lib/utils.test.mjs +0 -7
- package/dist/lib/utils.test.mjs.map +0 -1
- /package/dist/{chunk-6HXS43LW.mjs.map → chunk-BP3RN6OE.mjs.map} +0 -0
- /package/dist/{chunk-6JX4WIAX.mjs.map → chunk-TSDSBNOS.mjs.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotModal
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-EQUUN7ZM.mjs";
|
|
4
4
|
import "../../chunk-C3GSYRC3.mjs";
|
|
5
5
|
import "../../chunk-GVKA7RQQ.mjs";
|
|
6
6
|
import "../../chunk-V7W6IM2V.mjs";
|
|
@@ -11,8 +11,8 @@ import "../../chunk-KXE2JCUH.mjs";
|
|
|
11
11
|
import "../../chunk-NRA3CFEE.mjs";
|
|
12
12
|
import "../../chunk-BH6PCAAL.mjs";
|
|
13
13
|
import "../../chunk-UFN2VWSR.mjs";
|
|
14
|
-
import "../../chunk-
|
|
15
|
-
import "../../chunk-
|
|
14
|
+
import "../../chunk-4RAYX7ZX.mjs";
|
|
15
|
+
import "../../chunk-53CVDVS5.mjs";
|
|
16
16
|
import "../../chunk-2II3Q27P.mjs";
|
|
17
17
|
import "../../chunk-ULDQXCED.mjs";
|
|
18
18
|
import "../../chunk-C7OB63U5.mjs";
|
|
@@ -22,13 +22,13 @@ import "../../chunk-HWMFMBJC.mjs";
|
|
|
22
22
|
import "../../chunk-QGSPTXOV.mjs";
|
|
23
23
|
import "../../chunk-IMBPSLL4.mjs";
|
|
24
24
|
import "../../chunk-PLHTVHUW.mjs";
|
|
25
|
-
import "../../chunk-
|
|
25
|
+
import "../../chunk-X3LV7OXQ.mjs";
|
|
26
26
|
import "../../chunk-CGEAG65D.mjs";
|
|
27
27
|
import "../../chunk-YQFVRDNC.mjs";
|
|
28
28
|
import "../../chunk-YTXEWDNC.mjs";
|
|
29
|
-
import "../../chunk-KENCH7RN.mjs";
|
|
30
29
|
import "../../chunk-B3D7U7TJ.mjs";
|
|
31
30
|
import "../../chunk-IEMQ2SQW.mjs";
|
|
31
|
+
import "../../chunk-KENCH7RN.mjs";
|
|
32
32
|
import "../../chunk-XWG3L6QC.mjs";
|
|
33
33
|
import "../../chunk-54JAUBUJ.mjs";
|
|
34
34
|
import "../../chunk-JGMFJZMG.mjs";
|
|
@@ -1416,8 +1416,15 @@ function PoweredByTag({ showPoweredBy = true }) {
|
|
|
1416
1416
|
// src/components/chat/Input.tsx
|
|
1417
1417
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1418
1418
|
var MAX_NEWLINES = 6;
|
|
1419
|
-
var Input = ({
|
|
1420
|
-
|
|
1419
|
+
var Input = ({
|
|
1420
|
+
inProgress,
|
|
1421
|
+
onSend,
|
|
1422
|
+
isVisible = false,
|
|
1423
|
+
onStop,
|
|
1424
|
+
onUpload,
|
|
1425
|
+
hideStopButton = false
|
|
1426
|
+
}) => {
|
|
1427
|
+
var _a, _b;
|
|
1421
1428
|
const context = useChatContext();
|
|
1422
1429
|
const copilotContext = (0, import_react_core6.useCopilotContext)();
|
|
1423
1430
|
const showPoweredBy = !((_a = copilotContext.copilotApiConfig) == null ? void 0 : _a.publicApiKey);
|
|
@@ -1446,15 +1453,18 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
|
|
|
1446
1453
|
inProgress
|
|
1447
1454
|
});
|
|
1448
1455
|
const isInProgress = inProgress || pushToTalkState === "transcribing";
|
|
1449
|
-
const buttonIcon = isInProgress ? context.icons.stopIcon : context.icons.sendIcon;
|
|
1456
|
+
const buttonIcon = isInProgress && !hideStopButton ? context.icons.stopIcon : context.icons.sendIcon;
|
|
1450
1457
|
const showPushToTalk = pushToTalkConfigured && (pushToTalkState === "idle" || pushToTalkState === "recording") && !inProgress;
|
|
1451
|
-
const canSend = () => {
|
|
1458
|
+
const canSend = (0, import_react9.useMemo)(() => {
|
|
1452
1459
|
var _a2;
|
|
1453
1460
|
const interruptEvent = (_a2 = copilotContext.langGraphInterruptAction) == null ? void 0 : _a2.event;
|
|
1454
1461
|
const interruptInProgress = (interruptEvent == null ? void 0 : interruptEvent.name) === "LangGraphInterruptEvent" && !(interruptEvent == null ? void 0 : interruptEvent.response);
|
|
1455
|
-
return
|
|
1456
|
-
};
|
|
1457
|
-
const
|
|
1462
|
+
return !isInProgress && text.trim().length > 0 && pushToTalkState === "idle" && !interruptInProgress;
|
|
1463
|
+
}, [(_b = copilotContext.langGraphInterruptAction) == null ? void 0 : _b.event, isInProgress, text, pushToTalkState]);
|
|
1464
|
+
const canStop = (0, import_react9.useMemo)(() => {
|
|
1465
|
+
return isInProgress && !hideStopButton;
|
|
1466
|
+
}, [isInProgress, hideStopButton]);
|
|
1467
|
+
const sendDisabled = !canSend && !canStop;
|
|
1458
1468
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `copilotKitInputContainer ${showPoweredBy ? "poweredByContainer" : ""}`, children: [
|
|
1459
1469
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
|
|
1460
1470
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
@@ -1469,7 +1479,7 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
|
|
|
1469
1479
|
onKeyDown: (event) => {
|
|
1470
1480
|
if (event.key === "Enter" && !event.shiftKey) {
|
|
1471
1481
|
event.preventDefault();
|
|
1472
|
-
if (canSend
|
|
1482
|
+
if (canSend) {
|
|
1473
1483
|
send();
|
|
1474
1484
|
}
|
|
1475
1485
|
}
|
|
@@ -1491,7 +1501,7 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
|
|
|
1491
1501
|
"button",
|
|
1492
1502
|
{
|
|
1493
1503
|
disabled: sendDisabled,
|
|
1494
|
-
onClick: isInProgress ? onStop : send,
|
|
1504
|
+
onClick: isInProgress && !hideStopButton ? onStop : send,
|
|
1495
1505
|
"data-copilotkit-in-progress": inProgress,
|
|
1496
1506
|
"data-test-id": inProgress ? "copilot-chat-request-in-progress" : "copilot-chat-ready",
|
|
1497
1507
|
className: "copilotKitInputControlButton",
|
|
@@ -2215,9 +2225,12 @@ function RenderActionExecutionMessage(_a) {
|
|
|
2215
2225
|
try {
|
|
2216
2226
|
const toRender = render({
|
|
2217
2227
|
status,
|
|
2228
|
+
// Cast to any as RenderFunctionStatus is a union that can be complex to narrow here
|
|
2218
2229
|
args,
|
|
2219
2230
|
result: actionResult,
|
|
2220
|
-
name: message.name
|
|
2231
|
+
name: message.name,
|
|
2232
|
+
messageId: message.id
|
|
2233
|
+
// Pass messageId for HITL action correlation
|
|
2221
2234
|
});
|
|
2222
2235
|
if (!toRender && status === "complete") {
|
|
2223
2236
|
return null;
|
|
@@ -2697,7 +2710,8 @@ function CopilotChat({
|
|
|
2697
2710
|
AssistantMessage: AssistantMessage2 = AssistantMessage,
|
|
2698
2711
|
UserMessage: UserMessage2 = UserMessage,
|
|
2699
2712
|
imageUploadsEnabled,
|
|
2700
|
-
inputFileAccept = "image/*"
|
|
2713
|
+
inputFileAccept = "image/*",
|
|
2714
|
+
hideStopButton
|
|
2701
2715
|
}) {
|
|
2702
2716
|
const { additionalInstructions, setChatInstructions } = (0, import_react_core10.useCopilotContext)();
|
|
2703
2717
|
const [selectedImages, setSelectedImages] = (0, import_react13.useState)([]);
|
|
@@ -2880,7 +2894,8 @@ function CopilotChat({
|
|
|
2880
2894
|
onUpload: imageUploadsEnabled ? () => {
|
|
2881
2895
|
var _a;
|
|
2882
2896
|
return (_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
2883
|
-
} : void 0
|
|
2897
|
+
} : void 0,
|
|
2898
|
+
hideStopButton
|
|
2884
2899
|
}
|
|
2885
2900
|
)
|
|
2886
2901
|
] });
|
|
@@ -3145,8 +3160,10 @@ var CopilotModal = (_a) => {
|
|
|
3145
3160
|
onSetOpen == null ? void 0 : onSetOpen(open);
|
|
3146
3161
|
setOpenState(open);
|
|
3147
3162
|
};
|
|
3163
|
+
const memoizedHeader = (0, import_react14.useMemo)(() => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Header2, {}), [Header2]);
|
|
3164
|
+
const memoizedChildren = (0, import_react14.useMemo)(() => children, [children]);
|
|
3148
3165
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(ChatContextProvider, { icons, labels, open: openState, setOpen, children: [
|
|
3149
|
-
|
|
3166
|
+
memoizedChildren,
|
|
3150
3167
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className, children: [
|
|
3151
3168
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button2, {}),
|
|
3152
3169
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
@@ -3156,7 +3173,7 @@ var CopilotModal = (_a) => {
|
|
|
3156
3173
|
shortcut,
|
|
3157
3174
|
hitEscapeToClose,
|
|
3158
3175
|
children: [
|
|
3159
|
-
|
|
3176
|
+
memoizedHeader,
|
|
3160
3177
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3161
3178
|
CopilotChat,
|
|
3162
3179
|
__spreadProps(__spreadValues({}, props), {
|