@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,13 +1,13 @@
|
|
|
1
1
|
import "../chunk-MMVDU6DF.mjs";
|
|
2
2
|
import "../chunk-SC6JRFAJ.mjs";
|
|
3
|
+
import {
|
|
4
|
+
CopilotSidebar
|
|
5
|
+
} from "../chunk-TSDSBNOS.mjs";
|
|
3
6
|
import "../chunk-WB3YULQ4.mjs";
|
|
4
7
|
import {
|
|
5
8
|
CopilotPopup
|
|
6
|
-
} from "../chunk-
|
|
7
|
-
import
|
|
8
|
-
CopilotSidebar
|
|
9
|
-
} from "../chunk-6JX4WIAX.mjs";
|
|
10
|
-
import "../chunk-725PPN77.mjs";
|
|
9
|
+
} from "../chunk-BP3RN6OE.mjs";
|
|
10
|
+
import "../chunk-EQUUN7ZM.mjs";
|
|
11
11
|
import "../chunk-C3GSYRC3.mjs";
|
|
12
12
|
import "../chunk-GVKA7RQQ.mjs";
|
|
13
13
|
import "../chunk-V7W6IM2V.mjs";
|
|
@@ -24,8 +24,8 @@ import "../chunk-BH6PCAAL.mjs";
|
|
|
24
24
|
import "../chunk-UFN2VWSR.mjs";
|
|
25
25
|
import {
|
|
26
26
|
CopilotChat
|
|
27
|
-
} from "../chunk-
|
|
28
|
-
import "../chunk-
|
|
27
|
+
} from "../chunk-4RAYX7ZX.mjs";
|
|
28
|
+
import "../chunk-53CVDVS5.mjs";
|
|
29
29
|
import "../chunk-2II3Q27P.mjs";
|
|
30
30
|
import {
|
|
31
31
|
RenderImageMessage
|
|
@@ -45,17 +45,17 @@ import {
|
|
|
45
45
|
Suggestion
|
|
46
46
|
} from "../chunk-IMBPSLL4.mjs";
|
|
47
47
|
import "../chunk-PLHTVHUW.mjs";
|
|
48
|
-
import "../chunk-
|
|
48
|
+
import "../chunk-X3LV7OXQ.mjs";
|
|
49
49
|
import "../chunk-CGEAG65D.mjs";
|
|
50
50
|
import "../chunk-YQFVRDNC.mjs";
|
|
51
51
|
import {
|
|
52
52
|
Markdown
|
|
53
53
|
} from "../chunk-YTXEWDNC.mjs";
|
|
54
|
-
import "../chunk-KENCH7RN.mjs";
|
|
55
54
|
import "../chunk-B3D7U7TJ.mjs";
|
|
56
55
|
import {
|
|
57
56
|
useChatContext
|
|
58
57
|
} from "../chunk-IEMQ2SQW.mjs";
|
|
58
|
+
import "../chunk-KENCH7RN.mjs";
|
|
59
59
|
import "../chunk-XWG3L6QC.mjs";
|
|
60
60
|
import "../chunk-54JAUBUJ.mjs";
|
|
61
61
|
import "../chunk-JGMFJZMG.mjs";
|
package/dist/index.js
CHANGED
|
@@ -1429,8 +1429,15 @@ function PoweredByTag({ showPoweredBy = true }) {
|
|
|
1429
1429
|
// src/components/chat/Input.tsx
|
|
1430
1430
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1431
1431
|
var MAX_NEWLINES = 6;
|
|
1432
|
-
var Input = ({
|
|
1433
|
-
|
|
1432
|
+
var Input = ({
|
|
1433
|
+
inProgress,
|
|
1434
|
+
onSend,
|
|
1435
|
+
isVisible = false,
|
|
1436
|
+
onStop,
|
|
1437
|
+
onUpload,
|
|
1438
|
+
hideStopButton = false
|
|
1439
|
+
}) => {
|
|
1440
|
+
var _a, _b;
|
|
1434
1441
|
const context = useChatContext();
|
|
1435
1442
|
const copilotContext = (0, import_react_core6.useCopilotContext)();
|
|
1436
1443
|
const showPoweredBy = !((_a = copilotContext.copilotApiConfig) == null ? void 0 : _a.publicApiKey);
|
|
@@ -1459,15 +1466,18 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
|
|
|
1459
1466
|
inProgress
|
|
1460
1467
|
});
|
|
1461
1468
|
const isInProgress = inProgress || pushToTalkState === "transcribing";
|
|
1462
|
-
const buttonIcon = isInProgress ? context.icons.stopIcon : context.icons.sendIcon;
|
|
1469
|
+
const buttonIcon = isInProgress && !hideStopButton ? context.icons.stopIcon : context.icons.sendIcon;
|
|
1463
1470
|
const showPushToTalk = pushToTalkConfigured && (pushToTalkState === "idle" || pushToTalkState === "recording") && !inProgress;
|
|
1464
|
-
const canSend = () => {
|
|
1471
|
+
const canSend = (0, import_react9.useMemo)(() => {
|
|
1465
1472
|
var _a2;
|
|
1466
1473
|
const interruptEvent = (_a2 = copilotContext.langGraphInterruptAction) == null ? void 0 : _a2.event;
|
|
1467
1474
|
const interruptInProgress = (interruptEvent == null ? void 0 : interruptEvent.name) === "LangGraphInterruptEvent" && !(interruptEvent == null ? void 0 : interruptEvent.response);
|
|
1468
|
-
return
|
|
1469
|
-
};
|
|
1470
|
-
const
|
|
1475
|
+
return !isInProgress && text.trim().length > 0 && pushToTalkState === "idle" && !interruptInProgress;
|
|
1476
|
+
}, [(_b = copilotContext.langGraphInterruptAction) == null ? void 0 : _b.event, isInProgress, text, pushToTalkState]);
|
|
1477
|
+
const canStop = (0, import_react9.useMemo)(() => {
|
|
1478
|
+
return isInProgress && !hideStopButton;
|
|
1479
|
+
}, [isInProgress, hideStopButton]);
|
|
1480
|
+
const sendDisabled = !canSend && !canStop;
|
|
1471
1481
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `copilotKitInputContainer ${showPoweredBy ? "poweredByContainer" : ""}`, children: [
|
|
1472
1482
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
|
|
1473
1483
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
@@ -1482,7 +1492,7 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
|
|
|
1482
1492
|
onKeyDown: (event) => {
|
|
1483
1493
|
if (event.key === "Enter" && !event.shiftKey) {
|
|
1484
1494
|
event.preventDefault();
|
|
1485
|
-
if (canSend
|
|
1495
|
+
if (canSend) {
|
|
1486
1496
|
send();
|
|
1487
1497
|
}
|
|
1488
1498
|
}
|
|
@@ -1504,7 +1514,7 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
|
|
|
1504
1514
|
"button",
|
|
1505
1515
|
{
|
|
1506
1516
|
disabled: sendDisabled,
|
|
1507
|
-
onClick: isInProgress ? onStop : send,
|
|
1517
|
+
onClick: isInProgress && !hideStopButton ? onStop : send,
|
|
1508
1518
|
"data-copilotkit-in-progress": inProgress,
|
|
1509
1519
|
"data-test-id": inProgress ? "copilot-chat-request-in-progress" : "copilot-chat-ready",
|
|
1510
1520
|
className: "copilotKitInputControlButton",
|
|
@@ -2228,9 +2238,12 @@ function RenderActionExecutionMessage(_a) {
|
|
|
2228
2238
|
try {
|
|
2229
2239
|
const toRender = render({
|
|
2230
2240
|
status,
|
|
2241
|
+
// Cast to any as RenderFunctionStatus is a union that can be complex to narrow here
|
|
2231
2242
|
args,
|
|
2232
2243
|
result: actionResult,
|
|
2233
|
-
name: message.name
|
|
2244
|
+
name: message.name,
|
|
2245
|
+
messageId: message.id
|
|
2246
|
+
// Pass messageId for HITL action correlation
|
|
2234
2247
|
});
|
|
2235
2248
|
if (!toRender && status === "complete") {
|
|
2236
2249
|
return null;
|
|
@@ -2710,7 +2723,8 @@ function CopilotChat({
|
|
|
2710
2723
|
AssistantMessage: AssistantMessage2 = AssistantMessage,
|
|
2711
2724
|
UserMessage: UserMessage2 = UserMessage,
|
|
2712
2725
|
imageUploadsEnabled,
|
|
2713
|
-
inputFileAccept = "image/*"
|
|
2726
|
+
inputFileAccept = "image/*",
|
|
2727
|
+
hideStopButton
|
|
2714
2728
|
}) {
|
|
2715
2729
|
const { additionalInstructions, setChatInstructions } = (0, import_react_core10.useCopilotContext)();
|
|
2716
2730
|
const [selectedImages, setSelectedImages] = (0, import_react13.useState)([]);
|
|
@@ -2893,7 +2907,8 @@ function CopilotChat({
|
|
|
2893
2907
|
onUpload: imageUploadsEnabled ? () => {
|
|
2894
2908
|
var _a;
|
|
2895
2909
|
return (_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
2896
|
-
} : void 0
|
|
2910
|
+
} : void 0,
|
|
2911
|
+
hideStopButton
|
|
2897
2912
|
}
|
|
2898
2913
|
)
|
|
2899
2914
|
] });
|
|
@@ -3158,8 +3173,10 @@ var CopilotModal = (_a) => {
|
|
|
3158
3173
|
onSetOpen == null ? void 0 : onSetOpen(open);
|
|
3159
3174
|
setOpenState(open);
|
|
3160
3175
|
};
|
|
3176
|
+
const memoizedHeader = (0, import_react14.useMemo)(() => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Header2, {}), [Header2]);
|
|
3177
|
+
const memoizedChildren = (0, import_react14.useMemo)(() => children, [children]);
|
|
3161
3178
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(ChatContextProvider, { icons, labels, open: openState, setOpen, children: [
|
|
3162
|
-
|
|
3179
|
+
memoizedChildren,
|
|
3163
3180
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className, children: [
|
|
3164
3181
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button2, {}),
|
|
3165
3182
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
@@ -3169,7 +3186,7 @@ var CopilotModal = (_a) => {
|
|
|
3169
3186
|
shortcut,
|
|
3170
3187
|
hitEscapeToClose,
|
|
3171
3188
|
children: [
|
|
3172
|
-
|
|
3189
|
+
memoizedHeader,
|
|
3173
3190
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3174
3191
|
CopilotChat,
|
|
3175
3192
|
__spreadProps(__spreadValues({}, props), {
|