@copilotkit/react-ui 1.5.18 → 1.5.19-next.0

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.
Files changed (38) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/{chunk-LTVGARDO.mjs → chunk-525VKRDO.mjs} +2 -2
  3. package/dist/{chunk-EQD5OMET.mjs → chunk-652TZXBO.mjs} +2 -2
  4. package/dist/{chunk-IBPPZVL7.mjs → chunk-PO3UGUKD.mjs} +2 -2
  5. package/dist/{chunk-BS76QNZU.mjs → chunk-QRHVTE25.mjs} +3 -3
  6. package/dist/{chunk-EMQEEXUB.mjs → chunk-QXTRFMPM.mjs} +5 -2
  7. package/dist/chunk-QXTRFMPM.mjs.map +1 -0
  8. package/dist/components/chat/Chat.js +4 -1
  9. package/dist/components/chat/Chat.js.map +1 -1
  10. package/dist/components/chat/Chat.mjs +2 -2
  11. package/dist/components/chat/Input.js +4 -1
  12. package/dist/components/chat/Input.js.map +1 -1
  13. package/dist/components/chat/Input.mjs +1 -1
  14. package/dist/components/chat/Modal.js +4 -1
  15. package/dist/components/chat/Modal.js.map +1 -1
  16. package/dist/components/chat/Modal.mjs +3 -3
  17. package/dist/components/chat/Popup.js +4 -1
  18. package/dist/components/chat/Popup.js.map +1 -1
  19. package/dist/components/chat/Popup.mjs +4 -4
  20. package/dist/components/chat/Sidebar.js +4 -1
  21. package/dist/components/chat/Sidebar.js.map +1 -1
  22. package/dist/components/chat/Sidebar.mjs +4 -4
  23. package/dist/components/chat/index.js +4 -1
  24. package/dist/components/chat/index.js.map +1 -1
  25. package/dist/components/chat/index.mjs +5 -5
  26. package/dist/components/index.js +4 -1
  27. package/dist/components/index.js.map +1 -1
  28. package/dist/components/index.mjs +5 -5
  29. package/dist/index.js +4 -1
  30. package/dist/index.js.map +1 -1
  31. package/dist/index.mjs +5 -5
  32. package/package.json +4 -4
  33. package/src/components/chat/Input.tsx +6 -1
  34. package/dist/chunk-EMQEEXUB.mjs.map +0 -1
  35. /package/dist/{chunk-LTVGARDO.mjs.map → chunk-525VKRDO.mjs.map} +0 -0
  36. /package/dist/{chunk-EQD5OMET.mjs.map → chunk-652TZXBO.mjs.map} +0 -0
  37. /package/dist/{chunk-IBPPZVL7.mjs.map → chunk-PO3UGUKD.mjs.map} +0 -0
  38. /package/dist/{chunk-BS76QNZU.mjs.map → chunk-QRHVTE25.mjs.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # ui
2
2
 
3
+ ## 1.5.19-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [5bc68f8]
8
+ - @copilotkit/react-core@1.5.19-next.0
9
+ - @copilotkit/runtime-client-gql@1.5.19-next.0
10
+ - @copilotkit/shared@1.5.19-next.0
11
+
3
12
  ## 1.5.18
4
13
 
5
14
  ### Patch Changes
@@ -25,7 +25,7 @@ import {
25
25
  } from "./chunk-22K5DDPF.mjs";
26
26
  import {
27
27
  Input
28
- } from "./chunk-EMQEEXUB.mjs";
28
+ } from "./chunk-QXTRFMPM.mjs";
29
29
  import {
30
30
  Messages
31
31
  } from "./chunk-6FTRYYR5.mjs";
@@ -311,4 +311,4 @@ export {
311
311
  WrappedCopilotChat,
312
312
  useCopilotChatLogic
313
313
  };
