@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,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotSidebar
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-TSDSBNOS.mjs";
|
|
4
|
+
import "../../chunk-EQUUN7ZM.mjs";
|
|
5
5
|
import "../../chunk-C3GSYRC3.mjs";
|
|
6
6
|
import "../../chunk-GVKA7RQQ.mjs";
|
|
7
7
|
import "../../chunk-V7W6IM2V.mjs";
|
|
@@ -12,8 +12,8 @@ import "../../chunk-KXE2JCUH.mjs";
|
|
|
12
12
|
import "../../chunk-NRA3CFEE.mjs";
|
|
13
13
|
import "../../chunk-BH6PCAAL.mjs";
|
|
14
14
|
import "../../chunk-UFN2VWSR.mjs";
|
|
15
|
-
import "../../chunk-
|
|
16
|
-
import "../../chunk-
|
|
15
|
+
import "../../chunk-4RAYX7ZX.mjs";
|
|
16
|
+
import "../../chunk-53CVDVS5.mjs";
|
|
17
17
|
import "../../chunk-2II3Q27P.mjs";
|
|
18
18
|
import "../../chunk-ULDQXCED.mjs";
|
|
19
19
|
import "../../chunk-C7OB63U5.mjs";
|
|
@@ -23,13 +23,13 @@ import "../../chunk-HWMFMBJC.mjs";
|
|
|
23
23
|
import "../../chunk-QGSPTXOV.mjs";
|
|
24
24
|
import "../../chunk-IMBPSLL4.mjs";
|
|
25
25
|
import "../../chunk-PLHTVHUW.mjs";
|
|
26
|
-
import "../../chunk-
|
|
26
|
+
import "../../chunk-X3LV7OXQ.mjs";
|
|
27
27
|
import "../../chunk-CGEAG65D.mjs";
|
|
28
28
|
import "../../chunk-YQFVRDNC.mjs";
|
|
29
29
|
import "../../chunk-YTXEWDNC.mjs";
|
|
30
|
-
import "../../chunk-KENCH7RN.mjs";
|
|
31
30
|
import "../../chunk-B3D7U7TJ.mjs";
|
|
32
31
|
import "../../chunk-IEMQ2SQW.mjs";
|
|
32
|
+
import "../../chunk-KENCH7RN.mjs";
|
|
33
33
|
import "../../chunk-XWG3L6QC.mjs";
|
|
34
34
|
import "../../chunk-54JAUBUJ.mjs";
|
|
35
35
|
import "../../chunk-JGMFJZMG.mjs";
|
|
@@ -1425,8 +1425,15 @@ function PoweredByTag({ showPoweredBy = true }) {
|
|
|
1425
1425
|
// src/components/chat/Input.tsx
|
|
1426
1426
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1427
1427
|
var MAX_NEWLINES = 6;
|
|
1428
|
-
var Input = ({
|
|
1429
|
-
|
|
1428
|
+
var Input = ({
|
|
1429
|
+
inProgress,
|
|
1430
|
+
onSend,
|
|
1431
|
+
isVisible = false,
|
|
1432
|
+
onStop,
|
|
1433
|
+
onUpload,
|
|
1434
|
+
hideStopButton = false
|
|
1435
|
+
}) => {
|
|
1436
|
+
var _a, _b;
|
|
1430
1437
|
const context = useChatContext();
|
|
1431
1438
|
const copilotContext = (0, import_react_core6.useCopilotContext)();
|
|
1432
1439
|
const showPoweredBy = !((_a = copilotContext.copilotApiConfig) == null ? void 0 : _a.publicApiKey);
|
|
@@ -1455,15 +1462,18 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
|
|
|
1455
1462
|
inProgress
|
|
1456
1463
|
});
|
|
1457
1464
|
const isInProgress = inProgress || pushToTalkState === "transcribing";
|
|
1458
|
-
const buttonIcon = isInProgress ? context.icons.stopIcon : context.icons.sendIcon;
|
|
1465
|
+
const buttonIcon = isInProgress && !hideStopButton ? context.icons.stopIcon : context.icons.sendIcon;
|
|
1459
1466
|
const showPushToTalk = pushToTalkConfigured && (pushToTalkState === "idle" || pushToTalkState === "recording") && !inProgress;
|
|
1460
|
-
const canSend = () => {
|
|
1467
|
+
const canSend = (0, import_react9.useMemo)(() => {
|
|
1461
1468
|
var _a2;
|
|
1462
1469
|
const interruptEvent = (_a2 = copilotContext.langGraphInterruptAction) == null ? void 0 : _a2.event;
|
|
1463
1470
|
const interruptInProgress = (interruptEvent == null ? void 0 : interruptEvent.name) === "LangGraphInterruptEvent" && !(interruptEvent == null ? void 0 : interruptEvent.response);
|
|
1464
|
-
return
|
|
1465
|
-
};
|
|
1466
|
-
const
|
|
1471
|
+
return !isInProgress && text.trim().length > 0 && pushToTalkState === "idle" && !interruptInProgress;
|
|
1472
|
+
}, [(_b = copilotContext.langGraphInterruptAction) == null ? void 0 : _b.event, isInProgress, text, pushToTalkState]);
|
|
1473
|
+
const canStop = (0, import_react9.useMemo)(() => {
|
|
1474
|
+
return isInProgress && !hideStopButton;
|
|
1475
|
+
}, [isInProgress, hideStopButton]);
|
|
1476
|
+
const sendDisabled = !canSend && !canStop;
|
|
1467
1477
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `copilotKitInputContainer ${showPoweredBy ? "poweredByContainer" : ""}`, children: [
|
|
1468
1478
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
|
|
1469
1479
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
@@ -1478,7 +1488,7 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
|
|
|
1478
1488
|
onKeyDown: (event) => {
|
|
1479
1489
|
if (event.key === "Enter" && !event.shiftKey) {
|
|
1480
1490
|
event.preventDefault();
|
|
1481
|
-
if (canSend
|
|
1491
|
+
if (canSend) {
|
|
1482
1492
|
send();
|
|
1483
1493
|
}
|
|
1484
1494
|
}
|
|
@@ -1500,7 +1510,7 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
|
|
|
1500
1510
|
"button",
|
|
1501
1511
|
{
|
|
1502
1512
|
disabled: sendDisabled,
|
|
1503
|
-
onClick: isInProgress ? onStop : send,
|
|
1513
|
+
onClick: isInProgress && !hideStopButton ? onStop : send,
|
|
1504
1514
|
"data-copilotkit-in-progress": inProgress,
|
|
1505
1515
|
"data-test-id": inProgress ? "copilot-chat-request-in-progress" : "copilot-chat-ready",
|
|
1506
1516
|
className: "copilotKitInputControlButton",
|
|
@@ -2224,9 +2234,12 @@ function RenderActionExecutionMessage(_a) {
|
|
|
2224
2234
|
try {
|
|
2225
2235
|
const toRender = render({
|
|
2226
2236
|
status,
|
|
2237
|
+
// Cast to any as RenderFunctionStatus is a union that can be complex to narrow here
|
|
2227
2238
|
args,
|
|
2228
2239
|
result: actionResult,
|
|
2229
|
-
name: message.name
|
|
2240
|
+
name: message.name,
|
|
2241
|
+
messageId: message.id
|
|
2242
|
+
// Pass messageId for HITL action correlation
|
|
2230
2243
|
});
|
|
2231
2244
|
if (!toRender && status === "complete") {
|
|
2232
2245
|
return null;
|
|
@@ -2706,7 +2719,8 @@ function CopilotChat({
|
|
|
2706
2719
|
AssistantMessage: AssistantMessage2 = AssistantMessage,
|
|
2707
2720
|
UserMessage: UserMessage2 = UserMessage,
|
|
2708
2721
|
imageUploadsEnabled,
|
|
2709
|
-
inputFileAccept = "image/*"
|
|
2722
|
+
inputFileAccept = "image/*",
|
|
2723
|
+
hideStopButton
|
|
2710
2724
|
}) {
|
|
2711
2725
|
const { additionalInstructions, setChatInstructions } = (0, import_react_core10.useCopilotContext)();
|
|
2712
2726
|
const [selectedImages, setSelectedImages] = (0, import_react13.useState)([]);
|
|
@@ -2889,7 +2903,8 @@ function CopilotChat({
|
|
|
2889
2903
|
onUpload: imageUploadsEnabled ? () => {
|
|
2890
2904
|
var _a;
|
|
2891
2905
|
return (_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
2892
|
-
} : void 0
|
|
2906
|
+
} : void 0,
|
|
2907
|
+
hideStopButton
|
|
2893
2908
|
}
|
|
2894
2909
|
)
|
|
2895
2910
|
] });
|
|
@@ -3154,8 +3169,10 @@ var CopilotModal = (_a) => {
|
|
|
3154
3169
|
onSetOpen == null ? void 0 : onSetOpen(open);
|
|
3155
3170
|
setOpenState(open);
|
|
3156
3171
|
};
|
|
3172
|
+
const memoizedHeader = (0, import_react14.useMemo)(() => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Header2, {}), [Header2]);
|
|
3173
|
+
const memoizedChildren = (0, import_react14.useMemo)(() => children, [children]);
|
|
3157
3174
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(ChatContextProvider, { icons, labels, open: openState, setOpen, children: [
|
|
3158
|
-
|
|
3175
|
+
memoizedChildren,
|
|
3159
3176
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className, children: [
|
|
3160
3177
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button2, {}),
|
|
3161
3178
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
@@ -3165,7 +3182,7 @@ var CopilotModal = (_a) => {
|
|
|
3165
3182
|
shortcut,
|
|
3166
3183
|
hitEscapeToClose,
|
|
3167
3184
|
children: [
|
|
3168
|
-
|
|
3185
|
+
memoizedHeader,
|
|
3169
3186
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3170
3187
|
CopilotChat,
|
|
3171
3188
|
__spreadProps(__spreadValues({}, props), {
|