@copilotkit/react-ui 1.9.2-next.3 → 1.9.2-next.5
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 +19 -0
- package/dist/{chunk-KGKVOUC3.mjs → chunk-2TJK4TTF.mjs} +2 -2
- package/dist/{chunk-GBGU4ZR6.mjs → chunk-AHVYHPVQ.mjs} +2 -2
- package/dist/{chunk-RT4HE74K.mjs → chunk-KQEMBE47.mjs} +6 -4
- package/dist/chunk-KQEMBE47.mjs.map +1 -0
- package/dist/{chunk-XZI6DUGE.mjs → chunk-OMIVNOML.mjs} +3 -3
- 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 +23 -11
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +2 -2
- 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 +23 -11
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +3 -3
- package/dist/components/chat/Popup.js +23 -11
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +4 -4
- package/dist/components/chat/Sidebar.js +23 -11
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +4 -4
- package/dist/components/chat/index.js +23 -11
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +5 -5
- package/dist/components/chat/props.d.ts +1 -0
- package/dist/components/chat/props.js.map +1 -1
- package/dist/components/index.js +23 -11
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +5 -5
- package/dist/index.js +23 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -6
- 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/props.ts +1 -0
- package/dist/chunk-EMIYIMQ6.mjs.map +0 -1
- package/dist/chunk-RT4HE74K.mjs.map +0 -1
- /package/dist/{chunk-KGKVOUC3.mjs.map → chunk-2TJK4TTF.mjs.map} +0 -0
- /package/dist/{chunk-GBGU4ZR6.mjs.map → chunk-AHVYHPVQ.mjs.map} +0 -0
- /package/dist/{chunk-XZI6DUGE.mjs.map → chunk-OMIVNOML.mjs.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotPopup
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-AHVYHPVQ.mjs";
|
|
4
|
+
import "../../chunk-OMIVNOML.mjs";
|
|
5
5
|
import "../../chunk-C3GSYRC3.mjs";
|
|
6
6
|
import "../../chunk-GVKA7RQQ.mjs";
|
|
7
7
|
import "../../chunk-V7W6IM2V.mjs";
|
|
@@ -12,7 +12,7 @@ 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-
|
|
15
|
+
import "../../chunk-KQEMBE47.mjs";
|
|
16
16
|
import "../../chunk-UKCPOBQM.mjs";
|
|
17
17
|
import "../../chunk-2II3Q27P.mjs";
|
|
18
18
|
import "../../chunk-ULDQXCED.mjs";
|
|
@@ -23,7 +23,7 @@ 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";
|
|
@@ -1417,8 +1417,15 @@ function PoweredByTag({ showPoweredBy = true }) {
|
|
|
1417
1417
|
// src/components/chat/Input.tsx
|
|
1418
1418
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1419
1419
|
var MAX_NEWLINES = 6;
|
|
1420
|
-
var Input = ({
|
|
1421
|
-
|
|
1420
|
+
var Input = ({
|
|
1421
|
+
inProgress,
|
|
1422
|
+
onSend,
|
|
1423
|
+
isVisible = false,
|
|
1424
|
+
onStop,
|
|
1425
|
+
onUpload,
|
|
1426
|
+
hideStopButton = false
|
|
1427
|
+
}) => {
|
|
1428
|
+
var _a, _b;
|
|
1422
1429
|
const context = useChatContext();
|
|
1423
1430
|
const copilotContext = (0, import_react_core6.useCopilotContext)();
|
|
1424
1431
|
const showPoweredBy = !((_a = copilotContext.copilotApiConfig) == null ? void 0 : _a.publicApiKey);
|
|
@@ -1447,15 +1454,18 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
|
|
|
1447
1454
|
inProgress
|
|
1448
1455
|
});
|
|
1449
1456
|
const isInProgress = inProgress || pushToTalkState === "transcribing";
|
|
1450
|
-
const buttonIcon = isInProgress ? context.icons.stopIcon : context.icons.sendIcon;
|
|
1457
|
+
const buttonIcon = isInProgress && !hideStopButton ? context.icons.stopIcon : context.icons.sendIcon;
|
|
1451
1458
|
const showPushToTalk = pushToTalkConfigured && (pushToTalkState === "idle" || pushToTalkState === "recording") && !inProgress;
|
|
1452
|
-
const canSend = () => {
|
|
1459
|
+
const canSend = (0, import_react9.useMemo)(() => {
|
|
1453
1460
|
var _a2;
|
|
1454
1461
|
const interruptEvent = (_a2 = copilotContext.langGraphInterruptAction) == null ? void 0 : _a2.event;
|
|
1455
1462
|
const interruptInProgress = (interruptEvent == null ? void 0 : interruptEvent.name) === "LangGraphInterruptEvent" && !(interruptEvent == null ? void 0 : interruptEvent.response);
|
|
1456
|
-
return
|
|
1457
|
-
};
|
|
1458
|
-
const
|
|
1463
|
+
return !isInProgress && text.trim().length > 0 && pushToTalkState === "idle" && !interruptInProgress;
|
|
1464
|
+
}, [(_b = copilotContext.langGraphInterruptAction) == null ? void 0 : _b.event, isInProgress, text, pushToTalkState]);
|
|
1465
|
+
const canStop = (0, import_react9.useMemo)(() => {
|
|
1466
|
+
return isInProgress && !hideStopButton;
|
|
1467
|
+
}, [isInProgress, hideStopButton]);
|
|
1468
|
+
const sendDisabled = !canSend && !canStop;
|
|
1459
1469
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `copilotKitInputContainer ${showPoweredBy ? "poweredByContainer" : ""}`, children: [
|
|
1460
1470
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
|
|
1461
1471
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
@@ -1470,7 +1480,7 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
|
|
|
1470
1480
|
onKeyDown: (event) => {
|
|
1471
1481
|
if (event.key === "Enter" && !event.shiftKey) {
|
|
1472
1482
|
event.preventDefault();
|
|
1473
|
-
if (canSend
|
|
1483
|
+
if (canSend) {
|
|
1474
1484
|
send();
|
|
1475
1485
|
}
|
|
1476
1486
|
}
|
|
@@ -1492,7 +1502,7 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
|
|
|
1492
1502
|
"button",
|
|
1493
1503
|
{
|
|
1494
1504
|
disabled: sendDisabled,
|
|
1495
|
-
onClick: isInProgress ? onStop : send,
|
|
1505
|
+
onClick: isInProgress && !hideStopButton ? onStop : send,
|
|
1496
1506
|
"data-copilotkit-in-progress": inProgress,
|
|
1497
1507
|
"data-test-id": inProgress ? "copilot-chat-request-in-progress" : "copilot-chat-ready",
|
|
1498
1508
|
className: "copilotKitInputControlButton",
|
|
@@ -2698,7 +2708,8 @@ function CopilotChat({
|
|
|
2698
2708
|
AssistantMessage: AssistantMessage2 = AssistantMessage,
|
|
2699
2709
|
UserMessage: UserMessage2 = UserMessage,
|
|
2700
2710
|
imageUploadsEnabled,
|
|
2701
|
-
inputFileAccept = "image/*"
|
|
2711
|
+
inputFileAccept = "image/*",
|
|
2712
|
+
hideStopButton
|
|
2702
2713
|
}) {
|
|
2703
2714
|
const { additionalInstructions, setChatInstructions } = (0, import_react_core10.useCopilotContext)();
|
|
2704
2715
|
const [selectedImages, setSelectedImages] = (0, import_react13.useState)([]);
|
|
@@ -2881,7 +2892,8 @@ function CopilotChat({
|
|
|
2881
2892
|
onUpload: imageUploadsEnabled ? () => {
|
|
2882
2893
|
var _a;
|
|
2883
2894
|
return (_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
2884
|
-
} : void 0
|
|
2895
|
+
} : void 0,
|
|
2896
|
+
hideStopButton
|
|
2885
2897
|
}
|
|
2886
2898
|
)
|
|
2887
2899
|
] });
|