@copilotkit/react-ui 1.9.3-next.1 → 1.9.3-next.3
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 +17 -0
- package/dist/{chunk-X3LV7OXQ.mjs → chunk-4HUXYD3B.mjs} +6 -3
- package/dist/chunk-4HUXYD3B.mjs.map +1 -0
- package/dist/{chunk-TSDSBNOS.mjs → chunk-ALIBUJML.mjs} +2 -2
- package/dist/{chunk-BP3RN6OE.mjs → chunk-H3EM63WS.mjs} +2 -2
- package/dist/{chunk-4RAYX7ZX.mjs → chunk-HKTWKCPS.mjs} +2 -2
- package/dist/{chunk-EQUUN7ZM.mjs → chunk-KN2GCKBE.mjs} +3 -3
- package/dist/{chunk-YQFVRDNC.mjs → chunk-QIOJXTIQ.mjs} +13 -2
- package/dist/chunk-QIOJXTIQ.mjs.map +1 -0
- package/dist/components/chat/Chat.js +16 -2
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +3 -3
- package/dist/components/chat/Input.js +16 -2
- package/dist/components/chat/Input.js.map +1 -1
- package/dist/components/chat/Input.mjs +2 -2
- package/dist/components/chat/Modal.js +16 -2
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +4 -4
- package/dist/components/chat/Popup.js +16 -2
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +5 -5
- package/dist/components/chat/Sidebar.js +16 -2
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +5 -5
- package/dist/components/chat/Textarea.d.ts +2 -0
- package/dist/components/chat/Textarea.js +12 -1
- package/dist/components/chat/Textarea.js.map +1 -1
- package/dist/components/chat/Textarea.mjs +1 -1
- package/dist/components/chat/index.js +16 -2
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +6 -6
- package/dist/components/index.js +16 -2
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +6 -6
- package/dist/index.js +16 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -6
- package/package.json +4 -4
- package/src/components/chat/Input.tsx +4 -1
- package/src/components/chat/Textarea.tsx +17 -1
- package/dist/chunk-X3LV7OXQ.mjs.map +0 -1
- package/dist/chunk-YQFVRDNC.mjs.map +0 -1
- /package/dist/{chunk-TSDSBNOS.mjs.map → chunk-ALIBUJML.mjs.map} +0 -0
- /package/dist/{chunk-BP3RN6OE.mjs.map → chunk-H3EM63WS.mjs.map} +0 -0
- /package/dist/{chunk-4RAYX7ZX.mjs.map → chunk-HKTWKCPS.mjs.map} +0 -0
- /package/dist/{chunk-EQUUN7ZM.mjs.map → chunk-KN2GCKBE.mjs.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# ui
|
|
2
2
|
|
|
3
|
+
## 1.9.3-next.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [1bda332]
|
|
8
|
+
- @copilotkit/shared@1.9.3-next.3
|
|
9
|
+
- @copilotkit/runtime-client-gql@1.9.3-next.3
|
|
10
|
+
- @copilotkit/react-core@1.9.3-next.3
|
|
11
|
+
|
|
12
|
+
## 1.9.3-next.2
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- @copilotkit/runtime-client-gql@1.9.3-next.2
|
|
17
|
+
- @copilotkit/react-core@1.9.3-next.2
|
|
18
|
+
- @copilotkit/shared@1.9.3-next.2
|
|
19
|
+
|
|
3
20
|
## 1.9.3-next.1
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-CGEAG65D.mjs";
|
|
4
4
|
import {
|
|
5
5
|
Textarea_default
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QIOJXTIQ.mjs";
|
|
7
7
|
import {
|
|
8
8
|
useChatContext
|
|
9
9
|
} from "./chunk-IEMQ2SQW.mjs";
|
|
@@ -30,6 +30,7 @@ var Input = ({
|
|
|
30
30
|
const showPoweredBy = !((_a = copilotContext.copilotApiConfig) == null ? void 0 : _a.publicApiKey);
|
|
31
31
|
const pushToTalkConfigured = copilotContext.copilotApiConfig.textToSpeechUrl !== void 0 && copilotContext.copilotApiConfig.transcribeAudioUrl !== void 0;
|
|
32
32
|
const textareaRef = useRef(null);
|
|
33
|
+
const [isComposing, setIsComposing] = useState(false);
|
|
33
34
|
const handleDivClick = (event) => {
|
|
34
35
|
var _a2;
|
|
35
36
|
const target = event.target;
|
|
@@ -76,8 +77,10 @@ var Input = ({
|
|
|
76
77
|
maxRows: MAX_NEWLINES,
|
|
77
78
|
value: text,
|
|
78
79
|
onChange: (event) => setText(event.target.value),
|
|
80
|
+
onCompositionStart: () => setIsComposing(true),
|
|
81
|
+
onCompositionEnd: () => setIsComposing(false),
|
|
79
82
|
onKeyDown: (event) => {
|
|
80
|
-
if (event.key === "Enter" && !event.shiftKey) {
|
|
83
|
+
if (event.key === "Enter" && !event.shiftKey && !isComposing) {
|
|
81
84
|
event.preventDefault();
|
|
82
85
|
if (canSend) {
|
|
83
86
|
send();
|
|
@@ -117,4 +120,4 @@ var Input = ({
|
|
|
117
120
|
export {
|
|
118
121
|
Input
|
|
119
122
|
};
|
|
120
|
-
//# sourceMappingURL=chunk-
|
|
123
|
+
//# sourceMappingURL=chunk-4HUXYD3B.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/Input.tsx"],"sourcesContent":["import React, { useMemo, 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\";\nimport { PoweredByTag } from \"./PoweredByTag\";\n\nconst MAX_NEWLINES = 6;\n\nexport const Input = ({\n inProgress,\n onSend,\n isVisible = false,\n onStop,\n onUpload,\n hideStopButton = false,\n}: InputProps) => {\n const context = useChatContext();\n const copilotContext = useCopilotContext();\n\n const showPoweredBy = !copilotContext.copilotApiConfig?.publicApiKey;\n\n const pushToTalkConfigured =\n copilotContext.copilotApiConfig.textToSpeechUrl !== undefined &&\n copilotContext.copilotApiConfig.transcribeAudioUrl !== undefined;\n\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const [isComposing, setIsComposing] = useState(false);\n\n const handleDivClick = (event: React.MouseEvent<HTMLDivElement>) => {\n const target = event.target as HTMLElement;\n\n // If the user clicked a button or inside a button, don't focus the textarea\n if (target.closest(\"button\")) return;\n\n // If the user clicked the textarea, do nothing (it's already focused)\n if (target.tagName === \"TEXTAREA\") return;\n\n // Otherwise, focus the textarea\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 // tylerslaton:\n //\n // This scrolls CopilotKit into view always. Reading the commit history, it was likely\n // added to fix a bug but it is causing issues now.\n //\n // For the future, if we want this behavior again, we will need to find a way to do it without\n // forcing CopilotKit to always be in view. This code causes this because focusing an element\n // in most browsers will scroll that element into view.\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 isInProgress = inProgress || pushToTalkState === \"transcribing\";\n const buttonIcon =\n isInProgress && !hideStopButton ? context.icons.stopIcon : context.icons.sendIcon;\n const showPushToTalk =\n pushToTalkConfigured &&\n (pushToTalkState === \"idle\" || pushToTalkState === \"recording\") &&\n !inProgress;\n\n const canSend = useMemo(() => {\n const interruptEvent = copilotContext.langGraphInterruptAction?.event;\n const interruptInProgress =\n interruptEvent?.name === \"LangGraphInterruptEvent\" && !interruptEvent?.response;\n\n return (\n !isInProgress && text.trim().length > 0 && pushToTalkState === \"idle\" && !interruptInProgress\n );\n }, [copilotContext.langGraphInterruptAction?.event, isInProgress, text, pushToTalkState]);\n\n const canStop = useMemo(() => {\n return isInProgress && !hideStopButton;\n }, [isInProgress, hideStopButton]);\n\n const sendDisabled = !canSend && !canStop;\n\n return (\n <div className={`copilotKitInputContainer ${showPoweredBy ? \"poweredByContainer\" : \"\"}`}>\n <div className=\"copilotKitInput\" onClick={handleDivClick}>\n <AutoResizingTextarea\n ref={textareaRef}\n placeholder={context.labels.placeholder}\n autoFocus={false}\n maxRows={MAX_NEWLINES}\n value={text}\n onChange={(event) => setText(event.target.value)}\n onCompositionStart={() => setIsComposing(true)}\n onCompositionEnd={() => setIsComposing(false)}\n onKeyDown={(event) => {\n if (event.key === \"Enter\" && !event.shiftKey && !isComposing) {\n event.preventDefault();\n if (canSend) {\n send();\n }\n }\n }}\n />\n <div className=\"copilotKitInputControls\">\n {onUpload && (\n <button onClick={onUpload} className=\"copilotKitInputControlButton\">\n {context.icons.uploadIcon}\n </button>\n )}\n\n <div style={{ flexGrow: 1 }} />\n\n {showPushToTalk && (\n <button\n onClick={() =>\n setPushToTalkState(pushToTalkState === \"idle\" ? \"recording\" : \"transcribing\")\n }\n className={\n pushToTalkState === \"recording\"\n ? \"copilotKitInputControlButton copilotKitPushToTalkRecording\"\n : \"copilotKitInputControlButton\"\n }\n >\n {context.icons.pushToTalkIcon}\n </button>\n )}\n <button\n disabled={sendDisabled}\n onClick={isInProgress && !hideStopButton ? onStop : send}\n data-copilotkit-in-progress={inProgress}\n data-test-id={inProgress ? \"copilot-chat-request-in-progress\" : \"copilot-chat-ready\"}\n className=\"copilotKitInputControlButton\"\n >\n {buttonIcon}\n </button>\n </div>\n </div>\n <PoweredByTag showPoweredBy={showPoweredBy} />\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAgB,SAAS,QAAQ,gBAAgB;AAKjD,SAAS,yBAAyB;AA8F1B,cAkBA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AAC;AAAA;AAAA,YACC,UAAU;AAAA,YACV,SAAS,gBAAgB,CAAC,iBAAiB,SAAS;AAAA,YACpD,+BAA6B;AAAA,YAC7B,gBAAc,aAAa,qCAAqC;AAAA,YAChE,WAAU;AAAA,YAET;AAAA;AAAA,QACH;AAAA,SACF;AAAA,OACF;AAAA,IACA,oBAAC,gBAAa,eAA8B;AAAA,KAC9C;AAEJ;","names":["_a"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotModal
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KN2GCKBE.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-
|
|
30
|
+
//# sourceMappingURL=chunk-ALIBUJML.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotModal
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KN2GCKBE.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-
|
|
21
|
+
//# sourceMappingURL=chunk-H3EM63WS.mjs.map
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
} from "./chunk-PLHTVHUW.mjs";
|
|
31
31
|
import {
|
|
32
32
|
Input
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-4HUXYD3B.mjs";
|
|
34
34
|
import {
|
|
35
35
|
Messages
|
|
36
36
|
} from "./chunk-B3D7U7TJ.mjs";
|
|
@@ -471,4 +471,4 @@ export {
|
|
|
471
471
|
WrappedCopilotChat,
|
|
472
472
|
useCopilotChatLogic
|
|
473
473
|
};
|
|
474
|
-
//# sourceMappingURL=chunk-
|
|
474
|
+
//# sourceMappingURL=chunk-HKTWKCPS.mjs.map
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-UFN2VWSR.mjs";
|
|
10
10
|
import {
|
|
11
11
|
CopilotChat
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-HKTWKCPS.mjs";
|
|
13
13
|
import {
|
|
14
14
|
AssistantMessage
|
|
15
15
|
} from "./chunk-L3GZ7TXC.mjs";
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
} from "./chunk-HWMFMBJC.mjs";
|
|
19
19
|
import {
|
|
20
20
|
Input
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-4HUXYD3B.mjs";
|
|
22
22
|
import {
|
|
23
23
|
Messages
|
|
24
24
|
} from "./chunk-B3D7U7TJ.mjs";
|
|
@@ -141,4 +141,4 @@ var CopilotModal = (_a) => {
|
|
|
141
141
|
export {
|
|
142
142
|
CopilotModal
|
|
143
143
|
};
|
|
144
|
-
//# sourceMappingURL=chunk-
|
|
144
|
+
//# sourceMappingURL=chunk-KN2GCKBE.mjs.map
|
|
@@ -2,7 +2,16 @@
|
|
|
2
2
|
import { useState, useRef, useEffect, forwardRef, useImperativeHandle } from "react";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
var AutoResizingTextarea = forwardRef(
|
|
5
|
-
({
|
|
5
|
+
({
|
|
6
|
+
maxRows = 1,
|
|
7
|
+
placeholder,
|
|
8
|
+
value,
|
|
9
|
+
onChange,
|
|
10
|
+
onKeyDown,
|
|
11
|
+
onCompositionStart,
|
|
12
|
+
onCompositionEnd,
|
|
13
|
+
autoFocus
|
|
14
|
+
}, ref) => {
|
|
6
15
|
const internalTextareaRef = useRef(null);
|
|
7
16
|
const [maxHeight, setMaxHeight] = useState(0);
|
|
8
17
|
useImperativeHandle(ref, () => internalTextareaRef.current);
|
|
@@ -34,6 +43,8 @@ var AutoResizingTextarea = forwardRef(
|
|
|
34
43
|
value,
|
|
35
44
|
onChange,
|
|
36
45
|
onKeyDown,
|
|
46
|
+
onCompositionStart,
|
|
47
|
+
onCompositionEnd,
|
|
37
48
|
placeholder,
|
|
38
49
|
style: {
|
|
39
50
|
overflow: "auto",
|
|
@@ -50,4 +61,4 @@ var Textarea_default = AutoResizingTextarea;
|
|
|
50
61
|
export {
|
|
51
62
|
Textarea_default
|
|
52
63
|
};
|
|
53
|
-
//# sourceMappingURL=chunk-
|
|
64
|
+
//# sourceMappingURL=chunk-QIOJXTIQ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/Textarea.tsx"],"sourcesContent":["import React, { useState, useRef, useEffect, forwardRef, useImperativeHandle } from \"react\";\n\ninterface AutoResizingTextareaProps {\n maxRows?: number;\n placeholder?: string;\n value: string;\n onChange: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;\n onKeyDown?: (event: React.KeyboardEvent<HTMLTextAreaElement>) => void;\n onCompositionStart?: () => void;\n onCompositionEnd?: () => void;\n autoFocus?: boolean;\n}\n\nconst AutoResizingTextarea = forwardRef<HTMLTextAreaElement, AutoResizingTextareaProps>(\n (\n {\n maxRows = 1,\n placeholder,\n value,\n onChange,\n onKeyDown,\n onCompositionStart,\n onCompositionEnd,\n autoFocus,\n },\n ref,\n ) => {\n const internalTextareaRef = useRef<HTMLTextAreaElement>(null);\n const [maxHeight, setMaxHeight] = useState<number>(0);\n\n useImperativeHandle(ref, () => internalTextareaRef.current as HTMLTextAreaElement);\n\n useEffect(() => {\n const calculateMaxHeight = () => {\n const textarea = internalTextareaRef.current;\n if (textarea) {\n textarea.style.height = \"auto\";\n const singleRowHeight = textarea.scrollHeight;\n setMaxHeight(singleRowHeight * maxRows);\n if (autoFocus) {\n textarea.focus();\n }\n }\n };\n\n calculateMaxHeight();\n }, [maxRows]);\n\n useEffect(() => {\n const textarea = internalTextareaRef.current;\n if (textarea) {\n textarea.style.height = \"auto\";\n textarea.style.height = `${Math.min(textarea.scrollHeight, maxHeight)}px`;\n }\n }, [value, maxHeight]);\n\n return (\n <textarea\n ref={internalTextareaRef}\n value={value}\n onChange={onChange}\n onKeyDown={onKeyDown}\n onCompositionStart={onCompositionStart}\n onCompositionEnd={onCompositionEnd}\n placeholder={placeholder}\n style={{\n overflow: \"auto\",\n resize: \"none\",\n maxHeight: `${maxHeight}px`,\n }}\n rows={1}\n />\n );\n },\n);\n\nexport default AutoResizingTextarea;\n"],"mappings":";AAAA,SAAgB,UAAU,QAAQ,WAAW,YAAY,2BAA2B;AAyD9E;AA5CN,IAAM,uBAAuB;AAAA,EAC3B,CACE;AAAA,IACE,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GACA,QACG;AACH,UAAM,sBAAsB,OAA4B,IAAI;AAC5D,UAAM,CAAC,WAAW,YAAY,IAAI,SAAiB,CAAC;AAEpD,wBAAoB,KAAK,MAAM,oBAAoB,OAA8B;AAEjF,cAAU,MAAM;AACd,YAAM,qBAAqB,MAAM;AAC/B,cAAM,WAAW,oBAAoB;AACrC,YAAI,UAAU;AACZ,mBAAS,MAAM,SAAS;AACxB,gBAAM,kBAAkB,SAAS;AACjC,uBAAa,kBAAkB,OAAO;AACtC,cAAI,WAAW;AACb,qBAAS,MAAM;AAAA,UACjB;AAAA,QACF;AAAA,MACF;AAEA,yBAAmB;AAAA,IACrB,GAAG,CAAC,OAAO,CAAC;AAEZ,cAAU,MAAM;AACd,YAAM,WAAW,oBAAoB;AACrC,UAAI,UAAU;AACZ,iBAAS,MAAM,SAAS;AACxB,iBAAS,MAAM,SAAS,GAAG,KAAK,IAAI,SAAS,cAAc,SAAS;AAAA,MACtE;AAAA,IACF,GAAG,CAAC,OAAO,SAAS,CAAC;AAErB,WACE;AAAA,MAAC;AAAA;AAAA,QACC,KAAK;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,OAAO;AAAA,UACL,UAAU;AAAA,UACV,QAAQ;AAAA,UACR,WAAW,GAAG;AAAA,QAChB;AAAA,QACA,MAAM;AAAA;AAAA,IACR;AAAA,EAEJ;AACF;AAEA,IAAO,mBAAQ;","names":[]}
|
|
@@ -603,7 +603,16 @@ var import_react5 = require("react");
|
|
|
603
603
|
var import_react3 = require("react");
|
|
604
604
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
605
605
|
var AutoResizingTextarea = (0, import_react3.forwardRef)(
|
|
606
|
-
({
|
|
606
|
+
({
|
|
607
|
+
maxRows = 1,
|
|
608
|
+
placeholder,
|
|
609
|
+
value,
|
|
610
|
+
onChange,
|
|
611
|
+
onKeyDown,
|
|
612
|
+
onCompositionStart,
|
|
613
|
+
onCompositionEnd,
|
|
614
|
+
autoFocus
|
|
615
|
+
}, ref) => {
|
|
607
616
|
const internalTextareaRef = (0, import_react3.useRef)(null);
|
|
608
617
|
const [maxHeight, setMaxHeight] = (0, import_react3.useState)(0);
|
|
609
618
|
(0, import_react3.useImperativeHandle)(ref, () => internalTextareaRef.current);
|
|
@@ -635,6 +644,8 @@ var AutoResizingTextarea = (0, import_react3.forwardRef)(
|
|
|
635
644
|
value,
|
|
636
645
|
onChange,
|
|
637
646
|
onKeyDown,
|
|
647
|
+
onCompositionStart,
|
|
648
|
+
onCompositionEnd,
|
|
638
649
|
placeholder,
|
|
639
650
|
style: {
|
|
640
651
|
overflow: "auto",
|
|
@@ -798,6 +809,7 @@ var Input = ({
|
|
|
798
809
|
const showPoweredBy = !((_a = copilotContext.copilotApiConfig) == null ? void 0 : _a.publicApiKey);
|
|
799
810
|
const pushToTalkConfigured = copilotContext.copilotApiConfig.textToSpeechUrl !== void 0 && copilotContext.copilotApiConfig.transcribeAudioUrl !== void 0;
|
|
800
811
|
const textareaRef = (0, import_react5.useRef)(null);
|
|
812
|
+
const [isComposing, setIsComposing] = (0, import_react5.useState)(false);
|
|
801
813
|
const handleDivClick = (event) => {
|
|
802
814
|
var _a2;
|
|
803
815
|
const target = event.target;
|
|
@@ -844,8 +856,10 @@ var Input = ({
|
|
|
844
856
|
maxRows: MAX_NEWLINES,
|
|
845
857
|
value: text,
|
|
846
858
|
onChange: (event) => setText(event.target.value),
|
|
859
|
+
onCompositionStart: () => setIsComposing(true),
|
|
860
|
+
onCompositionEnd: () => setIsComposing(false),
|
|
847
861
|
onKeyDown: (event) => {
|
|
848
|
-
if (event.key === "Enter" && !event.shiftKey) {
|
|
862
|
+
if (event.key === "Enter" && !event.shiftKey && !isComposing) {
|
|
849
863
|
event.preventDefault();
|
|
850
864
|
if (canSend) {
|
|
851
865
|
send();
|