314
- //# sourceMappingURL=chunk-LTVGARDO.mjs.map
314
+ //# sourceMappingURL=chunk-525VKRDO.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CopilotModal
3
- } from "./chunk-BS76QNZU.mjs";
3
+ } from "./chunk-QRHVTE25.mjs";
4
4
  import {
5
5
  __spreadProps,
6
6
  __spreadValues
@@ -27,4 +27,4 @@ function CopilotSidebar(props) {
27
27
  export {
28
28
  CopilotSidebar
29
29
  };
30
- //# sourceMappingURL=chunk-EQD5OMET.mjs.map
30
+ //# sourceMappingURL=chunk-652TZXBO.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CopilotModal
3
- } from "./chunk-BS76QNZU.mjs";
3
+ } from "./chunk-QRHVTE25.mjs";
4
4
  import {
5
5
  __spreadProps,
6
6
  __spreadValues
@@ -18,4 +18,4 @@ function CopilotPopup(props) {
18
18
  export {
19
19
  CopilotPopup
20
20
  };
21
- //# sourceMappingURL=chunk-IBPPZVL7.mjs.map
21
+ //# sourceMappingURL=chunk-PO3UGUKD.mjs.map
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-RQNJNK2W.mjs";
10
10
  import {
11
11
  CopilotChat
12
- } from "./chunk-LTVGARDO.mjs";
12
+ } from "./chunk-525VKRDO.mjs";
13
13
  import {
14
14
  UserMessage
15
15
  } from "./chunk-HEIDCT7I.mjs";
@@ -18,7 +18,7 @@ import {
18
18
  } from "./chunk-3VNMQWGT.mjs";
19
19
  import {
20
20
  Input
21
- } from "./chunk-EMQEEXUB.mjs";
21
+ } from "./chunk-QXTRFMPM.mjs";
22
22
  import {
23
23
  Messages
24
24
  } from "./chunk-6FTRYYR5.mjs";
