@copilotkit/react-ui 1.51.5-next.0 → 1.51.5-next.2
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/.attw.json +3 -0
- package/CHANGELOG.md +17 -0
- package/dist/index.cjs +2737 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +258 -70
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +781 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +781 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +2685 -81
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +2750 -25
- package/dist/index.umd.js.map +1 -1
- package/package.json +19 -18
- package/src/components/chat/Popup.tsx +1 -1
- package/src/components/chat/Sidebar.tsx +1 -1
- package/tsdown.config.ts +58 -0
- package/vitest.config.mjs +11 -0
- package/dist/chunk-2QEDCM6H.mjs +0 -150
- package/dist/chunk-2QEDCM6H.mjs.map +0 -1
- package/dist/chunk-6SMTHXVA.mjs +0 -28
- package/dist/chunk-6SMTHXVA.mjs.map +0 -1
- package/dist/chunk-6TLDRWAD.mjs +0 -95
- package/dist/chunk-6TLDRWAD.mjs.map +0 -1
- package/dist/chunk-72FQQMQ2.mjs +0 -25
- package/dist/chunk-72FQQMQ2.mjs.map +0 -1
- package/dist/chunk-AOUHT4JR.mjs +0 -34
- package/dist/chunk-AOUHT4JR.mjs.map +0 -1
- package/dist/chunk-BNJX66OH.mjs +0 -118
- package/dist/chunk-BNJX66OH.mjs.map +0 -1
- package/dist/chunk-C27LZFA5.mjs +0 -97
- package/dist/chunk-C27LZFA5.mjs.map +0 -1
- package/dist/chunk-C7WM7GM3.mjs +0 -235
- package/dist/chunk-C7WM7GM3.mjs.map +0 -1
- package/dist/chunk-CNIC5HO5.mjs +0 -36
- package/dist/chunk-CNIC5HO5.mjs.map +0 -1
- package/dist/chunk-CQCXH5LY.mjs +0 -143
- package/dist/chunk-CQCXH5LY.mjs.map +0 -1
- package/dist/chunk-DM2V5WTG.mjs +0 -34
- package/dist/chunk-DM2V5WTG.mjs.map +0 -1
- package/dist/chunk-DSHTRV2R.mjs +0 -140
- package/dist/chunk-DSHTRV2R.mjs.map +0 -1
- package/dist/chunk-EACIYBQH.mjs +0 -32
- package/dist/chunk-EACIYBQH.mjs.map +0 -1
- package/dist/chunk-EFZPSZWO.mjs +0 -1
- package/dist/chunk-EFZPSZWO.mjs.map +0 -1
- package/dist/chunk-GBAPANZE.mjs +0 -323
- package/dist/chunk-GBAPANZE.mjs.map +0 -1
- package/dist/chunk-GFE5ZSPV.mjs +0 -112
- package/dist/chunk-GFE5ZSPV.mjs.map +0 -1
- package/dist/chunk-HHLX4MQN.mjs +0 -31
- package/dist/chunk-HHLX4MQN.mjs.map +0 -1
- package/dist/chunk-ICA2EXIX.mjs +0 -187
- package/dist/chunk-ICA2EXIX.mjs.map +0 -1
- package/dist/chunk-IU3WTXLQ.mjs +0 -1
- package/dist/chunk-IU3WTXLQ.mjs.map +0 -1
- package/dist/chunk-IWOCQACI.mjs +0 -73
- package/dist/chunk-IWOCQACI.mjs.map +0 -1
- package/dist/chunk-JGMFJZMG.mjs +0 -11
- package/dist/chunk-JGMFJZMG.mjs.map +0 -1
- package/dist/chunk-JYHRHKV5.mjs +0 -90
- package/dist/chunk-JYHRHKV5.mjs.map +0 -1
- package/dist/chunk-KXE2JCUH.mjs +0 -1
- package/dist/chunk-KXE2JCUH.mjs.map +0 -1
- package/dist/chunk-LIXN3OVQ.mjs +0 -405
- package/dist/chunk-LIXN3OVQ.mjs.map +0 -1
- package/dist/chunk-MC6PY7XH.mjs +0 -456
- package/dist/chunk-MC6PY7XH.mjs.map +0 -1
- package/dist/chunk-MMVDU6DF.mjs +0 -1
- package/dist/chunk-MMVDU6DF.mjs.map +0 -1
- package/dist/chunk-MRXNTQOX.mjs +0 -59
- package/dist/chunk-MRXNTQOX.mjs.map +0 -1
- package/dist/chunk-OQWEOBRX.mjs +0 -120
- package/dist/chunk-OQWEOBRX.mjs.map +0 -1
- package/dist/chunk-P34CL4LC.mjs +0 -82
- package/dist/chunk-P34CL4LC.mjs.map +0 -1
- package/dist/chunk-PF3QBO7V.mjs +0 -133
- package/dist/chunk-PF3QBO7V.mjs.map +0 -1
- package/dist/chunk-PLHTVHUW.mjs +0 -82
- package/dist/chunk-PLHTVHUW.mjs.map +0 -1
- package/dist/chunk-PP2A5RP6.mjs +0 -21
- package/dist/chunk-PP2A5RP6.mjs.map +0 -1
- package/dist/chunk-Q64GLWPQ.mjs +0 -30
- package/dist/chunk-Q64GLWPQ.mjs.map +0 -1
- package/dist/chunk-SC6JRFAJ.mjs +0 -1
- package/dist/chunk-SC6JRFAJ.mjs.map +0 -1
- package/dist/chunk-T26KLXLH.mjs +0 -1
- package/dist/chunk-T26KLXLH.mjs.map +0 -1
- package/dist/chunk-T4NNQG6T.mjs +0 -231
- package/dist/chunk-T4NNQG6T.mjs.map +0 -1
- package/dist/chunk-TGM5PKBF.mjs +0 -44
- package/dist/chunk-TGM5PKBF.mjs.map +0 -1
- package/dist/chunk-V7W6IM2V.mjs +0 -1
- package/dist/chunk-V7W6IM2V.mjs.map +0 -1
- package/dist/chunk-WB3YULQ4.mjs +0 -1
- package/dist/chunk-WB3YULQ4.mjs.map +0 -1
- package/dist/chunk-Y4FKRAKJ.mjs +0 -12
- package/dist/chunk-Y4FKRAKJ.mjs.map +0 -1
- package/dist/chunk-YDJ4YUUF.mjs +0 -141
- package/dist/chunk-YDJ4YUUF.mjs.map +0 -1
- package/dist/components/chat/Button.d.ts +0 -9
- package/dist/components/chat/Button.js +0 -73
- package/dist/components/chat/Button.js.map +0 -1
- package/dist/components/chat/Button.mjs +0 -10
- package/dist/components/chat/Button.mjs.map +0 -1
- package/dist/components/chat/Chat.d.ts +0 -204
- package/dist/components/chat/Chat.js +0 -2428
- package/dist/components/chat/Chat.js.map +0 -1
- package/dist/components/chat/Chat.mjs +0 -29
- package/dist/components/chat/Chat.mjs.map +0 -1
- package/dist/components/chat/ChatContext.d.ts +0 -145
- package/dist/components/chat/ChatContext.js +0 -383
- package/dist/components/chat/ChatContext.js.map +0 -1
- package/dist/components/chat/ChatContext.mjs +0 -13
- package/dist/components/chat/ChatContext.mjs.map +0 -1
- package/dist/components/chat/CodeBlock.d.ts +0 -14
- package/dist/components/chat/CodeBlock.js +0 -524
- package/dist/components/chat/CodeBlock.js.map +0 -1
- package/dist/components/chat/CodeBlock.mjs +0 -14
- package/dist/components/chat/CodeBlock.mjs.map +0 -1
- package/dist/components/chat/Header.d.ts +0 -9
- package/dist/components/chat/Header.js +0 -642
- package/dist/components/chat/Header.js.map +0 -1
- package/dist/components/chat/Header.mjs +0 -17
- package/dist/components/chat/Header.mjs.map +0 -1
- package/dist/components/chat/Icons.d.ts +0 -20
- package/dist/components/chat/Icons.js +0 -362
- package/dist/components/chat/Icons.js.map +0 -1
- package/dist/components/chat/Icons.mjs +0 -38
- package/dist/components/chat/Icons.mjs.map +0 -1
- package/dist/components/chat/ImageUploadQueue.d.ts +0 -13
- package/dist/components/chat/ImageUploadQueue.js +0 -106
- package/dist/components/chat/ImageUploadQueue.js.map +0 -1
- package/dist/components/chat/ImageUploadQueue.mjs +0 -8
- package/dist/components/chat/ImageUploadQueue.mjs.map +0 -1
- package/dist/components/chat/Input.d.ts +0 -9
- package/dist/components/chat/Input.js +0 -424
- package/dist/components/chat/Input.js.map +0 -1
- package/dist/components/chat/Input.mjs +0 -14
- package/dist/components/chat/Input.mjs.map +0 -1
- package/dist/components/chat/Markdown.d.ts +0 -10
- package/dist/components/chat/Markdown.js +0 -678
- package/dist/components/chat/Markdown.js.map +0 -1
- package/dist/components/chat/Markdown.mjs +0 -11
- package/dist/components/chat/Markdown.mjs.map +0 -1
- package/dist/components/chat/Messages.d.ts +0 -13
- package/dist/components/chat/Messages.js +0 -1242
- package/dist/components/chat/Messages.js.map +0 -1
- package/dist/components/chat/Messages.mjs +0 -20
- package/dist/components/chat/Messages.mjs.map +0 -1
- package/dist/components/chat/Modal.d.ts +0 -51
- package/dist/components/chat/Modal.js +0 -3294
- package/dist/components/chat/Modal.js.map +0 -1
- package/dist/components/chat/Modal.mjs +0 -38
- package/dist/components/chat/Modal.mjs.map +0 -1
- package/dist/components/chat/Popup.d.ts +0 -13
- package/dist/components/chat/Popup.js +0 -3305
- package/dist/components/chat/Popup.js.map +0 -1
- package/dist/components/chat/Popup.mjs +0 -39
- package/dist/components/chat/Popup.mjs.map +0 -1
- package/dist/components/chat/PoweredByTag.d.ts +0 -7
- package/dist/components/chat/PoweredByTag.js +0 -63
- package/dist/components/chat/PoweredByTag.js.map +0 -1
- package/dist/components/chat/PoweredByTag.mjs +0 -9
- package/dist/components/chat/PoweredByTag.mjs.map +0 -1
- package/dist/components/chat/Sidebar.d.ts +0 -13
- package/dist/components/chat/Sidebar.js +0 -3314
- package/dist/components/chat/Sidebar.js.map +0 -1
- package/dist/components/chat/Sidebar.mjs +0 -39
- package/dist/components/chat/Sidebar.mjs.map +0 -1
- package/dist/components/chat/Suggestion.d.ts +0 -12
- package/dist/components/chat/Suggestion.js +0 -68
- package/dist/components/chat/Suggestion.js.map +0 -1
- package/dist/components/chat/Suggestion.mjs +0 -9
- package/dist/components/chat/Suggestion.mjs.map +0 -1
- package/dist/components/chat/Suggestions.d.ts +0 -9
- package/dist/components/chat/Suggestions.js +0 -93
- package/dist/components/chat/Suggestions.js.map +0 -1
- package/dist/components/chat/Suggestions.mjs +0 -10
- package/dist/components/chat/Suggestions.mjs.map +0 -1
- package/dist/components/chat/Textarea.d.ts +0 -15
- package/dist/components/chat/Textarea.js +0 -87
- package/dist/components/chat/Textarea.js.map +0 -1
- package/dist/components/chat/Textarea.mjs +0 -8
- package/dist/components/chat/Textarea.mjs.map +0 -1
- package/dist/components/chat/Window.d.ts +0 -9
- package/dist/components/chat/Window.js +0 -166
- package/dist/components/chat/Window.js.map +0 -1
- package/dist/components/chat/Window.mjs +0 -10
- package/dist/components/chat/Window.mjs.map +0 -1
- package/dist/components/chat/index.d.ts +0 -18
- package/dist/components/chat/index.js +0 -3341
- package/dist/components/chat/index.js.map +0 -1
- package/dist/components/chat/index.mjs +0 -69
- package/dist/components/chat/index.mjs.map +0 -1
- package/dist/components/chat/messages/AssistantMessage.d.ts +0 -9
- package/dist/components/chat/messages/AssistantMessage.js +0 -807
- package/dist/components/chat/messages/AssistantMessage.js.map +0 -1
- package/dist/components/chat/messages/AssistantMessage.mjs +0 -13
- package/dist/components/chat/messages/AssistantMessage.mjs.map +0 -1
- package/dist/components/chat/messages/ErrorMessage.d.ts +0 -9
- package/dist/components/chat/messages/ErrorMessage.js +0 -756
- package/dist/components/chat/messages/ErrorMessage.js.map +0 -1
- package/dist/components/chat/messages/ErrorMessage.mjs +0 -72
- package/dist/components/chat/messages/ErrorMessage.mjs.map +0 -1
- package/dist/components/chat/messages/ImageRenderer.d.ts +0 -12
- package/dist/components/chat/messages/ImageRenderer.js +0 -68
- package/dist/components/chat/messages/ImageRenderer.js.map +0 -1
- package/dist/components/chat/messages/ImageRenderer.mjs +0 -8
- package/dist/components/chat/messages/ImageRenderer.mjs.map +0 -1
- package/dist/components/chat/messages/LegacyRenderMessage.d.ts +0 -28
- package/dist/components/chat/messages/LegacyRenderMessage.js +0 -1067
- package/dist/components/chat/messages/LegacyRenderMessage.js.map +0 -1
- package/dist/components/chat/messages/LegacyRenderMessage.mjs +0 -17
- package/dist/components/chat/messages/LegacyRenderMessage.mjs.map +0 -1
- package/dist/components/chat/messages/RenderMessage.d.ts +0 -9
- package/dist/components/chat/messages/RenderMessage.js +0 -942
- package/dist/components/chat/messages/RenderMessage.js.map +0 -1
- package/dist/components/chat/messages/RenderMessage.mjs +0 -16
- package/dist/components/chat/messages/RenderMessage.mjs.map +0 -1
- package/dist/components/chat/messages/UserMessage.d.ts +0 -9
- package/dist/components/chat/messages/UserMessage.js +0 -58
- package/dist/components/chat/messages/UserMessage.js.map +0 -1
- package/dist/components/chat/messages/UserMessage.mjs +0 -8
- package/dist/components/chat/messages/UserMessage.mjs.map +0 -1
- package/dist/components/chat/props.d.ts +0 -298
- package/dist/components/chat/props.js +0 -19
- package/dist/components/chat/props.js.map +0 -1
- package/dist/components/chat/props.mjs +0 -2
- package/dist/components/chat/props.mjs.map +0 -1
- package/dist/components/dev-console/console.d.ts +0 -11
- package/dist/components/dev-console/console.js +0 -595
- package/dist/components/dev-console/console.js.map +0 -1
- package/dist/components/dev-console/console.mjs +0 -17
- package/dist/components/dev-console/console.mjs.map +0 -1
- package/dist/components/dev-console/icons.d.ts +0 -9
- package/dist/components/dev-console/icons.js +0 -140
- package/dist/components/dev-console/icons.js.map +0 -1
- package/dist/components/dev-console/icons.mjs +0 -16
- package/dist/components/dev-console/icons.mjs.map +0 -1
- package/dist/components/dev-console/index.d.ts +0 -3
- package/dist/components/dev-console/index.js +0 -595
- package/dist/components/dev-console/index.js.map +0 -1
- package/dist/components/dev-console/index.mjs +0 -18
- package/dist/components/dev-console/index.mjs.map +0 -1
- package/dist/components/dev-console/types.d.ts +0 -9
- package/dist/components/dev-console/types.js +0 -19
- package/dist/components/dev-console/types.js.map +0 -1
- package/dist/components/dev-console/types.mjs +0 -1
- package/dist/components/dev-console/types.mjs.map +0 -1
- package/dist/components/dev-console/utils.d.ts +0 -10
- package/dist/components/dev-console/utils.js +0 -183
- package/dist/components/dev-console/utils.js.map +0 -1
- package/dist/components/dev-console/utils.mjs +0 -16
- package/dist/components/dev-console/utils.mjs.map +0 -1
- package/dist/components/help-modal/icons.d.ts +0 -9
- package/dist/components/help-modal/icons.js +0 -116
- package/dist/components/help-modal/icons.js.map +0 -1
- package/dist/components/help-modal/icons.mjs +0 -12
- package/dist/components/help-modal/icons.mjs.map +0 -1
- package/dist/components/help-modal/index.d.ts +0 -2
- package/dist/components/help-modal/index.js +0 -144
- package/dist/components/help-modal/index.js.map +0 -1
- package/dist/components/help-modal/index.mjs +0 -10
- package/dist/components/help-modal/index.mjs.map +0 -1
- package/dist/components/help-modal/modal.d.ts +0 -5
- package/dist/components/help-modal/modal.js +0 -142
- package/dist/components/help-modal/modal.js.map +0 -1
- package/dist/components/help-modal/modal.mjs +0 -9
- package/dist/components/help-modal/modal.mjs.map +0 -1
- package/dist/components/index.d.ts +0 -19
- package/dist/components/index.js +0 -3345
- package/dist/components/index.js.map +0 -1
- package/dist/components/index.mjs +0 -76
- package/dist/components/index.mjs.map +0 -1
- package/dist/context/index.d.ts +0 -2
- package/dist/context/index.js +0 -19
- package/dist/context/index.js.map +0 -1
- package/dist/context/index.mjs +0 -2
- package/dist/context/index.mjs.map +0 -1
- package/dist/hooks/index.d.ts +0 -2
- package/dist/hooks/index.js +0 -36
- package/dist/hooks/index.js.map +0 -1
- package/dist/hooks/index.mjs +0 -9
- package/dist/hooks/index.mjs.map +0 -1
- package/dist/hooks/use-copilot-chat-suggestions.d.ts +0 -66
- package/dist/hooks/use-copilot-chat-suggestions.js +0 -34
- package/dist/hooks/use-copilot-chat-suggestions.js.map +0 -1
- package/dist/hooks/use-copilot-chat-suggestions.mjs +0 -8
- package/dist/hooks/use-copilot-chat-suggestions.mjs.map +0 -1
- package/dist/hooks/use-copy-to-clipboard.d.ts +0 -9
- package/dist/hooks/use-copy-to-clipboard.js +0 -62
- package/dist/hooks/use-copy-to-clipboard.js.map +0 -1
- package/dist/hooks/use-copy-to-clipboard.mjs +0 -8
- package/dist/hooks/use-copy-to-clipboard.mjs.map +0 -1
- package/dist/hooks/use-dark-mode.d.ts +0 -3
- package/dist/hooks/use-dark-mode.js +0 -35
- package/dist/hooks/use-dark-mode.js.map +0 -1
- package/dist/hooks/use-dark-mode.mjs +0 -8
- package/dist/hooks/use-dark-mode.mjs.map +0 -1
- package/dist/hooks/use-push-to-talk.d.ts +0 -19
- package/dist/hooks/use-push-to-talk.js +0 -202
- package/dist/hooks/use-push-to-talk.js.map +0 -1
- package/dist/hooks/use-push-to-talk.mjs +0 -12
- package/dist/hooks/use-push-to-talk.mjs.map +0 -1
- package/dist/index.d.ts +0 -21
- package/dist/index.js +0 -3354
- package/dist/index.js.map +0 -1
- package/dist/lib/utils.d.ts +0 -4
- package/dist/lib/utils.js +0 -76
- package/dist/lib/utils.js.map +0 -1
- package/dist/lib/utils.mjs +0 -34
- package/dist/lib/utils.mjs.map +0 -1
- package/dist/types/css.d.ts +0 -22
- package/dist/types/css.js +0 -19
- package/dist/types/css.js.map +0 -1
- package/dist/types/css.mjs +0 -1
- package/dist/types/css.mjs.map +0 -1
- package/dist/types/index.d.ts +0 -3
- package/dist/types/index.js +0 -19
- package/dist/types/index.js.map +0 -1
- package/dist/types/index.mjs +0 -2
- package/dist/types/index.mjs.map +0 -1
- package/dist/types/suggestions.d.ts +0 -9
- package/dist/types/suggestions.js +0 -19
- package/dist/types/suggestions.js.map +0 -1
- package/dist/types/suggestions.mjs +0 -1
- package/dist/types/suggestions.mjs.map +0 -1
- package/dist/v2/index.css +0 -4
- package/dist/v2/index.css.map +0 -1
- package/dist/v2/index.d.ts +0 -2
- package/dist/v2/index.js +0 -2
- package/dist/v2/index.js.map +0 -1
- package/dist/v2/index.mjs +0 -2
- package/dist/v2/index.mjs.map +0 -1
- package/jest.config.js +0 -5
- package/rollup.config.mjs +0 -64
- package/tsup.config.ts +0 -15
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ActivityIcon,
|
|
3
|
-
CheckIcon,
|
|
4
|
-
CloseIcon,
|
|
5
|
-
CopyIcon,
|
|
6
|
-
DownloadIcon,
|
|
7
|
-
HeaderCloseIcon,
|
|
8
|
-
MicrophoneIcon,
|
|
9
|
-
OpenIcon,
|
|
10
|
-
RegenerateIcon,
|
|
11
|
-
SendIcon,
|
|
12
|
-
SmallSpinnerIcon,
|
|
13
|
-
SpinnerIcon,
|
|
14
|
-
StopIcon,
|
|
15
|
-
ThumbsDownIcon,
|
|
16
|
-
ThumbsUpIcon,
|
|
17
|
-
UploadIcon
|
|
18
|
-
} from "../../chunk-GBAPANZE.mjs";
|
|
19
|
-
import "../../chunk-MRXNTQOX.mjs";
|
|
20
|
-
export {
|
|
21
|
-
ActivityIcon,
|
|
22
|
-
CheckIcon,
|
|
23
|
-
CloseIcon,
|
|
24
|
-
CopyIcon,
|
|
25
|
-
DownloadIcon,
|
|
26
|
-
HeaderCloseIcon,
|
|
27
|
-
MicrophoneIcon,
|
|
28
|
-
OpenIcon,
|
|
29
|
-
RegenerateIcon,
|
|
30
|
-
SendIcon,
|
|
31
|
-
SmallSpinnerIcon,
|
|
32
|
-
SpinnerIcon,
|
|
33
|
-
StopIcon,
|
|
34
|
-
ThumbsDownIcon,
|
|
35
|
-
ThumbsUpIcon,
|
|
36
|
-
UploadIcon
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=Icons.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
|
|
3
|
-
interface ImageUploadQueueProps {
|
|
4
|
-
images: Array<{
|
|
5
|
-
contentType: string;
|
|
6
|
-
bytes: string;
|
|
7
|
-
}>;
|
|
8
|
-
onRemoveImage: (index: number) => void;
|
|
9
|
-
className?: string;
|
|
10
|
-
}
|
|
11
|
-
declare const ImageUploadQueue: React__default.FC<ImageUploadQueueProps>;
|
|
12
|
-
|
|
13
|
-
export { ImageUploadQueue };
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/components/chat/ImageUploadQueue.tsx
|
|
21
|
-
var ImageUploadQueue_exports = {};
|
|
22
|
-
__export(ImageUploadQueue_exports, {
|
|
23
|
-
ImageUploadQueue: () => ImageUploadQueue
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(ImageUploadQueue_exports);
|
|
26
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
27
|
-
var ImageUploadQueue = ({
|
|
28
|
-
images,
|
|
29
|
-
onRemoveImage,
|
|
30
|
-
className = ""
|
|
31
|
-
}) => {
|
|
32
|
-
if (images.length === 0)
|
|
33
|
-
return null;
|
|
34
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
35
|
-
"div",
|
|
36
|
-
{
|
|
37
|
-
className: `copilotKitImageUploadQueue ${className}`,
|
|
38
|
-
style: {
|
|
39
|
-
display: "flex",
|
|
40
|
-
flexWrap: "wrap",
|
|
41
|
-
gap: "8px",
|
|
42
|
-
margin: "8px",
|
|
43
|
-
padding: "8px"
|
|
44
|
-
},
|
|
45
|
-
children: images.map((image, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
46
|
-
"div",
|
|
47
|
-
{
|
|
48
|
-
className: "copilotKitImageUploadQueueItem",
|
|
49
|
-
style: {
|
|
50
|
-
position: "relative",
|
|
51
|
-
display: "inline-block",
|
|
52
|
-
width: "60px",
|
|
53
|
-
height: "60px",
|
|
54
|
-
borderRadius: "4px",
|
|
55
|
-
overflow: "hidden"
|
|
56
|
-
},
|
|
57
|
-
children: [
|
|
58
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
59
|
-
"img",
|
|
60
|
-
{
|
|
61
|
-
src: `data:${image.contentType};base64,${image.bytes}`,
|
|
62
|
-
alt: `Selected image ${index + 1}`,
|
|
63
|
-
style: {
|
|
64
|
-
width: "100%",
|
|
65
|
-
height: "100%",
|
|
66
|
-
objectFit: "cover"
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
),
|
|
70
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
71
|
-
"button",
|
|
72
|
-
{
|
|
73
|
-
onClick: () => onRemoveImage(index),
|
|
74
|
-
className: "copilotKitImageUploadQueueRemoveButton",
|
|
75
|
-
style: {
|
|
76
|
-
position: "absolute",
|
|
77
|
-
top: "2px",
|
|
78
|
-
right: "2px",
|
|
79
|
-
background: "rgba(0,0,0,0.6)",
|
|
80
|
-
color: "white",
|
|
81
|
-
border: "none",
|
|
82
|
-
borderRadius: "50%",
|
|
83
|
-
width: "18px",
|
|
84
|
-
height: "18px",
|
|
85
|
-
display: "flex",
|
|
86
|
-
alignItems: "center",
|
|
87
|
-
justifyContent: "center",
|
|
88
|
-
cursor: "pointer",
|
|
89
|
-
fontSize: "10px",
|
|
90
|
-
padding: 0
|
|
91
|
-
},
|
|
92
|
-
children: "\u2715"
|
|
93
|
-
}
|
|
94
|
-
)
|
|
95
|
-
]
|
|
96
|
-
},
|
|
97
|
-
index
|
|
98
|
-
))
|
|
99
|
-
}
|
|
100
|
-
);
|
|
101
|
-
};
|
|
102
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
103
|
-
0 && (module.exports = {
|
|
104
|
-
ImageUploadQueue
|
|
105
|
-
});
|
|
106
|
-
//# sourceMappingURL=ImageUploadQueue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/chat/ImageUploadQueue.tsx"],"sourcesContent":["import React from \"react\";\n\ninterface ImageUploadQueueProps {\n images: Array<{ contentType: string; bytes: string }>;\n onRemoveImage: (index: number) => void;\n className?: string;\n}\n\nexport const ImageUploadQueue: React.FC<ImageUploadQueueProps> = ({\n images,\n onRemoveImage,\n className = \"\",\n}) => {\n if (images.length === 0) return null;\n\n return (\n <div\n className={`copilotKitImageUploadQueue ${className}`}\n style={{\n display: \"flex\",\n flexWrap: \"wrap\",\n gap: \"8px\",\n margin: \"8px\",\n padding: \"8px\",\n }}\n >\n {images.map((image, index) => (\n <div\n key={index}\n className=\"copilotKitImageUploadQueueItem\"\n style={{\n position: \"relative\",\n display: \"inline-block\",\n width: \"60px\",\n height: \"60px\",\n borderRadius: \"4px\",\n overflow: \"hidden\",\n }}\n >\n {/* eslint-disable-next-line @next/next/no-img-element */}\n <img\n src={`data:${image.contentType};base64,${image.bytes}`}\n alt={`Selected image ${index + 1}`}\n style={{\n width: \"100%\",\n height: \"100%\",\n objectFit: \"cover\",\n }}\n />\n <button\n onClick={() => onRemoveImage(index)}\n className=\"copilotKitImageUploadQueueRemoveButton\"\n style={{\n position: \"absolute\",\n top: \"2px\",\n right: \"2px\",\n background: \"rgba(0,0,0,0.6)\",\n color: \"white\",\n border: \"none\",\n borderRadius: \"50%\",\n width: \"18px\",\n height: \"18px\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n cursor: \"pointer\",\n fontSize: \"10px\",\n padding: 0,\n }}\n >\n ✕\n </button>\n </div>\n ))}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA2BQ;AAnBD,IAAM,mBAAoD,CAAC;AAAA,EAChE;AAAA,EACA;AAAA,EACA,YAAY;AACd,MAAM;AACJ,MAAI,OAAO,WAAW;AAAG,WAAO;AAEhC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,8BAA8B;AAAA,MACzC,OAAO;AAAA,QACL,SAAS;AAAA,QACT,UAAU;AAAA,QACV,KAAK;AAAA,QACL,QAAQ;AAAA,QACR,SAAS;AAAA,MACX;AAAA,MAEC,iBAAO,IAAI,CAAC,OAAO,UAClB;AAAA,QAAC;AAAA;AAAA,UAEC,WAAU;AAAA,UACV,OAAO;AAAA,YACL,UAAU;AAAA,YACV,SAAS;AAAA,YACT,OAAO;AAAA,YACP,QAAQ;AAAA,YACR,cAAc;AAAA,YACd,UAAU;AAAA,UACZ;AAAA,UAGA;AAAA;AAAA,cAAC;AAAA;AAAA,gBACC,KAAK,QAAQ,MAAM,sBAAsB,MAAM;AAAA,gBAC/C,KAAK,kBAAkB,QAAQ;AAAA,gBAC/B,OAAO;AAAA,kBACL,OAAO;AAAA,kBACP,QAAQ;AAAA,kBACR,WAAW;AAAA,gBACb;AAAA;AAAA,YACF;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACC,SAAS,MAAM,cAAc,KAAK;AAAA,gBAClC,WAAU;AAAA,gBACV,OAAO;AAAA,kBACL,UAAU;AAAA,kBACV,KAAK;AAAA,kBACL,OAAO;AAAA,kBACP,YAAY;AAAA,kBACZ,OAAO;AAAA,kBACP,QAAQ;AAAA,kBACR,cAAc;AAAA,kBACd,OAAO;AAAA,kBACP,QAAQ;AAAA,kBACR,SAAS;AAAA,kBACT,YAAY;AAAA,kBACZ,gBAAgB;AAAA,kBAChB,QAAQ;AAAA,kBACR,UAAU;AAAA,kBACV,SAAS;AAAA,gBACX;AAAA,gBACD;AAAA;AAAA,YAED;AAAA;AAAA;AAAA,QA3CK;AAAA,MA4CP,CACD;AAAA;AAAA,EACH;AAEJ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { InputProps } from './props.js';
|
|
3
|
-
import '@copilotkit/shared';
|
|
4
|
-
import '../../types/suggestions.js';
|
|
5
|
-
import 'react';
|
|
6
|
-
|
|
7
|
-
declare const Input: ({ inProgress, onSend, chatReady, onStop, onUpload, hideStopButton, }: InputProps) => react_jsx_runtime.JSX.Element;
|
|
8
|
-
|
|
9
|
-
export { Input };
|
|
@@ -1,424 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
-
var __spreadValues = (a, b) => {
|
|
12
|
-
for (var prop in b || (b = {}))
|
|
13
|
-
if (__hasOwnProp.call(b, prop))
|
|
14
|
-
__defNormalProp(a, prop, b[prop]);
|
|
15
|
-
if (__getOwnPropSymbols)
|
|
16
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
-
if (__propIsEnum.call(b, prop))
|
|
18
|
-
__defNormalProp(a, prop, b[prop]);
|
|
19
|
-
}
|
|
20
|
-
return a;
|
|
21
|
-
};
|
|
22
|
-
var __export = (target, all) => {
|
|
23
|
-
for (var name in all)
|
|
24
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
25
|
-
};
|
|
26
|
-
var __copyProps = (to, from, except, desc) => {
|
|
27
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
28
|
-
for (let key of __getOwnPropNames(from))
|
|
29
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
30
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
31
|
-
}
|
|
32
|
-
return to;
|
|
33
|
-
};
|
|
34
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
35
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
36
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
37
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
38
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
39
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
40
|
-
mod
|
|
41
|
-
));
|
|
42
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
43
|
-
var __async = (__this, __arguments, generator) => {
|
|
44
|
-
return new Promise((resolve, reject) => {
|
|
45
|
-
var fulfilled = (value) => {
|
|
46
|
-
try {
|
|
47
|
-
step(generator.next(value));
|
|
48
|
-
} catch (e) {
|
|
49
|
-
reject(e);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
var rejected = (value) => {
|
|
53
|
-
try {
|
|
54
|
-
step(generator.throw(value));
|
|
55
|
-
} catch (e) {
|
|
56
|
-
reject(e);
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
60
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
// src/components/chat/Input.tsx
|
|
65
|
-
var Input_exports = {};
|
|
66
|
-
__export(Input_exports, {
|
|
67
|
-
Input: () => Input
|
|
68
|
-
});
|
|
69
|
-
module.exports = __toCommonJS(Input_exports);
|
|
70
|
-
var import_react5 = require("react");
|
|
71
|
-
|
|
72
|
-
// src/components/chat/ChatContext.tsx
|
|
73
|
-
var import_react = __toESM(require("react"));
|
|
74
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
75
|
-
var ChatContext = import_react.default.createContext(
|
|
76
|
-
void 0
|
|
77
|
-
);
|
|
78
|
-
function useChatContext() {
|
|
79
|
-
const context = import_react.default.useContext(ChatContext);
|
|
80
|
-
if (context === void 0) {
|
|
81
|
-
throw new Error(
|
|
82
|
-
"Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?"
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
return context;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// src/components/chat/Textarea.tsx
|
|
89
|
-
var import_react2 = require("react");
|
|
90
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
91
|
-
var AutoResizingTextarea = (0, import_react2.forwardRef)(
|
|
92
|
-
({
|
|
93
|
-
maxRows = 1,
|
|
94
|
-
placeholder,
|
|
95
|
-
value,
|
|
96
|
-
onChange,
|
|
97
|
-
onKeyDown,
|
|
98
|
-
onCompositionStart,
|
|
99
|
-
onCompositionEnd,
|
|
100
|
-
autoFocus
|
|
101
|
-
}, ref) => {
|
|
102
|
-
const internalTextareaRef = (0, import_react2.useRef)(null);
|
|
103
|
-
const [maxHeight, setMaxHeight] = (0, import_react2.useState)(0);
|
|
104
|
-
(0, import_react2.useImperativeHandle)(
|
|
105
|
-
ref,
|
|
106
|
-
() => internalTextareaRef.current
|
|
107
|
-
);
|
|
108
|
-
(0, import_react2.useEffect)(() => {
|
|
109
|
-
const calculateMaxHeight = () => {
|
|
110
|
-
const textarea = internalTextareaRef.current;
|
|
111
|
-
if (textarea) {
|
|
112
|
-
textarea.style.height = "auto";
|
|
113
|
-
const singleRowHeight = textarea.scrollHeight;
|
|
114
|
-
setMaxHeight(singleRowHeight * maxRows);
|
|
115
|
-
if (autoFocus) {
|
|
116
|
-
textarea.focus();
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
calculateMaxHeight();
|
|
121
|
-
}, [maxRows]);
|
|
122
|
-
(0, import_react2.useEffect)(() => {
|
|
123
|
-
const textarea = internalTextareaRef.current;
|
|
124
|
-
if (textarea) {
|
|
125
|
-
textarea.style.height = "auto";
|
|
126
|
-
textarea.style.height = `${Math.min(textarea.scrollHeight, maxHeight)}px`;
|
|
127
|
-
}
|
|
128
|
-
}, [value, maxHeight]);
|
|
129
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
130
|
-
"textarea",
|
|
131
|
-
{
|
|
132
|
-
ref: internalTextareaRef,
|
|
133
|
-
value,
|
|
134
|
-
onChange,
|
|
135
|
-
onKeyDown,
|
|
136
|
-
onCompositionStart,
|
|
137
|
-
onCompositionEnd,
|
|
138
|
-
placeholder,
|
|
139
|
-
style: {
|
|
140
|
-
overflow: "auto",
|
|
141
|
-
resize: "none",
|
|
142
|
-
maxHeight: `${maxHeight}px`
|
|
143
|
-
},
|
|
144
|
-
rows: 1
|
|
145
|
-
}
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
);
|
|
149
|
-
var Textarea_default = AutoResizingTextarea;
|
|
150
|
-
|
|
151
|
-
// src/hooks/use-push-to-talk.tsx
|
|
152
|
-
var import_react_core = require("@copilotkit/react-core");
|
|
153
|
-
var import_runtime_client_gql = require("@copilotkit/runtime-client-gql");
|
|
154
|
-
var import_react3 = require("react");
|
|
155
|
-
var startRecording = (mediaStreamRef, mediaRecorderRef, audioContextRef, recordedChunks, onStop) => __async(void 0, null, function* () {
|
|
156
|
-
if (!mediaStreamRef.current || !audioContextRef.current) {
|
|
157
|
-
mediaStreamRef.current = yield navigator.mediaDevices.getUserMedia({
|
|
158
|
-
audio: true
|
|
159
|
-
});
|
|
160
|
-
audioContextRef.current = new window.AudioContext();
|
|
161
|
-
yield audioContextRef.current.resume();
|
|
162
|
-
}
|
|
163
|
-
mediaRecorderRef.current = new MediaRecorder(mediaStreamRef.current);
|
|
164
|
-
mediaRecorderRef.current.start(1e3);
|
|
165
|
-
mediaRecorderRef.current.ondataavailable = (event) => {
|
|
166
|
-
recordedChunks.push(event.data);
|
|
167
|
-
};
|
|
168
|
-
mediaRecorderRef.current.onstop = onStop;
|
|
169
|
-
});
|
|
170
|
-
var stopRecording = (mediaRecorderRef) => {
|
|
171
|
-
if (mediaRecorderRef.current && mediaRecorderRef.current.state !== "inactive") {
|
|
172
|
-
mediaRecorderRef.current.stop();
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
var transcribeAudio = (recordedChunks, transcribeAudioUrl) => __async(void 0, null, function* () {
|
|
176
|
-
const completeBlob = new Blob(recordedChunks, { type: "audio/mp4" });
|
|
177
|
-
const formData = new FormData();
|
|
178
|
-
formData.append("file", completeBlob, "recording.mp4");
|
|
179
|
-
const response = yield fetch(transcribeAudioUrl, {
|
|
180
|
-
method: "POST",
|
|
181
|
-
body: formData
|
|
182
|
-
});
|
|
183
|
-
if (!response.ok) {
|
|
184
|
-
throw new Error(`Error: ${response.statusText}`);
|
|
185
|
-
}
|
|
186
|
-
const transcription = yield response.json();
|
|
187
|
-
return transcription.text;
|
|
188
|
-
});
|
|
189
|
-
var playAudioResponse = (text, textToSpeechUrl, audioContext) => {
|
|
190
|
-
const encodedText = encodeURIComponent(text);
|
|
191
|
-
const url = `${textToSpeechUrl}?text=${encodedText}`;
|
|
192
|
-
fetch(url).then((response) => response.arrayBuffer()).then((arrayBuffer) => audioContext.decodeAudioData(arrayBuffer)).then((audioBuffer) => {
|
|
193
|
-
const source = audioContext.createBufferSource();
|
|
194
|
-
source.buffer = audioBuffer;
|
|
195
|
-
source.connect(audioContext.destination);
|
|
196
|
-
source.start(0);
|
|
197
|
-
}).catch((error) => {
|
|
198
|
-
console.error("Error with decoding audio data", error);
|
|
199
|
-
});
|
|
200
|
-
};
|
|
201
|
-
var usePushToTalk = ({
|
|
202
|
-
sendFunction,
|
|
203
|
-
inProgress
|
|
204
|
-
}) => {
|
|
205
|
-
const [pushToTalkState, setPushToTalkState] = (0, import_react3.useState)("idle");
|
|
206
|
-
const mediaStreamRef = (0, import_react3.useRef)(null);
|
|
207
|
-
const audioContextRef = (0, import_react3.useRef)(null);
|
|
208
|
-
const mediaRecorderRef = (0, import_react3.useRef)(null);
|
|
209
|
-
const recordedChunks = (0, import_react3.useRef)([]);
|
|
210
|
-
const generalContext = (0, import_react_core.useCopilotContext)();
|
|
211
|
-
const messagesContext = (0, import_react_core.useCopilotMessagesContext)();
|
|
212
|
-
const context = __spreadValues(__spreadValues({}, generalContext), messagesContext);
|
|
213
|
-
const [startReadingFromMessageId, setStartReadingFromMessageId] = (0, import_react3.useState)(null);
|
|
214
|
-
(0, import_react3.useEffect)(() => {
|
|
215
|
-
if (pushToTalkState === "recording") {
|
|
216
|
-
startRecording(
|
|
217
|
-
mediaStreamRef,
|
|
218
|
-
mediaRecorderRef,
|
|
219
|
-
audioContextRef,
|
|
220
|
-
recordedChunks.current,
|
|
221
|
-
() => {
|
|
222
|
-
setPushToTalkState("transcribing");
|
|
223
|
-
}
|
|
224
|
-
);
|
|
225
|
-
} else {
|
|
226
|
-
stopRecording(mediaRecorderRef);
|
|
227
|
-
if (pushToTalkState === "transcribing") {
|
|
228
|
-
transcribeAudio(
|
|
229
|
-
recordedChunks.current,
|
|
230
|
-
context.copilotApiConfig.transcribeAudioUrl
|
|
231
|
-
).then((transcription) => __async(void 0, null, function* () {
|
|
232
|
-
recordedChunks.current = [];
|
|
233
|
-
setPushToTalkState("idle");
|
|
234
|
-
const message = yield sendFunction(transcription);
|
|
235
|
-
setStartReadingFromMessageId(message.id);
|
|
236
|
-
}));
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
return () => {
|
|
240
|
-
stopRecording(mediaRecorderRef);
|
|
241
|
-
};
|
|
242
|
-
}, [pushToTalkState]);
|
|
243
|
-
(0, import_react3.useEffect)(() => {
|
|
244
|
-
if (inProgress === false && startReadingFromMessageId) {
|
|
245
|
-
const lastMessageIndex = context.messages.findIndex(
|
|
246
|
-
(message) => message.id === startReadingFromMessageId
|
|
247
|
-
);
|
|
248
|
-
const aguiMessages = (0, import_runtime_client_gql.gqlToAGUI)(context.messages);
|
|
249
|
-
const messagesAfterLast = aguiMessages.slice(lastMessageIndex + 1).filter((message) => message.role === "assistant");
|
|
250
|
-
const text = messagesAfterLast.map((message) => message.content).join("\n");
|
|
251
|
-
playAudioResponse(
|
|
252
|
-
text,
|
|
253
|
-
context.copilotApiConfig.textToSpeechUrl,
|
|
254
|
-
audioContextRef.current
|
|
255
|
-
);
|
|
256
|
-
setStartReadingFromMessageId(null);
|
|
257
|
-
}
|
|
258
|
-
}, [startReadingFromMessageId, inProgress]);
|
|
259
|
-
return { pushToTalkState, setPushToTalkState };
|
|
260
|
-
};
|
|
261
|
-
|
|
262
|
-
// src/components/chat/Input.tsx
|
|
263
|
-
var import_react_core2 = require("@copilotkit/react-core");
|
|
264
|
-
|
|
265
|
-
// src/components/chat/PoweredByTag.tsx
|
|
266
|
-
var import_react4 = require("react");
|
|
267
|
-
|
|
268
|
-
// src/hooks/use-dark-mode.ts
|
|
269
|
-
var useDarkMode = () => {
|
|
270
|
-
if (typeof window === "undefined")
|
|
271
|
-
return false;
|
|
272
|
-
return document.documentElement.classList.contains("dark") || document.body.classList.contains("dark") || document.documentElement.getAttribute("data-theme") === "dark" || document.body.getAttribute("data-theme") === "dark" || window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
273
|
-
};
|
|
274
|
-
|
|
275
|
-
// src/components/chat/PoweredByTag.tsx
|
|
276
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
277
|
-
function PoweredByTag({
|
|
278
|
-
showPoweredBy = true
|
|
279
|
-
}) {
|
|
280
|
-
const [mounted, setMounted] = (0, import_react4.useState)(false);
|
|
281
|
-
const isDark = useDarkMode();
|
|
282
|
-
(0, import_react4.useEffect)(() => {
|
|
283
|
-
setMounted(true);
|
|
284
|
-
}, []);
|
|
285
|
-
if (!showPoweredBy) {
|
|
286
|
-
return null;
|
|
287
|
-
}
|
|
288
|
-
const poweredByStyle = {
|
|
289
|
-
visibility: "visible",
|
|
290
|
-
display: "block",
|
|
291
|
-
position: "static",
|
|
292
|
-
textAlign: "center",
|
|
293
|
-
fontSize: "12px",
|
|
294
|
-
padding: "3px 0",
|
|
295
|
-
color: mounted && isDark ? "rgb(69, 69, 69)" : "rgb(214, 214, 214)"
|
|
296
|
-
};
|
|
297
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "poweredBy", style: poweredByStyle, children: "Powered by CopilotKit" }) });
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
// src/components/chat/Input.tsx
|
|
301
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
302
|
-
var MAX_NEWLINES = 6;
|
|
303
|
-
var Input = ({
|
|
304
|
-
inProgress,
|
|
305
|
-
onSend,
|
|
306
|
-
chatReady = false,
|
|
307
|
-
onStop,
|
|
308
|
-
onUpload,
|
|
309
|
-
hideStopButton = false
|
|
310
|
-
}) => {
|
|
311
|
-
var _a;
|
|
312
|
-
const context = useChatContext();
|
|
313
|
-
const copilotContext = (0, import_react_core2.useCopilotContext)();
|
|
314
|
-
const showPoweredBy = !((_a = copilotContext.copilotApiConfig) == null ? void 0 : _a.publicApiKey);
|
|
315
|
-
const pushToTalkConfigured = copilotContext.copilotApiConfig.textToSpeechUrl !== void 0 && copilotContext.copilotApiConfig.transcribeAudioUrl !== void 0;
|
|
316
|
-
const textareaRef = (0, import_react5.useRef)(null);
|
|
317
|
-
const [isComposing, setIsComposing] = (0, import_react5.useState)(false);
|
|
318
|
-
const handleDivClick = (event) => {
|
|
319
|
-
var _a2;
|
|
320
|
-
const target = event.target;
|
|
321
|
-
if (target.closest("button"))
|
|
322
|
-
return;
|
|
323
|
-
if (target.tagName === "TEXTAREA")
|
|
324
|
-
return;
|
|
325
|
-
(_a2 = textareaRef.current) == null ? void 0 : _a2.focus();
|
|
326
|
-
};
|
|
327
|
-
const [text, setText] = (0, import_react5.useState)("");
|
|
328
|
-
const send = () => {
|
|
329
|
-
var _a2;
|
|
330
|
-
if (inProgress)
|
|
331
|
-
return;
|
|
332
|
-
onSend(text);
|
|
333
|
-
setText("");
|
|
334
|
-
(_a2 = textareaRef.current) == null ? void 0 : _a2.focus();
|
|
335
|
-
};
|
|
336
|
-
const { pushToTalkState, setPushToTalkState } = usePushToTalk({
|
|
337
|
-
sendFunction: onSend,
|
|
338
|
-
inProgress
|
|
339
|
-
});
|
|
340
|
-
const isInProgress = inProgress || pushToTalkState === "transcribing";
|
|
341
|
-
const { buttonIcon, buttonAlt } = (0, import_react5.useMemo)(() => {
|
|
342
|
-
if (!chatReady)
|
|
343
|
-
return { buttonIcon: context.icons.spinnerIcon, buttonAlt: "Loading" };
|
|
344
|
-
return isInProgress && !hideStopButton && chatReady ? { buttonIcon: context.icons.stopIcon, buttonAlt: "Stop" } : { buttonIcon: context.icons.sendIcon, buttonAlt: "Send" };
|
|
345
|
-
}, [
|
|
346
|
-
isInProgress,
|
|
347
|
-
chatReady,
|
|
348
|
-
hideStopButton,
|
|
349
|
-
context.icons.stopIcon,
|
|
350
|
-
context.icons.sendIcon
|
|
351
|
-
]);
|
|
352
|
-
const showPushToTalk = pushToTalkConfigured && (pushToTalkState === "idle" || pushToTalkState === "recording") && !inProgress;
|
|
353
|
-
const { interrupt } = (0, import_react_core2.useCopilotChatInternal)();
|
|
354
|
-
const canSend = (0, import_react5.useMemo)(() => {
|
|
355
|
-
return !isInProgress && text.trim().length > 0 && pushToTalkState === "idle" && !interrupt;
|
|
356
|
-
}, [interrupt, isInProgress, text, pushToTalkState]);
|
|
357
|
-
const canStop = (0, import_react5.useMemo)(() => {
|
|
358
|
-
return isInProgress && !hideStopButton;
|
|
359
|
-
}, [isInProgress, hideStopButton]);
|
|
360
|
-
const sendDisabled = !canSend && !canStop;
|
|
361
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
362
|
-
"div",
|
|
363
|
-
{
|
|
364
|
-
className: `copilotKitInputContainer ${showPoweredBy ? "poweredByContainer" : ""}`,
|
|
365
|
-
children: [
|
|
366
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
|
|
367
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
368
|
-
Textarea_default,
|
|
369
|
-
{
|
|
370
|
-
ref: textareaRef,
|
|
371
|
-
placeholder: context.labels.placeholder,
|
|
372
|
-
autoFocus: false,
|
|
373
|
-
maxRows: MAX_NEWLINES,
|
|
374
|
-
value: text,
|
|
375
|
-
onChange: (event) => setText(event.target.value),
|
|
376
|
-
onCompositionStart: () => setIsComposing(true),
|
|
377
|
-
onCompositionEnd: () => setIsComposing(false),
|
|
378
|
-
onKeyDown: (event) => {
|
|
379
|
-
if (event.key === "Enter" && !event.shiftKey && !isComposing) {
|
|
380
|
-
event.preventDefault();
|
|
381
|
-
if (canSend) {
|
|
382
|
-
send();
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
),
|
|
388
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "copilotKitInputControls", children: [
|
|
389
|
-
onUpload && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { onClick: onUpload, className: "copilotKitInputControlButton", children: context.icons.uploadIcon }),
|
|
390
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { flexGrow: 1 } }),
|
|
391
|
-
showPushToTalk && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
392
|
-
"button",
|
|
393
|
-
{
|
|
394
|
-
onClick: () => setPushToTalkState(
|
|
395
|
-
pushToTalkState === "idle" ? "recording" : "transcribing"
|
|
396
|
-
),
|
|
397
|
-
className: pushToTalkState === "recording" ? "copilotKitInputControlButton copilotKitPushToTalkRecording" : "copilotKitInputControlButton",
|
|
398
|
-
children: context.icons.pushToTalkIcon
|
|
399
|
-
}
|
|
400
|
-
),
|
|
401
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
402
|
-
"button",
|
|
403
|
-
{
|
|
404
|
-
disabled: sendDisabled,
|
|
405
|
-
onClick: isInProgress && !hideStopButton ? onStop : send,
|
|
406
|
-
"data-copilotkit-in-progress": inProgress,
|
|
407
|
-
"data-test-id": inProgress ? "copilot-chat-request-in-progress" : "copilot-chat-ready",
|
|
408
|
-
className: "copilotKitInputControlButton",
|
|
409
|
-
"aria-label": buttonAlt,
|
|
410
|
-
children: buttonIcon
|
|
411
|
-
}
|
|
412
|
-
)
|
|
413
|
-
] })
|
|
414
|
-
] }),
|
|
415
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PoweredByTag, { showPoweredBy })
|
|
416
|
-
]
|
|
417
|
-
}
|
|
418
|
-
);
|
|
419
|
-
};
|
|
420
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
421
|
-
0 && (module.exports = {
|
|
422
|
-
Input
|
|
423
|
-
});
|
|
424
|
-
//# sourceMappingURL=Input.js.map
|