@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
package/dist/components/index.js
DELETED
|
@@ -1,3345 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
10
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
-
var __objRest = (source, exclude) => {
|
|
26
|
-
var target = {};
|
|
27
|
-
for (var prop in source)
|
|
28
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
-
target[prop] = source[prop];
|
|
30
|
-
if (source != null && __getOwnPropSymbols)
|
|
31
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
-
target[prop] = source[prop];
|
|
34
|
-
}
|
|
35
|
-
return target;
|
|
36
|
-
};
|
|
37
|
-
var __export = (target, all) => {
|
|
38
|
-
for (var name in all)
|
|
39
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
40
|
-
};
|
|
41
|
-
var __copyProps = (to, from, except, desc) => {
|
|
42
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
43
|
-
for (let key of __getOwnPropNames(from))
|
|
44
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
45
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
46
|
-
}
|
|
47
|
-
return to;
|
|
48
|
-
};
|
|
49
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
50
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
51
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
52
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
53
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
54
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
55
|
-
mod
|
|
56
|
-
));
|
|
57
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
58
|
-
var __async = (__this, __arguments, generator) => {
|
|
59
|
-
return new Promise((resolve, reject) => {
|
|
60
|
-
var fulfilled = (value) => {
|
|
61
|
-
try {
|
|
62
|
-
step(generator.next(value));
|
|
63
|
-
} catch (e) {
|
|
64
|
-
reject(e);
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
var rejected = (value) => {
|
|
68
|
-
try {
|
|
69
|
-
step(generator.throw(value));
|
|
70
|
-
} catch (e) {
|
|
71
|
-
reject(e);
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
75
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
// src/components/index.ts
|
|
80
|
-
var components_exports = {};
|
|
81
|
-
__export(components_exports, {
|
|
82
|
-
AssistantMessage: () => AssistantMessage,
|
|
83
|
-
CopilotChat: () => CopilotChat,
|
|
84
|
-
CopilotDevConsole: () => CopilotDevConsole,
|
|
85
|
-
CopilotPopup: () => CopilotPopup,
|
|
86
|
-
CopilotSidebar: () => CopilotSidebar,
|
|
87
|
-
ImageRenderer: () => ImageRenderer,
|
|
88
|
-
Markdown: () => Markdown,
|
|
89
|
-
RenderSuggestion: () => Suggestion,
|
|
90
|
-
RenderSuggestionsList: () => Suggestions,
|
|
91
|
-
UserMessage: () => UserMessage,
|
|
92
|
-
shouldShowDevConsole: () => import_react_core3.shouldShowDevConsole,
|
|
93
|
-
useChatContext: () => useChatContext
|
|
94
|
-
});
|
|
95
|
-
module.exports = __toCommonJS(components_exports);
|
|
96
|
-
|
|
97
|
-
// src/components/chat/Modal.tsx
|
|
98
|
-
var import_react16 = __toESM(require("react"));
|
|
99
|
-
|
|
100
|
-
// src/components/chat/ChatContext.tsx
|
|
101
|
-
var import_react = __toESM(require("react"));
|
|
102
|
-
|
|
103
|
-
// src/components/chat/Icons.tsx
|
|
104
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
105
|
-
var OpenIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
106
|
-
"svg",
|
|
107
|
-
{
|
|
108
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
109
|
-
viewBox: "0 0 24 24",
|
|
110
|
-
fill: "currentColor",
|
|
111
|
-
width: "24",
|
|
112
|
-
height: "24",
|
|
113
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", { transform: "translate(24, 0) scale(-1, 1)", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
114
|
-
"path",
|
|
115
|
-
{
|
|
116
|
-
fillRule: "evenodd",
|
|
117
|
-
d: "M5.337 21.718a6.707 6.707 0 01-.533-.074.75.75 0 01-.44-1.223 3.73 3.73 0 00.814-1.686c.023-.115-.022-.317-.254-.543C3.274 16.587 2.25 14.41 2.25 12c0-5.03 4.428-9 9.75-9s9.75 3.97 9.75 9c0 5.03-4.428 9-9.75 9-.833 0-1.643-.097-2.417-.279a6.721 6.721 0 01-4.246.997z",
|
|
118
|
-
clipRule: "evenodd"
|
|
119
|
-
}
|
|
120
|
-
) })
|
|
121
|
-
}
|
|
122
|
-
);
|
|
123
|
-
var CloseIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
124
|
-
"svg",
|
|
125
|
-
{
|
|
126
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
127
|
-
fill: "none",
|
|
128
|
-
viewBox: "0 0 24 24",
|
|
129
|
-
strokeWidth: "1.5",
|
|
130
|
-
stroke: "currentColor",
|
|
131
|
-
width: "24",
|
|
132
|
-
height: "24",
|
|
133
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
134
|
-
"path",
|
|
135
|
-
{
|
|
136
|
-
strokeLinecap: "round",
|
|
137
|
-
strokeLinejoin: "round",
|
|
138
|
-
d: "M19.5 8.25l-7.5 7.5-7.5-7.5"
|
|
139
|
-
}
|
|
140
|
-
)
|
|
141
|
-
}
|
|
142
|
-
);
|
|
143
|
-
var HeaderCloseIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
144
|
-
"svg",
|
|
145
|
-
{
|
|
146
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
147
|
-
fill: "none",
|
|
148
|
-
viewBox: "0 0 24 24",
|
|
149
|
-
strokeWidth: "1.5",
|
|
150
|
-
stroke: "currentColor",
|
|
151
|
-
width: "24",
|
|
152
|
-
height: "24",
|
|
153
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
154
|
-
"path",
|
|
155
|
-
{
|
|
156
|
-
strokeLinecap: "round",
|
|
157
|
-
strokeLinejoin: "round",
|
|
158
|
-
d: "M6 18L18 6M6 6l12 12"
|
|
159
|
-
}
|
|
160
|
-
)
|
|
161
|
-
}
|
|
162
|
-
);
|
|
163
|
-
var SendIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
164
|
-
"svg",
|
|
165
|
-
{
|
|
166
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
167
|
-
fill: "none",
|
|
168
|
-
viewBox: "0 0 24 24",
|
|
169
|
-
strokeWidth: "1.5",
|
|
170
|
-
stroke: "currentColor",
|
|
171
|
-
width: "24",
|
|
172
|
-
height: "24",
|
|
173
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
174
|
-
"path",
|
|
175
|
-
{
|
|
176
|
-
strokeLinecap: "round",
|
|
177
|
-
strokeLinejoin: "round",
|
|
178
|
-
d: "M12 19V5m0 0l-7 7m7-7l7 7"
|
|
179
|
-
}
|
|
180
|
-
)
|
|
181
|
-
}
|
|
182
|
-
);
|
|
183
|
-
var MicrophoneIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
184
|
-
"svg",
|
|
185
|
-
{
|
|
186
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
187
|
-
fill: "none",
|
|
188
|
-
viewBox: "0 0 24 24",
|
|
189
|
-
strokeWidth: "1.5",
|
|
190
|
-
stroke: "currentColor",
|
|
191
|
-
width: "24",
|
|
192
|
-
height: "24",
|
|
193
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
194
|
-
"path",
|
|
195
|
-
{
|
|
196
|
-
strokeLinecap: "round",
|
|
197
|
-
strokeLinejoin: "round",
|
|
198
|
-
d: "M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"
|
|
199
|
-
}
|
|
200
|
-
)
|
|
201
|
-
}
|
|
202
|
-
);
|
|
203
|
-
var StopIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
204
|
-
"svg",
|
|
205
|
-
{
|
|
206
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
207
|
-
fill: "none",
|
|
208
|
-
viewBox: "0 0 24 24",
|
|
209
|
-
strokeWidth: "1.5",
|
|
210
|
-
stroke: "currentColor",
|
|
211
|
-
width: "24",
|
|
212
|
-
height: "24",
|
|
213
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
214
|
-
"path",
|
|
215
|
-
{
|
|
216
|
-
strokeLinecap: "round",
|
|
217
|
-
strokeLinejoin: "round",
|
|
218
|
-
d: "M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"
|
|
219
|
-
}
|
|
220
|
-
)
|
|
221
|
-
}
|
|
222
|
-
);
|
|
223
|
-
var RegenerateIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
224
|
-
"svg",
|
|
225
|
-
{
|
|
226
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
227
|
-
fill: "none",
|
|
228
|
-
viewBox: "0 0 24 24",
|
|
229
|
-
strokeWidth: "2",
|
|
230
|
-
stroke: "currentColor",
|
|
231
|
-
width: "16",
|
|
232
|
-
height: "16",
|
|
233
|
-
style: { minWidth: "16px", minHeight: "16px" },
|
|
234
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
235
|
-
"path",
|
|
236
|
-
{
|
|
237
|
-
strokeLinecap: "round",
|
|
238
|
-
strokeLinejoin: "round",
|
|
239
|
-
d: "M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182m0-4.991v4.99"
|
|
240
|
-
}
|
|
241
|
-
)
|
|
242
|
-
}
|
|
243
|
-
);
|
|
244
|
-
var CopyIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
245
|
-
"svg",
|
|
246
|
-
{
|
|
247
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
248
|
-
fill: "none",
|
|
249
|
-
viewBox: "0 0 24 24",
|
|
250
|
-
strokeWidth: "2",
|
|
251
|
-
stroke: "currentColor",
|
|
252
|
-
width: "16",
|
|
253
|
-
height: "16",
|
|
254
|
-
style: { minWidth: "16px", minHeight: "16px" },
|
|
255
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
256
|
-
"path",
|
|
257
|
-
{
|
|
258
|
-
strokeLinecap: "round",
|
|
259
|
-
strokeLinejoin: "round",
|
|
260
|
-
d: "M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 01-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 011.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 00-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 01-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 00-3.375-3.375h-1.5a1.125 1.125 0 01-1.125-1.125v-1.5a3.375 3.375 0 00-3.375-3.375H9.75"
|
|
261
|
-
}
|
|
262
|
-
)
|
|
263
|
-
}
|
|
264
|
-
);
|
|
265
|
-
var SmallSpinnerIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
266
|
-
"span",
|
|
267
|
-
{
|
|
268
|
-
className: "copilotKitSpinner",
|
|
269
|
-
style: { width: "13px", height: "13px" }
|
|
270
|
-
}
|
|
271
|
-
);
|
|
272
|
-
var SpinnerIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
273
|
-
"span",
|
|
274
|
-
{
|
|
275
|
-
className: "copilotKitSpinner",
|
|
276
|
-
style: { width: "24px", height: "24px" }
|
|
277
|
-
}
|
|
278
|
-
);
|
|
279
|
-
var ActivityIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: [
|
|
280
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
281
|
-
"span",
|
|
282
|
-
{
|
|
283
|
-
className: "copilotKitActivityDot",
|
|
284
|
-
style: { animationDelay: "0s" }
|
|
285
|
-
}
|
|
286
|
-
),
|
|
287
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
288
|
-
"span",
|
|
289
|
-
{
|
|
290
|
-
className: "copilotKitActivityDot",
|
|
291
|
-
style: { animationDelay: "0.2s" }
|
|
292
|
-
}
|
|
293
|
-
),
|
|
294
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
295
|
-
"span",
|
|
296
|
-
{
|
|
297
|
-
className: "copilotKitActivityDot",
|
|
298
|
-
style: { animationDelay: "0.4s" }
|
|
299
|
-
}
|
|
300
|
-
)
|
|
301
|
-
] });
|
|
302
|
-
var ThumbsUpIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
303
|
-
"svg",
|
|
304
|
-
{
|
|
305
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
306
|
-
fill: "none",
|
|
307
|
-
viewBox: "0 0 24 24",
|
|
308
|
-
strokeWidth: "2",
|
|
309
|
-
stroke: "currentColor",
|
|
310
|
-
width: "16",
|
|
311
|
-
height: "16",
|
|
312
|
-
style: { minWidth: "16px", minHeight: "16px" },
|
|
313
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
314
|
-
"path",
|
|
315
|
-
{
|
|
316
|
-
strokeLinecap: "round",
|
|
317
|
-
strokeLinejoin: "round",
|
|
318
|
-
d: "M6.633 10.5c.806 0 1.533-.446 2.031-1.08a9.041 9.041 0 012.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 00.322-1.672V3a.75.75 0 01.75-.75A2.25 2.25 0 0116.5 4.5c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 01-2.649 7.521c-.388.482-.987.729-1.605.729H13.48c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 00-1.423-.23H5.904M14.25 9h2.25M5.904 18.75c.083.205.173.405.27.602.197.4-.078.898-.523.898h-.908c-.889 0-1.713-.518-1.972-1.368a12 12 0 01-.521-3.507c0-1.553.295-3.036.831-4.398C3.387 10.203 4.167 9.75 5 9.75h1.053c.472 0 .745.556.5.96a8.958 8.958 0 00-1.302 4.665c0 1.194.232 2.333.654 3.375z"
|
|
319
|
-
}
|
|
320
|
-
)
|
|
321
|
-
}
|
|
322
|
-
);
|
|
323
|
-
var ThumbsDownIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
324
|
-
"svg",
|
|
325
|
-
{
|
|
326
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
327
|
-
fill: "none",
|
|
328
|
-
viewBox: "0 0 24 24",
|
|
329
|
-
strokeWidth: "2",
|
|
330
|
-
stroke: "currentColor",
|
|
331
|
-
width: "16",
|
|
332
|
-
height: "16",
|
|
333
|
-
style: { minWidth: "16px", minHeight: "16px" },
|
|
334
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
335
|
-
"path",
|
|
336
|
-
{
|
|
337
|
-
strokeLinecap: "round",
|
|
338
|
-
strokeLinejoin: "round",
|
|
339
|
-
d: "M7.5 15h2.25m8.024-9.75c.011.05.028.1.052.148.591 1.2.924 2.55.924 3.977a8.96 8.96 0 01-.999 4.125m.023-8.25c-.076-.365.183-.75.575-.75h.908c.889 0 1.713.518 1.972 1.368.339 1.11.521 2.287.521 3.507 0 1.553-.295 3.036-.831 4.398C20.613 14.547 19.833 15 19 15h-1.053c-.472 0-.745-.556-.5-.96a8.95 8.95 0 00.303-.54m.023-8.25H16.48a4.5 4.5 0 01-1.423-.23l-3.114-1.04a4.5 4.5 0 00-1.423-.23H6.504c-.618 0-1.217.247-1.605.729A11.95 11.95 0 002.25 12c0 .434.023.863.068 1.285C2.427 14.306 3.346 15 4.372 15h3.126c.618 0 .991.724.725 1.282A7.471 7.471 0 007.5 19.5a2.25 2.25 0 002.25 2.25.75.75 0 00.75-.75v-.633c0-.573.11-1.14.322-1.672.304-.76.93-1.33 1.653-1.715a9.04 9.04 0 002.86-2.4c.498-.634 1.226-1.08 2.032-1.08h.384"
|
|
340
|
-
}
|
|
341
|
-
)
|
|
342
|
-
}
|
|
343
|
-
);
|
|
344
|
-
var DownloadIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
345
|
-
"svg",
|
|
346
|
-
{
|
|
347
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
348
|
-
fill: "none",
|
|
349
|
-
viewBox: "0 0 24 24",
|
|
350
|
-
strokeWidth: "2",
|
|
351
|
-
stroke: "currentColor",
|
|
352
|
-
width: "16",
|
|
353
|
-
height: "16",
|
|
354
|
-
style: { minWidth: "16px", minHeight: "16px" },
|
|
355
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
356
|
-
"path",
|
|
357
|
-
{
|
|
358
|
-
strokeLinecap: "round",
|
|
359
|
-
strokeLinejoin: "round",
|
|
360
|
-
d: "M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"
|
|
361
|
-
}
|
|
362
|
-
)
|
|
363
|
-
}
|
|
364
|
-
);
|
|
365
|
-
var UploadIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
366
|
-
"svg",
|
|
367
|
-
{
|
|
368
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
369
|
-
fill: "none",
|
|
370
|
-
viewBox: "0 0 24 24",
|
|
371
|
-
strokeWidth: "1.5",
|
|
372
|
-
stroke: "currentColor",
|
|
373
|
-
width: "24",
|
|
374
|
-
height: "24",
|
|
375
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
376
|
-
"path",
|
|
377
|
-
{
|
|
378
|
-
strokeLinecap: "round",
|
|
379
|
-
strokeLinejoin: "round",
|
|
380
|
-
d: "M12 4.5v15m7.5-7.5h-15"
|
|
381
|
-
}
|
|
382
|
-
)
|
|
383
|
-
}
|
|
384
|
-
);
|
|
385
|
-
var CheckIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
386
|
-
"svg",
|
|
387
|
-
{
|
|
388
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
389
|
-
fill: "none",
|
|
390
|
-
viewBox: "0 0 24 24",
|
|
391
|
-
strokeWidth: "2",
|
|
392
|
-
stroke: "currentColor",
|
|
393
|
-
width: "16",
|
|
394
|
-
height: "16",
|
|
395
|
-
style: { minWidth: "16px", minHeight: "16px" },
|
|
396
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
397
|
-
"path",
|
|
398
|
-
{
|
|
399
|
-
strokeLinecap: "round",
|
|
400
|
-
strokeLinejoin: "round",
|
|
401
|
-
d: "M4.5 12.75l6 6 9-13.5"
|
|
402
|
-
}
|
|
403
|
-
)
|
|
404
|
-
}
|
|
405
|
-
);
|
|
406
|
-
|
|
407
|
-
// src/components/chat/ChatContext.tsx
|
|
408
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
409
|
-
var ChatContext = import_react.default.createContext(
|
|
410
|
-
void 0
|
|
411
|
-
);
|
|
412
|
-
function useChatContext() {
|
|
413
|
-
const context = import_react.default.useContext(ChatContext);
|
|
414
|
-
if (context === void 0) {
|
|
415
|
-
throw new Error(
|
|
416
|
-
"Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?"
|
|
417
|
-
);
|
|
418
|
-
}
|
|
419
|
-
return context;
|
|
420
|
-
}
|
|
421
|
-
var ChatContextProvider = ({
|
|
422
|
-
// temperature,
|
|
423
|
-
// instructions,
|
|
424
|
-
// maxFeedback,
|
|
425
|
-
labels,
|
|
426
|
-
icons,
|
|
427
|
-
children,
|
|
428
|
-
open,
|
|
429
|
-
setOpen
|
|
430
|
-
}) => {
|
|
431
|
-
const memoizedLabels = (0, import_react.useMemo)(
|
|
432
|
-
() => __spreadValues(__spreadValues({}, {
|
|
433
|
-
initial: "",
|
|
434
|
-
title: "CopilotKit",
|
|
435
|
-
placeholder: "Type a message...",
|
|
436
|
-
error: "\u274C An error occurred. Please try again.",
|
|
437
|
-
stopGenerating: "Stop generating",
|
|
438
|
-
regenerateResponse: "Regenerate response",
|
|
439
|
-
copyToClipboard: "Copy to clipboard",
|
|
440
|
-
thumbsUp: "Thumbs up",
|
|
441
|
-
thumbsDown: "Thumbs down",
|
|
442
|
-
copied: "Copied!"
|
|
443
|
-
}), labels),
|
|
444
|
-
[labels]
|
|
445
|
-
);
|
|
446
|
-
const memoizedIcons = (0, import_react.useMemo)(
|
|
447
|
-
() => __spreadValues(__spreadValues({}, {
|
|
448
|
-
openIcon: OpenIcon,
|
|
449
|
-
closeIcon: CloseIcon,
|
|
450
|
-
headerCloseIcon: HeaderCloseIcon,
|
|
451
|
-
sendIcon: SendIcon,
|
|
452
|
-
activityIcon: ActivityIcon,
|
|
453
|
-
spinnerIcon: SpinnerIcon,
|
|
454
|
-
stopIcon: StopIcon,
|
|
455
|
-
regenerateIcon: RegenerateIcon,
|
|
456
|
-
pushToTalkIcon: MicrophoneIcon,
|
|
457
|
-
copyIcon: CopyIcon,
|
|
458
|
-
thumbsUpIcon: ThumbsUpIcon,
|
|
459
|
-
thumbsDownIcon: ThumbsDownIcon,
|
|
460
|
-
uploadIcon: UploadIcon
|
|
461
|
-
}), icons),
|
|
462
|
-
[icons]
|
|
463
|
-
);
|
|
464
|
-
const context = (0, import_react.useMemo)(
|
|
465
|
-
() => ({
|
|
466
|
-
labels: memoizedLabels,
|
|
467
|
-
icons: memoizedIcons,
|
|
468
|
-
open,
|
|
469
|
-
setOpen
|
|
470
|
-
}),
|
|
471
|
-
[memoizedLabels, memoizedIcons, open, setOpen]
|
|
472
|
-
);
|
|
473
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ChatContext.Provider, { value: context, children });
|
|
474
|
-
};
|
|
475
|
-
|
|
476
|
-
// src/components/chat/Window.tsx
|
|
477
|
-
var import_react2 = __toESM(require("react"));
|
|
478
|
-
var import_react_core = require("@copilotkit/react-core");
|
|
479
|
-
var import_shared = require("@copilotkit/shared");
|
|
480
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
481
|
-
var Window = ({
|
|
482
|
-
children,
|
|
483
|
-
clickOutsideToClose,
|
|
484
|
-
shortcut,
|
|
485
|
-
hitEscapeToClose
|
|
486
|
-
}) => {
|
|
487
|
-
const windowRef = import_react2.default.useRef(null);
|
|
488
|
-
const context = (0, import_react_core.useCopilotContext)();
|
|
489
|
-
const { open, setOpen } = useChatContext();
|
|
490
|
-
const handleClickOutside = (0, import_react2.useCallback)(
|
|
491
|
-
(event) => {
|
|
492
|
-
var _a;
|
|
493
|
-
if (!clickOutsideToClose) {
|
|
494
|
-
return;
|
|
495
|
-
}
|
|
496
|
-
const parentElement = (_a = windowRef.current) == null ? void 0 : _a.parentElement;
|
|
497
|
-
let className = "";
|
|
498
|
-
if (event.target instanceof HTMLElement) {
|
|
499
|
-
className = event.target.className;
|
|
500
|
-
}
|
|
501
|
-
if (open && parentElement && !parentElement.contains(event.target) && // prevent closing the window when clicking on the debug menu
|
|
502
|
-
!className.includes("copilotKitDebugMenu")) {
|
|
503
|
-
setOpen(false);
|
|
504
|
-
}
|
|
505
|
-
},
|
|
506
|
-
[clickOutsideToClose, open, setOpen]
|
|
507
|
-
);
|
|
508
|
-
const handleKeyDown = (0, import_react2.useCallback)(
|
|
509
|
-
(event) => {
|
|
510
|
-
var _a;
|
|
511
|
-
const target = event.target;
|
|
512
|
-
const isInput = target.tagName === "INPUT" || target.tagName === "SELECT" || target.tagName === "TEXTAREA" || target.isContentEditable;
|
|
513
|
-
const isDescendantOfWrapper = (_a = windowRef.current) == null ? void 0 : _a.contains(target);
|
|
514
|
-
if (open && event.key === "Escape" && (!isInput || isDescendantOfWrapper) && hitEscapeToClose) {
|
|
515
|
-
setOpen(false);
|
|
516
|
-
} else if (event.key === shortcut && ((0, import_shared.isMacOS)() && event.metaKey || !(0, import_shared.isMacOS)() && event.ctrlKey) && (!isInput || isDescendantOfWrapper)) {
|
|
517
|
-
setOpen(!open);
|
|
518
|
-
}
|
|
519
|
-
},
|
|
520
|
-
[hitEscapeToClose, shortcut, open, setOpen]
|
|
521
|
-
);
|
|
522
|
-
const adjustForMobile = (0, import_react2.useCallback)(() => {
|
|
523
|
-
const copilotKitWindow = windowRef.current;
|
|
524
|
-
const vv = window.visualViewport;
|
|
525
|
-
if (!copilotKitWindow || !vv) {
|
|
526
|
-
return;
|
|
527
|
-
}
|
|
528
|
-
if (window.innerWidth < 640 && open) {
|
|
529
|
-
copilotKitWindow.style.height = `${vv.height}px`;
|
|
530
|
-
copilotKitWindow.style.left = `${vv.offsetLeft}px`;
|
|
531
|
-
copilotKitWindow.style.top = `${vv.offsetTop}px`;
|
|
532
|
-
document.body.style.position = "fixed";
|
|
533
|
-
document.body.style.width = "100%";
|
|
534
|
-
document.body.style.height = `${window.innerHeight}px`;
|
|
535
|
-
document.body.style.overflow = "hidden";
|
|
536
|
-
document.body.style.touchAction = "none";
|
|
537
|
-
document.body.addEventListener("touchmove", preventScroll, {
|
|
538
|
-
passive: false
|
|
539
|
-
});
|
|
540
|
-
} else {
|
|
541
|
-
copilotKitWindow.style.height = "";
|
|
542
|
-
copilotKitWindow.style.left = "";
|
|
543
|
-
copilotKitWindow.style.top = "";
|
|
544
|
-
document.body.style.position = "";
|
|
545
|
-
document.body.style.height = "";
|
|
546
|
-
document.body.style.width = "";
|
|
547
|
-
document.body.style.overflow = "";
|
|
548
|
-
document.body.style.top = "";
|
|
549
|
-
document.body.style.touchAction = "";
|
|
550
|
-
document.body.removeEventListener("touchmove", preventScroll);
|
|
551
|
-
}
|
|
552
|
-
}, [open]);
|
|
553
|
-
(0, import_react2.useEffect)(() => {
|
|
554
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
555
|
-
document.addEventListener("keydown", handleKeyDown);
|
|
556
|
-
if (window.visualViewport) {
|
|
557
|
-
window.visualViewport.addEventListener("resize", adjustForMobile);
|
|
558
|
-
adjustForMobile();
|
|
559
|
-
}
|
|
560
|
-
return () => {
|
|
561
|
-
document.removeEventListener("mousedown", handleClickOutside);
|
|
562
|
-
document.removeEventListener("keydown", handleKeyDown);
|
|
563
|
-
if (window.visualViewport) {
|
|
564
|
-
window.visualViewport.removeEventListener("resize", adjustForMobile);
|
|
565
|
-
}
|
|
566
|
-
};
|
|
567
|
-
}, [adjustForMobile, handleClickOutside, handleKeyDown]);
|
|
568
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: `copilotKitWindow ${open ? " open" : ""}`, ref: windowRef, children });
|
|
569
|
-
};
|
|
570
|
-
var preventScroll = (event) => {
|
|
571
|
-
let targetElement = event.target;
|
|
572
|
-
const hasParentWithClass = (element, className) => {
|
|
573
|
-
while (element && element !== document.body) {
|
|
574
|
-
if (element.classList.contains(className)) {
|
|
575
|
-
return true;
|
|
576
|
-
}
|
|
577
|
-
element = element.parentElement;
|
|
578
|
-
}
|
|
579
|
-
return false;
|
|
580
|
-
};
|
|
581
|
-
if (!hasParentWithClass(targetElement, "copilotKitMessages")) {
|
|
582
|
-
event.preventDefault();
|
|
583
|
-
}
|
|
584
|
-
};
|
|
585
|
-
|
|
586
|
-
// src/components/chat/Button.tsx
|
|
587
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
588
|
-
var Button = ({}) => {
|
|
589
|
-
const { open, setOpen, icons } = useChatContext();
|
|
590
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { onClick: () => setOpen(!open), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
591
|
-
"button",
|
|
592
|
-
{
|
|
593
|
-
className: `copilotKitButton ${open ? "open" : ""}`,
|
|
594
|
-
"aria-label": open ? "Close Chat" : "Open Chat",
|
|
595
|
-
children: [
|
|
596
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "copilotKitButtonIcon copilotKitButtonIconOpen", children: icons.openIcon }),
|
|
597
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "copilotKitButtonIcon copilotKitButtonIconClose", children: icons.closeIcon })
|
|
598
|
-
]
|
|
599
|
-
}
|
|
600
|
-
) });
|
|
601
|
-
};
|
|
602
|
-
|
|
603
|
-
// src/components/dev-console/utils.ts
|
|
604
|
-
var import_react_core2 = require("@copilotkit/react-core");
|
|
605
|
-
var import_react_core3 = require("@copilotkit/react-core");
|
|
606
|
-
function getPublishedCopilotKitVersion(current, forceCheck = false) {
|
|
607
|
-
return __async(this, null, function* () {
|
|
608
|
-
const LOCAL_STORAGE_KEY = "__copilotkit_version_check__";
|
|
609
|
-
const serializedVersion = localStorage.getItem(LOCAL_STORAGE_KEY);
|
|
610
|
-
if (serializedVersion && !forceCheck) {
|
|
611
|
-
try {
|
|
612
|
-
const parsedVersion = JSON.parse(serializedVersion);
|
|
613
|
-
const oneHour = 60 * 60 * 1e3;
|
|
614
|
-
const now = (/* @__PURE__ */ new Date()).getTime();
|
|
615
|
-
if (parsedVersion.current === current && now - new Date(parsedVersion.lastChecked).getTime() < oneHour) {
|
|
616
|
-
return parsedVersion;
|
|
617
|
-
}
|
|
618
|
-
} catch (error) {
|
|
619
|
-
console.error(
|
|
620
|
-
"Failed to parse CopilotKitVersion from localStorage",
|
|
621
|
-
error
|
|
622
|
-
);
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
try {
|
|
626
|
-
const response = yield fetch(
|
|
627
|
-
"https://api.cloud.copilotkit.ai/check-for-updates",
|
|
628
|
-
{
|
|
629
|
-
method: "POST",
|
|
630
|
-
headers: {
|
|
631
|
-
"Content-Type": "application/json"
|
|
632
|
-
},
|
|
633
|
-
body: JSON.stringify({
|
|
634
|
-
packages: [
|
|
635
|
-
{
|
|
636
|
-
packageName: "@copilotkit/shared",
|
|
637
|
-
packageVersion: current
|
|
638
|
-
}
|
|
639
|
-
]
|
|
640
|
-
})
|
|
641
|
-
}
|
|
642
|
-
);
|
|
643
|
-
const data = yield response.json();
|
|
644
|
-
const version = {
|
|
645
|
-
current,
|
|
646
|
-
lastChecked: (/* @__PURE__ */ new Date()).getTime(),
|
|
647
|
-
latest: data.packages[0].latestVersion,
|
|
648
|
-
severity: data.packages[0].severity,
|
|
649
|
-
advisory: data.packages[0].advisory || null
|
|
650
|
-
};
|
|
651
|
-
localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(version));
|
|
652
|
-
return version;
|
|
653
|
-
} catch (error) {
|
|
654
|
-
console.error("Failed to check for updates", error);
|
|
655
|
-
throw error;
|
|
656
|
-
}
|
|
657
|
-
});
|
|
658
|
-
}
|
|
659
|
-
function logReadables(context) {
|
|
660
|
-
console.log("%cCurrent Readables:", "font-size: 16px; font-weight: bold;");
|
|
661
|
-
const readables = context.getContextString([], import_react_core2.defaultCopilotContextCategories).trim();
|
|
662
|
-
if (readables.length === 0) {
|
|
663
|
-
console.log("No readables found");
|
|
664
|
-
return;
|
|
665
|
-
}
|
|
666
|
-
console.log(readables);
|
|
667
|
-
}
|
|
668
|
-
function logActions(context) {
|
|
669
|
-
console.log("%cCurrent Actions:", "font-size: 16px; font-weight: bold;");
|
|
670
|
-
if (Object.values(context.actions).length === 0) {
|
|
671
|
-
console.log("No actions found");
|
|
672
|
-
return;
|
|
673
|
-
}
|
|
674
|
-
for (const action of Object.values(context.actions)) {
|
|
675
|
-
console.group(action.name);
|
|
676
|
-
console.log("name", action.name);
|
|
677
|
-
console.log("description", action.description);
|
|
678
|
-
console.log("parameters", action.parameters);
|
|
679
|
-
console.groupEnd();
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
function logMessages(context) {
|
|
683
|
-
console.log("%cCurrent Messages:", "font-size: 16px; font-weight: bold;");
|
|
684
|
-
if (context.messages.length === 0) {
|
|
685
|
-
console.log("No messages found");
|
|
686
|
-
return;
|
|
687
|
-
}
|
|
688
|
-
const tableData = context.messages.map((message) => {
|
|
689
|
-
if (message.isTextMessage()) {
|
|
690
|
-
return {
|
|
691
|
-
id: message.id,
|
|
692
|
-
type: "TextMessage",
|
|
693
|
-
role: message.role,
|
|
694
|
-
name: void 0,
|
|
695
|
-
scope: void 0,
|
|
696
|
-
content: message.content
|
|
697
|
-
};
|
|
698
|
-
} else if (message.isActionExecutionMessage()) {
|
|
699
|
-
return {
|
|
700
|
-
id: message.id,
|
|
701
|
-
type: "ActionExecutionMessage",
|
|
702
|
-
role: void 0,
|
|
703
|
-
name: message.name,
|
|
704
|
-
scope: message.parentMessageId,
|
|
705
|
-
content: message.arguments
|
|
706
|
-
};
|
|
707
|
-
} else if (message.isResultMessage()) {
|
|
708
|
-
return {
|
|
709
|
-
id: message.id,
|
|
710
|
-
type: "ResultMessage",
|
|
711
|
-
role: void 0,
|
|
712
|
-
name: message.actionName,
|
|
713
|
-
scope: message.actionExecutionId,
|
|
714
|
-
content: message.result
|
|
715
|
-
};
|
|
716
|
-
} else if (message.isAgentStateMessage()) {
|
|
717
|
-
return {
|
|
718
|
-
id: message.id,
|
|
719
|
-
type: `AgentStateMessage (running: ${message.running})`,
|
|
720
|
-
role: message.role,
|
|
721
|
-
name: void 0,
|
|
722
|
-
scope: message.threadId,
|
|
723
|
-
content: message.state
|
|
724
|
-
};
|
|
725
|
-
}
|
|
726
|
-
});
|
|
727
|
-
console.table(tableData);
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
// src/components/dev-console/console.tsx
|
|
731
|
-
var import_react_core4 = require("@copilotkit/react-core");
|
|
732
|
-
var import_react4 = require("react");
|
|
733
|
-
|
|
734
|
-
// src/components/dev-console/icons.tsx
|
|
735
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
736
|
-
var ExclamationMarkTriangleIcon = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
737
|
-
"svg",
|
|
738
|
-
{
|
|
739
|
-
width: "13.3967723px",
|
|
740
|
-
height: "12px",
|
|
741
|
-
viewBox: "0 0 13.3967723 12",
|
|
742
|
-
version: "1.1",
|
|
743
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
744
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { id: "exclamation-triangle", fill: "#CD2121", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
745
|
-
"path",
|
|
746
|
-
{
|
|
747
|
-
d: "M5.39935802,0.75 C5.97670802,-0.25 7.42007802,-0.25 7.99742802,0.75 L13.193588,9.75 C13.770888,10.75 13.049288,12 11.894588,12 L1.50223802,12 C0.34753802,12 -0.37414898,10.75 0.20319802,9.75 L5.39935802,0.75 Z M6.69838802,2.5 C7.11260802,2.5 7.44838802,2.83579 7.44838802,3.25 L7.44838802,6.25 C7.44838802,6.66421 7.11260802,7 6.69838802,7 C6.28417802,7 5.94838802,6.66421 5.94838802,6.25 L5.94838802,3.25 C5.94838802,2.83579 6.28417802,2.5 6.69838802,2.5 Z M6.69838802,10.5 C7.25067802,10.5 7.69838802,10.0523 7.69838802,9.5 C7.69838802,8.9477 7.25067802,8.5 6.69838802,8.5 C6.14610802,8.5 5.69838802,8.9477 5.69838802,9.5 C5.69838802,10.0523 6.14610802,10.5 6.69838802,10.5 Z",
|
|
748
|
-
id: "Shape"
|
|
749
|
-
}
|
|
750
|
-
) }) })
|
|
751
|
-
}
|
|
752
|
-
);
|
|
753
|
-
var ExclamationMarkIcon = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
754
|
-
"svg",
|
|
755
|
-
{
|
|
756
|
-
width: "14px",
|
|
757
|
-
height: "14px",
|
|
758
|
-
viewBox: "0 0 14 14",
|
|
759
|
-
version: "1.1",
|
|
760
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
761
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { id: "exclamation-circle", fill: "#EC662C", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
762
|
-
"path",
|
|
763
|
-
{
|
|
764
|
-
d: "M7,14 C10.866,14 14,10.866 14,7 C14,3.13401 10.866,0 7,0 C3.13401,0 0,3.13401 0,7 C0,10.866 3.13401,14 7,14 Z M7,3 C7.41421,3 7.75,3.33579 7.75,3.75 L7.75,6.75 C7.75,7.16421 7.41421,7.5 7,7.5 C6.58579,7.5 6.25,7.16421 6.25,6.75 L6.25,3.75 C6.25,3.33579 6.58579,3 7,3 Z M7,11 C7.55228,11 8,10.5523 8,10 C8,9.4477 7.55228,9 7,9 C6.44772,9 6,9.4477 6,10 C6,10.5523 6.44772,11 7,11 Z",
|
|
765
|
-
id: "Shape"
|
|
766
|
-
}
|
|
767
|
-
) }) })
|
|
768
|
-
}
|
|
769
|
-
);
|
|
770
|
-
var ChevronDownIcon = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
771
|
-
"svg",
|
|
772
|
-
{
|
|
773
|
-
width: "7px",
|
|
774
|
-
height: "4px",
|
|
775
|
-
viewBox: "0 0 7 4",
|
|
776
|
-
version: "1.1",
|
|
777
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
778
|
-
fill: "currentColor",
|
|
779
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { id: "Group", fill: "currentColor", fillRule: "nonzero", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
780
|
-
"path",
|
|
781
|
-
{
|
|
782
|
-
d: "M3.71690723,3.90271086 C3.59268176,4.03242971 3.39143629,4.03242971 3.26721082,3.90271086 L0.0853966595,0.57605615 C-0.0314221035,0.444981627 -0.0279751448,0.240725043 0.0931934622,0.114040675 C0.214362069,-0.0126436935 0.409725445,-0.0162475626 0.535093061,0.105888951 L3.49205902,3.19746006 L6.44902499,0.105888951 C6.52834574,0.0168884389 6.64780588,-0.0197473458 6.7605411,0.0103538404 C6.87327633,0.0404550266 6.96130636,0.132492308 6.99009696,0.250359396 C7.01888756,0.368226483 6.98384687,0.493124608 6.89872139,0.57605615 L3.71690723,3.90271086 Z",
|
|
783
|
-
id: "Path"
|
|
784
|
-
}
|
|
785
|
-
) }) })
|
|
786
|
-
}
|
|
787
|
-
);
|
|
788
|
-
var CheckIcon2 = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
789
|
-
"svg",
|
|
790
|
-
{
|
|
791
|
-
width: "14px",
|
|
792
|
-
height: "14px",
|
|
793
|
-
viewBox: "0 0 14 14",
|
|
794
|
-
version: "1.1",
|
|
795
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
796
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
797
|
-
"g",
|
|
798
|
-
{
|
|
799
|
-
id: "Group-2",
|
|
800
|
-
transform: "translate(-118, 0)",
|
|
801
|
-
fill: "#1BC030",
|
|
802
|
-
fillRule: "nonzero",
|
|
803
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { id: "Group", transform: "translate(118, 0)", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
804
|
-
"path",
|
|
805
|
-
{
|
|
806
|
-
d: "M0,7 C0,3.13384615 3.13384615,0 7,0 C10.8661538,0 14,3.13384615 14,7 C14,10.8661538 10.8661538,14 7,14 C3.13384615,14 0,10.8661538 0,7 Z M9.59179487,5.69764103 C9.70905818,5.54139023 9.73249341,5.33388318 9.65303227,5.15541491 C9.57357113,4.97694665 9.40367989,4.85551619 9.20909814,4.83811118 C9.01451638,4.82070616 8.82577109,4.91005717 8.71589744,5.07158974 L6.39261538,8.32389744 L5.22666667,7.15794872 C5.01450582,6.96025518 4.68389046,6.9660885 4.47883563,7.17114332 C4.27378081,7.37619815 4.26794748,7.70681351 4.46564103,7.91897436 L6.08102564,9.53435897 C6.19289944,9.64614839 6.3482622,9.70310251 6.50588106,9.69010587 C6.66349993,9.67710922 6.80743532,9.59547613 6.89948718,9.46687179 L9.59179487,5.69764103 L9.59179487,5.69764103 Z",
|
|
807
|
-
id: "Shape"
|
|
808
|
-
}
|
|
809
|
-
) })
|
|
810
|
-
}
|
|
811
|
-
) })
|
|
812
|
-
}
|
|
813
|
-
);
|
|
814
|
-
|
|
815
|
-
// src/components/dev-console/console.tsx
|
|
816
|
-
var import_react5 = require("@headlessui/react");
|
|
817
|
-
var import_shared2 = require("@copilotkit/shared");
|
|
818
|
-
|
|
819
|
-
// src/components/help-modal/modal.tsx
|
|
820
|
-
var import_react3 = require("react");
|
|
821
|
-
|
|
822
|
-
// src/components/help-modal/icons.tsx
|
|
823
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
824
|
-
var CloseIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
825
|
-
"svg",
|
|
826
|
-
{
|
|
827
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
828
|
-
fill: "none",
|
|
829
|
-
viewBox: "0 0 24 24",
|
|
830
|
-
strokeWidth: "1.5",
|
|
831
|
-
stroke: "currentColor",
|
|
832
|
-
width: "20",
|
|
833
|
-
height: "20",
|
|
834
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
835
|
-
"path",
|
|
836
|
-
{
|
|
837
|
-
strokeLinecap: "round",
|
|
838
|
-
strokeLinejoin: "round",
|
|
839
|
-
d: "M6 18L18 6M6 6l12 12"
|
|
840
|
-
}
|
|
841
|
-
)
|
|
842
|
-
}
|
|
843
|
-
);
|
|
844
|
-
|
|
845
|
-
// src/components/help-modal/modal.tsx
|
|
846
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
847
|
-
function CopilotKitHelpModal() {
|
|
848
|
-
const [showHelpModal, setShowHelpModal] = (0, import_react3.useState)(false);
|
|
849
|
-
const buttonRef = (0, import_react3.useRef)(null);
|
|
850
|
-
const popoverRef = (0, import_react3.useRef)(null);
|
|
851
|
-
(0, import_react3.useEffect)(() => {
|
|
852
|
-
const handleClickOutside = (event) => {
|
|
853
|
-
if (popoverRef.current && !popoverRef.current.contains(event.target) && buttonRef.current && !buttonRef.current.contains(event.target)) {
|
|
854
|
-
setShowHelpModal(false);
|
|
855
|
-
}
|
|
856
|
-
};
|
|
857
|
-
if (showHelpModal) {
|
|
858
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
859
|
-
}
|
|
860
|
-
return () => {
|
|
861
|
-
document.removeEventListener("mousedown", handleClickOutside);
|
|
862
|
-
};
|
|
863
|
-
}, [showHelpModal]);
|
|
864
|
-
const HelpButton = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
865
|
-
"button",
|
|
866
|
-
{
|
|
867
|
-
ref: buttonRef,
|
|
868
|
-
onClick: () => setShowHelpModal(!showHelpModal),
|
|
869
|
-
className: "copilotKitDebugMenuTriggerButton relative",
|
|
870
|
-
"aria-label": "Open Help",
|
|
871
|
-
children: "Help"
|
|
872
|
-
}
|
|
873
|
-
);
|
|
874
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "relative", children: [
|
|
875
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(HelpButton, {}),
|
|
876
|
-
showHelpModal && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
877
|
-
"div",
|
|
878
|
-
{
|
|
879
|
-
ref: popoverRef,
|
|
880
|
-
className: "absolute mt-2 z-50",
|
|
881
|
-
style: {
|
|
882
|
-
top: "100%",
|
|
883
|
-
right: "-120px",
|
|
884
|
-
width: "380px"
|
|
885
|
-
},
|
|
886
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "copilotKitHelpModal rounded-lg shadow-xl w-full p-4 flex-col relative", children: [
|
|
887
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
888
|
-
"button",
|
|
889
|
-
{
|
|
890
|
-
className: "copilotKitHelpModalCloseButton absolute text-gray-400 hover:text-gray-600 focus:outline-none",
|
|
891
|
-
style: { top: "10px", right: "10px" },
|
|
892
|
-
onClick: () => setShowHelpModal(false),
|
|
893
|
-
"aria-label": "Close",
|
|
894
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CloseIcon2, {})
|
|
895
|
-
}
|
|
896
|
-
),
|
|
897
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w-full flex mb-6 justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h2", { className: "text-2xl font-bold", children: "Help Options" }) }),
|
|
898
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-4 mb-4", children: [
|
|
899
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "copilotKitHelpItemButton", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
900
|
-
"a",
|
|
901
|
-
{
|
|
902
|
-
href: "https://docs.copilotkit.ai/coagents/troubleshooting/common-issues",
|
|
903
|
-
target: "_blank",
|
|
904
|
-
rel: "noopener noreferrer",
|
|
905
|
-
children: "Visit the Troubleshooting and FAQ section in the docs"
|
|
906
|
-
}
|
|
907
|
-
) }),
|
|
908
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "copilotKitHelpItemButton", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
909
|
-
"a",
|
|
910
|
-
{
|
|
911
|
-
href: "https://go.copilotkit.ai/dev-console-support-discord",
|
|
912
|
-
target: "_blank",
|
|
913
|
-
rel: "noopener noreferrer",
|
|
914
|
-
children: "Go to Discord Support Channel (Community Support)"
|
|
915
|
-
}
|
|
916
|
-
) }),
|
|
917
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "copilotKitHelpItemButton", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
918
|
-
"a",
|
|
919
|
-
{
|
|
920
|
-
href: "https://go.copilotkit.ai/dev-console-support-slack",
|
|
921
|
-
target: "_blank",
|
|
922
|
-
rel: "noopener noreferrer",
|
|
923
|
-
children: "Apply for Priority Direct Slack Support"
|
|
924
|
-
}
|
|
925
|
-
) })
|
|
926
|
-
] })
|
|
927
|
-
] })
|
|
928
|
-
}
|
|
929
|
-
)
|
|
930
|
-
] });
|
|
931
|
-
}
|
|
932
|
-
|
|
933
|
-
// src/components/dev-console/console.tsx
|
|
934
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
935
|
-
function CopilotDevConsole() {
|
|
936
|
-
const currentVersion = import_shared2.COPILOTKIT_VERSION;
|
|
937
|
-
const context = (0, import_react_core4.useCopilotContext)();
|
|
938
|
-
const [showDevConsole, setShowDevConsole] = (0, import_react4.useState)(false);
|
|
939
|
-
(0, import_react4.useEffect)(() => {
|
|
940
|
-
setShowDevConsole((0, import_react_core3.shouldShowDevConsole)(context.showDevConsole));
|
|
941
|
-
}, [context.showDevConsole]);
|
|
942
|
-
const dontRunTwiceInDevMode = (0, import_react4.useRef)(false);
|
|
943
|
-
const [versionStatus, setVersionStatus] = (0, import_react4.useState)("unknown");
|
|
944
|
-
const [latestVersion, setLatestVersion] = (0, import_react4.useState)("");
|
|
945
|
-
const consoleRef = (0, import_react4.useRef)(null);
|
|
946
|
-
const [debugButtonMode, setDebugButtonMode] = (0, import_react4.useState)(
|
|
947
|
-
"full"
|
|
948
|
-
);
|
|
949
|
-
const checkForUpdates = (force = false) => {
|
|
950
|
-
setVersionStatus("checking");
|
|
951
|
-
getPublishedCopilotKitVersion(currentVersion, force).then((v) => {
|
|
952
|
-
setLatestVersion(v.latest);
|
|
953
|
-
let versionOk = false;
|
|
954
|
-
if (v.current === v.latest) {
|
|
955
|
-
versionOk = true;
|
|
956
|
-
} else if (/[a-zA-Z]/.test(v.current)) {
|
|
957
|
-
versionOk = true;
|
|
958
|
-
}
|
|
959
|
-
if (versionOk) {
|
|
960
|
-
setVersionStatus("latest");
|
|
961
|
-
} else if (v.severity !== "low") {
|
|
962
|
-
setVersionStatus("outdated");
|
|
963
|
-
} else {
|
|
964
|
-
setVersionStatus("update-available");
|
|
965
|
-
}
|
|
966
|
-
}).catch((e) => {
|
|
967
|
-
console.error(e);
|
|
968
|
-
setVersionStatus("unknown");
|
|
969
|
-
});
|
|
970
|
-
};
|
|
971
|
-
(0, import_react4.useEffect)(() => {
|
|
972
|
-
if (dontRunTwiceInDevMode.current === true) {
|
|
973
|
-
return;
|
|
974
|
-
}
|
|
975
|
-
dontRunTwiceInDevMode.current = true;
|
|
976
|
-
checkForUpdates();
|
|
977
|
-
}, []);
|
|
978
|
-
if (!showDevConsole) {
|
|
979
|
-
return null;
|
|
980
|
-
}
|
|
981
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
982
|
-
"div",
|
|
983
|
-
{
|
|
984
|
-
ref: consoleRef,
|
|
985
|
-
className: "copilotKitDevConsole " + (versionStatus === "update-available" ? "copilotKitDevConsoleUpgrade" : "") + (versionStatus === "outdated" ? "copilotKitDevConsoleWarnOutdated" : ""),
|
|
986
|
-
children: [
|
|
987
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
988
|
-
VersionInfo,
|
|
989
|
-
{
|
|
990
|
-
showDevConsole: context.showDevConsole,
|
|
991
|
-
versionStatus,
|
|
992
|
-
currentVersion,
|
|
993
|
-
latestVersion
|
|
994
|
-
}
|
|
995
|
-
),
|
|
996
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CopilotKitHelpModal, {}),
|
|
997
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
998
|
-
DebugMenuButton,
|
|
999
|
-
{
|
|
1000
|
-
setShowDevConsole,
|
|
1001
|
-
checkForUpdates,
|
|
1002
|
-
mode: debugButtonMode
|
|
1003
|
-
}
|
|
1004
|
-
)
|
|
1005
|
-
]
|
|
1006
|
-
}
|
|
1007
|
-
);
|
|
1008
|
-
}
|
|
1009
|
-
function VersionInfo({
|
|
1010
|
-
showDevConsole,
|
|
1011
|
-
versionStatus,
|
|
1012
|
-
currentVersion,
|
|
1013
|
-
latestVersion
|
|
1014
|
-
}) {
|
|
1015
|
-
const [copyStatus, setCopyStatus] = (0, import_react4.useState)("");
|
|
1016
|
-
let versionLabel = "";
|
|
1017
|
-
let versionIcon = "";
|
|
1018
|
-
let currentVersionLabel = currentVersion;
|
|
1019
|
-
if (versionStatus === "latest") {
|
|
1020
|
-
versionLabel = "latest";
|
|
1021
|
-
versionIcon = CheckIcon2;
|
|
1022
|
-
} else if (versionStatus === "checking") {
|
|
1023
|
-
versionLabel = "checking";
|
|
1024
|
-
versionIcon = SmallSpinnerIcon;
|
|
1025
|
-
} else if (versionStatus === "update-available") {
|
|
1026
|
-
versionLabel = "update available";
|
|
1027
|
-
versionIcon = ExclamationMarkIcon;
|
|
1028
|
-
currentVersionLabel = `${currentVersion} \u2192 ${latestVersion}`;
|
|
1029
|
-
} else if (versionStatus === "outdated") {
|
|
1030
|
-
versionLabel = "outdated";
|
|
1031
|
-
versionIcon = ExclamationMarkTriangleIcon;
|
|
1032
|
-
currentVersionLabel = `${currentVersion} \u2192 ${latestVersion}`;
|
|
1033
|
-
}
|
|
1034
|
-
let asideLabel = "";
|
|
1035
|
-
if (showDevConsole === true) {
|
|
1036
|
-
asideLabel = "(enabled)";
|
|
1037
|
-
}
|
|
1038
|
-
const installCommand = [
|
|
1039
|
-
`npm install`,
|
|
1040
|
-
`@copilotkit/react-core@${latestVersion}`,
|
|
1041
|
-
`@copilotkit/react-ui@${latestVersion}`,
|
|
1042
|
-
`@copilotkit/react-textarea@${latestVersion}`,
|
|
1043
|
-
`&& npm install @copilotkit/runtime@${latestVersion}`
|
|
1044
|
-
].join(" ");
|
|
1045
|
-
const handleCopyClick = () => {
|
|
1046
|
-
navigator.clipboard.writeText(installCommand.trim()).then(() => {
|
|
1047
|
-
setCopyStatus("Command copied to clipboard!");
|
|
1048
|
-
setTimeout(() => setCopyStatus(""), 1e3);
|
|
1049
|
-
});
|
|
1050
|
-
};
|
|
1051
|
-
if (versionStatus === "update-available" || versionStatus === "outdated") {
|
|
1052
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "copilotKitVersionInfo", children: [
|
|
1053
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("p", { children: [
|
|
1054
|
-
currentVersionLabel,
|
|
1055
|
-
" ",
|
|
1056
|
-
versionIcon
|
|
1057
|
-
] }),
|
|
1058
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { onClick: handleCopyClick, children: copyStatus || installCommand })
|
|
1059
|
-
] });
|
|
1060
|
-
}
|
|
1061
|
-
return null;
|
|
1062
|
-
}
|
|
1063
|
-
function DebugMenuButton({
|
|
1064
|
-
setShowDevConsole,
|
|
1065
|
-
checkForUpdates,
|
|
1066
|
-
mode
|
|
1067
|
-
}) {
|
|
1068
|
-
const context = (0, import_react_core4.useCopilotContext)();
|
|
1069
|
-
const messagesContext = (0, import_react_core4.useCopilotMessagesContext)();
|
|
1070
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react5.Menu, { children: [
|
|
1071
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1072
|
-
import_react5.MenuButton,
|
|
1073
|
-
{
|
|
1074
|
-
className: `copilotKitDebugMenuTriggerButton ${mode === "compact" ? "compact" : ""}`,
|
|
1075
|
-
children: mode == "compact" ? "Debug" : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
1076
|
-
"Debug ",
|
|
1077
|
-
ChevronDownIcon
|
|
1078
|
-
] })
|
|
1079
|
-
}
|
|
1080
|
-
),
|
|
1081
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1082
|
-
import_react5.MenuItems,
|
|
1083
|
-
{
|
|
1084
|
-
transition: true,
|
|
1085
|
-
anchor: "bottom end",
|
|
1086
|
-
className: "copilotKitDebugMenu",
|
|
1087
|
-
style: { zIndex: 40 },
|
|
1088
|
-
children: [
|
|
1089
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1090
|
-
"button",
|
|
1091
|
-
{
|
|
1092
|
-
className: "copilotKitDebugMenuItem",
|
|
1093
|
-
onClick: () => logReadables(context),
|
|
1094
|
-
children: "Log Readables"
|
|
1095
|
-
}
|
|
1096
|
-
) }),
|
|
1097
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1098
|
-
"button",
|
|
1099
|
-
{
|
|
1100
|
-
className: "copilotKitDebugMenuItem",
|
|
1101
|
-
onClick: () => logActions(context),
|
|
1102
|
-
children: "Log Actions"
|
|
1103
|
-
}
|
|
1104
|
-
) }),
|
|
1105
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1106
|
-
"button",
|
|
1107
|
-
{
|
|
1108
|
-
className: "copilotKitDebugMenuItem",
|
|
1109
|
-
onClick: () => logMessages(messagesContext),
|
|
1110
|
-
children: "Log Messages"
|
|
1111
|
-
}
|
|
1112
|
-
) }),
|
|
1113
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1114
|
-
"button",
|
|
1115
|
-
{
|
|
1116
|
-
className: "copilotKitDebugMenuItem",
|
|
1117
|
-
onClick: () => checkForUpdates(true),
|
|
1118
|
-
children: "Check for Updates"
|
|
1119
|
-
}
|
|
1120
|
-
) }),
|
|
1121
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("hr", {}),
|
|
1122
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1123
|
-
"button",
|
|
1124
|
-
{
|
|
1125
|
-
className: "copilotKitDebugMenuItem",
|
|
1126
|
-
onClick: () => setShowDevConsole(false),
|
|
1127
|
-
children: "Hide Dev Console"
|
|
1128
|
-
}
|
|
1129
|
-
) })
|
|
1130
|
-
]
|
|
1131
|
-
}
|
|
1132
|
-
)
|
|
1133
|
-
] }) });
|
|
1134
|
-
}
|
|
1135
|
-
|
|
1136
|
-
// src/components/chat/Header.tsx
|
|
1137
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1138
|
-
var Header = ({}) => {
|
|
1139
|
-
const { setOpen, icons, labels } = useChatContext();
|
|
1140
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "copilotKitHeader", children: [
|
|
1141
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: labels.title }),
|
|
1142
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "copilotKitHeaderControls", children: [
|
|
1143
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CopilotDevConsole, {}),
|
|
1144
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1145
|
-
"button",
|
|
1146
|
-
{
|
|
1147
|
-
onClick: () => setOpen(false),
|
|
1148
|
-
"aria-label": "Close",
|
|
1149
|
-
className: "copilotKitHeaderCloseButton",
|
|
1150
|
-
children: icons.headerCloseIcon
|
|
1151
|
-
}
|
|
1152
|
-
)
|
|
1153
|
-
] })
|
|
1154
|
-
] });
|
|
1155
|
-
};
|
|
1156
|
-
|
|
1157
|
-
// src/components/chat/Messages.tsx
|
|
1158
|
-
var import_react10 = require("react");
|
|
1159
|
-
var import_react_core5 = require("@copilotkit/react-core");
|
|
1160
|
-
|
|
1161
|
-
// src/components/chat/messages/UserMessage.tsx
|
|
1162
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1163
|
-
var getTextContent = (content) => {
|
|
1164
|
-
if (typeof content === "undefined") {
|
|
1165
|
-
return void 0;
|
|
1166
|
-
}
|
|
1167
|
-
if (typeof content === "string") {
|
|
1168
|
-
return content;
|
|
1169
|
-
}
|
|
1170
|
-
return content.map((part) => {
|
|
1171
|
-
if (part.type === "text") {
|
|
1172
|
-
return part.text;
|
|
1173
|
-
}
|
|
1174
|
-
return void 0;
|
|
1175
|
-
}).filter(
|
|
1176
|
-
(value) => typeof value === "string" && value.length > 0
|
|
1177
|
-
).join(" ").trim() || void 0;
|
|
1178
|
-
};
|
|
1179
|
-
var UserMessage = (props) => {
|
|
1180
|
-
const { message, ImageRenderer: ImageRenderer2 } = props;
|
|
1181
|
-
const isImageMessage = message && "image" in message && Boolean(message.image);
|
|
1182
|
-
if (isImageMessage) {
|
|
1183
|
-
const imageMessage = message;
|
|
1184
|
-
const content2 = getTextContent(imageMessage == null ? void 0 : imageMessage.content);
|
|
1185
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "copilotKitMessage copilotKitUserMessage", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ImageRenderer2, { image: imageMessage.image, content: content2 }) });
|
|
1186
|
-
}
|
|
1187
|
-
const content = getTextContent(message == null ? void 0 : message.content);
|
|
1188
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "copilotKitMessage copilotKitUserMessage", children: content });
|
|
1189
|
-
};
|
|
1190
|
-
|
|
1191
|
-
// src/components/chat/Markdown.tsx
|
|
1192
|
-
var import_react7 = require("react");
|
|
1193
|
-
var import_react_markdown = __toESM(require("react-markdown"));
|
|
1194
|
-
|
|
1195
|
-
// src/components/chat/CodeBlock.tsx
|
|
1196
|
-
var import_react6 = require("react");
|
|
1197
|
-
var import_react_syntax_highlighter = require("react-syntax-highlighter");
|
|
1198
|
-
|
|
1199
|
-
// src/hooks/use-copy-to-clipboard.tsx
|
|
1200
|
-
var React5 = __toESM(require("react"));
|
|
1201
|
-
function useCopyToClipboard({
|
|
1202
|
-
timeout = 2e3
|
|
1203
|
-
}) {
|
|
1204
|
-
const [isCopied, setIsCopied] = React5.useState(false);
|
|
1205
|
-
const copyToClipboard = (value) => {
|
|
1206
|
-
var _a;
|
|
1207
|
-
if (typeof window === "undefined" || !((_a = navigator.clipboard) == null ? void 0 : _a.writeText)) {
|
|
1208
|
-
return;
|
|
1209
|
-
}
|
|
1210
|
-
if (!value) {
|
|
1211
|
-
return;
|
|
1212
|
-
}
|
|
1213
|
-
navigator.clipboard.writeText(value).then(() => {
|
|
1214
|
-
setIsCopied(true);
|
|
1215
|
-
setTimeout(() => {
|
|
1216
|
-
setIsCopied(false);
|
|
1217
|
-
}, timeout);
|
|
1218
|
-
});
|
|
1219
|
-
};
|
|
1220
|
-
return { isCopied, copyToClipboard };
|
|
1221
|
-
}
|
|
1222
|
-
|
|
1223
|
-
// src/components/chat/CodeBlock.tsx
|
|
1224
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1225
|
-
var programmingLanguages = {
|
|
1226
|
-
javascript: ".js",
|
|
1227
|
-
python: ".py",
|
|
1228
|
-
java: ".java",
|
|
1229
|
-
c: ".c",
|
|
1230
|
-
cpp: ".cpp",
|
|
1231
|
-
"c++": ".cpp",
|
|
1232
|
-
"c#": ".cs",
|
|
1233
|
-
ruby: ".rb",
|
|
1234
|
-
php: ".php",
|
|
1235
|
-
swift: ".swift",
|
|
1236
|
-
"objective-c": ".m",
|
|
1237
|
-
kotlin: ".kt",
|
|
1238
|
-
typescript: ".ts",
|
|
1239
|
-
go: ".go",
|
|
1240
|
-
perl: ".pl",
|
|
1241
|
-
rust: ".rs",
|
|
1242
|
-
scala: ".scala",
|
|
1243
|
-
haskell: ".hs",
|
|
1244
|
-
lua: ".lua",
|
|
1245
|
-
shell: ".sh",
|
|
1246
|
-
sql: ".sql",
|
|
1247
|
-
html: ".html",
|
|
1248
|
-
css: ".css"
|
|
1249
|
-
// add more file extensions here, make sure the key is same as language prop in CodeBlock.tsx component
|
|
1250
|
-
};
|
|
1251
|
-
var generateRandomString = (length, lowercase = false) => {
|
|
1252
|
-
const chars = "ABCDEFGHJKLMNPQRSTUVWXY3456789";
|
|
1253
|
-
let result = "";
|
|
1254
|
-
for (let i = 0; i < length; i++) {
|
|
1255
|
-
result += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1256
|
-
}
|
|
1257
|
-
return lowercase ? result.toLowerCase() : result;
|
|
1258
|
-
};
|
|
1259
|
-
var CodeBlock = (0, import_react6.memo)(({ language, value }) => {
|
|
1260
|
-
const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2e3 });
|
|
1261
|
-
const [SyntaxHighlighter, setSyntaxHighlighter] = (0, import_react6.useState)(() => import_react_syntax_highlighter.Light);
|
|
1262
|
-
(0, import_react6.useEffect)(() => {
|
|
1263
|
-
try {
|
|
1264
|
-
new RegExp("(?<=#)\\w+");
|
|
1265
|
-
setSyntaxHighlighter(() => import_react_syntax_highlighter.Prism);
|
|
1266
|
-
} catch (e) {
|
|
1267
|
-
setSyntaxHighlighter(() => import_react_syntax_highlighter.Light);
|
|
1268
|
-
}
|
|
1269
|
-
}, []);
|
|
1270
|
-
const downloadAsFile = () => {
|
|
1271
|
-
if (typeof window === "undefined") {
|
|
1272
|
-
return;
|
|
1273
|
-
}
|
|
1274
|
-
const fileExtension = programmingLanguages[language] || ".file";
|
|
1275
|
-
const suggestedFileName = `file-${generateRandomString(3, true)}${fileExtension}`;
|
|
1276
|
-
const fileName = window.prompt("Enter file name", suggestedFileName);
|
|
1277
|
-
if (!fileName) {
|
|
1278
|
-
return;
|
|
1279
|
-
}
|
|
1280
|
-
const blob = new Blob([value], { type: "text/plain" });
|
|
1281
|
-
const url = URL.createObjectURL(blob);
|
|
1282
|
-
const link = document.createElement("a");
|
|
1283
|
-
link.download = fileName;
|
|
1284
|
-
link.href = url;
|
|
1285
|
-
link.style.display = "none";
|
|
1286
|
-
document.body.appendChild(link);
|
|
1287
|
-
link.click();
|
|
1288
|
-
document.body.removeChild(link);
|
|
1289
|
-
URL.revokeObjectURL(url);
|
|
1290
|
-
};
|
|
1291
|
-
const onCopy = () => {
|
|
1292
|
-
if (isCopied)
|
|
1293
|
-
return;
|
|
1294
|
-
copyToClipboard(value);
|
|
1295
|
-
};
|
|
1296
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "copilotKitCodeBlock", children: [
|
|
1297
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "copilotKitCodeBlockToolbar", children: [
|
|
1298
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "copilotKitCodeBlockToolbarLanguage", children: language }),
|
|
1299
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "copilotKitCodeBlockToolbarButtons", children: [
|
|
1300
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1301
|
-
"button",
|
|
1302
|
-
{
|
|
1303
|
-
className: "copilotKitCodeBlockToolbarButton",
|
|
1304
|
-
onClick: downloadAsFile,
|
|
1305
|
-
children: DownloadIcon
|
|
1306
|
-
}
|
|
1307
|
-
),
|
|
1308
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "copilotKitCodeBlockToolbarButton", onClick: onCopy, children: isCopied ? CheckIcon : CopyIcon })
|
|
1309
|
-
] })
|
|
1310
|
-
] }),
|
|
1311
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1312
|
-
SyntaxHighlighter,
|
|
1313
|
-
{
|
|
1314
|
-
language,
|
|
1315
|
-
style: highlightStyle,
|
|
1316
|
-
PreTag: "div",
|
|
1317
|
-
customStyle: {
|
|
1318
|
-
margin: 0,
|
|
1319
|
-
borderBottomLeftRadius: "0.375rem",
|
|
1320
|
-
borderBottomRightRadius: "0.375rem"
|
|
1321
|
-
},
|
|
1322
|
-
children: value
|
|
1323
|
-
}
|
|
1324
|
-
)
|
|
1325
|
-
] });
|
|
1326
|
-
});
|
|
1327
|
-
CodeBlock.displayName = "CodeBlock";
|
|
1328
|
-
var highlightStyle = {
|
|
1329
|
-
'pre[class*="language-"]': {
|
|
1330
|
-
color: "#d4d4d4",
|
|
1331
|
-
fontSize: "13px",
|
|
1332
|
-
textShadow: "none",
|
|
1333
|
-
fontFamily: 'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',
|
|
1334
|
-
direction: "ltr",
|
|
1335
|
-
textAlign: "left",
|
|
1336
|
-
whiteSpace: "pre",
|
|
1337
|
-
wordSpacing: "normal",
|
|
1338
|
-
wordBreak: "normal",
|
|
1339
|
-
lineHeight: "1.5",
|
|
1340
|
-
MozTabSize: "4",
|
|
1341
|
-
OTabSize: "4",
|
|
1342
|
-
tabSize: "4",
|
|
1343
|
-
WebkitHyphens: "none",
|
|
1344
|
-
MozHyphens: "none",
|
|
1345
|
-
msHyphens: "none",
|
|
1346
|
-
hyphens: "none",
|
|
1347
|
-
padding: "1em",
|
|
1348
|
-
margin: ".5em 0",
|
|
1349
|
-
overflow: "auto",
|
|
1350
|
-
background: "#1e1e1e"
|
|
1351
|
-
},
|
|
1352
|
-
'code[class*="language-"]': {
|
|
1353
|
-
color: "#d4d4d4",
|
|
1354
|
-
fontSize: "13px",
|
|
1355
|
-
textShadow: "none",
|
|
1356
|
-
fontFamily: 'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',
|
|
1357
|
-
direction: "ltr",
|
|
1358
|
-
textAlign: "left",
|
|
1359
|
-
whiteSpace: "pre",
|
|
1360
|
-
wordSpacing: "normal",
|
|
1361
|
-
wordBreak: "normal",
|
|
1362
|
-
lineHeight: "1.5",
|
|
1363
|
-
MozTabSize: "4",
|
|
1364
|
-
OTabSize: "4",
|
|
1365
|
-
tabSize: "4",
|
|
1366
|
-
WebkitHyphens: "none",
|
|
1367
|
-
MozHyphens: "none",
|
|
1368
|
-
msHyphens: "none",
|
|
1369
|
-
hyphens: "none"
|
|
1370
|
-
},
|
|
1371
|
-
'pre[class*="language-"]::selection': {
|
|
1372
|
-
textShadow: "none",
|
|
1373
|
-
background: "#264F78"
|
|
1374
|
-
},
|
|
1375
|
-
'code[class*="language-"]::selection': {
|
|
1376
|
-
textShadow: "none",
|
|
1377
|
-
background: "#264F78"
|
|
1378
|
-
},
|
|
1379
|
-
'pre[class*="language-"] *::selection': {
|
|
1380
|
-
textShadow: "none",
|
|
1381
|
-
background: "#264F78"
|
|
1382
|
-
},
|
|
1383
|
-
'code[class*="language-"] *::selection': {
|
|
1384
|
-
textShadow: "none",
|
|
1385
|
-
background: "#264F78"
|
|
1386
|
-
},
|
|
1387
|
-
':not(pre) > code[class*="language-"]': {
|
|
1388
|
-
padding: ".1em .3em",
|
|
1389
|
-
borderRadius: ".3em",
|
|
1390
|
-
color: "#db4c69",
|
|
1391
|
-
background: "#1e1e1e"
|
|
1392
|
-
},
|
|
1393
|
-
".namespace": {
|
|
1394
|
-
Opacity: ".7"
|
|
1395
|
-
},
|
|
1396
|
-
"doctype.doctype-tag": {
|
|
1397
|
-
color: "#569CD6"
|
|
1398
|
-
},
|
|
1399
|
-
"doctype.name": {
|
|
1400
|
-
color: "#9cdcfe"
|
|
1401
|
-
},
|
|
1402
|
-
comment: {
|
|
1403
|
-
color: "#6a9955"
|
|
1404
|
-
},
|
|
1405
|
-
prolog: {
|
|
1406
|
-
color: "#6a9955"
|
|
1407
|
-
},
|
|
1408
|
-
punctuation: {
|
|
1409
|
-
color: "#d4d4d4"
|
|
1410
|
-
},
|
|
1411
|
-
".language-html .language-css .token.punctuation": {
|
|
1412
|
-
color: "#d4d4d4"
|
|
1413
|
-
},
|
|
1414
|
-
".language-html .language-javascript .token.punctuation": {
|
|
1415
|
-
color: "#d4d4d4"
|
|
1416
|
-
},
|
|
1417
|
-
property: {
|
|
1418
|
-
color: "#9cdcfe"
|
|
1419
|
-
},
|
|
1420
|
-
tag: {
|
|
1421
|
-
color: "#569cd6"
|
|
1422
|
-
},
|
|
1423
|
-
boolean: {
|
|
1424
|
-
color: "#569cd6"
|
|
1425
|
-
},
|
|
1426
|
-
number: {
|
|
1427
|
-
color: "#b5cea8"
|
|
1428
|
-
},
|
|
1429
|
-
constant: {
|
|
1430
|
-
color: "#9cdcfe"
|
|
1431
|
-
},
|
|
1432
|
-
symbol: {
|
|
1433
|
-
color: "#b5cea8"
|
|
1434
|
-
},
|
|
1435
|
-
inserted: {
|
|
1436
|
-
color: "#b5cea8"
|
|
1437
|
-
},
|
|
1438
|
-
unit: {
|
|
1439
|
-
color: "#b5cea8"
|
|
1440
|
-
},
|
|
1441
|
-
selector: {
|
|
1442
|
-
color: "#d7ba7d"
|
|
1443
|
-
},
|
|
1444
|
-
"attr-name": {
|
|
1445
|
-
color: "#9cdcfe"
|
|
1446
|
-
},
|
|
1447
|
-
string: {
|
|
1448
|
-
color: "#ce9178"
|
|
1449
|
-
},
|
|
1450
|
-
char: {
|
|
1451
|
-
color: "#ce9178"
|
|
1452
|
-
},
|
|
1453
|
-
builtin: {
|
|
1454
|
-
color: "#ce9178"
|
|
1455
|
-
},
|
|
1456
|
-
deleted: {
|
|
1457
|
-
color: "#ce9178"
|
|
1458
|
-
},
|
|
1459
|
-
".language-css .token.string.url": {
|
|
1460
|
-
textDecoration: "underline"
|
|
1461
|
-
},
|
|
1462
|
-
operator: {
|
|
1463
|
-
color: "#d4d4d4"
|
|
1464
|
-
},
|
|
1465
|
-
entity: {
|
|
1466
|
-
color: "#569cd6"
|
|
1467
|
-
},
|
|
1468
|
-
"operator.arrow": {
|
|
1469
|
-
color: "#569CD6"
|
|
1470
|
-
},
|
|
1471
|
-
atrule: {
|
|
1472
|
-
color: "#ce9178"
|
|
1473
|
-
},
|
|
1474
|
-
"atrule.rule": {
|
|
1475
|
-
color: "#c586c0"
|
|
1476
|
-
},
|
|
1477
|
-
"atrule.url": {
|
|
1478
|
-
color: "#9cdcfe"
|
|
1479
|
-
},
|
|
1480
|
-
"atrule.url.function": {
|
|
1481
|
-
color: "#dcdcaa"
|
|
1482
|
-
},
|
|
1483
|
-
"atrule.url.punctuation": {
|
|
1484
|
-
color: "#d4d4d4"
|
|
1485
|
-
},
|
|
1486
|
-
keyword: {
|
|
1487
|
-
color: "#569CD6"
|
|
1488
|
-
},
|
|
1489
|
-
"keyword.module": {
|
|
1490
|
-
color: "#c586c0"
|
|
1491
|
-
},
|
|
1492
|
-
"keyword.control-flow": {
|
|
1493
|
-
color: "#c586c0"
|
|
1494
|
-
},
|
|
1495
|
-
function: {
|
|
1496
|
-
color: "#dcdcaa"
|
|
1497
|
-
},
|
|
1498
|
-
"function.maybe-class-name": {
|
|
1499
|
-
color: "#dcdcaa"
|
|
1500
|
-
},
|
|
1501
|
-
regex: {
|
|
1502
|
-
color: "#d16969"
|
|
1503
|
-
},
|
|
1504
|
-
important: {
|
|
1505
|
-
color: "#569cd6"
|
|
1506
|
-
},
|
|
1507
|
-
italic: {
|
|
1508
|
-
fontStyle: "italic"
|
|
1509
|
-
},
|
|
1510
|
-
"class-name": {
|
|
1511
|
-
color: "#4ec9b0"
|
|
1512
|
-
},
|
|
1513
|
-
"maybe-class-name": {
|
|
1514
|
-
color: "#4ec9b0"
|
|
1515
|
-
},
|
|
1516
|
-
console: {
|
|
1517
|
-
color: "#9cdcfe"
|
|
1518
|
-
},
|
|
1519
|
-
parameter: {
|
|
1520
|
-
color: "#9cdcfe"
|
|
1521
|
-
},
|
|
1522
|
-
interpolation: {
|
|
1523
|
-
color: "#9cdcfe"
|
|
1524
|
-
},
|
|
1525
|
-
"punctuation.interpolation-punctuation": {
|
|
1526
|
-
color: "#569cd6"
|
|
1527
|
-
},
|
|
1528
|
-
variable: {
|
|
1529
|
-
color: "#9cdcfe"
|
|
1530
|
-
},
|
|
1531
|
-
"imports.maybe-class-name": {
|
|
1532
|
-
color: "#9cdcfe"
|
|
1533
|
-
},
|
|
1534
|
-
"exports.maybe-class-name": {
|
|
1535
|
-
color: "#9cdcfe"
|
|
1536
|
-
},
|
|
1537
|
-
escape: {
|
|
1538
|
-
color: "#d7ba7d"
|
|
1539
|
-
},
|
|
1540
|
-
"tag.punctuation": {
|
|
1541
|
-
color: "#808080"
|
|
1542
|
-
},
|
|
1543
|
-
cdata: {
|
|
1544
|
-
color: "#808080"
|
|
1545
|
-
},
|
|
1546
|
-
"attr-value": {
|
|
1547
|
-
color: "#ce9178"
|
|
1548
|
-
},
|
|
1549
|
-
"attr-value.punctuation": {
|
|
1550
|
-
color: "#ce9178"
|
|
1551
|
-
},
|
|
1552
|
-
"attr-value.punctuation.attr-equals": {
|
|
1553
|
-
color: "#d4d4d4"
|
|
1554
|
-
},
|
|
1555
|
-
namespace: {
|
|
1556
|
-
color: "#4ec9b0"
|
|
1557
|
-
},
|
|
1558
|
-
'pre[class*="language-javascript"]': {
|
|
1559
|
-
color: "#9cdcfe"
|
|
1560
|
-
},
|
|
1561
|
-
'code[class*="language-javascript"]': {
|
|
1562
|
-
color: "#9cdcfe"
|
|
1563
|
-
},
|
|
1564
|
-
'pre[class*="language-jsx"]': {
|
|
1565
|
-
color: "#9cdcfe"
|
|
1566
|
-
},
|
|
1567
|
-
'code[class*="language-jsx"]': {
|
|
1568
|
-
color: "#9cdcfe"
|
|
1569
|
-
},
|
|
1570
|
-
'pre[class*="language-typescript"]': {
|
|
1571
|
-
color: "#9cdcfe"
|
|
1572
|
-
},
|
|
1573
|
-
'code[class*="language-typescript"]': {
|
|
1574
|
-
color: "#9cdcfe"
|
|
1575
|
-
},
|
|
1576
|
-
'pre[class*="language-tsx"]': {
|
|
1577
|
-
color: "#9cdcfe"
|
|
1578
|
-
},
|
|
1579
|
-
'code[class*="language-tsx"]': {
|
|
1580
|
-
color: "#9cdcfe"
|
|
1581
|
-
},
|
|
1582
|
-
'pre[class*="language-css"]': {
|
|
1583
|
-
color: "#ce9178"
|
|
1584
|
-
},
|
|
1585
|
-
'code[class*="language-css"]': {
|
|
1586
|
-
color: "#ce9178"
|
|
1587
|
-
},
|
|
1588
|
-
'pre[class*="language-html"]': {
|
|
1589
|
-
color: "#d4d4d4"
|
|
1590
|
-
},
|
|
1591
|
-
'code[class*="language-html"]': {
|
|
1592
|
-
color: "#d4d4d4"
|
|
1593
|
-
},
|
|
1594
|
-
".language-regex .token.anchor": {
|
|
1595
|
-
color: "#dcdcaa"
|
|
1596
|
-
},
|
|
1597
|
-
".language-html .token.punctuation": {
|
|
1598
|
-
color: "#808080"
|
|
1599
|
-
},
|
|
1600
|
-
'pre[class*="language-"] > code[class*="language-"]': {
|
|
1601
|
-
position: "relative",
|
|
1602
|
-
zIndex: "1"
|
|
1603
|
-
},
|
|
1604
|
-
".line-highlight.line-highlight": {
|
|
1605
|
-
background: "#f7ebc6",
|
|
1606
|
-
boxShadow: "inset 5px 0 0 #f7d87c",
|
|
1607
|
-
zIndex: "0"
|
|
1608
|
-
}
|
|
1609
|
-
};
|
|
1610
|
-
|
|
1611
|
-
// src/components/chat/Markdown.tsx
|
|
1612
|
-
var import_remark_gfm = __toESM(require("remark-gfm"));
|
|
1613
|
-
var import_remark_math = __toESM(require("remark-math"));
|
|
1614
|
-
var import_rehype_raw = __toESM(require("rehype-raw"));
|
|
1615
|
-
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1616
|
-
var defaultComponents = {
|
|
1617
|
-
a(_a) {
|
|
1618
|
-
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
|
1619
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1620
|
-
"a",
|
|
1621
|
-
__spreadProps(__spreadValues({
|
|
1622
|
-
className: "copilotKitMarkdownElement"
|
|
1623
|
-
}, props), {
|
|
1624
|
-
target: "_blank",
|
|
1625
|
-
rel: "noopener noreferrer",
|
|
1626
|
-
children
|
|
1627
|
-
})
|
|
1628
|
-
);
|
|
1629
|
-
},
|
|
1630
|
-
// @ts-expect-error -- inline
|
|
1631
|
-
code(_c) {
|
|
1632
|
-
var _d = _c, { children, className, inline } = _d, props = __objRest(_d, ["children", "className", "inline"]);
|
|
1633
|
-
if (Array.isArray(children) && children.length) {
|
|
1634
|
-
if (children[0] == "\u258D") {
|
|
1635
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1636
|
-
"span",
|
|
1637
|
-
{
|
|
1638
|
-
style: {
|
|
1639
|
-
animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
|
|
1640
|
-
marginTop: "0.25rem"
|
|
1641
|
-
},
|
|
1642
|
-
children: "\u258D"
|
|
1643
|
-
}
|
|
1644
|
-
);
|
|
1645
|
-
}
|
|
1646
|
-
children[0] = (children == null ? void 0 : children[0]).replace("`\u258D`", "\u258D");
|
|
1647
|
-
}
|
|
1648
|
-
const match = /language-(\w+)/.exec(className || "");
|
|
1649
|
-
const hasLanguage = match && match[1];
|
|
1650
|
-
const content = String(children);
|
|
1651
|
-
const hasNewlines = content.includes("\n");
|
|
1652
|
-
const isInline = !hasLanguage && !hasNewlines;
|
|
1653
|
-
if (isInline) {
|
|
1654
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1655
|
-
"code",
|
|
1656
|
-
__spreadProps(__spreadValues({
|
|
1657
|
-
className: `copilotKitMarkdownElement copilotKitInlineCode ${className || ""}`
|
|
1658
|
-
}, props), {
|
|
1659
|
-
children
|
|
1660
|
-
})
|
|
1661
|
-
);
|
|
1662
|
-
}
|
|
1663
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1664
|
-
CodeBlock,
|
|
1665
|
-
__spreadValues({
|
|
1666
|
-
language: match && match[1] || "",
|
|
1667
|
-
value: String(children).replace(/\n$/, "")
|
|
1668
|
-
}, props),
|
|
1669
|
-
Math.random()
|
|
1670
|
-
);
|
|
1671
|
-
},
|
|
1672
|
-
h1: (_e) => {
|
|
1673
|
-
var _f = _e, { children } = _f, props = __objRest(_f, ["children"]);
|
|
1674
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h1", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
|
|
1675
|
-
},
|
|
1676
|
-
h2: (_g) => {
|
|
1677
|
-
var _h = _g, { children } = _h, props = __objRest(_h, ["children"]);
|
|
1678
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h2", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
|
|
1679
|
-
},
|
|
1680
|
-
h3: (_i) => {
|
|
1681
|
-
var _j = _i, { children } = _j, props = __objRest(_j, ["children"]);
|
|
1682
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
|
|
1683
|
-
},
|
|
1684
|
-
h4: (_k) => {
|
|
1685
|
-
var _l = _k, { children } = _l, props = __objRest(_l, ["children"]);
|
|
1686
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h4", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
|
|
1687
|
-
},
|
|
1688
|
-
h5: (_m) => {
|
|
1689
|
-
var _n = _m, { children } = _n, props = __objRest(_n, ["children"]);
|
|
1690
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h5", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
|
|
1691
|
-
},
|
|
1692
|
-
h6: (_o) => {
|
|
1693
|
-
var _p = _o, { children } = _p, props = __objRest(_p, ["children"]);
|
|
1694
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h6", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
|
|
1695
|
-
},
|
|
1696
|
-
p: (_q) => {
|
|
1697
|
-
var _r = _q, { children } = _r, props = __objRest(_r, ["children"]);
|
|
1698
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
|
|
1699
|
-
},
|
|
1700
|
-
pre: (_s) => {
|
|
1701
|
-
var _t = _s, { children } = _t, props = __objRest(_t, ["children"]);
|
|
1702
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("pre", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
|
|
1703
|
-
},
|
|
1704
|
-
blockquote: (_u) => {
|
|
1705
|
-
var _v = _u, { children } = _v, props = __objRest(_v, ["children"]);
|
|
1706
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("blockquote", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
|
|
1707
|
-
},
|
|
1708
|
-
ul: (_w) => {
|
|
1709
|
-
var _x = _w, { children } = _x, props = __objRest(_x, ["children"]);
|
|
1710
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ul", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
|
|
1711
|
-
},
|
|
1712
|
-
li: (_y) => {
|
|
1713
|
-
var _z = _y, { children } = _z, props = __objRest(_z, ["children"]);
|
|
1714
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("li", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
|
|
1715
|
-
}
|
|
1716
|
-
};
|
|
1717
|
-
var MemoizedReactMarkdown = (0, import_react7.memo)(
|
|
1718
|
-
import_react_markdown.default,
|
|
1719
|
-
(prevProps, nextProps) => prevProps.children === nextProps.children && prevProps.components === nextProps.components
|
|
1720
|
-
);
|
|
1721
|
-
var Markdown = ({ content, components }) => {
|
|
1722
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "copilotKitMarkdown", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1723
|
-
MemoizedReactMarkdown,
|
|
1724
|
-
{
|
|
1725
|
-
components: __spreadValues(__spreadValues({}, defaultComponents), components),
|
|
1726
|
-
remarkPlugins: [
|
|
1727
|
-
import_remark_gfm.default,
|
|
1728
|
-
[import_remark_math.default, { singleDollarTextMath: false }]
|
|
1729
|
-
],
|
|
1730
|
-
rehypePlugins: [import_rehype_raw.default],
|
|
1731
|
-
children: content
|
|
1732
|
-
}
|
|
1733
|
-
) });
|
|
1734
|
-
};
|
|
1735
|
-
|
|
1736
|
-
// src/components/chat/messages/AssistantMessage.tsx
|
|
1737
|
-
var import_react8 = require("react");
|
|
1738
|
-
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1739
|
-
var AssistantMessage = (props) => {
|
|
1740
|
-
var _a, _b, _c;
|
|
1741
|
-
const { icons, labels } = useChatContext();
|
|
1742
|
-
const {
|
|
1743
|
-
message,
|
|
1744
|
-
isLoading,
|
|
1745
|
-
onRegenerate,
|
|
1746
|
-
onCopy,
|
|
1747
|
-
onThumbsUp,
|
|
1748
|
-
onThumbsDown,
|
|
1749
|
-
isCurrentMessage,
|
|
1750
|
-
feedback,
|
|
1751
|
-
markdownTagRenderers
|
|
1752
|
-
} = props;
|
|
1753
|
-
const [copied, setCopied] = (0, import_react8.useState)(false);
|
|
1754
|
-
const handleCopy = () => {
|
|
1755
|
-
const content2 = (message == null ? void 0 : message.content) || "";
|
|
1756
|
-
if (content2 && onCopy) {
|
|
1757
|
-
navigator.clipboard.writeText(content2);
|
|
1758
|
-
setCopied(true);
|
|
1759
|
-
onCopy(content2);
|
|
1760
|
-
setTimeout(() => setCopied(false), 2e3);
|
|
1761
|
-
} else if (content2) {
|
|
1762
|
-
navigator.clipboard.writeText(content2);
|
|
1763
|
-
setCopied(true);
|
|
1764
|
-
setTimeout(() => setCopied(false), 2e3);
|
|
1765
|
-
}
|
|
1766
|
-
};
|
|
1767
|
-
const handleRegenerate = () => {
|
|
1768
|
-
if (onRegenerate)
|
|
1769
|
-
onRegenerate();
|
|
1770
|
-
};
|
|
1771
|
-
const handleThumbsUp = () => {
|
|
1772
|
-
if (onThumbsUp && message) {
|
|
1773
|
-
onThumbsUp(message);
|
|
1774
|
-
}
|
|
1775
|
-
};
|
|
1776
|
-
const handleThumbsDown = () => {
|
|
1777
|
-
if (onThumbsDown && message) {
|
|
1778
|
-
onThumbsDown(message);
|
|
1779
|
-
}
|
|
1780
|
-
};
|
|
1781
|
-
const LoadingIcon = () => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: icons.activityIcon });
|
|
1782
|
-
const content = (message == null ? void 0 : message.content) || "";
|
|
1783
|
-
const subComponent = (_b = (_a = message == null ? void 0 : message.generativeUI) == null ? void 0 : _a.call(message)) != null ? _b : props.subComponent;
|
|
1784
|
-
const subComponentPosition = (_c = message == null ? void 0 : message.generativeUIPosition) != null ? _c : "after";
|
|
1785
|
-
const renderBefore = subComponent && subComponentPosition === "before";
|
|
1786
|
-
const renderAfter = subComponent && subComponentPosition !== "before";
|
|
1787
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
1788
|
-
renderBefore ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { marginBottom: "0.5rem" }, children: subComponent }) : null,
|
|
1789
|
-
content && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "copilotKitMessage copilotKitAssistantMessage", children: [
|
|
1790
|
-
content && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Markdown, { content, components: markdownTagRenderers }),
|
|
1791
|
-
content && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1792
|
-
"div",
|
|
1793
|
-
{
|
|
1794
|
-
className: `copilotKitMessageControls ${isCurrentMessage ? "currentMessage" : ""}`,
|
|
1795
|
-
children: [
|
|
1796
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1797
|
-
"button",
|
|
1798
|
-
{
|
|
1799
|
-
className: "copilotKitMessageControlButton",
|
|
1800
|
-
onClick: handleRegenerate,
|
|
1801
|
-
"aria-label": labels.regenerateResponse,
|
|
1802
|
-
title: labels.regenerateResponse,
|
|
1803
|
-
children: icons.regenerateIcon
|
|
1804
|
-
}
|
|
1805
|
-
),
|
|
1806
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1807
|
-
"button",
|
|
1808
|
-
{
|
|
1809
|
-
className: "copilotKitMessageControlButton",
|
|
1810
|
-
onClick: handleCopy,
|
|
1811
|
-
"aria-label": labels.copyToClipboard,
|
|
1812
|
-
title: labels.copyToClipboard,
|
|
1813
|
-
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontSize: "10px", fontWeight: "bold" }, children: "\u2713" }) : icons.copyIcon
|
|
1814
|
-
}
|
|
1815
|
-
),
|
|
1816
|
-
onThumbsUp && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1817
|
-
"button",
|
|
1818
|
-
{
|
|
1819
|
-
className: `copilotKitMessageControlButton ${feedback === "thumbsUp" ? "active" : ""}`,
|
|
1820
|
-
onClick: handleThumbsUp,
|
|
1821
|
-
"aria-label": labels.thumbsUp,
|
|
1822
|
-
title: labels.thumbsUp,
|
|
1823
|
-
children: icons.thumbsUpIcon
|
|
1824
|
-
}
|
|
1825
|
-
),
|
|
1826
|
-
onThumbsDown && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1827
|
-
"button",
|
|
1828
|
-
{
|
|
1829
|
-
className: `copilotKitMessageControlButton ${feedback === "thumbsDown" ? "active" : ""}`,
|
|
1830
|
-
onClick: handleThumbsDown,
|
|
1831
|
-
"aria-label": labels.thumbsDown,
|
|
1832
|
-
title: labels.thumbsDown,
|
|
1833
|
-
children: icons.thumbsDownIcon
|
|
1834
|
-
}
|
|
1835
|
-
)
|
|
1836
|
-
]
|
|
1837
|
-
}
|
|
1838
|
-
)
|
|
1839
|
-
] }),
|
|
1840
|
-
renderAfter ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { marginBottom: "0.5rem" }, children: subComponent }) : null,
|
|
1841
|
-
isLoading && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LoadingIcon, {})
|
|
1842
|
-
] });
|
|
1843
|
-
};
|
|
1844
|
-
|
|
1845
|
-
// src/components/chat/messages/ImageRenderer.tsx
|
|
1846
|
-
var import_react9 = require("react");
|
|
1847
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1848
|
-
var ImageRenderer = ({
|
|
1849
|
-
image,
|
|
1850
|
-
content,
|
|
1851
|
-
className = ""
|
|
1852
|
-
}) => {
|
|
1853
|
-
const [imageError, setImageError] = (0, import_react9.useState)(false);
|
|
1854
|
-
const imageSrc = `data:image/${image.format};base64,${image.bytes}`;
|
|
1855
|
-
const altText = content || "User uploaded image";
|
|
1856
|
-
const handleImageError = () => {
|
|
1857
|
-
setImageError(true);
|
|
1858
|
-
};
|
|
1859
|
-
if (imageError) {
|
|
1860
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1861
|
-
"div",
|
|
1862
|
-
{
|
|
1863
|
-
className: `copilotKitImageRendering copilotKitImageRenderingError ${className}`,
|
|
1864
|
-
children: [
|
|
1865
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "copilotKitImageRenderingErrorMessage", children: "Failed to load image" }),
|
|
1866
|
-
content && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "copilotKitImageRenderingContent", children: content })
|
|
1867
|
-
]
|
|
1868
|
-
}
|
|
1869
|
-
);
|
|
1870
|
-
}
|
|
1871
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: `copilotKitImageRendering ${className}`, children: [
|
|
1872
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1873
|
-
"img",
|
|
1874
|
-
{
|
|
1875
|
-
src: imageSrc,
|
|
1876
|
-
alt: altText,
|
|
1877
|
-
className: "copilotKitImageRenderingImage",
|
|
1878
|
-
onError: handleImageError
|
|
1879
|
-
}
|
|
1880
|
-
),
|
|
1881
|
-
content && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "copilotKitImageRenderingContent", children: content })
|
|
1882
|
-
] });
|
|
1883
|
-
};
|
|
1884
|
-
|
|
1885
|
-
// src/components/chat/messages/RenderMessage.tsx
|
|
1886
|
-
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1887
|
-
function RenderMessage(_a) {
|
|
1888
|
-
var _b = _a, {
|
|
1889
|
-
UserMessage: UserMessage2 = UserMessage,
|
|
1890
|
-
AssistantMessage: AssistantMessage2 = AssistantMessage,
|
|
1891
|
-
ImageRenderer: ImageRenderer2 = ImageRenderer
|
|
1892
|
-
} = _b, props = __objRest(_b, [
|
|
1893
|
-
"UserMessage",
|
|
1894
|
-
"AssistantMessage",
|
|
1895
|
-
"ImageRenderer"
|
|
1896
|
-
]);
|
|
1897
|
-
var _a2;
|
|
1898
|
-
const {
|
|
1899
|
-
message,
|
|
1900
|
-
messages,
|
|
1901
|
-
inProgress,
|
|
1902
|
-
index,
|
|
1903
|
-
isCurrentMessage,
|
|
1904
|
-
onRegenerate,
|
|
1905
|
-
onCopy,
|
|
1906
|
-
onThumbsUp,
|
|
1907
|
-
onThumbsDown,
|
|
1908
|
-
messageFeedback,
|
|
1909
|
-
markdownTagRenderers
|
|
1910
|
-
} = props;
|
|
1911
|
-
switch (message.role) {
|
|
1912
|
-
case "user":
|
|
1913
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1914
|
-
UserMessage2,
|
|
1915
|
-
{
|
|
1916
|
-
rawData: message,
|
|
1917
|
-
"data-message-role": "user",
|
|
1918
|
-
message,
|
|
1919
|
-
ImageRenderer: ImageRenderer2
|
|
1920
|
-
},
|
|
1921
|
-
index
|
|
1922
|
-
);
|
|
1923
|
-
case "assistant":
|
|
1924
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1925
|
-
AssistantMessage2,
|
|
1926
|
-
{
|
|
1927
|
-
"data-message-role": "assistant",
|
|
1928
|
-
subComponent: (_a2 = message.generativeUI) == null ? void 0 : _a2.call(message),
|
|
1929
|
-
rawData: message,
|
|
1930
|
-
message,
|
|
1931
|
-
messages,
|
|
1932
|
-
isLoading: inProgress && isCurrentMessage && !message.content,
|
|
1933
|
-
isGenerating: inProgress && isCurrentMessage && !!message.content,
|
|
1934
|
-
isCurrentMessage,
|
|
1935
|
-
onRegenerate: () => onRegenerate == null ? void 0 : onRegenerate(message.id),
|
|
1936
|
-
onCopy,
|
|
1937
|
-
onThumbsUp,
|
|
1938
|
-
onThumbsDown,
|
|
1939
|
-
feedback: (messageFeedback == null ? void 0 : messageFeedback[message.id]) || null,
|
|
1940
|
-
markdownTagRenderers,
|
|
1941
|
-
ImageRenderer: ImageRenderer2
|
|
1942
|
-
},
|
|
1943
|
-
index
|
|
1944
|
-
);
|
|
1945
|
-
default:
|
|
1946
|
-
return null;
|
|
1947
|
-
}
|
|
1948
|
-
}
|
|
1949
|
-
|
|
1950
|
-
// src/components/chat/messages/LegacyRenderMessage.tsx
|
|
1951
|
-
var import_runtime_client_gql = require("@copilotkit/runtime-client-gql");
|
|
1952
|
-
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1953
|
-
var LegacyRenderMessage = ({
|
|
1954
|
-
message,
|
|
1955
|
-
messages,
|
|
1956
|
-
inProgress,
|
|
1957
|
-
index,
|
|
1958
|
-
isCurrentMessage,
|
|
1959
|
-
actionResult,
|
|
1960
|
-
AssistantMessage: AssistantMessage2,
|
|
1961
|
-
UserMessage: UserMessage2,
|
|
1962
|
-
ImageRenderer: ImageRenderer2,
|
|
1963
|
-
onRegenerate,
|
|
1964
|
-
onCopy,
|
|
1965
|
-
onThumbsUp,
|
|
1966
|
-
onThumbsDown,
|
|
1967
|
-
markdownTagRenderers,
|
|
1968
|
-
legacyProps
|
|
1969
|
-
}) => {
|
|
1970
|
-
var _a;
|
|
1971
|
-
const {
|
|
1972
|
-
RenderTextMessage,
|
|
1973
|
-
RenderActionExecutionMessage,
|
|
1974
|
-
RenderAgentStateMessage,
|
|
1975
|
-
RenderResultMessage,
|
|
1976
|
-
RenderImageMessage
|
|
1977
|
-
} = legacyProps;
|
|
1978
|
-
const deprecatedMessage = (_a = (0, import_runtime_client_gql.aguiToGQL)(message)[0]) != null ? _a : void 0;
|
|
1979
|
-
if (deprecatedMessage.isTextMessage() && RenderTextMessage) {
|
|
1980
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1981
|
-
RenderTextMessage,
|
|
1982
|
-
{
|
|
1983
|
-
message,
|
|
1984
|
-
messages,
|
|
1985
|
-
inProgress,
|
|
1986
|
-
index,
|
|
1987
|
-
isCurrentMessage,
|
|
1988
|
-
AssistantMessage: AssistantMessage2,
|
|
1989
|
-
UserMessage: UserMessage2,
|
|
1990
|
-
onRegenerate,
|
|
1991
|
-
onCopy,
|
|
1992
|
-
onThumbsUp,
|
|
1993
|
-
onThumbsDown,
|
|
1994
|
-
markdownTagRenderers
|
|
1995
|
-
}
|
|
1996
|
-
);
|
|
1997
|
-
}
|
|
1998
|
-
if (deprecatedMessage.isActionExecutionMessage() && RenderActionExecutionMessage) {
|
|
1999
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2000
|
-
RenderActionExecutionMessage,
|
|
2001
|
-
{
|
|
2002
|
-
messages,
|
|
2003
|
-
message,
|
|
2004
|
-
inProgress,
|
|
2005
|
-
index,
|
|
2006
|
-
isCurrentMessage,
|
|
2007
|
-
actionResult,
|
|
2008
|
-
AssistantMessage: AssistantMessage2,
|
|
2009
|
-
UserMessage: UserMessage2
|
|
2010
|
-
}
|
|
2011
|
-
);
|
|
2012
|
-
}
|
|
2013
|
-
if (deprecatedMessage.isAgentStateMessage() && RenderAgentStateMessage) {
|
|
2014
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2015
|
-
RenderAgentStateMessage,
|
|
2016
|
-
{
|
|
2017
|
-
messages,
|
|
2018
|
-
message,
|
|
2019
|
-
inProgress,
|
|
2020
|
-
index,
|
|
2021
|
-
isCurrentMessage,
|
|
2022
|
-
AssistantMessage: AssistantMessage2,
|
|
2023
|
-
UserMessage: UserMessage2
|
|
2024
|
-
}
|
|
2025
|
-
);
|
|
2026
|
-
}
|
|
2027
|
-
if (deprecatedMessage.isResultMessage() && RenderResultMessage) {
|
|
2028
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2029
|
-
RenderResultMessage,
|
|
2030
|
-
{
|
|
2031
|
-
messages,
|
|
2032
|
-
message,
|
|
2033
|
-
inProgress,
|
|
2034
|
-
index,
|
|
2035
|
-
isCurrentMessage,
|
|
2036
|
-
AssistantMessage: AssistantMessage2,
|
|
2037
|
-
UserMessage: UserMessage2
|
|
2038
|
-
}
|
|
2039
|
-
);
|
|
2040
|
-
}
|
|
2041
|
-
if (deprecatedMessage.isImageMessage() && RenderImageMessage) {
|
|
2042
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2043
|
-
RenderImageMessage,
|
|
2044
|
-
{
|
|
2045
|
-
messages,
|
|
2046
|
-
message,
|
|
2047
|
-
inProgress,
|
|
2048
|
-
index,
|
|
2049
|
-
isCurrentMessage,
|
|
2050
|
-
AssistantMessage: AssistantMessage2,
|
|
2051
|
-
UserMessage: UserMessage2
|
|
2052
|
-
}
|
|
2053
|
-
);
|
|
2054
|
-
}
|
|
2055
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2056
|
-
RenderMessage,
|
|
2057
|
-
{
|
|
2058
|
-
messages,
|
|
2059
|
-
message,
|
|
2060
|
-
inProgress,
|
|
2061
|
-
index,
|
|
2062
|
-
isCurrentMessage,
|
|
2063
|
-
AssistantMessage: AssistantMessage2,
|
|
2064
|
-
UserMessage: UserMessage2,
|
|
2065
|
-
ImageRenderer: ImageRenderer2,
|
|
2066
|
-
onRegenerate,
|
|
2067
|
-
onCopy,
|
|
2068
|
-
onThumbsUp,
|
|
2069
|
-
onThumbsDown,
|
|
2070
|
-
markdownTagRenderers
|
|
2071
|
-
}
|
|
2072
|
-
);
|
|
2073
|
-
};
|
|
2074
|
-
|
|
2075
|
-
// src/components/chat/Messages.tsx
|
|
2076
|
-
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2077
|
-
var Messages = ({
|
|
2078
|
-
inProgress,
|
|
2079
|
-
children,
|
|
2080
|
-
RenderMessage: RenderMessage2,
|
|
2081
|
-
AssistantMessage: AssistantMessage2,
|
|
2082
|
-
UserMessage: UserMessage2,
|
|
2083
|
-
ErrorMessage,
|
|
2084
|
-
ImageRenderer: ImageRenderer2,
|
|
2085
|
-
onRegenerate,
|
|
2086
|
-
onCopy,
|
|
2087
|
-
onThumbsUp,
|
|
2088
|
-
onThumbsDown,
|
|
2089
|
-
messageFeedback,
|
|
2090
|
-
markdownTagRenderers,
|
|
2091
|
-
chatError,
|
|
2092
|
-
// Legacy props
|
|
2093
|
-
RenderTextMessage,
|
|
2094
|
-
RenderActionExecutionMessage,
|
|
2095
|
-
RenderAgentStateMessage,
|
|
2096
|
-
RenderResultMessage,
|
|
2097
|
-
RenderImageMessage
|
|
2098
|
-
}) => {
|
|
2099
|
-
var _a;
|
|
2100
|
-
const { labels, icons } = useChatContext();
|
|
2101
|
-
const { messages: visibleMessages, interrupt } = (0, import_react_core5.useCopilotChatInternal)();
|
|
2102
|
-
const initialMessages = (0, import_react10.useMemo)(
|
|
2103
|
-
() => makeInitialMessages(labels.initial),
|
|
2104
|
-
[labels.initial]
|
|
2105
|
-
);
|
|
2106
|
-
const messages = [...initialMessages, ...visibleMessages];
|
|
2107
|
-
const { messagesContainerRef, messagesEndRef } = useScrollToBottom(messages);
|
|
2108
|
-
const hasLegacyProps = !!(RenderTextMessage || RenderActionExecutionMessage || RenderAgentStateMessage || RenderResultMessage || RenderImageMessage);
|
|
2109
|
-
(0, import_react10.useEffect)(() => {
|
|
2110
|
-
if (hasLegacyProps) {
|
|
2111
|
-
console.warn(
|
|
2112
|
-
"[CopilotKit] Legacy message render props (RenderTextMessage, RenderActionExecutionMessage, etc.) are deprecated. Please use the unified 'RenderMessage' prop instead. See migration guide: https://docs.copilotkit.ai/migration/render-message"
|
|
2113
|
-
);
|
|
2114
|
-
}
|
|
2115
|
-
}, [hasLegacyProps]);
|
|
2116
|
-
const legacyProps = (0, import_react10.useMemo)(
|
|
2117
|
-
() => ({
|
|
2118
|
-
RenderTextMessage,
|
|
2119
|
-
RenderActionExecutionMessage,
|
|
2120
|
-
RenderAgentStateMessage,
|
|
2121
|
-
RenderResultMessage,
|
|
2122
|
-
RenderImageMessage
|
|
2123
|
-
}),
|
|
2124
|
-
[
|
|
2125
|
-
RenderTextMessage,
|
|
2126
|
-
RenderActionExecutionMessage,
|
|
2127
|
-
RenderAgentStateMessage,
|
|
2128
|
-
RenderResultMessage,
|
|
2129
|
-
RenderImageMessage
|
|
2130
|
-
]
|
|
2131
|
-
);
|
|
2132
|
-
const MessageRenderer = hasLegacyProps ? (props) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(LegacyRenderMessage, __spreadProps(__spreadValues({}, props), { legacyProps })) : RenderMessage2;
|
|
2133
|
-
const LoadingIcon = () => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: icons.activityIcon });
|
|
2134
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "copilotKitMessages", ref: messagesContainerRef, children: [
|
|
2135
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "copilotKitMessagesContainer", children: [
|
|
2136
|
-
messages.map((message, index) => {
|
|
2137
|
-
const isCurrentMessage = index === messages.length - 1;
|
|
2138
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2139
|
-
MessageRenderer,
|
|
2140
|
-
{
|
|
2141
|
-
message,
|
|
2142
|
-
messages,
|
|
2143
|
-
inProgress,
|
|
2144
|
-
index,
|
|
2145
|
-
isCurrentMessage,
|
|
2146
|
-
AssistantMessage: AssistantMessage2,
|
|
2147
|
-
UserMessage: UserMessage2,
|
|
2148
|
-
ImageRenderer: ImageRenderer2,
|
|
2149
|
-
onRegenerate,
|
|
2150
|
-
onCopy,
|
|
2151
|
-
onThumbsUp,
|
|
2152
|
-
onThumbsDown,
|
|
2153
|
-
messageFeedback,
|
|
2154
|
-
markdownTagRenderers
|
|
2155
|
-
},
|
|
2156
|
-
index
|
|
2157
|
-
);
|
|
2158
|
-
}),
|
|
2159
|
-
((_a = messages[messages.length - 1]) == null ? void 0 : _a.role) === "user" && inProgress && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(LoadingIcon, {}),
|
|
2160
|
-
interrupt,
|
|
2161
|
-
chatError && ErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ErrorMessage, { error: chatError, isCurrentMessage: true })
|
|
2162
|
-
] }),
|
|
2163
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("footer", { className: "copilotKitMessagesFooter", ref: messagesEndRef, children })
|
|
2164
|
-
] });
|
|
2165
|
-
};
|
|
2166
|
-
function makeInitialMessages(initial) {
|
|
2167
|
-
if (!initial)
|
|
2168
|
-
return [];
|
|
2169
|
-
if (Array.isArray(initial)) {
|
|
2170
|
-
return initial.map((message) => {
|
|
2171
|
-
return {
|
|
2172
|
-
id: message,
|
|
2173
|
-
role: "assistant",
|
|
2174
|
-
content: message
|
|
2175
|
-
};
|
|
2176
|
-
});
|
|
2177
|
-
}
|
|
2178
|
-
return [
|
|
2179
|
-
{
|
|
2180
|
-
id: initial,
|
|
2181
|
-
role: "assistant",
|
|
2182
|
-
content: initial
|
|
2183
|
-
}
|
|
2184
|
-
];
|
|
2185
|
-
}
|
|
2186
|
-
function useScrollToBottom(messages) {
|
|
2187
|
-
const messagesEndRef = (0, import_react10.useRef)(null);
|
|
2188
|
-
const messagesContainerRef = (0, import_react10.useRef)(null);
|
|
2189
|
-
const isProgrammaticScrollRef = (0, import_react10.useRef)(false);
|
|
2190
|
-
const isUserScrollUpRef = (0, import_react10.useRef)(false);
|
|
2191
|
-
const scrollToBottom = () => {
|
|
2192
|
-
if (messagesContainerRef.current && messagesEndRef.current) {
|
|
2193
|
-
isProgrammaticScrollRef.current = true;
|
|
2194
|
-
messagesContainerRef.current.scrollTop = messagesContainerRef.current.scrollHeight;
|
|
2195
|
-
}
|
|
2196
|
-
};
|
|
2197
|
-
const handleScroll = () => {
|
|
2198
|
-
if (isProgrammaticScrollRef.current) {
|
|
2199
|
-
isProgrammaticScrollRef.current = false;
|
|
2200
|
-
return;
|
|
2201
|
-
}
|
|
2202
|
-
if (messagesContainerRef.current) {
|
|
2203
|
-
const { scrollTop, scrollHeight, clientHeight } = messagesContainerRef.current;
|
|
2204
|
-
isUserScrollUpRef.current = scrollTop + clientHeight < scrollHeight;
|
|
2205
|
-
}
|
|
2206
|
-
};
|
|
2207
|
-
(0, import_react10.useEffect)(() => {
|
|
2208
|
-
const container = messagesContainerRef.current;
|
|
2209
|
-
if (container) {
|
|
2210
|
-
container.addEventListener("scroll", handleScroll);
|
|
2211
|
-
}
|
|
2212
|
-
return () => {
|
|
2213
|
-
if (container) {
|
|
2214
|
-
container.removeEventListener("scroll", handleScroll);
|
|
2215
|
-
}
|
|
2216
|
-
};
|
|
2217
|
-
}, []);
|
|
2218
|
-
(0, import_react10.useEffect)(() => {
|
|
2219
|
-
const container = messagesContainerRef.current;
|
|
2220
|
-
if (!container) {
|
|
2221
|
-
return;
|
|
2222
|
-
}
|
|
2223
|
-
const mutationObserver = new MutationObserver(() => {
|
|
2224
|
-
if (!isUserScrollUpRef.current) {
|
|
2225
|
-
scrollToBottom();
|
|
2226
|
-
}
|
|
2227
|
-
});
|
|
2228
|
-
mutationObserver.observe(container, {
|
|
2229
|
-
childList: true,
|
|
2230
|
-
subtree: true,
|
|
2231
|
-
characterData: true
|
|
2232
|
-
});
|
|
2233
|
-
return () => {
|
|
2234
|
-
mutationObserver.disconnect();
|
|
2235
|
-
};
|
|
2236
|
-
}, []);
|
|
2237
|
-
(0, import_react10.useEffect)(() => {
|
|
2238
|
-
isUserScrollUpRef.current = false;
|
|
2239
|
-
scrollToBottom();
|
|
2240
|
-
}, [messages.filter((m) => m.role === "user").length]);
|
|
2241
|
-
return { messagesEndRef, messagesContainerRef };
|
|
2242
|
-
}
|
|
2243
|
-
|
|
2244
|
-
// src/components/chat/Input.tsx
|
|
2245
|
-
var import_react14 = require("react");
|
|
2246
|
-
|
|
2247
|
-
// src/components/chat/Textarea.tsx
|
|
2248
|
-
var import_react11 = require("react");
|
|
2249
|
-
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2250
|
-
var AutoResizingTextarea = (0, import_react11.forwardRef)(
|
|
2251
|
-
({
|
|
2252
|
-
maxRows = 1,
|
|
2253
|
-
placeholder,
|
|
2254
|
-
value,
|
|
2255
|
-
onChange,
|
|
2256
|
-
onKeyDown,
|
|
2257
|
-
onCompositionStart,
|
|
2258
|
-
onCompositionEnd,
|
|
2259
|
-
autoFocus
|
|
2260
|
-
}, ref) => {
|
|
2261
|
-
const internalTextareaRef = (0, import_react11.useRef)(null);
|
|
2262
|
-
const [maxHeight, setMaxHeight] = (0, import_react11.useState)(0);
|
|
2263
|
-
(0, import_react11.useImperativeHandle)(
|
|
2264
|
-
ref,
|
|
2265
|
-
() => internalTextareaRef.current
|
|
2266
|
-
);
|
|
2267
|
-
(0, import_react11.useEffect)(() => {
|
|
2268
|
-
const calculateMaxHeight = () => {
|
|
2269
|
-
const textarea = internalTextareaRef.current;
|
|
2270
|
-
if (textarea) {
|
|
2271
|
-
textarea.style.height = "auto";
|
|
2272
|
-
const singleRowHeight = textarea.scrollHeight;
|
|
2273
|
-
setMaxHeight(singleRowHeight * maxRows);
|
|
2274
|
-
if (autoFocus) {
|
|
2275
|
-
textarea.focus();
|
|
2276
|
-
}
|
|
2277
|
-
}
|
|
2278
|
-
};
|
|
2279
|
-
calculateMaxHeight();
|
|
2280
|
-
}, [maxRows]);
|
|
2281
|
-
(0, import_react11.useEffect)(() => {
|
|
2282
|
-
const textarea = internalTextareaRef.current;
|
|
2283
|
-
if (textarea) {
|
|
2284
|
-
textarea.style.height = "auto";
|
|
2285
|
-
textarea.style.height = `${Math.min(textarea.scrollHeight, maxHeight)}px`;
|
|
2286
|
-
}
|
|
2287
|
-
}, [value, maxHeight]);
|
|
2288
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2289
|
-
"textarea",
|
|
2290
|
-
{
|
|
2291
|
-
ref: internalTextareaRef,
|
|
2292
|
-
value,
|
|
2293
|
-
onChange,
|
|
2294
|
-
onKeyDown,
|
|
2295
|
-
onCompositionStart,
|
|
2296
|
-
onCompositionEnd,
|
|
2297
|
-
placeholder,
|
|
2298
|
-
style: {
|
|
2299
|
-
overflow: "auto",
|
|
2300
|
-
resize: "none",
|
|
2301
|
-
maxHeight: `${maxHeight}px`
|
|
2302
|
-
},
|
|
2303
|
-
rows: 1
|
|
2304
|
-
}
|
|
2305
|
-
);
|
|
2306
|
-
}
|
|
2307
|
-
);
|
|
2308
|
-
var Textarea_default = AutoResizingTextarea;
|
|
2309
|
-
|
|
2310
|
-
// src/hooks/use-push-to-talk.tsx
|
|
2311
|
-
var import_react_core6 = require("@copilotkit/react-core");
|
|
2312
|
-
var import_runtime_client_gql2 = require("@copilotkit/runtime-client-gql");
|
|
2313
|
-
var import_react12 = require("react");
|
|
2314
|
-
var startRecording = (mediaStreamRef, mediaRecorderRef, audioContextRef, recordedChunks, onStop) => __async(void 0, null, function* () {
|
|
2315
|
-
if (!mediaStreamRef.current || !audioContextRef.current) {
|
|
2316
|
-
mediaStreamRef.current = yield navigator.mediaDevices.getUserMedia({
|
|
2317
|
-
audio: true
|
|
2318
|
-
});
|
|
2319
|
-
audioContextRef.current = new window.AudioContext();
|
|
2320
|
-
yield audioContextRef.current.resume();
|
|
2321
|
-
}
|
|
2322
|
-
mediaRecorderRef.current = new MediaRecorder(mediaStreamRef.current);
|
|
2323
|
-
mediaRecorderRef.current.start(1e3);
|
|
2324
|
-
mediaRecorderRef.current.ondataavailable = (event) => {
|
|
2325
|
-
recordedChunks.push(event.data);
|
|
2326
|
-
};
|
|
2327
|
-
mediaRecorderRef.current.onstop = onStop;
|
|
2328
|
-
});
|
|
2329
|
-
var stopRecording = (mediaRecorderRef) => {
|
|
2330
|
-
if (mediaRecorderRef.current && mediaRecorderRef.current.state !== "inactive") {
|
|
2331
|
-
mediaRecorderRef.current.stop();
|
|
2332
|
-
}
|
|
2333
|
-
};
|
|
2334
|
-
var transcribeAudio = (recordedChunks, transcribeAudioUrl) => __async(void 0, null, function* () {
|
|
2335
|
-
const completeBlob = new Blob(recordedChunks, { type: "audio/mp4" });
|
|
2336
|
-
const formData = new FormData();
|
|
2337
|
-
formData.append("file", completeBlob, "recording.mp4");
|
|
2338
|
-
const response = yield fetch(transcribeAudioUrl, {
|
|
2339
|
-
method: "POST",
|
|
2340
|
-
body: formData
|
|
2341
|
-
});
|
|
2342
|
-
if (!response.ok) {
|
|
2343
|
-
throw new Error(`Error: ${response.statusText}`);
|
|
2344
|
-
}
|
|
2345
|
-
const transcription = yield response.json();
|
|
2346
|
-
return transcription.text;
|
|
2347
|
-
});
|
|
2348
|
-
var playAudioResponse = (text, textToSpeechUrl, audioContext) => {
|
|
2349
|
-
const encodedText = encodeURIComponent(text);
|
|
2350
|
-
const url = `${textToSpeechUrl}?text=${encodedText}`;
|
|
2351
|
-
fetch(url).then((response) => response.arrayBuffer()).then((arrayBuffer) => audioContext.decodeAudioData(arrayBuffer)).then((audioBuffer) => {
|
|
2352
|
-
const source = audioContext.createBufferSource();
|
|
2353
|
-
source.buffer = audioBuffer;
|
|
2354
|
-
source.connect(audioContext.destination);
|
|
2355
|
-
source.start(0);
|
|
2356
|
-
}).catch((error) => {
|
|
2357
|
-
console.error("Error with decoding audio data", error);
|
|
2358
|
-
});
|
|
2359
|
-
};
|
|
2360
|
-
var usePushToTalk = ({
|
|
2361
|
-
sendFunction,
|
|
2362
|
-
inProgress
|
|
2363
|
-
}) => {
|
|
2364
|
-
const [pushToTalkState, setPushToTalkState] = (0, import_react12.useState)("idle");
|
|
2365
|
-
const mediaStreamRef = (0, import_react12.useRef)(null);
|
|
2366
|
-
const audioContextRef = (0, import_react12.useRef)(null);
|
|
2367
|
-
const mediaRecorderRef = (0, import_react12.useRef)(null);
|
|
2368
|
-
const recordedChunks = (0, import_react12.useRef)([]);
|
|
2369
|
-
const generalContext = (0, import_react_core6.useCopilotContext)();
|
|
2370
|
-
const messagesContext = (0, import_react_core6.useCopilotMessagesContext)();
|
|
2371
|
-
const context = __spreadValues(__spreadValues({}, generalContext), messagesContext);
|
|
2372
|
-
const [startReadingFromMessageId, setStartReadingFromMessageId] = (0, import_react12.useState)(null);
|
|
2373
|
-
(0, import_react12.useEffect)(() => {
|
|
2374
|
-
if (pushToTalkState === "recording") {
|
|
2375
|
-
startRecording(
|
|
2376
|
-
mediaStreamRef,
|
|
2377
|
-
mediaRecorderRef,
|
|
2378
|
-
audioContextRef,
|
|
2379
|
-
recordedChunks.current,
|
|
2380
|
-
() => {
|
|
2381
|
-
setPushToTalkState("transcribing");
|
|
2382
|
-
}
|
|
2383
|
-
);
|
|
2384
|
-
} else {
|
|
2385
|
-
stopRecording(mediaRecorderRef);
|
|
2386
|
-
if (pushToTalkState === "transcribing") {
|
|
2387
|
-
transcribeAudio(
|
|
2388
|
-
recordedChunks.current,
|
|
2389
|
-
context.copilotApiConfig.transcribeAudioUrl
|
|
2390
|
-
).then((transcription) => __async(void 0, null, function* () {
|
|
2391
|
-
recordedChunks.current = [];
|
|
2392
|
-
setPushToTalkState("idle");
|
|
2393
|
-
const message = yield sendFunction(transcription);
|
|
2394
|
-
setStartReadingFromMessageId(message.id);
|
|
2395
|
-
}));
|
|
2396
|
-
}
|
|
2397
|
-
}
|
|
2398
|
-
return () => {
|
|
2399
|
-
stopRecording(mediaRecorderRef);
|
|
2400
|
-
};
|
|
2401
|
-
}, [pushToTalkState]);
|
|
2402
|
-
(0, import_react12.useEffect)(() => {
|
|
2403
|
-
if (inProgress === false && startReadingFromMessageId) {
|
|
2404
|
-
const lastMessageIndex = context.messages.findIndex(
|
|
2405
|
-
(message) => message.id === startReadingFromMessageId
|
|
2406
|
-
);
|
|
2407
|
-
const aguiMessages = (0, import_runtime_client_gql2.gqlToAGUI)(context.messages);
|
|
2408
|
-
const messagesAfterLast = aguiMessages.slice(lastMessageIndex + 1).filter((message) => message.role === "assistant");
|
|
2409
|
-
const text = messagesAfterLast.map((message) => message.content).join("\n");
|
|
2410
|
-
playAudioResponse(
|
|
2411
|
-
text,
|
|
2412
|
-
context.copilotApiConfig.textToSpeechUrl,
|
|
2413
|
-
audioContextRef.current
|
|
2414
|
-
);
|
|
2415
|
-
setStartReadingFromMessageId(null);
|
|
2416
|
-
}
|
|
2417
|
-
}, [startReadingFromMessageId, inProgress]);
|
|
2418
|
-
return { pushToTalkState, setPushToTalkState };
|
|
2419
|
-
};
|
|
2420
|
-
|
|
2421
|
-
// src/components/chat/Input.tsx
|
|
2422
|
-
var import_react_core7 = require("@copilotkit/react-core");
|
|
2423
|
-
|
|
2424
|
-
// src/components/chat/PoweredByTag.tsx
|
|
2425
|
-
var import_react13 = require("react");
|
|
2426
|
-
|
|
2427
|
-
// src/hooks/use-dark-mode.ts
|
|
2428
|
-
var useDarkMode = () => {
|
|
2429
|
-
if (typeof window === "undefined")
|
|
2430
|
-
return false;
|
|
2431
|
-
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;
|
|
2432
|
-
};
|
|
2433
|
-
|
|
2434
|
-
// src/components/chat/PoweredByTag.tsx
|
|
2435
|
-
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2436
|
-
function PoweredByTag({
|
|
2437
|
-
showPoweredBy = true
|
|
2438
|
-
}) {
|
|
2439
|
-
const [mounted, setMounted] = (0, import_react13.useState)(false);
|
|
2440
|
-
const isDark = useDarkMode();
|
|
2441
|
-
(0, import_react13.useEffect)(() => {
|
|
2442
|
-
setMounted(true);
|
|
2443
|
-
}, []);
|
|
2444
|
-
if (!showPoweredBy) {
|
|
2445
|
-
return null;
|
|
2446
|
-
}
|
|
2447
|
-
const poweredByStyle = {
|
|
2448
|
-
visibility: "visible",
|
|
2449
|
-
display: "block",
|
|
2450
|
-
position: "static",
|
|
2451
|
-
textAlign: "center",
|
|
2452
|
-
fontSize: "12px",
|
|
2453
|
-
padding: "3px 0",
|
|
2454
|
-
color: mounted && isDark ? "rgb(69, 69, 69)" : "rgb(214, 214, 214)"
|
|
2455
|
-
};
|
|
2456
|
-
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "poweredBy", style: poweredByStyle, children: "Powered by CopilotKit" }) });
|
|
2457
|
-
}
|
|
2458
|
-
|
|
2459
|
-
// src/components/chat/Input.tsx
|
|
2460
|
-
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2461
|
-
var MAX_NEWLINES = 6;
|
|
2462
|
-
var Input = ({
|
|
2463
|
-
inProgress,
|
|
2464
|
-
onSend,
|
|
2465
|
-
chatReady = false,
|
|
2466
|
-
onStop,
|
|
2467
|
-
onUpload,
|
|
2468
|
-
hideStopButton = false
|
|
2469
|
-
}) => {
|
|
2470
|
-
var _a;
|
|
2471
|
-
const context = useChatContext();
|
|
2472
|
-
const copilotContext = (0, import_react_core7.useCopilotContext)();
|
|
2473
|
-
const showPoweredBy = !((_a = copilotContext.copilotApiConfig) == null ? void 0 : _a.publicApiKey);
|
|
2474
|
-
const pushToTalkConfigured = copilotContext.copilotApiConfig.textToSpeechUrl !== void 0 && copilotContext.copilotApiConfig.transcribeAudioUrl !== void 0;
|
|
2475
|
-
const textareaRef = (0, import_react14.useRef)(null);
|
|
2476
|
-
const [isComposing, setIsComposing] = (0, import_react14.useState)(false);
|
|
2477
|
-
const handleDivClick = (event) => {
|
|
2478
|
-
var _a2;
|
|
2479
|
-
const target = event.target;
|
|
2480
|
-
if (target.closest("button"))
|
|
2481
|
-
return;
|
|
2482
|
-
if (target.tagName === "TEXTAREA")
|
|
2483
|
-
return;
|
|
2484
|
-
(_a2 = textareaRef.current) == null ? void 0 : _a2.focus();
|
|
2485
|
-
};
|
|
2486
|
-
const [text, setText] = (0, import_react14.useState)("");
|
|
2487
|
-
const send = () => {
|
|
2488
|
-
var _a2;
|
|
2489
|
-
if (inProgress)
|
|
2490
|
-
return;
|
|
2491
|
-
onSend(text);
|
|
2492
|
-
setText("");
|
|
2493
|
-
(_a2 = textareaRef.current) == null ? void 0 : _a2.focus();
|
|
2494
|
-
};
|
|
2495
|
-
const { pushToTalkState, setPushToTalkState } = usePushToTalk({
|
|
2496
|
-
sendFunction: onSend,
|
|
2497
|
-
inProgress
|
|
2498
|
-
});
|
|
2499
|
-
const isInProgress = inProgress || pushToTalkState === "transcribing";
|
|
2500
|
-
const { buttonIcon, buttonAlt } = (0, import_react14.useMemo)(() => {
|
|
2501
|
-
if (!chatReady)
|
|
2502
|
-
return { buttonIcon: context.icons.spinnerIcon, buttonAlt: "Loading" };
|
|
2503
|
-
return isInProgress && !hideStopButton && chatReady ? { buttonIcon: context.icons.stopIcon, buttonAlt: "Stop" } : { buttonIcon: context.icons.sendIcon, buttonAlt: "Send" };
|
|
2504
|
-
}, [
|
|
2505
|
-
isInProgress,
|
|
2506
|
-
chatReady,
|
|
2507
|
-
hideStopButton,
|
|
2508
|
-
context.icons.stopIcon,
|
|
2509
|
-
context.icons.sendIcon
|
|
2510
|
-
]);
|
|
2511
|
-
const showPushToTalk = pushToTalkConfigured && (pushToTalkState === "idle" || pushToTalkState === "recording") && !inProgress;
|
|
2512
|
-
const { interrupt } = (0, import_react_core7.useCopilotChatInternal)();
|
|
2513
|
-
const canSend = (0, import_react14.useMemo)(() => {
|
|
2514
|
-
return !isInProgress && text.trim().length > 0 && pushToTalkState === "idle" && !interrupt;
|
|
2515
|
-
}, [interrupt, isInProgress, text, pushToTalkState]);
|
|
2516
|
-
const canStop = (0, import_react14.useMemo)(() => {
|
|
2517
|
-
return isInProgress && !hideStopButton;
|
|
2518
|
-
}, [isInProgress, hideStopButton]);
|
|
2519
|
-
const sendDisabled = !canSend && !canStop;
|
|
2520
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2521
|
-
"div",
|
|
2522
|
-
{
|
|
2523
|
-
className: `copilotKitInputContainer ${showPoweredBy ? "poweredByContainer" : ""}`,
|
|
2524
|
-
children: [
|
|
2525
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
|
|
2526
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2527
|
-
Textarea_default,
|
|
2528
|
-
{
|
|
2529
|
-
ref: textareaRef,
|
|
2530
|
-
placeholder: context.labels.placeholder,
|
|
2531
|
-
autoFocus: false,
|
|
2532
|
-
maxRows: MAX_NEWLINES,
|
|
2533
|
-
value: text,
|
|
2534
|
-
onChange: (event) => setText(event.target.value),
|
|
2535
|
-
onCompositionStart: () => setIsComposing(true),
|
|
2536
|
-
onCompositionEnd: () => setIsComposing(false),
|
|
2537
|
-
onKeyDown: (event) => {
|
|
2538
|
-
if (event.key === "Enter" && !event.shiftKey && !isComposing) {
|
|
2539
|
-
event.preventDefault();
|
|
2540
|
-
if (canSend) {
|
|
2541
|
-
send();
|
|
2542
|
-
}
|
|
2543
|
-
}
|
|
2544
|
-
}
|
|
2545
|
-
}
|
|
2546
|
-
),
|
|
2547
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "copilotKitInputControls", children: [
|
|
2548
|
-
onUpload && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { onClick: onUpload, className: "copilotKitInputControlButton", children: context.icons.uploadIcon }),
|
|
2549
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { flexGrow: 1 } }),
|
|
2550
|
-
showPushToTalk && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2551
|
-
"button",
|
|
2552
|
-
{
|
|
2553
|
-
onClick: () => setPushToTalkState(
|
|
2554
|
-
pushToTalkState === "idle" ? "recording" : "transcribing"
|
|
2555
|
-
),
|
|
2556
|
-
className: pushToTalkState === "recording" ? "copilotKitInputControlButton copilotKitPushToTalkRecording" : "copilotKitInputControlButton",
|
|
2557
|
-
children: context.icons.pushToTalkIcon
|
|
2558
|
-
}
|
|
2559
|
-
),
|
|
2560
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2561
|
-
"button",
|
|
2562
|
-
{
|
|
2563
|
-
disabled: sendDisabled,
|
|
2564
|
-
onClick: isInProgress && !hideStopButton ? onStop : send,
|
|
2565
|
-
"data-copilotkit-in-progress": inProgress,
|
|
2566
|
-
"data-test-id": inProgress ? "copilot-chat-request-in-progress" : "copilot-chat-ready",
|
|
2567
|
-
className: "copilotKitInputControlButton",
|
|
2568
|
-
"aria-label": buttonAlt,
|
|
2569
|
-
children: buttonIcon
|
|
2570
|
-
}
|
|
2571
|
-
)
|
|
2572
|
-
] })
|
|
2573
|
-
] }),
|
|
2574
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PoweredByTag, { showPoweredBy })
|
|
2575
|
-
]
|
|
2576
|
-
}
|
|
2577
|
-
);
|
|
2578
|
-
};
|
|
2579
|
-
|
|
2580
|
-
// src/components/chat/Chat.tsx
|
|
2581
|
-
var import_react15 = __toESM(require("react"));
|
|
2582
|
-
var import_react_core9 = require("@copilotkit/react-core");
|
|
2583
|
-
var import_shared3 = require("@copilotkit/shared");
|
|
2584
|
-
|
|
2585
|
-
// src/components/chat/ImageUploadQueue.tsx
|
|
2586
|
-
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2587
|
-
var ImageUploadQueue = ({
|
|
2588
|
-
images,
|
|
2589
|
-
onRemoveImage,
|
|
2590
|
-
className = ""
|
|
2591
|
-
}) => {
|
|
2592
|
-
if (images.length === 0)
|
|
2593
|
-
return null;
|
|
2594
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2595
|
-
"div",
|
|
2596
|
-
{
|
|
2597
|
-
className: `copilotKitImageUploadQueue ${className}`,
|
|
2598
|
-
style: {
|
|
2599
|
-
display: "flex",
|
|
2600
|
-
flexWrap: "wrap",
|
|
2601
|
-
gap: "8px",
|
|
2602
|
-
margin: "8px",
|
|
2603
|
-
padding: "8px"
|
|
2604
|
-
},
|
|
2605
|
-
children: images.map((image, index) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2606
|
-
"div",
|
|
2607
|
-
{
|
|
2608
|
-
className: "copilotKitImageUploadQueueItem",
|
|
2609
|
-
style: {
|
|
2610
|
-
position: "relative",
|
|
2611
|
-
display: "inline-block",
|
|
2612
|
-
width: "60px",
|
|
2613
|
-
height: "60px",
|
|
2614
|
-
borderRadius: "4px",
|
|
2615
|
-
overflow: "hidden"
|
|
2616
|
-
},
|
|
2617
|
-
children: [
|
|
2618
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2619
|
-
"img",
|
|
2620
|
-
{
|
|
2621
|
-
src: `data:${image.contentType};base64,${image.bytes}`,
|
|
2622
|
-
alt: `Selected image ${index + 1}`,
|
|
2623
|
-
style: {
|
|
2624
|
-
width: "100%",
|
|
2625
|
-
height: "100%",
|
|
2626
|
-
objectFit: "cover"
|
|
2627
|
-
}
|
|
2628
|
-
}
|
|
2629
|
-
),
|
|
2630
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2631
|
-
"button",
|
|
2632
|
-
{
|
|
2633
|
-
onClick: () => onRemoveImage(index),
|
|
2634
|
-
className: "copilotKitImageUploadQueueRemoveButton",
|
|
2635
|
-
style: {
|
|
2636
|
-
position: "absolute",
|
|
2637
|
-
top: "2px",
|
|
2638
|
-
right: "2px",
|
|
2639
|
-
background: "rgba(0,0,0,0.6)",
|
|
2640
|
-
color: "white",
|
|
2641
|
-
border: "none",
|
|
2642
|
-
borderRadius: "50%",
|
|
2643
|
-
width: "18px",
|
|
2644
|
-
height: "18px",
|
|
2645
|
-
display: "flex",
|
|
2646
|
-
alignItems: "center",
|
|
2647
|
-
justifyContent: "center",
|
|
2648
|
-
cursor: "pointer",
|
|
2649
|
-
fontSize: "10px",
|
|
2650
|
-
padding: 0
|
|
2651
|
-
},
|
|
2652
|
-
children: "\u2715"
|
|
2653
|
-
}
|
|
2654
|
-
)
|
|
2655
|
-
]
|
|
2656
|
-
},
|
|
2657
|
-
index
|
|
2658
|
-
))
|
|
2659
|
-
}
|
|
2660
|
-
);
|
|
2661
|
-
};
|
|
2662
|
-
|
|
2663
|
-
// src/components/chat/Suggestion.tsx
|
|
2664
|
-
var import_react_core8 = require("@copilotkit/react-core");
|
|
2665
|
-
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2666
|
-
function Suggestion({
|
|
2667
|
-
title,
|
|
2668
|
-
onClick,
|
|
2669
|
-
partial,
|
|
2670
|
-
className
|
|
2671
|
-
}) {
|
|
2672
|
-
const { isLoading } = (0, import_react_core8.useCopilotChatInternal)();
|
|
2673
|
-
if (!title)
|
|
2674
|
-
return null;
|
|
2675
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2676
|
-
"button",
|
|
2677
|
-
{
|
|
2678
|
-
disabled: partial || isLoading,
|
|
2679
|
-
onClick: (e) => {
|
|
2680
|
-
e.preventDefault();
|
|
2681
|
-
onClick();
|
|
2682
|
-
},
|
|
2683
|
-
className: `suggestion ${className != null ? className : ""} ${partial ? "loading" : ""}`,
|
|
2684
|
-
"data-test-id": "suggestion",
|
|
2685
|
-
type: "button",
|
|
2686
|
-
children: partial ? SmallSpinnerIcon : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: title })
|
|
2687
|
-
}
|
|
2688
|
-
);
|
|
2689
|
-
}
|
|
2690
|
-
|
|
2691
|
-
// src/components/chat/Suggestions.tsx
|
|
2692
|
-
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2693
|
-
function Suggestions({
|
|
2694
|
-
suggestions,
|
|
2695
|
-
onSuggestionClick,
|
|
2696
|
-
isLoading
|
|
2697
|
-
}) {
|
|
2698
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "suggestions", children: suggestions.map((suggestion, index) => {
|
|
2699
|
-
var _a, _b;
|
|
2700
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2701
|
-
Suggestion,
|
|
2702
|
-
{
|
|
2703
|
-
title: suggestion.title,
|
|
2704
|
-
message: suggestion.message,
|
|
2705
|
-
partial: (_b = (_a = suggestion.isLoading) != null ? _a : suggestion.partial) != null ? _b : isLoading,
|
|
2706
|
-
className: suggestion.className,
|
|
2707
|
-
onClick: () => onSuggestionClick(suggestion.message)
|
|
2708
|
-
},
|
|
2709
|
-
index
|
|
2710
|
-
);
|
|
2711
|
-
}) });
|
|
2712
|
-
}
|
|
2713
|
-
|
|
2714
|
-
// src/components/chat/Chat.tsx
|
|
2715
|
-
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2716
|
-
function CopilotChat({
|
|
2717
|
-
instructions,
|
|
2718
|
-
suggestions = "auto",
|
|
2719
|
-
onSubmitMessage,
|
|
2720
|
-
makeSystemMessage,
|
|
2721
|
-
disableSystemMessage,
|
|
2722
|
-
onInProgress,
|
|
2723
|
-
onStopGeneration,
|
|
2724
|
-
onReloadMessages,
|
|
2725
|
-
onRegenerate,
|
|
2726
|
-
onCopy,
|
|
2727
|
-
onThumbsUp,
|
|
2728
|
-
onThumbsDown,
|
|
2729
|
-
markdownTagRenderers,
|
|
2730
|
-
Messages: Messages2 = Messages,
|
|
2731
|
-
RenderMessage: RenderMessage2 = RenderMessage,
|
|
2732
|
-
RenderSuggestionsList = Suggestions,
|
|
2733
|
-
Input: Input2 = Input,
|
|
2734
|
-
className,
|
|
2735
|
-
icons,
|
|
2736
|
-
labels,
|
|
2737
|
-
AssistantMessage: AssistantMessage2 = AssistantMessage,
|
|
2738
|
-
UserMessage: UserMessage2 = UserMessage,
|
|
2739
|
-
ImageRenderer: ImageRenderer2 = ImageRenderer,
|
|
2740
|
-
ErrorMessage,
|
|
2741
|
-
imageUploadsEnabled,
|
|
2742
|
-
inputFileAccept = "image/*",
|
|
2743
|
-
hideStopButton,
|
|
2744
|
-
observabilityHooks,
|
|
2745
|
-
renderError,
|
|
2746
|
-
onError,
|
|
2747
|
-
// Legacy props - deprecated
|
|
2748
|
-
RenderTextMessage,
|
|
2749
|
-
RenderActionExecutionMessage,
|
|
2750
|
-
RenderAgentStateMessage,
|
|
2751
|
-
RenderResultMessage,
|
|
2752
|
-
RenderImageMessage
|
|
2753
|
-
}) {
|
|
2754
|
-
const {
|
|
2755
|
-
additionalInstructions,
|
|
2756
|
-
setChatInstructions,
|
|
2757
|
-
copilotApiConfig,
|
|
2758
|
-
setBannerError,
|
|
2759
|
-
setInternalErrorHandler,
|
|
2760
|
-
removeInternalErrorHandler
|
|
2761
|
-
} = (0, import_react_core9.useCopilotContext)();
|
|
2762
|
-
const { publicApiKey, chatApiEndpoint } = copilotApiConfig;
|
|
2763
|
-
const [selectedImages, setSelectedImages] = (0, import_react15.useState)([]);
|
|
2764
|
-
const [chatError, setChatError] = (0, import_react15.useState)(null);
|
|
2765
|
-
const [messageFeedback, setMessageFeedback] = (0, import_react15.useState)({});
|
|
2766
|
-
const fileInputRef = (0, import_react15.useRef)(null);
|
|
2767
|
-
const triggerObservabilityHook = (0, import_react15.useCallback)(
|
|
2768
|
-
(hookName, ...args) => {
|
|
2769
|
-
if (publicApiKey && (observabilityHooks == null ? void 0 : observabilityHooks[hookName])) {
|
|
2770
|
-
observabilityHooks[hookName](...args);
|
|
2771
|
-
}
|
|
2772
|
-
if ((observabilityHooks == null ? void 0 : observabilityHooks[hookName]) && !publicApiKey) {
|
|
2773
|
-
setBannerError(
|
|
2774
|
-
new import_shared3.CopilotKitError({
|
|
2775
|
-
message: "observabilityHooks requires a publicApiKey to function.",
|
|
2776
|
-
code: import_shared3.CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR,
|
|
2777
|
-
severity: import_shared3.Severity.CRITICAL,
|
|
2778
|
-
visibility: import_shared3.ErrorVisibility.BANNER
|
|
2779
|
-
})
|
|
2780
|
-
);
|
|
2781
|
-
import_shared3.styledConsole.publicApiKeyRequired("observabilityHooks");
|
|
2782
|
-
}
|
|
2783
|
-
},
|
|
2784
|
-
[publicApiKey, observabilityHooks, setBannerError]
|
|
2785
|
-
);
|
|
2786
|
-
const triggerChatError = (0, import_react15.useCallback)(
|
|
2787
|
-
(error, operation, originalError) => {
|
|
2788
|
-
const errorMessage = (error == null ? void 0 : error.message) || (error == null ? void 0 : error.toString()) || "An error occurred";
|
|
2789
|
-
setChatError({
|
|
2790
|
-
message: errorMessage,
|
|
2791
|
-
operation,
|
|
2792
|
-
timestamp: Date.now()
|
|
2793
|
-
});
|
|
2794
|
-
const errorEvent = {
|
|
2795
|
-
type: "error",
|
|
2796
|
-
timestamp: Date.now(),
|
|
2797
|
-
context: {
|
|
2798
|
-
source: "ui",
|
|
2799
|
-
request: {
|
|
2800
|
-
operation,
|
|
2801
|
-
url: chatApiEndpoint,
|
|
2802
|
-
startTime: Date.now()
|
|
2803
|
-
},
|
|
2804
|
-
technical: {
|
|
2805
|
-
environment: "browser",
|
|
2806
|
-
userAgent: typeof navigator !== "undefined" ? navigator.userAgent : void 0,
|
|
2807
|
-
stackTrace: originalError instanceof Error ? originalError.stack : void 0
|
|
2808
|
-
}
|
|
2809
|
-
},
|
|
2810
|
-
error
|
|
2811
|
-
};
|
|
2812
|
-
if (onError) {
|
|
2813
|
-
onError(errorEvent);
|
|
2814
|
-
}
|
|
2815
|
-
if (publicApiKey && (observabilityHooks == null ? void 0 : observabilityHooks.onError)) {
|
|
2816
|
-
observabilityHooks.onError(errorEvent);
|
|
2817
|
-
}
|
|
2818
|
-
if ((observabilityHooks == null ? void 0 : observabilityHooks.onError) && !publicApiKey) {
|
|
2819
|
-
setBannerError(
|
|
2820
|
-
new import_shared3.CopilotKitError({
|
|
2821
|
-
message: "observabilityHooks.onError requires a publicApiKey to function.",
|
|
2822
|
-
code: import_shared3.CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR,
|
|
2823
|
-
severity: import_shared3.Severity.CRITICAL,
|
|
2824
|
-
visibility: import_shared3.ErrorVisibility.BANNER
|
|
2825
|
-
})
|
|
2826
|
-
);
|
|
2827
|
-
import_shared3.styledConsole.publicApiKeyRequired("observabilityHooks.onError");
|
|
2828
|
-
}
|
|
2829
|
-
},
|
|
2830
|
-
[publicApiKey, chatApiEndpoint, observabilityHooks, setBannerError]
|
|
2831
|
-
);
|
|
2832
|
-
(0, import_react15.useEffect)(() => {
|
|
2833
|
-
const id = "chat-component";
|
|
2834
|
-
setInternalErrorHandler({
|
|
2835
|
-
[id]: (error) => {
|
|
2836
|
-
if (!error)
|
|
2837
|
-
return;
|
|
2838
|
-
triggerChatError(error.error, "sendMessage");
|
|
2839
|
-
}
|
|
2840
|
-
});
|
|
2841
|
-
return () => {
|
|
2842
|
-
removeInternalErrorHandler == null ? void 0 : removeInternalErrorHandler(id);
|
|
2843
|
-
};
|
|
2844
|
-
}, [triggerChatError, setInternalErrorHandler, removeInternalErrorHandler]);
|
|
2845
|
-
(0, import_react15.useEffect)(() => {
|
|
2846
|
-
if (!imageUploadsEnabled)
|
|
2847
|
-
return;
|
|
2848
|
-
const handlePaste = (e) => __async(this, null, function* () {
|
|
2849
|
-
var _a, _b;
|
|
2850
|
-
const target = e.target;
|
|
2851
|
-
if (!((_a = target.parentElement) == null ? void 0 : _a.classList.contains("copilotKitInput")))
|
|
2852
|
-
return;
|
|
2853
|
-
const items = Array.from(((_b = e.clipboardData) == null ? void 0 : _b.items) || []);
|
|
2854
|
-
const imageItems = items.filter((item) => item.type.startsWith("image/"));
|
|
2855
|
-
if (imageItems.length === 0)
|
|
2856
|
-
return;
|
|
2857
|
-
e.preventDefault();
|
|
2858
|
-
const imagePromises = imageItems.map(
|
|
2859
|
-
(item) => {
|
|
2860
|
-
const file = item.getAsFile();
|
|
2861
|
-
if (!file)
|
|
2862
|
-
return Promise.resolve(null);
|
|
2863
|
-
return new Promise((resolve, reject) => {
|
|
2864
|
-
const reader = new FileReader();
|
|
2865
|
-
reader.onload = (e2) => {
|
|
2866
|
-
var _a2, _b2;
|
|
2867
|
-
const base64String = (_b2 = (_a2 = e2.target) == null ? void 0 : _a2.result) == null ? void 0 : _b2.split(",")[1];
|
|
2868
|
-
if (base64String) {
|
|
2869
|
-
resolve({
|
|
2870
|
-
contentType: file.type,
|
|
2871
|
-
bytes: base64String
|
|
2872
|
-
});
|
|
2873
|
-
} else {
|
|
2874
|
-
resolve(null);
|
|
2875
|
-
}
|
|
2876
|
-
};
|
|
2877
|
-
reader.onerror = reject;
|
|
2878
|
-
reader.readAsDataURL(file);
|
|
2879
|
-
});
|
|
2880
|
-
}
|
|
2881
|
-
);
|
|
2882
|
-
try {
|
|
2883
|
-
const loadedImages = (yield Promise.all(imagePromises)).filter(
|
|
2884
|
-
(img) => img !== null
|
|
2885
|
-
);
|
|
2886
|
-
setSelectedImages((prev) => [...prev, ...loadedImages]);
|
|
2887
|
-
} catch (error) {
|
|
2888
|
-
triggerChatError(error, "processClipboardImages", error);
|
|
2889
|
-
console.error("Error processing pasted images:", error);
|
|
2890
|
-
}
|
|
2891
|
-
});
|
|
2892
|
-
document.addEventListener("paste", handlePaste);
|
|
2893
|
-
return () => document.removeEventListener("paste", handlePaste);
|
|
2894
|
-
}, [imageUploadsEnabled, triggerChatError]);
|
|
2895
|
-
(0, import_react15.useEffect)(() => {
|
|
2896
|
-
if (!(additionalInstructions == null ? void 0 : additionalInstructions.length)) {
|
|
2897
|
-
setChatInstructions(instructions || "");
|
|
2898
|
-
return;
|
|
2899
|
-
}
|
|
2900
|
-
const combinedAdditionalInstructions = [
|
|
2901
|
-
instructions,
|
|
2902
|
-
"Additionally, follow these instructions:",
|
|
2903
|
-
...additionalInstructions.map((instruction) => `- ${instruction}`)
|
|
2904
|
-
];
|
|
2905
|
-
setChatInstructions(combinedAdditionalInstructions.join("\n") || "");
|
|
2906
|
-
}, [instructions, additionalInstructions]);
|
|
2907
|
-
const {
|
|
2908
|
-
messages,
|
|
2909
|
-
isLoading,
|
|
2910
|
-
sendMessage,
|
|
2911
|
-
stopGeneration,
|
|
2912
|
-
reloadMessages,
|
|
2913
|
-
suggestions: currentSuggestions,
|
|
2914
|
-
isLoadingSuggestions,
|
|
2915
|
-
agent
|
|
2916
|
-
} = (0, import_react_core9.useCopilotChatInternal)({
|
|
2917
|
-
suggestions,
|
|
2918
|
-
onInProgress,
|
|
2919
|
-
onSubmitMessage,
|
|
2920
|
-
onStopGeneration,
|
|
2921
|
-
onReloadMessages
|
|
2922
|
-
});
|
|
2923
|
-
const prevIsLoading = (0, import_react15.useRef)(isLoading);
|
|
2924
|
-
(0, import_react15.useEffect)(() => {
|
|
2925
|
-
if (prevIsLoading.current !== isLoading) {
|
|
2926
|
-
if (isLoading) {
|
|
2927
|
-
triggerObservabilityHook("onChatStarted");
|
|
2928
|
-
} else {
|
|
2929
|
-
triggerObservabilityHook("onChatStopped");
|
|
2930
|
-
}
|
|
2931
|
-
prevIsLoading.current = isLoading;
|
|
2932
|
-
}
|
|
2933
|
-
}, [isLoading, triggerObservabilityHook]);
|
|
2934
|
-
const handleSendMessage = (text) => {
|
|
2935
|
-
const images = selectedImages;
|
|
2936
|
-
setSelectedImages([]);
|
|
2937
|
-
if (fileInputRef.current) {
|
|
2938
|
-
fileInputRef.current.value = "";
|
|
2939
|
-
}
|
|
2940
|
-
triggerObservabilityHook("onMessageSent", text);
|
|
2941
|
-
return sendMessage({
|
|
2942
|
-
id: (0, import_shared3.randomUUID)(),
|
|
2943
|
-
content: text,
|
|
2944
|
-
role: "user"
|
|
2945
|
-
});
|
|
2946
|
-
};
|
|
2947
|
-
const chatContext = import_react15.default.useContext(ChatContext);
|
|
2948
|
-
const isVisible = chatContext ? chatContext.open : true;
|
|
2949
|
-
const handleRegenerate = (messageId) => {
|
|
2950
|
-
if (onRegenerate) {
|
|
2951
|
-
onRegenerate(messageId);
|
|
2952
|
-
}
|
|
2953
|
-
triggerObservabilityHook("onMessageRegenerated", messageId);
|
|
2954
|
-
reloadMessages(messageId);
|
|
2955
|
-
};
|
|
2956
|
-
const handleCopy = (message) => {
|
|
2957
|
-
if (onCopy) {
|
|
2958
|
-
onCopy(message);
|
|
2959
|
-
}
|
|
2960
|
-
triggerObservabilityHook("onMessageCopied", message);
|
|
2961
|
-
};
|
|
2962
|
-
const handleImageUpload = (event) => __async(this, null, function* () {
|
|
2963
|
-
if (!event.target.files || event.target.files.length === 0) {
|
|
2964
|
-
return;
|
|
2965
|
-
}
|
|
2966
|
-
const files = Array.from(event.target.files).filter(
|
|
2967
|
-
(file) => file.type.startsWith("image/")
|
|
2968
|
-
);
|
|
2969
|
-
if (files.length === 0)
|
|
2970
|
-
return;
|
|
2971
|
-
const fileReadPromises = files.map((file) => {
|
|
2972
|
-
return new Promise(
|
|
2973
|
-
(resolve, reject) => {
|
|
2974
|
-
const reader = new FileReader();
|
|
2975
|
-
reader.onload = (e) => {
|
|
2976
|
-
var _a, _b;
|
|
2977
|
-
const base64String = ((_b = (_a = e.target) == null ? void 0 : _a.result) == null ? void 0 : _b.split(",")[1]) || "";
|
|
2978
|
-
if (base64String) {
|
|
2979
|
-
resolve({
|
|
2980
|
-
contentType: file.type,
|
|
2981
|
-
bytes: base64String
|
|
2982
|
-
});
|
|
2983
|
-
}
|
|
2984
|
-
};
|
|
2985
|
-
reader.onerror = reject;
|
|
2986
|
-
reader.readAsDataURL(file);
|
|
2987
|
-
}
|
|
2988
|
-
);
|
|
2989
|
-
});
|
|
2990
|
-
try {
|
|
2991
|
-
const loadedImages = yield Promise.all(fileReadPromises);
|
|
2992
|
-
setSelectedImages((prev) => [...prev, ...loadedImages]);
|
|
2993
|
-
} catch (error) {
|
|
2994
|
-
triggerChatError(error, "processUploadedImages", error);
|
|
2995
|
-
console.error("Error reading files:", error);
|
|
2996
|
-
}
|
|
2997
|
-
});
|
|
2998
|
-
const removeSelectedImage = (index) => {
|
|
2999
|
-
setSelectedImages((prev) => prev.filter((_, i) => i !== index));
|
|
3000
|
-
};
|
|
3001
|
-
const handleThumbsUp = (message) => {
|
|
3002
|
-
if (onThumbsUp) {
|
|
3003
|
-
onThumbsUp(message);
|
|
3004
|
-
}
|
|
3005
|
-
setMessageFeedback((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
3006
|
-
[message.id]: "thumbsUp"
|
|
3007
|
-
}));
|
|
3008
|
-
triggerObservabilityHook("onFeedbackGiven", message.id, "thumbsUp");
|
|
3009
|
-
};
|
|
3010
|
-
const handleThumbsDown = (message) => {
|
|
3011
|
-
if (onThumbsDown) {
|
|
3012
|
-
onThumbsDown(message);
|
|
3013
|
-
}
|
|
3014
|
-
setMessageFeedback((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
3015
|
-
[message.id]: "thumbsDown"
|
|
3016
|
-
}));
|
|
3017
|
-
triggerObservabilityHook("onFeedbackGiven", message.id, "thumbsDown");
|
|
3018
|
-
};
|
|
3019
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
|
|
3020
|
-
chatError && renderError && renderError(__spreadProps(__spreadValues({}, chatError), {
|
|
3021
|
-
onDismiss: () => setChatError(null),
|
|
3022
|
-
onRetry: () => {
|
|
3023
|
-
setChatError(null);
|
|
3024
|
-
}
|
|
3025
|
-
})),
|
|
3026
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3027
|
-
Messages2,
|
|
3028
|
-
{
|
|
3029
|
-
AssistantMessage: AssistantMessage2,
|
|
3030
|
-
UserMessage: UserMessage2,
|
|
3031
|
-
RenderMessage: RenderMessage2,
|
|
3032
|
-
messages,
|
|
3033
|
-
inProgress: isLoading,
|
|
3034
|
-
onRegenerate: handleRegenerate,
|
|
3035
|
-
onCopy: handleCopy,
|
|
3036
|
-
onThumbsUp: handleThumbsUp,
|
|
3037
|
-
onThumbsDown: handleThumbsDown,
|
|
3038
|
-
messageFeedback,
|
|
3039
|
-
markdownTagRenderers,
|
|
3040
|
-
ImageRenderer: ImageRenderer2,
|
|
3041
|
-
ErrorMessage,
|
|
3042
|
-
chatError,
|
|
3043
|
-
RenderTextMessage,
|
|
3044
|
-
RenderActionExecutionMessage,
|
|
3045
|
-
RenderAgentStateMessage,
|
|
3046
|
-
RenderResultMessage,
|
|
3047
|
-
RenderImageMessage,
|
|
3048
|
-
children: currentSuggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3049
|
-
RenderSuggestionsList,
|
|
3050
|
-
{
|
|
3051
|
-
onSuggestionClick: handleSendMessage,
|
|
3052
|
-
suggestions: currentSuggestions,
|
|
3053
|
-
isLoading: isLoadingSuggestions
|
|
3054
|
-
}
|
|
3055
|
-
)
|
|
3056
|
-
}
|
|
3057
|
-
),
|
|
3058
|
-
imageUploadsEnabled && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
3059
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3060
|
-
ImageUploadQueue,
|
|
3061
|
-
{
|
|
3062
|
-
images: selectedImages,
|
|
3063
|
-
onRemoveImage: removeSelectedImage
|
|
3064
|
-
}
|
|
3065
|
-
),
|
|
3066
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3067
|
-
"input",
|
|
3068
|
-
{
|
|
3069
|
-
type: "file",
|
|
3070
|
-
multiple: true,
|
|
3071
|
-
ref: fileInputRef,
|
|
3072
|
-
onChange: handleImageUpload,
|
|
3073
|
-
accept: inputFileAccept,
|
|
3074
|
-
style: { display: "none" }
|
|
3075
|
-
}
|
|
3076
|
-
)
|
|
3077
|
-
] }),
|
|
3078
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3079
|
-
Input2,
|
|
3080
|
-
{
|
|
3081
|
-
inProgress: isLoading,
|
|
3082
|
-
chatReady: Boolean(agent),
|
|
3083
|
-
onSend: handleSendMessage,
|
|
3084
|
-
isVisible,
|
|
3085
|
-
onStop: stopGeneration,
|
|
3086
|
-
onUpload: imageUploadsEnabled ? () => {
|
|
3087
|
-
var _a;
|
|
3088
|
-
return (_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
3089
|
-
} : void 0,
|
|
3090
|
-
hideStopButton
|
|
3091
|
-
}
|
|
3092
|
-
)
|
|
3093
|
-
] });
|
|
3094
|
-
}
|
|
3095
|
-
function WrappedCopilotChat({
|
|
3096
|
-
children,
|
|
3097
|
-
icons,
|
|
3098
|
-
labels,
|
|
3099
|
-
className
|
|
3100
|
-
}) {
|
|
3101
|
-
const chatContext = import_react15.default.useContext(ChatContext);
|
|
3102
|
-
if (!chatContext) {
|
|
3103
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3104
|
-
ChatContextProvider,
|
|
3105
|
-
{
|
|
3106
|
-
icons,
|
|
3107
|
-
labels,
|
|
3108
|
-
open: true,
|
|
3109
|
-
setOpen: () => {
|
|
3110
|
-
},
|
|
3111
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: `copilotKitChat ${className != null ? className : ""}`, children })
|
|
3112
|
-
}
|
|
3113
|
-
);
|
|
3114
|
-
}
|
|
3115
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children });
|
|
3116
|
-
}
|
|
3117
|
-
|
|
3118
|
-
// src/components/chat/Modal.tsx
|
|
3119
|
-
var import_react_core10 = require("@copilotkit/react-core");
|
|
3120
|
-
var import_shared4 = require("@copilotkit/shared");
|
|
3121
|
-
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3122
|
-
var CopilotModalInner = (_a) => {
|
|
3123
|
-
var _b = _a, {
|
|
3124
|
-
observabilityHooks,
|
|
3125
|
-
onSetOpen,
|
|
3126
|
-
clickOutsideToClose,
|
|
3127
|
-
hitEscapeToClose,
|
|
3128
|
-
shortcut,
|
|
3129
|
-
className,
|
|
3130
|
-
children,
|
|
3131
|
-
Window: Window2,
|
|
3132
|
-
Button: Button2,
|
|
3133
|
-
Header: Header2
|
|
3134
|
-
} = _b, chatProps = __objRest(_b, [
|
|
3135
|
-
"observabilityHooks",
|
|
3136
|
-
"onSetOpen",
|
|
3137
|
-
"clickOutsideToClose",
|
|
3138
|
-
"hitEscapeToClose",
|
|
3139
|
-
"shortcut",
|
|
3140
|
-
"className",
|
|
3141
|
-
"children",
|
|
3142
|
-
"Window",
|
|
3143
|
-
"Button",
|
|
3144
|
-
"Header"
|
|
3145
|
-
]);
|
|
3146
|
-
const { copilotApiConfig, setBannerError } = (0, import_react_core10.useCopilotContext)();
|
|
3147
|
-
const { publicApiKey } = copilotApiConfig;
|
|
3148
|
-
const triggerObservabilityHook = (0, import_react16.useCallback)(
|
|
3149
|
-
(hookName, ...args) => {
|
|
3150
|
-
if (publicApiKey && (observabilityHooks == null ? void 0 : observabilityHooks[hookName])) {
|
|
3151
|
-
observabilityHooks[hookName](...args);
|
|
3152
|
-
}
|
|
3153
|
-
if ((observabilityHooks == null ? void 0 : observabilityHooks[hookName]) && !publicApiKey) {
|
|
3154
|
-
setBannerError(
|
|
3155
|
-
new import_shared4.CopilotKitError({
|
|
3156
|
-
message: "observabilityHooks requires a publicApiKey to function.",
|
|
3157
|
-
code: import_shared4.CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR,
|
|
3158
|
-
severity: import_shared4.Severity.CRITICAL,
|
|
3159
|
-
visibility: import_shared4.ErrorVisibility.BANNER
|
|
3160
|
-
})
|
|
3161
|
-
);
|
|
3162
|
-
import_shared4.styledConsole.publicApiKeyRequired("observabilityHooks");
|
|
3163
|
-
}
|
|
3164
|
-
},
|
|
3165
|
-
[publicApiKey, observabilityHooks, setBannerError]
|
|
3166
|
-
);
|
|
3167
|
-
const { open } = useChatContext();
|
|
3168
|
-
const prevOpen = (0, import_react16.useRef)(open);
|
|
3169
|
-
(0, import_react16.useEffect)(() => {
|
|
3170
|
-
if (prevOpen.current !== open) {
|
|
3171
|
-
onSetOpen == null ? void 0 : onSetOpen(open);
|
|
3172
|
-
if (open) {
|
|
3173
|
-
triggerObservabilityHook("onChatExpanded");
|
|
3174
|
-
} else {
|
|
3175
|
-
triggerObservabilityHook("onChatMinimized");
|
|
3176
|
-
}
|
|
3177
|
-
prevOpen.current = open;
|
|
3178
|
-
}
|
|
3179
|
-
}, [open, onSetOpen, triggerObservabilityHook]);
|
|
3180
|
-
const memoizedHeader = (0, import_react16.useMemo)(() => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Header2, {}), [Header2]);
|
|
3181
|
-
const memoizedChildren = (0, import_react16.useMemo)(() => children, [children]);
|
|
3182
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
3183
|
-
memoizedChildren,
|
|
3184
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className, children: [
|
|
3185
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Button2, {}),
|
|
3186
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
3187
|
-
Window2,
|
|
3188
|
-
{
|
|
3189
|
-
clickOutsideToClose,
|
|
3190
|
-
shortcut,
|
|
3191
|
-
hitEscapeToClose,
|
|
3192
|
-
children: [
|
|
3193
|
-
memoizedHeader,
|
|
3194
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CopilotChat, __spreadProps(__spreadValues({}, chatProps), { observabilityHooks }))
|
|
3195
|
-
]
|
|
3196
|
-
}
|
|
3197
|
-
)
|
|
3198
|
-
] })
|
|
3199
|
-
] });
|
|
3200
|
-
};
|
|
3201
|
-
var CopilotModal = (_a) => {
|
|
3202
|
-
var _b = _a, {
|
|
3203
|
-
instructions,
|
|
3204
|
-
defaultOpen = false,
|
|
3205
|
-
clickOutsideToClose = true,
|
|
3206
|
-
hitEscapeToClose = true,
|
|
3207
|
-
onSetOpen,
|
|
3208
|
-
onSubmitMessage,
|
|
3209
|
-
onStopGeneration,
|
|
3210
|
-
onReloadMessages,
|
|
3211
|
-
shortcut = "/",
|
|
3212
|
-
icons,
|
|
3213
|
-
labels,
|
|
3214
|
-
makeSystemMessage,
|
|
3215
|
-
onInProgress,
|
|
3216
|
-
Window: Window2 = Window,
|
|
3217
|
-
Button: Button2 = Button,
|
|
3218
|
-
Header: Header2 = Header,
|
|
3219
|
-
Messages: Messages2 = Messages,
|
|
3220
|
-
Input: Input2 = Input,
|
|
3221
|
-
AssistantMessage: AssistantMessage2 = AssistantMessage,
|
|
3222
|
-
UserMessage: UserMessage2 = UserMessage,
|
|
3223
|
-
onThumbsUp,
|
|
3224
|
-
onThumbsDown,
|
|
3225
|
-
onCopy,
|
|
3226
|
-
onRegenerate,
|
|
3227
|
-
markdownTagRenderers,
|
|
3228
|
-
className,
|
|
3229
|
-
children,
|
|
3230
|
-
observabilityHooks
|
|
3231
|
-
} = _b, props = __objRest(_b, [
|
|
3232
|
-
"instructions",
|
|
3233
|
-
"defaultOpen",
|
|
3234
|
-
"clickOutsideToClose",
|
|
3235
|
-
"hitEscapeToClose",
|
|
3236
|
-
"onSetOpen",
|
|
3237
|
-
"onSubmitMessage",
|
|
3238
|
-
"onStopGeneration",
|
|
3239
|
-
"onReloadMessages",
|
|
3240
|
-
"shortcut",
|
|
3241
|
-
"icons",
|
|
3242
|
-
"labels",
|
|
3243
|
-
"makeSystemMessage",
|
|
3244
|
-
"onInProgress",
|
|
3245
|
-
"Window",
|
|
3246
|
-
"Button",
|
|
3247
|
-
"Header",
|
|
3248
|
-
"Messages",
|
|
3249
|
-
"Input",
|
|
3250
|
-
"AssistantMessage",
|
|
3251
|
-
"UserMessage",
|
|
3252
|
-
"onThumbsUp",
|
|
3253
|
-
"onThumbsDown",
|
|
3254
|
-
"onCopy",
|
|
3255
|
-
"onRegenerate",
|
|
3256
|
-
"markdownTagRenderers",
|
|
3257
|
-
"className",
|
|
3258
|
-
"children",
|
|
3259
|
-
"observabilityHooks"
|
|
3260
|
-
]);
|
|
3261
|
-
const [openState, setOpenState] = import_react16.default.useState(defaultOpen);
|
|
3262
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3263
|
-
ChatContextProvider,
|
|
3264
|
-
{
|
|
3265
|
-
icons,
|
|
3266
|
-
labels,
|
|
3267
|
-
open: openState,
|
|
3268
|
-
setOpen: setOpenState,
|
|
3269
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3270
|
-
CopilotModalInner,
|
|
3271
|
-
__spreadProps(__spreadValues({
|
|
3272
|
-
observabilityHooks,
|
|
3273
|
-
onSetOpen,
|
|
3274
|
-
clickOutsideToClose: clickOutsideToClose != null ? clickOutsideToClose : true,
|
|
3275
|
-
hitEscapeToClose: hitEscapeToClose != null ? hitEscapeToClose : true,
|
|
3276
|
-
shortcut: shortcut != null ? shortcut : "/",
|
|
3277
|
-
className,
|
|
3278
|
-
Window: Window2,
|
|
3279
|
-
Button: Button2,
|
|
3280
|
-
Header: Header2,
|
|
3281
|
-
instructions,
|
|
3282
|
-
onSubmitMessage,
|
|
3283
|
-
onStopGeneration,
|
|
3284
|
-
onReloadMessages,
|
|
3285
|
-
makeSystemMessage,
|
|
3286
|
-
onInProgress,
|
|
3287
|
-
Messages: Messages2,
|
|
3288
|
-
Input: Input2,
|
|
3289
|
-
AssistantMessage: AssistantMessage2,
|
|
3290
|
-
UserMessage: UserMessage2,
|
|
3291
|
-
onThumbsUp,
|
|
3292
|
-
onThumbsDown,
|
|
3293
|
-
onCopy,
|
|
3294
|
-
onRegenerate,
|
|
3295
|
-
markdownTagRenderers
|
|
3296
|
-
}, props), {
|
|
3297
|
-
children
|
|
3298
|
-
})
|
|
3299
|
-
)
|
|
3300
|
-
}
|
|
3301
|
-
);
|
|
3302
|
-
};
|
|
3303
|
-
|
|
3304
|
-
// src/components/chat/Popup.tsx
|
|
3305
|
-
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3306
|
-
function CopilotPopup(props) {
|
|
3307
|
-
props = __spreadProps(__spreadValues({}, props), {
|
|
3308
|
-
className: props.className ? props.className + " copilotKitPopup" : "copilotKitPopup"
|
|
3309
|
-
});
|
|
3310
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CopilotModal, __spreadProps(__spreadValues({}, props), { children: props.children }));
|
|
3311
|
-
}
|
|
3312
|
-
|
|
3313
|
-
// src/components/chat/Sidebar.tsx
|
|
3314
|
-
var import_react17 = require("react");
|
|
3315
|
-
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3316
|
-
function CopilotSidebar(props) {
|
|
3317
|
-
props = __spreadProps(__spreadValues({}, props), {
|
|
3318
|
-
className: props.className ? props.className + " copilotKitSidebar" : "copilotKitSidebar"
|
|
3319
|
-
});
|
|
3320
|
-
const [expandedClassName, setExpandedClassName] = (0, import_react17.useState)(
|
|
3321
|
-
props.defaultOpen ? "sidebarExpanded" : ""
|
|
3322
|
-
);
|
|
3323
|
-
const onSetOpen = (open) => {
|
|
3324
|
-
var _a;
|
|
3325
|
-
(_a = props.onSetOpen) == null ? void 0 : _a.call(props, open);
|
|
3326
|
-
setExpandedClassName(open ? "sidebarExpanded" : "");
|
|
3327
|
-
};
|
|
3328
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: `copilotKitSidebarContentWrapper ${expandedClassName}`, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CopilotModal, __spreadProps(__spreadValues(__spreadValues({}, props), { onSetOpen }), { children: props.children })) });
|
|
3329
|
-
}
|
|
3330
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
3331
|
-
0 && (module.exports = {
|
|
3332
|
-
AssistantMessage,
|
|
3333
|
-
CopilotChat,
|
|
3334
|
-
CopilotDevConsole,
|
|
3335
|
-
CopilotPopup,
|
|
3336
|
-
CopilotSidebar,
|
|
3337
|
-
ImageRenderer,
|
|
3338
|
-
Markdown,
|
|
3339
|
-
RenderSuggestion,
|
|
3340
|
-
RenderSuggestionsList,
|
|
3341
|
-
UserMessage,
|
|
3342
|
-
shouldShowDevConsole,
|
|
3343
|
-
useChatContext
|
|
3344
|
-
});
|
|
3345
|
-
//# sourceMappingURL=index.js.map
|