@@ -102,4 +102,4 @@ var CopilotModal = ({
102
102
  export {
103
103
  CopilotModal
104
104
  };
105
- //# sourceMappingURL=chunk-BS76QNZU.mjs.map
105
+ //# sourceMappingURL=chunk-QRHVTE25.mjs.map
@@ -45,7 +45,10 @@ var Input = ({ inProgress, onSend, isVisible = false }) => {
45
45
  const sendIcon = inProgress || pushToTalkState === "transcribing" ? context.icons.activityIcon : context.icons.sendIcon;
46
46
  const showPushToTalk = pushToTalkConfigured && (pushToTalkState === "idle" || pushToTalkState === "recording") && !inProgress;
47
47
  const canSend = () => {
48
- return !inProgress && text.trim().length > 0 && pushToTalkState === "idle";
48
+ var _a;
49
+ const interruptEvent = (_a = copilotContext.langGraphInterruptAction) == null ? void 0 : _a.event;
50
+ const interruptInProgress = (interruptEvent == null ? void 0 : interruptEvent.name) === "LangGraphInterruptEvent" && !(interruptEvent == null ? void 0 : interruptEvent.response);
51
+ return !inProgress && text.trim().length > 0 && pushToTalkState === "idle" && !interruptInProgress;
49
52
  };
50
53
  const sendDisabled = !canSend();
51
54
  return /* @__PURE__ */ jsxs("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
@@ -94,4 +97,4 @@ var Input = ({ inProgress, onSend, isVisible = false }) => {
94
97
  export {
95
98
  Input
96
99
  };
97
- //# sourceMappingURL=chunk-EMQEEXUB.mjs.map
100
+ //# sourceMappingURL=chunk-QXTRFMPM.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chat/Input.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from \"react\";\nimport { InputProps } from \"./props\";\nimport { useChatContext } from \"./ChatContext\";\nimport AutoResizingTextarea from \"./Textarea\";\nimport { usePushToTalk } from \"../../hooks/use-push-to-talk\";\nimport { useCopilotContext } from \"@copilotkit/react-core\";\n\nexport const Input = ({ inProgress, onSend, isVisible = false }: InputProps) => {\n const context = useChatContext();\n const copilotContext = useCopilotContext();\n\n const pushToTalkConfigured =\n copilotContext.copilotApiConfig.textToSpeechUrl !== undefined &&\n copilotContext.copilotApiConfig.transcribeAudioUrl !== undefined;\n\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n\n const handleDivClick = (event: React.MouseEvent<HTMLDivElement>) => {\n // Check if the clicked element is not the textarea itself\n if (event.target !== event.currentTarget) return;\n\n textareaRef.current?.focus();\n };\n\n const [text, setText] = useState(\"\");\n const send = () => {\n if (inProgress) return;\n onSend(text);\n setText(\"\");\n\n textareaRef.current?.focus();\n };\n\n useEffect(() => {\n if (isVisible) {\n textareaRef.current?.focus();\n }\n }, [isVisible]);\n\n const { pushToTalkState, setPushToTalkState } = usePushToTalk({\n sendFunction: onSend,\n inProgress,\n });\n\n const sendIcon =\n inProgress || pushToTalkState === \"transcribing\"\n ? context.icons.activityIcon\n : context.icons.sendIcon;\n const showPushToTalk =\n pushToTalkConfigured &&\n (pushToTalkState === \"idle\" || pushToTalkState === \"recording\") &&\n !inProgress;\n\n const canSend = () => {\n const interruptEvent = copilotContext.langGraphInterruptAction?.event;\n const interruptInProgress =\n interruptEvent?.name === \"LangGraphInterruptEvent\" && !interruptEvent?.response;\n return (\n !inProgress && text.trim().length > 0 && pushToTalkState === \"idle\" && !interruptInProgress\n );\n };\n\n const sendDisabled = !canSend();\n\n return (\n <div className=\"copilotKitInput\" onClick={handleDivClick}>\n <AutoResizingTextarea\n ref={textareaRef}\n placeholder={context.labels.placeholder}\n autoFocus={true}\n maxRows={5}\n value={text}\n onChange={(event) => setText(event.target.value)}\n onKeyDown={(event) => {\n if (event.key === \"Enter\" && !event.shiftKey) {\n event.preventDefault();\n if (canSend()) {\n send();\n }\n }\n }}\n />\n <div className=\"copilotKitInputControls\">\n {showPushToTalk && (\n <button\n onClick={() =>\n setPushToTalkState(pushToTalkState === \"idle\" ? \"recording\" : \"transcribing\")\n }\n className={pushToTalkState === \"recording\" ? \"copilotKitPushToTalkRecording\" : \"\"}\n >\n {context.icons.pushToTalkIcon}\n </button>\n )}\n <button\n disabled={sendDisabled}\n onClick={send}\n data-copilotkit-in-progress={!!inProgress}\n data-testid={inProgress ? \"copilot-chat-request-in-progress\" : undefined}\n >\n {sendIcon}\n </button>\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;AAAA,SAAgB,WAAW,QAAQ,gBAAgB;AAKnD,SAAS,yBAAyB;AA6D5B,cAgBA,YAhBA;AA3DC,IAAM,QAAQ,CAAC,EAAE,YAAY,QAAQ,YAAY,MAAM,MAAkB;AAC9E,QAAM,UAAU,eAAe;AAC/B,QAAM,iBAAiB,kBAAkB;AAEzC,QAAM,uBACJ,eAAe,iBAAiB,oBAAoB,UACpD,eAAe,iBAAiB,uBAAuB;AAEzD,QAAM,cAAc,OAA4B,IAAI;AAEpD,QAAM,iBAAiB,CAAC,UAA4C;AAjBtE;AAmBI,QAAI,MAAM,WAAW,MAAM;AAAe;AAE1C,sBAAY,YAAZ,mBAAqB;AAAA,EACvB;AAEA,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,EAAE;AACnC,QAAM,OAAO,MAAM;A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AAc,cAAc;AAAA,UAE9E,WAAW,oBAAoB,cAAc,kCAAkC;AAAA,UAE9E,kBAAQ,MAAM;AAAA;AAAA,MACjB;AAAA,MAEF;AAAA,QAAC;AAAA;AAAA,UACC,UAAU;AAAA,UACV,SAAS;AAAA,UACT,+BAA6B,CAAC,CAAC;AAAA,UAC/B,eAAa,aAAa,qCAAqC;AAAA,UAE9D;AAAA;AAAA,MACH;AAAA,OACF;AAAA,KACF;AAEJ;","names":[]}
@@ -753,7 +753,10 @@ var Input = ({ inProgress, onSend, isVisible = false }) => {
753
753
  const sendIcon = inProgress || pushToTalkState === "transcribing" ? context.icons.activityIcon : context.icons.sendIcon;
754
754
  const showPushToTalk = pushToTalkConfigured && (pushToTalkState === "idle" || pushToTalkState === "recording") && !inProgress;
755
755
  const canSend = () => {
756
- return !inProgress && text.trim().length > 0 && pushToTalkState === "idle";
756
+ var _a;
757
+ const interruptEvent = (_a = copilotContext.langGraphInterruptAction) == null ? void 0 : _a.event;
758
+ const interruptInProgress = (interruptEvent == null ? void 0 : interruptEvent.name) === "LangGraphInterruptEvent" && !(interruptEvent == null ? void 0 : interruptEvent.response);
759
+ return !inProgress && text.trim().length > 0 && pushToTalkState === "idle" && !interruptInProgress;
757
760
  };
758
761
  const sendDisabled = !canSend();
759
762
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "copilotKitInput", onClick: handleDivClick, children: [