@copilotkit/react-ui 1.10.6 → 1.50.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-H5Y4W7DM.mjs → chunk-3JYVJHL5.mjs} +6 -6
- package/dist/chunk-3YWFGNSM.mjs +32 -0
- package/dist/chunk-3YWFGNSM.mjs.map +1 -0
- package/dist/{chunk-BAD2NFZ7.mjs → chunk-CQ2WALZ7.mjs} +2 -2
- package/dist/{chunk-W7ONZTSW.mjs → chunk-E6WVAOQA.mjs} +11 -5
- package/dist/chunk-E6WVAOQA.mjs.map +1 -0
- package/dist/{chunk-ME2WM7IP.mjs → chunk-G35HUUDA.mjs} +36 -260
- package/dist/chunk-G35HUUDA.mjs.map +1 -0
- package/dist/{chunk-EZQA3UPQ.mjs → chunk-HBZW7E5Z.mjs} +16 -13
- package/dist/chunk-HBZW7E5Z.mjs.map +1 -0
- package/dist/{chunk-3QYTKBWC.mjs → chunk-IHFR6PYG.mjs} +8 -5
- package/dist/chunk-IHFR6PYG.mjs.map +1 -0
- package/dist/{chunk-5XLGXUQI.mjs → chunk-MPF6BJUF.mjs} +7 -3
- package/dist/chunk-MPF6BJUF.mjs.map +1 -0
- package/dist/{chunk-W26XFBEG.mjs → chunk-NGJ32FAP.mjs} +3 -3
- package/dist/chunk-NGJ32FAP.mjs.map +1 -0
- package/dist/{chunk-2LIO4Z3E.mjs → chunk-ODEHR7KI.mjs} +9 -2
- package/dist/chunk-ODEHR7KI.mjs.map +1 -0
- package/dist/chunk-OYRZ4VLU.mjs +12 -0
- package/dist/chunk-OYRZ4VLU.mjs.map +1 -0
- package/dist/chunk-QB3GUN2N.mjs +31 -0
- package/dist/chunk-QB3GUN2N.mjs.map +1 -0
- package/dist/{chunk-7RDGZ5JL.mjs → chunk-SOB5EIL7.mjs} +2 -2
- package/dist/components/chat/Chat.d.ts +3 -98
- package/dist/components/chat/Chat.js +100 -279
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +12 -14
- package/dist/components/chat/Input.d.ts +1 -1
- package/dist/components/chat/Input.js +11 -8
- package/dist/components/chat/Input.js.map +1 -1
- package/dist/components/chat/Input.mjs +2 -2
- package/dist/components/chat/Messages.d.ts +4 -4
- package/dist/components/chat/Messages.js +44 -8
- package/dist/components/chat/Messages.js.map +1 -1
- package/dist/components/chat/Messages.mjs +5 -5
- package/dist/components/chat/Modal.d.ts +1 -6
- package/dist/components/chat/Modal.js +106 -283
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +11 -11
- package/dist/components/chat/Popup.d.ts +1 -6
- package/dist/components/chat/Popup.js +106 -283
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +12 -12
- package/dist/components/chat/Sidebar.d.ts +1 -6
- package/dist/components/chat/Sidebar.js +106 -283
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +12 -12
- package/dist/components/chat/Suggestion.js.map +1 -1
- package/dist/components/chat/Suggestion.mjs +1 -1
- package/dist/components/chat/Suggestions.d.ts +1 -1
- package/dist/components/chat/Suggestions.js +19 -12
- package/dist/components/chat/Suggestions.js.map +1 -1
- package/dist/components/chat/Suggestions.mjs +2 -2
- package/dist/components/chat/index.d.ts +0 -5
- package/dist/components/chat/index.js +106 -283
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +13 -13
- package/dist/components/chat/messages/AssistantMessage.js +7 -4
- package/dist/components/chat/messages/AssistantMessage.js.map +1 -1
- package/dist/components/chat/messages/AssistantMessage.mjs +1 -1
- package/dist/components/chat/messages/LegacyRenderMessage.js +37 -7
- package/dist/components/chat/messages/LegacyRenderMessage.js.map +1 -1
- package/dist/components/chat/messages/LegacyRenderMessage.mjs +4 -4
- package/dist/components/chat/messages/RenderMessage.js +30 -7
- package/dist/components/chat/messages/RenderMessage.js.map +1 -1
- package/dist/components/chat/messages/RenderMessage.mjs +3 -3
- package/dist/components/chat/messages/UserMessage.js +19 -3
- package/dist/components/chat/messages/UserMessage.js.map +1 -1
- package/dist/components/chat/messages/UserMessage.mjs +1 -1
- package/dist/components/chat/props.d.ts +16 -0
- package/dist/components/chat/props.js.map +1 -1
- package/dist/components/index.d.ts +0 -5
- package/dist/components/index.js +106 -283
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +13 -13
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +2 -24
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/hooks/use-copilot-chat-suggestions.d.ts +4 -26
- package/dist/hooks/use-copilot-chat-suggestions.js +2 -24
- package/dist/hooks/use-copilot-chat-suggestions.js.map +1 -1
- package/dist/hooks/use-copilot-chat-suggestions.mjs +1 -1
- package/dist/index.css +8 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +0 -5
- package/dist/index.js +109 -308
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -14
- package/dist/types/suggestions.d.ts +1 -0
- package/dist/types/suggestions.js.map +1 -1
- package/package.json +23 -22
- package/src/components/chat/Chat.tsx +40 -325
- package/src/components/chat/Input.tsx +13 -12
- package/src/components/chat/Messages.tsx +10 -4
- package/src/components/chat/Suggestion.tsx +2 -2
- package/src/components/chat/Suggestions.tsx +6 -2
- package/src/components/chat/messages/AssistantMessage.tsx +14 -4
- package/src/components/chat/messages/LegacyRenderMessage.tsx +7 -0
- package/src/components/chat/messages/RenderMessage.tsx +4 -0
- package/src/components/chat/messages/UserMessage.tsx +30 -6
- package/src/components/chat/props.ts +19 -0
- package/src/css/messages.css +10 -1
- package/src/hooks/use-copilot-chat-suggestions.tsx +6 -57
- package/src/types/suggestions.ts +1 -0
- package/tsup.config.ts +1 -1
- package/dist/chunk-226ZMOE3.mjs +0 -24
- package/dist/chunk-226ZMOE3.mjs.map +0 -1
- package/dist/chunk-2LIO4Z3E.mjs.map +0 -1
- package/dist/chunk-3QYTKBWC.mjs.map +0 -1
- package/dist/chunk-5XLGXUQI.mjs.map +0 -1
- package/dist/chunk-EYRKZDP5.mjs +0 -32
- package/dist/chunk-EYRKZDP5.mjs.map +0 -1
- package/dist/chunk-EZQA3UPQ.mjs.map +0 -1
- package/dist/chunk-ME2WM7IP.mjs.map +0 -1
- package/dist/chunk-VVL6JFCJ.mjs +0 -16
- package/dist/chunk-VVL6JFCJ.mjs.map +0 -1
- package/dist/chunk-W26XFBEG.mjs.map +0 -1
- package/dist/chunk-W7ONZTSW.mjs.map +0 -1
- /package/dist/{chunk-H5Y4W7DM.mjs.map → chunk-3JYVJHL5.mjs.map} +0 -0
- /package/dist/{chunk-BAD2NFZ7.mjs.map → chunk-CQ2WALZ7.mjs.map} +0 -0
- /package/dist/{chunk-7RDGZ5JL.mjs.map → chunk-SOB5EIL7.mjs.map} +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import "../../chunk-SC6JRFAJ.mjs";
|
|
2
2
|
import {
|
|
3
3
|
CopilotSidebar
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-SOB5EIL7.mjs";
|
|
5
5
|
import "../../chunk-WB3YULQ4.mjs";
|
|
6
6
|
import {
|
|
7
7
|
CopilotPopup
|
|
8
|
-
} from "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
8
|
+
} from "../../chunk-CQ2WALZ7.mjs";
|
|
9
|
+
import "../../chunk-3JYVJHL5.mjs";
|
|
10
10
|
import "../../chunk-C3GSYRC3.mjs";
|
|
11
11
|
import "../../chunk-GDSZGYCE.mjs";
|
|
12
12
|
import "../../chunk-V7W6IM2V.mjs";
|
|
@@ -19,33 +19,32 @@ import "../../chunk-BH6PCAAL.mjs";
|
|
|
19
19
|
import "../../chunk-UFN2VWSR.mjs";
|
|
20
20
|
import {
|
|
21
21
|
CopilotChat
|
|
22
|
-
} from "../../chunk-
|
|
22
|
+
} from "../../chunk-G35HUUDA.mjs";
|
|
23
23
|
import {
|
|
24
24
|
Suggestions
|
|
25
|
-
} from "../../chunk-
|
|
25
|
+
} from "../../chunk-QB3GUN2N.mjs";
|
|
26
26
|
import {
|
|
27
27
|
Suggestion
|
|
28
|
-
} from "../../chunk-
|
|
28
|
+
} from "../../chunk-NGJ32FAP.mjs";
|
|
29
29
|
import "../../chunk-PLHTVHUW.mjs";
|
|
30
|
-
import "../../chunk-
|
|
30
|
+
import "../../chunk-HBZW7E5Z.mjs";
|
|
31
31
|
import "../../chunk-ELGRNEAO.mjs";
|
|
32
32
|
import "../../chunk-QIOJXTIQ.mjs";
|
|
33
|
-
import "../../chunk-
|
|
34
|
-
import "../../chunk-
|
|
35
|
-
import "../../chunk-
|
|
33
|
+
import "../../chunk-E6WVAOQA.mjs";
|
|
34
|
+
import "../../chunk-ODEHR7KI.mjs";
|
|
35
|
+
import "../../chunk-MPF6BJUF.mjs";
|
|
36
36
|
import {
|
|
37
37
|
AssistantMessage
|
|
38
|
-
} from "../../chunk-
|
|
38
|
+
} from "../../chunk-IHFR6PYG.mjs";
|
|
39
39
|
import {
|
|
40
40
|
ImageRenderer
|
|
41
41
|
} from "../../chunk-DBKRAOH7.mjs";
|
|
42
42
|
import {
|
|
43
43
|
UserMessage
|
|
44
|
-
} from "../../chunk-
|
|
44
|
+
} from "../../chunk-3YWFGNSM.mjs";
|
|
45
45
|
import {
|
|
46
46
|
Markdown
|
|
47
47
|
} from "../../chunk-JZ3RFQQ6.mjs";
|
|
48
|
-
import "../../chunk-O72ZB5V3.mjs";
|
|
49
48
|
import {
|
|
50
49
|
useChatContext
|
|
51
50
|
} from "../../chunk-IEMQ2SQW.mjs";
|
|
@@ -53,6 +52,7 @@ import "../../chunk-IK2BPURM.mjs";
|
|
|
53
52
|
import "../../chunk-XWG3L6QC.mjs";
|
|
54
53
|
import "../../chunk-54JAUBUJ.mjs";
|
|
55
54
|
import "../../chunk-JGMFJZMG.mjs";
|
|
55
|
+
import "../../chunk-O72ZB5V3.mjs";
|
|
56
56
|
import "../../chunk-MRXNTQOX.mjs";
|
|
57
57
|
export {
|
|
58
58
|
AssistantMessage,
|
|
@@ -678,6 +678,7 @@ var AssistantMessage = (props) => {
|
|
|
678
678
|
onThumbsUp,
|
|
679
679
|
onThumbsDown,
|
|
680
680
|
isCurrentMessage,
|
|
681
|
+
feedback,
|
|
681
682
|
markdownTagRenderers
|
|
682
683
|
} = props;
|
|
683
684
|
const [copied, setCopied] = (0, import_react4.useState)(false);
|
|
@@ -699,12 +700,14 @@ var AssistantMessage = (props) => {
|
|
|
699
700
|
onRegenerate();
|
|
700
701
|
};
|
|
701
702
|
const handleThumbsUp = () => {
|
|
702
|
-
if (onThumbsUp && message)
|
|
703
|
+
if (onThumbsUp && message) {
|
|
703
704
|
onThumbsUp(message);
|
|
705
|
+
}
|
|
704
706
|
};
|
|
705
707
|
const handleThumbsDown = () => {
|
|
706
|
-
if (onThumbsDown && message)
|
|
708
|
+
if (onThumbsDown && message) {
|
|
707
709
|
onThumbsDown(message);
|
|
710
|
+
}
|
|
708
711
|
};
|
|
709
712
|
const LoadingIcon = () => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: icons.activityIcon });
|
|
710
713
|
const content = (message == null ? void 0 : message.content) || "";
|
|
@@ -740,7 +743,7 @@ var AssistantMessage = (props) => {
|
|
|
740
743
|
onThumbsUp && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
741
744
|
"button",
|
|
742
745
|
{
|
|
743
|
-
className:
|
|
746
|
+
className: `copilotKitMessageControlButton ${feedback === "thumbsUp" ? "active" : ""}`,
|
|
744
747
|
onClick: handleThumbsUp,
|
|
745
748
|
"aria-label": labels.thumbsUp,
|
|
746
749
|
title: labels.thumbsUp,
|
|
@@ -750,7 +753,7 @@ var AssistantMessage = (props) => {
|
|
|
750
753
|
onThumbsDown && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
751
754
|
"button",
|
|
752
755
|
{
|
|
753
|
-
className:
|
|
756
|
+
className: `copilotKitMessageControlButton ${feedback === "thumbsDown" ? "active" : ""}`,
|
|
754
757
|
onClick: handleThumbsDown,
|
|
755
758
|
"aria-label": labels.thumbsDown,
|
|
756
759
|
title: labels.thumbsDown,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/chat/messages/AssistantMessage.tsx","../../../../src/components/chat/ChatContext.tsx","../../../../src/components/chat/Icons.tsx","../../../../src/components/chat/Markdown.tsx","../../../../src/components/chat/CodeBlock.tsx","../../../../src/hooks/use-copy-to-clipboard.tsx"],"sourcesContent":["import { AssistantMessageProps } from \"../props\";\nimport { useChatContext } from \"../ChatContext\";\nimport { Markdown } from \"../Markdown\";\nimport { useState } from \"react\";\n\nexport const AssistantMessage = (props: AssistantMessageProps) => {\n const { icons, labels } = useChatContext();\n const {\n message,\n isLoading,\n onRegenerate,\n onCopy,\n onThumbsUp,\n onThumbsDown,\n isCurrentMessage,\n markdownTagRenderers,\n } = props;\n const [copied, setCopied] = useState(false);\n\n const handleCopy = () => {\n const content = message?.content || \"\";\n if (content && onCopy) {\n navigator.clipboard.writeText(content);\n setCopied(true);\n onCopy(content);\n setTimeout(() => setCopied(false), 2000);\n } else if (content) {\n navigator.clipboard.writeText(content);\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n }\n };\n\n const handleRegenerate = () => {\n if (onRegenerate) onRegenerate();\n };\n\n const handleThumbsUp = () => {\n if (onThumbsUp && message) onThumbsUp(message);\n };\n\n const handleThumbsDown = () => {\n if (onThumbsDown && message) onThumbsDown(message);\n };\n\n const LoadingIcon = () => <span>{icons.activityIcon}</span>;\n const content = message?.content || \"\";\n const subComponent = message?.generativeUI?.();\n\n return (\n <>\n {content && (\n <div className=\"copilotKitMessage copilotKitAssistantMessage\">\n {content && <Markdown content={content} components={markdownTagRenderers} />}\n\n {content && !isLoading && (\n <div\n className={`copilotKitMessageControls ${isCurrentMessage ? \"currentMessage\" : \"\"}`}\n >\n <button\n className=\"copilotKitMessageControlButton\"\n onClick={handleRegenerate}\n aria-label={labels.regenerateResponse}\n title={labels.regenerateResponse}\n >\n {icons.regenerateIcon}\n </button>\n <button\n className=\"copilotKitMessageControlButton\"\n onClick={handleCopy}\n aria-label={labels.copyToClipboard}\n title={labels.copyToClipboard}\n >\n {copied ? (\n <span style={{ fontSize: \"10px\", fontWeight: \"bold\" }}>✓</span>\n ) : (\n icons.copyIcon\n )}\n </button>\n {onThumbsUp && (\n <button\n className=\"copilotKitMessageControlButton\"\n onClick={handleThumbsUp}\n aria-label={labels.thumbsUp}\n title={labels.thumbsUp}\n >\n {icons.thumbsUpIcon}\n </button>\n )}\n {onThumbsDown && (\n <button\n className=\"copilotKitMessageControlButton\"\n onClick={handleThumbsDown}\n aria-label={labels.thumbsDown}\n title={labels.thumbsDown}\n >\n {icons.thumbsDownIcon}\n </button>\n )}\n </div>\n )}\n </div>\n )}\n <div style={{ marginBottom: \"0.5rem\" }}>{subComponent}</div>\n {isLoading && <LoadingIcon />}\n </>\n );\n};\n","import React, { useMemo, useState } from \"react\";\nimport * as DefaultIcons from \"./Icons\";\nimport { ThumbsDownIcon, ThumbsUpIcon } from \"./Icons\";\n\n/**\n * Icons for CopilotChat component.\n */\nexport interface CopilotChatIcons {\n /**\n * The icon to use for the open chat button.\n * @default <OpenIcon />\n */\n openIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button.\n * @default <CloseIcon />\n */\n closeIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button in the header.\n * @default <HeaderCloseIcon />\n */\n headerCloseIcon?: React.ReactNode;\n\n /**\n * The icon to use for the send button.\n * @default <SendIcon />\n */\n sendIcon?: React.ReactNode;\n\n /**\n * The icon to use for the activity indicator.\n * @default <ActivityIcon />\n */\n activityIcon?: React.ReactNode;\n\n /**\n * The icon to use for the spinner.\n * @default <SpinnerIcon />\n */\n spinnerIcon?: React.ReactNode;\n\n /**\n * The icon to use for the stop button.\n * @default <StopIcon />\n */\n stopIcon?: React.ReactNode;\n\n /**\n * The icon to use for the regenerate button.\n * @default <RegenerateIcon />\n */\n regenerateIcon?: React.ReactNode;\n\n /**\n * The icons to use for push to talk.\n * @default <PushToTalkIcon />\n */\n\n pushToTalkIcon?: React.ReactNode;\n\n /**\n * The icons to use for copy assistant response\n * @default <CopyIcon />\n */\n\n copyIcon?: React.ReactNode;\n\n /**\n * The icon to use for thumbs up/response approval.\n * @default <ThumbsUpIcon />\n */\n\n thumbsUpIcon?: React.ReactNode;\n\n /**\n * The icon to use for thumbs down/response rejection.\n * @default <ThumbsDownIcon />\n */\n\n thumbsDownIcon?: React.ReactNode;\n\n /**\n * The icon to use for the upload button.\n * @default <UploadIcon />\n */\n uploadIcon?: React.ReactNode;\n}\n\n/**\n * Labels for CopilotChat component.\n */\nexport interface CopilotChatLabels {\n /**\n * The initial message(s) to display in the chat window.\n */\n initial?: string | string[];\n\n /**\n * The title to display in the header.\n * @default \"CopilotKit\"\n */\n title?: string;\n\n /**\n * The placeholder to display in the input.\n * @default \"Type a message...\"\n */\n placeholder?: string;\n\n /**\n * The message to display when an error occurs.\n * @default \"❌ An error occurred. Please try again.\"\n */\n error?: string;\n\n /**\n * The label to display on the stop button.\n * @default \"Stop generating\"\n */\n stopGenerating?: string;\n\n /**\n * The label to display on the regenerate button.\n * @default \"Regenerate response\"\n */\n regenerateResponse?: string;\n\n /**\n * The label for the copy button.\n * @default \"Copy to clipboard\"\n */\n copyToClipboard?: string;\n\n /**\n * The label for the thumbs up button.\n * @default \"Thumbs up\"\n */\n thumbsUp?: string;\n\n /**\n * The label for the thumbs down button.\n * @default \"Thumbs down\"\n */\n thumbsDown?: string;\n\n /**\n * The text to display when content is copied.\n * @default \"Copied!\"\n */\n copied?: string;\n}\n\ninterface ChatContext {\n labels: Required<CopilotChatLabels>;\n icons: Required<CopilotChatIcons>;\n open: boolean;\n setOpen: (open: boolean) => void;\n}\n\nexport const ChatContext = React.createContext<ChatContext | undefined>(undefined);\n\nexport function useChatContext(): ChatContext {\n const context = React.useContext(ChatContext);\n if (context === undefined) {\n throw new Error(\n \"Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?\",\n );\n }\n return context;\n}\n\ninterface ChatContextProps {\n // temperature?: number;\n // instructions?: string;\n // maxFeedback?: number;\n labels?: CopilotChatLabels;\n icons?: CopilotChatIcons;\n children?: React.ReactNode;\n open: boolean;\n setOpen: (open: boolean) => void;\n}\n\nexport const ChatContextProvider = ({\n // temperature,\n // instructions,\n // maxFeedback,\n labels,\n icons,\n children,\n open,\n setOpen,\n}: ChatContextProps) => {\n const memoizedLabels = useMemo(\n () => ({\n ...{\n initial: \"\",\n title: \"CopilotKit\",\n placeholder: \"Type a message...\",\n error: \"❌ An error occurred. Please try again.\",\n stopGenerating: \"Stop generating\",\n regenerateResponse: \"Regenerate response\",\n copyToClipboard: \"Copy to clipboard\",\n thumbsUp: \"Thumbs up\",\n thumbsDown: \"Thumbs down\",\n copied: \"Copied!\",\n },\n ...labels,\n }),\n [labels],\n );\n\n const memoizedIcons = useMemo(\n () => ({\n ...{\n openIcon: DefaultIcons.OpenIcon,\n closeIcon: DefaultIcons.CloseIcon,\n headerCloseIcon: DefaultIcons.HeaderCloseIcon,\n sendIcon: DefaultIcons.SendIcon,\n activityIcon: DefaultIcons.ActivityIcon,\n spinnerIcon: DefaultIcons.SpinnerIcon,\n stopIcon: DefaultIcons.StopIcon,\n regenerateIcon: DefaultIcons.RegenerateIcon,\n pushToTalkIcon: DefaultIcons.MicrophoneIcon,\n copyIcon: DefaultIcons.CopyIcon,\n thumbsUpIcon: DefaultIcons.ThumbsUpIcon,\n thumbsDownIcon: DefaultIcons.ThumbsDownIcon,\n uploadIcon: DefaultIcons.UploadIcon,\n },\n ...icons,\n }),\n [icons],\n );\n\n const context = useMemo(\n () => ({\n labels: memoizedLabels,\n icons: memoizedIcons,\n open,\n setOpen,\n }),\n [memoizedLabels, memoizedIcons, open, setOpen],\n );\n\n return <ChatContext.Provider value={context}>{children}</ChatContext.Provider>;\n};\n","import React from \"react\";\n\nexport const OpenIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <g transform=\"translate(24, 0) scale(-1, 1)\">\n <path\n fillRule=\"evenodd\"\n 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\"\n clipRule=\"evenodd\"\n />\n </g>\n </svg>\n);\n\nexport const CloseIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M19.5 8.25l-7.5 7.5-7.5-7.5\" />\n </svg>\n);\n\nexport const HeaderCloseIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M6 18L18 6M6 6l12 12\" />\n </svg>\n);\n\nexport const SendIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M12 19V5m0 0l-7 7m7-7l7 7\" />\n </svg>\n);\n\nexport const MicrophoneIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n 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\"\n />\n </svg>\n);\n\nexport const StopIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n 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\"\n />\n </svg>\n);\n\nexport const RegenerateIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n 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\"\n />\n </svg>\n);\n\nexport const CopyIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n 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\"\n />\n </svg>\n);\n\nexport const SmallSpinnerIcon = (\n <span className=\"copilotKitSpinner\" style={{ width: \"13px\", height: \"13px\" }}></span>\n);\n\nexport const SpinnerIcon = (\n <span className=\"copilotKitSpinner\" style={{ width: \"24px\", height: \"24px\" }}></span>\n);\n\nexport const ActivityIcon = (\n <div style={{ display: \"flex\", alignItems: \"center\", gap: \"4px\" }}>\n <span className=\"copilotKitActivityDot\" style={{ animationDelay: \"0s\" }}></span>\n <span className=\"copilotKitActivityDot\" style={{ animationDelay: \"0.2s\" }}></span>\n <span className=\"copilotKitActivityDot\" style={{ animationDelay: \"0.4s\" }}></span>\n </div>\n);\n\nexport const ThumbsUpIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n 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\"\n />\n </svg>\n);\n\nexport const ThumbsDownIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n 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\"\n />\n </svg>\n);\n\nexport const DownloadIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n 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\"\n />\n </svg>\n);\n\nexport const UploadIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M12 4.5v15m7.5-7.5h-15\" />\n </svg>\n);\n\nexport const CheckIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\" />\n </svg>\n);\n","import { FC, memo } from \"react\";\nimport ReactMarkdown, { Options, Components } from \"react-markdown\";\nimport { CodeBlock } from \"./CodeBlock\";\nimport remarkGfm from \"remark-gfm\";\nimport remarkMath from \"remark-math\";\nimport rehypeRaw from \"rehype-raw\";\n\nconst defaultComponents: Components = {\n a({ children, ...props }) {\n return (\n <a className=\"copilotKitMarkdownElement\" {...props} target=\"_blank\" rel=\"noopener noreferrer\">\n {children}\n </a>\n );\n },\n // @ts-expect-error -- inline\n code({ children, className, inline, ...props }) {\n if (Array.isArray(children) && children.length) {\n if (children[0] == \"▍\") {\n return (\n <span\n style={{\n animation: \"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite\",\n marginTop: \"0.25rem\",\n }}\n >\n ▍\n </span>\n );\n }\n\n children[0] = (children?.[0] as string).replace(\"`▍`\", \"▍\");\n }\n\n const match = /language-(\\w+)/.exec(className || \"\");\n\n // Detect inline code: if it has a language class or contains newlines, it's likely a code block\n // Otherwise, treat it as inline code\n const hasLanguage = match && match[1];\n const content = String(children);\n const hasNewlines = content.includes(\"\\n\");\n const isInline = !hasLanguage && !hasNewlines;\n\n if (isInline) {\n return (\n <code\n className={`copilotKitMarkdownElement copilotKitInlineCode ${className || \"\"}`}\n {...props}\n >\n {children}\n </code>\n );\n }\n\n return (\n <CodeBlock\n key={Math.random()}\n language={(match && match[1]) || \"\"}\n value={String(children).replace(/\\n$/, \"\")}\n {...props}\n />\n );\n },\n h1: ({ children, ...props }) => (\n <h1 className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </h1>\n ),\n h2: ({ children, ...props }) => (\n <h2 className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </h2>\n ),\n h3: ({ children, ...props }) => (\n <h3 className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </h3>\n ),\n h4: ({ children, ...props }) => (\n <h4 className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </h4>\n ),\n h5: ({ children, ...props }) => (\n <h5 className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </h5>\n ),\n h6: ({ children, ...props }) => (\n <h6 className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </h6>\n ),\n p: ({ children, ...props }) => (\n <p className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </p>\n ),\n pre: ({ children, ...props }) => (\n <pre className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </pre>\n ),\n blockquote: ({ children, ...props }) => (\n <blockquote className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </blockquote>\n ),\n ul: ({ children, ...props }) => (\n <ul className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </ul>\n ),\n li: ({ children, ...props }) => (\n <li className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </li>\n ),\n};\n\nconst MemoizedReactMarkdown: FC<Options> = memo(\n ReactMarkdown,\n (prevProps, nextProps) =>\n prevProps.children === nextProps.children && prevProps.components === nextProps.components,\n);\n\ntype MarkdownProps = {\n content: string;\n components?: Components;\n};\n\nexport const Markdown = ({ content, components }: MarkdownProps) => {\n return (\n <div className=\"copilotKitMarkdown\">\n <MemoizedReactMarkdown\n components={{ ...defaultComponents, ...components }}\n remarkPlugins={[remarkGfm, [remarkMath, { singleDollarTextMath: false }]]}\n rehypePlugins={[rehypeRaw]}\n >\n {content}\n </MemoizedReactMarkdown>\n </div>\n );\n};\n","import { FC, memo, useEffect, useState } from \"react\";\nimport { Prism, Light } from \"react-syntax-highlighter\";\nimport { useCopyToClipboard } from \"../../hooks/use-copy-to-clipboard\";\nimport { CheckIcon, CopyIcon, DownloadIcon } from \"./Icons\";\n\ninterface CodeActionButtonProps {\n onClick: () => void;\n children: React.ReactNode;\n}\n\ninterface Props {\n language: string;\n value: string;\n}\n\ninterface languageMap {\n [key: string]: string | undefined;\n}\n\nexport const programmingLanguages: languageMap = {\n javascript: \".js\",\n python: \".py\",\n java: \".java\",\n c: \".c\",\n cpp: \".cpp\",\n \"c++\": \".cpp\",\n \"c#\": \".cs\",\n ruby: \".rb\",\n php: \".php\",\n swift: \".swift\",\n \"objective-c\": \".m\",\n kotlin: \".kt\",\n typescript: \".ts\",\n go: \".go\",\n perl: \".pl\",\n rust: \".rs\",\n scala: \".scala\",\n haskell: \".hs\",\n lua: \".lua\",\n shell: \".sh\",\n sql: \".sql\",\n html: \".html\",\n css: \".css\",\n // add more file extensions here, make sure the key is same as language prop in CodeBlock.tsx component\n};\n\nexport const generateRandomString = (length: number, lowercase = false) => {\n const chars = \"ABCDEFGHJKLMNPQRSTUVWXY3456789\"; // excluding similar looking characters like Z, 2, I, 1, O, 0\n let result = \"\";\n for (let i = 0; i < length; i++) {\n result += chars.charAt(Math.floor(Math.random() * chars.length));\n }\n return lowercase ? result.toLowerCase() : result;\n};\n\nconst CodeBlock: FC<Props> = memo(({ language, value }) => {\n const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2000 });\n const [SyntaxHighlighter, setSyntaxHighlighter] = useState<typeof Light | typeof Prism>(\n () => Light,\n );\n\n useEffect(() => {\n try {\n new RegExp(\"(?<=#)\\\\w+\");\n setSyntaxHighlighter(() => Prism);\n } catch {\n setSyntaxHighlighter(() => Light);\n }\n }, []);\n\n const downloadAsFile = () => {\n if (typeof window === \"undefined\") {\n return;\n }\n const fileExtension = programmingLanguages[language] || \".file\";\n const suggestedFileName = `file-${generateRandomString(3, true)}${fileExtension}`;\n const fileName = window.prompt(\"Enter file name\", suggestedFileName);\n\n if (!fileName) {\n // User pressed cancel on prompt.\n return;\n }\n\n const blob = new Blob([value], { type: \"text/plain\" });\n const url = URL.createObjectURL(blob);\n const link = document.createElement(\"a\");\n link.download = fileName;\n link.href = url;\n link.style.display = \"none\";\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n URL.revokeObjectURL(url);\n };\n\n const onCopy = () => {\n if (isCopied) return;\n copyToClipboard(value);\n };\n\n return (\n <div className=\"copilotKitCodeBlock\">\n <div className=\"copilotKitCodeBlockToolbar\">\n <span className=\"copilotKitCodeBlockToolbarLanguage\">{language}</span>\n <div className=\"copilotKitCodeBlockToolbarButtons\">\n <button className=\"copilotKitCodeBlockToolbarButton\" onClick={downloadAsFile}>\n {DownloadIcon}\n </button>\n <button className=\"copilotKitCodeBlockToolbarButton\" onClick={onCopy}>\n {isCopied ? CheckIcon : CopyIcon}\n </button>\n </div>\n </div>\n <SyntaxHighlighter\n language={language}\n style={highlightStyle}\n PreTag=\"div\"\n customStyle={{\n margin: 0,\n borderBottomLeftRadius: \"0.375rem\",\n borderBottomRightRadius: \"0.375rem\",\n }}\n >\n {value}\n </SyntaxHighlighter>\n </div>\n );\n});\nCodeBlock.displayName = \"CodeBlock\";\n\nexport { CodeBlock };\n\n// import { vscDarkPlus as highlightStyle } from \"react-syntax-highlighter/dist/esm/styles/prism\";\n// As a workaround, we inline the vscDarkPlus from react-syntax-highlighter.\n// Importing it as recommended in the documentation leads to build errors in the non app router\n// (Next.js classic) setup.\nconst highlightStyle: any = {\n 'pre[class*=\"language-\"]': {\n color: \"#d4d4d4\",\n fontSize: \"13px\",\n textShadow: \"none\",\n fontFamily: 'Menlo, Monaco, Consolas, \"Andale Mono\", \"Ubuntu Mono\", \"Courier New\", monospace',\n direction: \"ltr\",\n textAlign: \"left\",\n whiteSpace: \"pre\",\n wordSpacing: \"normal\",\n wordBreak: \"normal\",\n lineHeight: \"1.5\",\n MozTabSize: \"4\",\n OTabSize: \"4\",\n tabSize: \"4\",\n WebkitHyphens: \"none\",\n MozHyphens: \"none\",\n msHyphens: \"none\",\n hyphens: \"none\",\n padding: \"1em\",\n margin: \".5em 0\",\n overflow: \"auto\",\n background: \"#1e1e1e\",\n },\n 'code[class*=\"language-\"]': {\n color: \"#d4d4d4\",\n fontSize: \"13px\",\n textShadow: \"none\",\n fontFamily: 'Menlo, Monaco, Consolas, \"Andale Mono\", \"Ubuntu Mono\", \"Courier New\", monospace',\n direction: \"ltr\",\n textAlign: \"left\",\n whiteSpace: \"pre\",\n wordSpacing: \"normal\",\n wordBreak: \"normal\",\n lineHeight: \"1.5\",\n MozTabSize: \"4\",\n OTabSize: \"4\",\n tabSize: \"4\",\n WebkitHyphens: \"none\",\n MozHyphens: \"none\",\n msHyphens: \"none\",\n hyphens: \"none\",\n },\n 'pre[class*=\"language-\"]::selection': {\n textShadow: \"none\",\n background: \"#264F78\",\n },\n 'code[class*=\"language-\"]::selection': {\n textShadow: \"none\",\n background: \"#264F78\",\n },\n 'pre[class*=\"language-\"] *::selection': {\n textShadow: \"none\",\n background: \"#264F78\",\n },\n 'code[class*=\"language-\"] *::selection': {\n textShadow: \"none\",\n background: \"#264F78\",\n },\n ':not(pre) > code[class*=\"language-\"]': {\n padding: \".1em .3em\",\n borderRadius: \".3em\",\n color: \"#db4c69\",\n background: \"#1e1e1e\",\n },\n \".namespace\": {\n Opacity: \".7\",\n },\n \"doctype.doctype-tag\": {\n color: \"#569CD6\",\n },\n \"doctype.name\": {\n color: \"#9cdcfe\",\n },\n comment: {\n color: \"#6a9955\",\n },\n prolog: {\n color: \"#6a9955\",\n },\n punctuation: {\n color: \"#d4d4d4\",\n },\n \".language-html .language-css .token.punctuation\": {\n color: \"#d4d4d4\",\n },\n \".language-html .language-javascript .token.punctuation\": {\n color: \"#d4d4d4\",\n },\n property: {\n color: \"#9cdcfe\",\n },\n tag: {\n color: \"#569cd6\",\n },\n boolean: {\n color: \"#569cd6\",\n },\n number: {\n color: \"#b5cea8\",\n },\n constant: {\n color: \"#9cdcfe\",\n },\n symbol: {\n color: \"#b5cea8\",\n },\n inserted: {\n color: \"#b5cea8\",\n },\n unit: {\n color: \"#b5cea8\",\n },\n selector: {\n color: \"#d7ba7d\",\n },\n \"attr-name\": {\n color: \"#9cdcfe\",\n },\n string: {\n color: \"#ce9178\",\n },\n char: {\n color: \"#ce9178\",\n },\n builtin: {\n color: \"#ce9178\",\n },\n deleted: {\n color: \"#ce9178\",\n },\n \".language-css .token.string.url\": {\n textDecoration: \"underline\",\n },\n operator: {\n color: \"#d4d4d4\",\n },\n entity: {\n color: \"#569cd6\",\n },\n \"operator.arrow\": {\n color: \"#569CD6\",\n },\n atrule: {\n color: \"#ce9178\",\n },\n \"atrule.rule\": {\n color: \"#c586c0\",\n },\n \"atrule.url\": {\n color: \"#9cdcfe\",\n },\n \"atrule.url.function\": {\n color: \"#dcdcaa\",\n },\n \"atrule.url.punctuation\": {\n color: \"#d4d4d4\",\n },\n keyword: {\n color: \"#569CD6\",\n },\n \"keyword.module\": {\n color: \"#c586c0\",\n },\n \"keyword.control-flow\": {\n color: \"#c586c0\",\n },\n function: {\n color: \"#dcdcaa\",\n },\n \"function.maybe-class-name\": {\n color: \"#dcdcaa\",\n },\n regex: {\n color: \"#d16969\",\n },\n important: {\n color: \"#569cd6\",\n },\n italic: {\n fontStyle: \"italic\",\n },\n \"class-name\": {\n color: \"#4ec9b0\",\n },\n \"maybe-class-name\": {\n color: \"#4ec9b0\",\n },\n console: {\n color: \"#9cdcfe\",\n },\n parameter: {\n color: \"#9cdcfe\",\n },\n interpolation: {\n color: \"#9cdcfe\",\n },\n \"punctuation.interpolation-punctuation\": {\n color: \"#569cd6\",\n },\n variable: {\n color: \"#9cdcfe\",\n },\n \"imports.maybe-class-name\": {\n color: \"#9cdcfe\",\n },\n \"exports.maybe-class-name\": {\n color: \"#9cdcfe\",\n },\n escape: {\n color: \"#d7ba7d\",\n },\n \"tag.punctuation\": {\n color: \"#808080\",\n },\n cdata: {\n color: \"#808080\",\n },\n \"attr-value\": {\n color: \"#ce9178\",\n },\n \"attr-value.punctuation\": {\n color: \"#ce9178\",\n },\n \"attr-value.punctuation.attr-equals\": {\n color: \"#d4d4d4\",\n },\n namespace: {\n color: \"#4ec9b0\",\n },\n 'pre[class*=\"language-javascript\"]': {\n color: \"#9cdcfe\",\n },\n 'code[class*=\"language-javascript\"]': {\n color: \"#9cdcfe\",\n },\n 'pre[class*=\"language-jsx\"]': {\n color: \"#9cdcfe\",\n },\n 'code[class*=\"language-jsx\"]': {\n color: \"#9cdcfe\",\n },\n 'pre[class*=\"language-typescript\"]': {\n color: \"#9cdcfe\",\n },\n 'code[class*=\"language-typescript\"]': {\n color: \"#9cdcfe\",\n },\n 'pre[class*=\"language-tsx\"]': {\n color: \"#9cdcfe\",\n },\n 'code[class*=\"language-tsx\"]': {\n color: \"#9cdcfe\",\n },\n 'pre[class*=\"language-css\"]': {\n color: \"#ce9178\",\n },\n 'code[class*=\"language-css\"]': {\n color: \"#ce9178\",\n },\n 'pre[class*=\"language-html\"]': {\n color: \"#d4d4d4\",\n },\n 'code[class*=\"language-html\"]': {\n color: \"#d4d4d4\",\n },\n \".language-regex .token.anchor\": {\n color: \"#dcdcaa\",\n },\n \".language-html .token.punctuation\": {\n color: \"#808080\",\n },\n 'pre[class*=\"language-\"] > code[class*=\"language-\"]': {\n position: \"relative\",\n zIndex: \"1\",\n },\n \".line-highlight.line-highlight\": {\n background: \"#f7ebc6\",\n boxShadow: \"inset 5px 0 0 #f7d87c\",\n zIndex: \"0\",\n },\n};\n","import * as React from \"react\";\n\nexport interface useCopyToClipboardProps {\n timeout?: number;\n}\n\nexport function useCopyToClipboard({ timeout = 2000 }: useCopyToClipboardProps) {\n const [isCopied, setIsCopied] = React.useState<Boolean>(false);\n\n const copyToClipboard = (value: string) => {\n if (typeof window === \"undefined\" || !navigator.clipboard?.writeText) {\n return;\n }\n\n if (!value) {\n return;\n }\n\n navigator.clipboard.writeText(value).then(() => {\n setIsCopied(true);\n\n setTimeout(() => {\n setIsCopied(false);\n }, timeout);\n });\n };\n\n return { isCopied, copyToClipboard };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAyC;;;ACWnC;AA0GC,IAAM,WACX;AAAA,EAAC;AAAA;AAAA,IACC,OAAM;AAAA,IACN,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,aAAY;AAAA,IACZ,QAAO;AAAA,IACP,OAAM;AAAA,IACN,QAAO;AAAA,IACP,OAAO,EAAE,UAAU,QAAQ,WAAW,OAAO;AAAA,IAE7C;AAAA,MAAC;AAAA;AAAA,QACC,eAAc;AAAA,QACd,gBAAe;AAAA,QACf,GAAE;AAAA;AAAA,IACJ;AAAA;AACF;AAyDK,IAAM,eACX;AAAA,EAAC;AAAA;AAAA,IACC,OAAM;AAAA,IACN,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,aAAY;AAAA,IACZ,QAAO;AAAA,IACP,OAAM;AAAA,IACN,QAAO;AAAA,IACP,OAAO,EAAE,UAAU,QAAQ,WAAW,OAAO;AAAA,IAE7C;AAAA,MAAC;AAAA;AAAA,QACC,eAAc;AAAA,QACd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B,OAAO,OAAO;AAAA,gBAEb,gBAAM;AAAA;AAAA,YACT;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACC,WAAU;AAAA,gBACV,SAAS;AAAA,gBACT,cAAY,OAAO;AAAA,gBACnB,OAAO,OAAO;AAAA,gBAEb,mBACC,6CAAC,UAAK,OAAO,EAAE,UAAU,QAAQ,YAAY,OAAO,GAAG,oBAAC,IAExD,MAAM;AAAA;AAAA,YAEV;AAAA,YACC,cACC;AAAA,cAAC;AAAA;AAAA,gBACC,WAAU;AAAA,gBACV,SAAS;AAAA,gBACT,cAAY,OAAO;AAAA,gBACnB,OAAO,OAAO;AAAA,gBAEb,gBAAM;AAAA;AAAA,YACT;AAAA,YAED,gBACC;AAAA,cAAC;AAAA;AAAA,gBACC,WAAU;AAAA,gBACV,SAAS;AAAA,gBACT,cAAY,OAAO;AAAA,gBACnB,OAAO,OAAO;AAAA,gBAEb,gBAAM;AAAA;AAAA,YACT;AAAA;AAAA;AAAA,MAEJ;AAAA,OAEJ;AAAA,IAEF,6CAAC,SAAI,OAAO,EAAE,cAAc,SAAS,GAAI,wBAAa;AAAA,IACrD,aAAa,6CAAC,eAAY;AAAA,KAC7B;AAEJ;","names":["import_jsx_runtime","React","import_react","import_react","React","import_jsx_runtime","import_jsx_runtime","ReactMarkdown","remarkGfm","remarkMath","rehypeRaw","import_react","import_jsx_runtime","content"]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/chat/messages/AssistantMessage.tsx","../../../../src/components/chat/ChatContext.tsx","../../../../src/components/chat/Icons.tsx","../../../../src/components/chat/Markdown.tsx","../../../../src/components/chat/CodeBlock.tsx","../../../../src/hooks/use-copy-to-clipboard.tsx"],"sourcesContent":["import { AssistantMessageProps } from \"../props\";\nimport { useChatContext } from \"../ChatContext\";\nimport { Markdown } from \"../Markdown\";\nimport { useState } from \"react\";\nimport React from \"react\";\n\nexport const AssistantMessage = (props: AssistantMessageProps) => {\n const { icons, labels } = useChatContext();\n const {\n message,\n isLoading,\n onRegenerate,\n onCopy,\n onThumbsUp,\n onThumbsDown,\n isCurrentMessage,\n feedback,\n markdownTagRenderers,\n } = props;\n const [copied, setCopied] = useState(false);\n\n const handleCopy = () => {\n const content = message?.content || \"\";\n if (content && onCopy) {\n navigator.clipboard.writeText(content);\n setCopied(true);\n onCopy(content);\n setTimeout(() => setCopied(false), 2000);\n } else if (content) {\n navigator.clipboard.writeText(content);\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n }\n };\n\n const handleRegenerate = () => {\n if (onRegenerate) onRegenerate();\n };\n\n const handleThumbsUp = () => {\n if (onThumbsUp && message) {\n onThumbsUp(message);\n }\n };\n\n const handleThumbsDown = () => {\n if (onThumbsDown && message) {\n onThumbsDown(message);\n }\n };\n\n const LoadingIcon = () => <span>{icons.activityIcon}</span>;\n const content = message?.content || \"\";\n const subComponent = message?.generativeUI?.();\n\n return (\n <>\n {content && (\n <div className=\"copilotKitMessage copilotKitAssistantMessage\">\n {content && <Markdown content={content} components={markdownTagRenderers} />}\n\n {content && !isLoading && (\n <div\n className={`copilotKitMessageControls ${isCurrentMessage ? \"currentMessage\" : \"\"}`}\n >\n <button\n className=\"copilotKitMessageControlButton\"\n onClick={handleRegenerate}\n aria-label={labels.regenerateResponse}\n title={labels.regenerateResponse}\n >\n {icons.regenerateIcon}\n </button>\n <button\n className=\"copilotKitMessageControlButton\"\n onClick={handleCopy}\n aria-label={labels.copyToClipboard}\n title={labels.copyToClipboard}\n >\n {copied ? (\n <span style={{ fontSize: \"10px\", fontWeight: \"bold\" }}>✓</span>\n ) : (\n icons.copyIcon\n )}\n </button>\n {onThumbsUp && (\n <button\n className={`copilotKitMessageControlButton ${\n feedback === \"thumbsUp\" ? \"active\" : \"\"\n }`}\n onClick={handleThumbsUp}\n aria-label={labels.thumbsUp}\n title={labels.thumbsUp}\n >\n {icons.thumbsUpIcon}\n </button>\n )}\n {onThumbsDown && (\n <button\n className={`copilotKitMessageControlButton ${\n feedback === \"thumbsDown\" ? \"active\" : \"\"\n }`}\n onClick={handleThumbsDown}\n aria-label={labels.thumbsDown}\n title={labels.thumbsDown}\n >\n {icons.thumbsDownIcon}\n </button>\n )}\n </div>\n )}\n </div>\n )}\n <div style={{ marginBottom: \"0.5rem\" }}>{subComponent}</div>\n {isLoading && <LoadingIcon />}\n </>\n );\n};\n","import React, { useMemo, useState } from \"react\";\nimport * as DefaultIcons from \"./Icons\";\nimport { ThumbsDownIcon, ThumbsUpIcon } from \"./Icons\";\n\n/**\n * Icons for CopilotChat component.\n */\nexport interface CopilotChatIcons {\n /**\n * The icon to use for the open chat button.\n * @default <OpenIcon />\n */\n openIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button.\n * @default <CloseIcon />\n */\n closeIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button in the header.\n * @default <HeaderCloseIcon />\n */\n headerCloseIcon?: React.ReactNode;\n\n /**\n * The icon to use for the send button.\n * @default <SendIcon />\n */\n sendIcon?: React.ReactNode;\n\n /**\n * The icon to use for the activity indicator.\n * @default <ActivityIcon />\n */\n activityIcon?: React.ReactNode;\n\n /**\n * The icon to use for the spinner.\n * @default <SpinnerIcon />\n */\n spinnerIcon?: React.ReactNode;\n\n /**\n * The icon to use for the stop button.\n * @default <StopIcon />\n */\n stopIcon?: React.ReactNode;\n\n /**\n * The icon to use for the regenerate button.\n * @default <RegenerateIcon />\n */\n regenerateIcon?: React.ReactNode;\n\n /**\n * The icons to use for push to talk.\n * @default <PushToTalkIcon />\n */\n\n pushToTalkIcon?: React.ReactNode;\n\n /**\n * The icons to use for copy assistant response\n * @default <CopyIcon />\n */\n\n copyIcon?: React.ReactNode;\n\n /**\n * The icon to use for thumbs up/response approval.\n * @default <ThumbsUpIcon />\n */\n\n thumbsUpIcon?: React.ReactNode;\n\n /**\n * The icon to use for thumbs down/response rejection.\n * @default <ThumbsDownIcon />\n */\n\n thumbsDownIcon?: React.ReactNode;\n\n /**\n * The icon to use for the upload button.\n * @default <UploadIcon />\n */\n uploadIcon?: React.ReactNode;\n}\n\n/**\n * Labels for CopilotChat component.\n */\nexport interface CopilotChatLabels {\n /**\n * The initial message(s) to display in the chat window.\n */\n initial?: string | string[];\n\n /**\n * The title to display in the header.\n * @default \"CopilotKit\"\n */\n title?: string;\n\n /**\n * The placeholder to display in the input.\n * @default \"Type a message...\"\n */\n placeholder?: string;\n\n /**\n * The message to display when an error occurs.\n * @default \"❌ An error occurred. Please try again.\"\n */\n error?: string;\n\n /**\n * The label to display on the stop button.\n * @default \"Stop generating\"\n */\n stopGenerating?: string;\n\n /**\n * The label to display on the regenerate button.\n * @default \"Regenerate response\"\n */\n regenerateResponse?: string;\n\n /**\n * The label for the copy button.\n * @default \"Copy to clipboard\"\n */\n copyToClipboard?: string;\n\n /**\n * The label for the thumbs up button.\n * @default \"Thumbs up\"\n */\n thumbsUp?: string;\n\n /**\n * The label for the thumbs down button.\n * @default \"Thumbs down\"\n */\n thumbsDown?: string;\n\n /**\n * The text to display when content is copied.\n * @default \"Copied!\"\n */\n copied?: string;\n}\n\ninterface ChatContext {\n labels: Required<CopilotChatLabels>;\n icons: Required<CopilotChatIcons>;\n open: boolean;\n setOpen: (open: boolean) => void;\n}\n\nexport const ChatContext = React.createContext<ChatContext | undefined>(undefined);\n\nexport function useChatContext(): ChatContext {\n const context = React.useContext(ChatContext);\n if (context === undefined) {\n throw new Error(\n \"Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?\",\n );\n }\n return context;\n}\n\ninterface ChatContextProps {\n // temperature?: number;\n // instructions?: string;\n // maxFeedback?: number;\n labels?: CopilotChatLabels;\n icons?: CopilotChatIcons;\n children?: React.ReactNode;\n open: boolean;\n setOpen: (open: boolean) => void;\n}\n\nexport const ChatContextProvider = ({\n // temperature,\n // instructions,\n // maxFeedback,\n labels,\n icons,\n children,\n open,\n setOpen,\n}: ChatContextProps) => {\n const memoizedLabels = useMemo(\n () => ({\n ...{\n initial: \"\",\n title: \"CopilotKit\",\n placeholder: \"Type a message...\",\n error: \"❌ An error occurred. Please try again.\",\n stopGenerating: \"Stop generating\",\n regenerateResponse: \"Regenerate response\",\n copyToClipboard: \"Copy to clipboard\",\n thumbsUp: \"Thumbs up\",\n thumbsDown: \"Thumbs down\",\n copied: \"Copied!\",\n },\n ...labels,\n }),\n [labels],\n );\n\n const memoizedIcons = useMemo(\n () => ({\n ...{\n openIcon: DefaultIcons.OpenIcon,\n closeIcon: DefaultIcons.CloseIcon,\n headerCloseIcon: DefaultIcons.HeaderCloseIcon,\n sendIcon: DefaultIcons.SendIcon,\n activityIcon: DefaultIcons.ActivityIcon,\n spinnerIcon: DefaultIcons.SpinnerIcon,\n stopIcon: DefaultIcons.StopIcon,\n regenerateIcon: DefaultIcons.RegenerateIcon,\n pushToTalkIcon: DefaultIcons.MicrophoneIcon,\n copyIcon: DefaultIcons.CopyIcon,\n thumbsUpIcon: DefaultIcons.ThumbsUpIcon,\n thumbsDownIcon: DefaultIcons.ThumbsDownIcon,\n uploadIcon: DefaultIcons.UploadIcon,\n },\n ...icons,\n }),\n [icons],\n );\n\n const context = useMemo(\n () => ({\n labels: memoizedLabels,\n icons: memoizedIcons,\n open,\n setOpen,\n }),\n [memoizedLabels, memoizedIcons, open, setOpen],\n );\n\n return <ChatContext.Provider value={context}>{children}</ChatContext.Provider>;\n};\n","import React from \"react\";\n\nexport const OpenIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <g transform=\"translate(24, 0) scale(-1, 1)\">\n <path\n fillRule=\"evenodd\"\n 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\"\n clipRule=\"evenodd\"\n />\n </g>\n </svg>\n);\n\nexport const CloseIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M19.5 8.25l-7.5 7.5-7.5-7.5\" />\n </svg>\n);\n\nexport const HeaderCloseIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M6 18L18 6M6 6l12 12\" />\n </svg>\n);\n\nexport const SendIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M12 19V5m0 0l-7 7m7-7l7 7\" />\n </svg>\n);\n\nexport const MicrophoneIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n 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\"\n />\n </svg>\n);\n\nexport const StopIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n 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\"\n />\n </svg>\n);\n\nexport const RegenerateIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n 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\"\n />\n </svg>\n);\n\nexport const CopyIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n 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\"\n />\n </svg>\n);\n\nexport const SmallSpinnerIcon = (\n <span className=\"copilotKitSpinner\" style={{ width: \"13px\", height: \"13px\" }}></span>\n);\n\nexport const SpinnerIcon = (\n <span className=\"copilotKitSpinner\" style={{ width: \"24px\", height: \"24px\" }}></span>\n);\n\nexport const ActivityIcon = (\n <div style={{ display: \"flex\", alignItems: \"center\", gap: \"4px\" }}>\n <span className=\"copilotKitActivityDot\" style={{ animationDelay: \"0s\" }}></span>\n <span className=\"copilotKitActivityDot\" style={{ animationDelay: \"0.2s\" }}></span>\n <span className=\"copilotKitActivityDot\" style={{ animationDelay: \"0.4s\" }}></span>\n </div>\n);\n\nexport const ThumbsUpIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n 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\"\n />\n </svg>\n);\n\nexport const ThumbsDownIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n 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\"\n />\n </svg>\n);\n\nexport const DownloadIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n 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\"\n />\n </svg>\n);\n\nexport const UploadIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M12 4.5v15m7.5-7.5h-15\" />\n </svg>\n);\n\nexport const CheckIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n style={{ minWidth: \"16px\", minHeight: \"16px\" }}\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\" />\n </svg>\n);\n","import { FC, memo } from \"react\";\nimport ReactMarkdown, { Options, Components } from \"react-markdown\";\nimport { CodeBlock } from \"./CodeBlock\";\nimport remarkGfm from \"remark-gfm\";\nimport remarkMath from \"remark-math\";\nimport rehypeRaw from \"rehype-raw\";\n\nconst defaultComponents: Components = {\n a({ children, ...props }) {\n return (\n <a className=\"copilotKitMarkdownElement\" {...props} target=\"_blank\" rel=\"noopener noreferrer\">\n {children}\n </a>\n );\n },\n // @ts-expect-error -- inline\n code({ children, className, inline, ...props }) {\n if (Array.isArray(children) && children.length) {\n if (children[0] == \"▍\") {\n return (\n <span\n style={{\n animation: \"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite\",\n marginTop: \"0.25rem\",\n }}\n >\n ▍\n </span>\n );\n }\n\n children[0] = (children?.[0] as string).replace(\"`▍`\", \"▍\");\n }\n\n const match = /language-(\\w+)/.exec(className || \"\");\n\n // Detect inline code: if it has a language class or contains newlines, it's likely a code block\n // Otherwise, treat it as inline code\n const hasLanguage = match && match[1];\n const content = String(children);\n const hasNewlines = content.includes(\"\\n\");\n const isInline = !hasLanguage && !hasNewlines;\n\n if (isInline) {\n return (\n <code\n className={`copilotKitMarkdownElement copilotKitInlineCode ${className || \"\"}`}\n {...props}\n >\n {children}\n </code>\n );\n }\n\n return (\n <CodeBlock\n key={Math.random()}\n language={(match && match[1]) || \"\"}\n value={String(children).replace(/\\n$/, \"\")}\n {...props}\n />\n );\n },\n h1: ({ children, ...props }) => (\n <h1 className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </h1>\n ),\n h2: ({ children, ...props }) => (\n <h2 className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </h2>\n ),\n h3: ({ children, ...props }) => (\n <h3 className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </h3>\n ),\n h4: ({ children, ...props }) => (\n <h4 className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </h4>\n ),\n h5: ({ children, ...props }) => (\n <h5 className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </h5>\n ),\n h6: ({ children, ...props }) => (\n <h6 className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </h6>\n ),\n p: ({ children, ...props }) => (\n <p className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </p>\n ),\n pre: ({ children, ...props }) => (\n <pre className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </pre>\n ),\n blockquote: ({ children, ...props }) => (\n <blockquote className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </blockquote>\n ),\n ul: ({ children, ...props }) => (\n <ul className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </ul>\n ),\n li: ({ children, ...props }) => (\n <li className=\"copilotKitMarkdownElement\" {...props}>\n {children}\n </li>\n ),\n};\n\nconst MemoizedReactMarkdown: FC<Options> = memo(\n ReactMarkdown,\n (prevProps, nextProps) =>\n prevProps.children === nextProps.children && prevProps.components === nextProps.components,\n);\n\ntype MarkdownProps = {\n content: string;\n components?: Components;\n};\n\nexport const Markdown = ({ content, components }: MarkdownProps) => {\n return (\n <div className=\"copilotKitMarkdown\">\n <MemoizedReactMarkdown\n components={{ ...defaultComponents, ...components }}\n remarkPlugins={[remarkGfm, [remarkMath, { singleDollarTextMath: false }]]}\n rehypePlugins={[rehypeRaw]}\n >\n {content}\n </MemoizedReactMarkdown>\n </div>\n );\n};\n","import { FC, memo, useEffect, useState } from \"react\";\nimport { Prism, Light } from \"react-syntax-highlighter\";\nimport { useCopyToClipboard } from \"../../hooks/use-copy-to-clipboard\";\nimport { CheckIcon, CopyIcon, DownloadIcon } from \"./Icons\";\n\ninterface CodeActionButtonProps {\n onClick: () => void;\n children: React.ReactNode;\n}\n\ninterface Props {\n language: string;\n value: string;\n}\n\ninterface languageMap {\n [key: string]: string | undefined;\n}\n\nexport const programmingLanguages: languageMap = {\n javascript: \".js\",\n python: \".py\",\n java: \".java\",\n c: \".c\",\n cpp: \".cpp\",\n \"c++\": \".cpp\",\n \"c#\": \".cs\",\n ruby: \".rb\",\n php: \".php\",\n swift: \".swift\",\n \"objective-c\": \".m\",\n kotlin: \".kt\",\n typescript: \".ts\",\n go: \".go\",\n perl: \".pl\",\n rust: \".rs\",\n scala: \".scala\",\n haskell: \".hs\",\n lua: \".lua\",\n shell: \".sh\",\n sql: \".sql\",\n html: \".html\",\n css: \".css\",\n // add more file extensions here, make sure the key is same as language prop in CodeBlock.tsx component\n};\n\nexport const generateRandomString = (length: number, lowercase = false) => {\n const chars = \"ABCDEFGHJKLMNPQRSTUVWXY3456789\"; // excluding similar looking characters like Z, 2, I, 1, O, 0\n let result = \"\";\n for (let i = 0; i < length; i++) {\n result += chars.charAt(Math.floor(Math.random() * chars.length));\n }\n return lowercase ? result.toLowerCase() : result;\n};\n\nconst CodeBlock: FC<Props> = memo(({ language, value }) => {\n const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2000 });\n const [SyntaxHighlighter, setSyntaxHighlighter] = useState<typeof Light | typeof Prism>(\n () => Light,\n );\n\n useEffect(() => {\n try {\n new RegExp(\"(?<=#)\\\\w+\");\n setSyntaxHighlighter(() => Prism);\n } catch {\n setSyntaxHighlighter(() => Light);\n }\n }, []);\n\n const downloadAsFile = () => {\n if (typeof window === \"undefined\") {\n return;\n }\n const fileExtension = programmingLanguages[language] || \".file\";\n const suggestedFileName = `file-${generateRandomString(3, true)}${fileExtension}`;\n const fileName = window.prompt(\"Enter file name\", suggestedFileName);\n\n if (!fileName) {\n // User pressed cancel on prompt.\n return;\n }\n\n const blob = new Blob([value], { type: \"text/plain\" });\n const url = URL.createObjectURL(blob);\n const link = document.createElement(\"a\");\n link.download = fileName;\n link.href = url;\n link.style.display = \"none\";\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n URL.revokeObjectURL(url);\n };\n\n const onCopy = () => {\n if (isCopied) return;\n copyToClipboard(value);\n };\n\n return (\n <div className=\"copilotKitCodeBlock\">\n <div className=\"copilotKitCodeBlockToolbar\">\n <span className=\"copilotKitCodeBlockToolbarLanguage\">{language}</span>\n <div className=\"copilotKitCodeBlockToolbarButtons\">\n <button className=\"copilotKitCodeBlockToolbarButton\" onClick={downloadAsFile}>\n {DownloadIcon}\n </button>\n <button className=\"copilotKitCodeBlockToolbarButton\" onClick={onCopy}>\n {isCopied ? CheckIcon : CopyIcon}\n </button>\n </div>\n </div>\n <SyntaxHighlighter\n language={language}\n style={highlightStyle}\n PreTag=\"div\"\n customStyle={{\n margin: 0,\n borderBottomLeftRadius: \"0.375rem\",\n borderBottomRightRadius: \"0.375rem\",\n }}\n >\n {value}\n </SyntaxHighlighter>\n </div>\n );\n});\nCodeBlock.displayName = \"CodeBlock\";\n\nexport { CodeBlock };\n\n// import { vscDarkPlus as highlightStyle } from \"react-syntax-highlighter/dist/esm/styles/prism\";\n// As a workaround, we inline the vscDarkPlus from react-syntax-highlighter.\n// Importing it as recommended in the documentation leads to build errors in the non app router\n// (Next.js classic) setup.\nconst highlightStyle: any = {\n 'pre[class*=\"language-\"]': {\n color: \"#d4d4d4\",\n fontSize: \"13px\",\n textShadow: \"none\",\n fontFamily: 'Menlo, Monaco, Consolas, \"Andale Mono\", \"Ubuntu Mono\", \"Courier New\", monospace',\n direction: \"ltr\",\n textAlign: \"left\",\n whiteSpace: \"pre\",\n wordSpacing: \"normal\",\n wordBreak: \"normal\",\n lineHeight: \"1.5\",\n MozTabSize: \"4\",\n OTabSize: \"4\",\n tabSize: \"4\",\n WebkitHyphens: \"none\",\n MozHyphens: \"none\",\n msHyphens: \"none\",\n hyphens: \"none\",\n padding: \"1em\",\n margin: \".5em 0\",\n overflow: \"auto\",\n background: \"#1e1e1e\",\n },\n 'code[class*=\"language-\"]': {\n color: \"#d4d4d4\",\n fontSize: \"13px\",\n textShadow: \"none\",\n fontFamily: 'Menlo, Monaco, Consolas, \"Andale Mono\", \"Ubuntu Mono\", \"Courier New\", monospace',\n direction: \"ltr\",\n textAlign: \"left\",\n whiteSpace: \"pre\",\n wordSpacing: \"normal\",\n wordBreak: \"normal\",\n lineHeight: \"1.5\",\n MozTabSize: \"4\",\n OTabSize: \"4\",\n tabSize: \"4\",\n WebkitHyphens: \"none\",\n MozHyphens: \"none\",\n msHyphens: \"none\",\n hyphens: \"none\",\n },\n 'pre[class*=\"language-\"]::selection': {\n textShadow: \"none\",\n background: \"#264F78\",\n },\n 'code[class*=\"language-\"]::selection': {\n textShadow: \"none\",\n background: \"#264F78\",\n },\n 'pre[class*=\"language-\"] *::selection': {\n textShadow: \"none\",\n background: \"#264F78\",\n },\n 'code[class*=\"language-\"] *::selection': {\n textShadow: \"none\",\n background: \"#264F78\",\n },\n ':not(pre) > code[class*=\"language-\"]': {\n padding: \".1em .3em\",\n borderRadius: \".3em\",\n color: \"#db4c69\",\n background: \"#1e1e1e\",\n },\n \".namespace\": {\n Opacity: \".7\",\n },\n \"doctype.doctype-tag\": {\n color: \"#569CD6\",\n },\n \"doctype.name\": {\n color: \"#9cdcfe\",\n },\n comment: {\n color: \"#6a9955\",\n },\n prolog: {\n color: \"#6a9955\",\n },\n punctuation: {\n color: \"#d4d4d4\",\n },\n \".language-html .language-css .token.punctuation\": {\n color: \"#d4d4d4\",\n },\n \".language-html .language-javascript .token.punctuation\": {\n color: \"#d4d4d4\",\n },\n property: {\n color: \"#9cdcfe\",\n },\n tag: {\n color: \"#569cd6\",\n },\n boolean: {\n color: \"#569cd6\",\n },\n number: {\n color: \"#b5cea8\",\n },\n constant: {\n color: \"#9cdcfe\",\n },\n symbol: {\n color: \"#b5cea8\",\n },\n inserted: {\n color: \"#b5cea8\",\n },\n unit: {\n color: \"#b5cea8\",\n },\n selector: {\n color: \"#d7ba7d\",\n },\n \"attr-name\": {\n color: \"#9cdcfe\",\n },\n string: {\n color: \"#ce9178\",\n },\n char: {\n color: \"#ce9178\",\n },\n builtin: {\n color: \"#ce9178\",\n },\n deleted: {\n color: \"#ce9178\",\n },\n \".language-css .token.string.url\": {\n textDecoration: \"underline\",\n },\n operator: {\n color: \"#d4d4d4\",\n },\n entity: {\n color: \"#569cd6\",\n },\n \"operator.arrow\": {\n color: \"#569CD6\",\n },\n atrule: {\n color: \"#ce9178\",\n },\n \"atrule.rule\": {\n color: \"#c586c0\",\n },\n \"atrule.url\": {\n color: \"#9cdcfe\",\n },\n \"atrule.url.function\": {\n color: \"#dcdcaa\",\n },\n \"atrule.url.punctuation\": {\n color: \"#d4d4d4\",\n },\n keyword: {\n color: \"#569CD6\",\n },\n \"keyword.module\": {\n color: \"#c586c0\",\n },\n \"keyword.control-flow\": {\n color: \"#c586c0\",\n },\n function: {\n color: \"#dcdcaa\",\n },\n \"function.maybe-class-name\": {\n color: \"#dcdcaa\",\n },\n regex: {\n color: \"#d16969\",\n },\n important: {\n color: \"#569cd6\",\n },\n italic: {\n fontStyle: \"italic\",\n },\n \"class-name\": {\n color: \"#4ec9b0\",\n },\n \"maybe-class-name\": {\n color: \"#4ec9b0\",\n },\n console: {\n color: \"#9cdcfe\",\n },\n parameter: {\n color: \"#9cdcfe\",\n },\n interpolation: {\n color: \"#9cdcfe\",\n },\n \"punctuation.interpolation-punctuation\": {\n color: \"#569cd6\",\n },\n variable: {\n color: \"#9cdcfe\",\n },\n \"imports.maybe-class-name\": {\n color: \"#9cdcfe\",\n },\n \"exports.maybe-class-name\": {\n color: \"#9cdcfe\",\n },\n escape: {\n color: \"#d7ba7d\",\n },\n \"tag.punctuation\": {\n color: \"#808080\",\n },\n cdata: {\n color: \"#808080\",\n },\n \"attr-value\": {\n color: \"#ce9178\",\n },\n \"attr-value.punctuation\": {\n color: \"#ce9178\",\n },\n \"attr-value.punctuation.attr-equals\": {\n color: \"#d4d4d4\",\n },\n namespace: {\n color: \"#4ec9b0\",\n },\n 'pre[class*=\"language-javascript\"]': {\n color: \"#9cdcfe\",\n },\n 'code[class*=\"language-javascript\"]': {\n color: \"#9cdcfe\",\n },\n 'pre[class*=\"language-jsx\"]': {\n color: \"#9cdcfe\",\n },\n 'code[class*=\"language-jsx\"]': {\n color: \"#9cdcfe\",\n },\n 'pre[class*=\"language-typescript\"]': {\n color: \"#9cdcfe\",\n },\n 'code[class*=\"language-typescript\"]': {\n color: \"#9cdcfe\",\n },\n 'pre[class*=\"language-tsx\"]': {\n color: \"#9cdcfe\",\n },\n 'code[class*=\"language-tsx\"]': {\n color: \"#9cdcfe\",\n },\n 'pre[class*=\"language-css\"]': {\n color: \"#ce9178\",\n },\n 'code[class*=\"language-css\"]': {\n color: \"#ce9178\",\n },\n 'pre[class*=\"language-html\"]': {\n color: \"#d4d4d4\",\n },\n 'code[class*=\"language-html\"]': {\n color: \"#d4d4d4\",\n },\n \".language-regex .token.anchor\": {\n color: \"#dcdcaa\",\n },\n \".language-html .token.punctuation\": {\n color: \"#808080\",\n },\n 'pre[class*=\"language-\"] > code[class*=\"language-\"]': {\n position: \"relative\",\n zIndex: \"1\",\n },\n \".line-highlight.line-highlight\": {\n background: \"#f7ebc6\",\n boxShadow: \"inset 5px 0 0 #f7d87c\",\n zIndex: \"0\",\n },\n};\n","import * as React from \"react\";\n\nexport interface useCopyToClipboardProps {\n timeout?: number;\n}\n\nexport function useCopyToClipboard({ timeout = 2000 }: useCopyToClipboardProps) {\n const [isCopied, setIsCopied] = React.useState<Boolean>(false);\n\n const copyToClipboard = (value: string) => {\n if (typeof window === \"undefined\" || !navigator.clipboard?.writeText) {\n return;\n }\n\n if (!value) {\n return;\n }\n\n navigator.clipboard.writeText(value).then(() => {\n setIsCopied(true);\n\n setTimeout(() => {\n setIsCopied(false);\n }, timeout);\n });\n };\n\n return { isCopied, copyToClipboard };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAyC;;;ACWnC;AA0GC,IAAM,WACX;AAAA,EAAC;AAAA;AAAA,IACC,OAAM;AAAA,IACN,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,aAAY;AAAA,IACZ,QAAO;AAAA,IACP,OAAM;AAAA,IACN,QAAO;AAAA,IACP,OAAO,EAAE,UAAU,QAAQ,WAAW,OAAO;AAAA,IAE7C;AAAA,MAAC;AAAA;AAAA,QACC,eAAc;AAAA,QACd,gBAAe;AAAA,QACf,GAAE;AAAA;AAAA,IACJ;AAAA;AACF;AAyDK,IAAM,eACX;AAAA,EAAC;AAAA;AAAA,IACC,OAAM;AAAA,IACN,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,aAAY;AAAA,IACZ,QAAO;AAAA,IACP,OAAM;AAAA,IACN,QAAO;AAAA,IACP,OAAO,EAAE,UAAU,QAAQ,WAAW,OAAO;AAAA,IAE7C;AAAA,MAAC;AAAA;AAAA,QACC,eAAc;AAAA,QACd,gBAAe;AAAA,QACf,GAAE;AAAA;AAAA,IACJ;AAAA;AACF;AAiBK,IAAM,YACX;AAAA,EAAC;AAAA;AAAA,IACC,OAAM;AAAA,IACN,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,aAAY;AAAA,IACZ,QAAO;AAAA,IACP,OAAM;AAAA,IACN,QAAO;AAAA,IACP,OAAO,EAAE,UAAU,QAAQ,WAAW,OAAO;AAAA,IAE7C,sDAAC,UAAK,eAAc,SAAQ,gBAAe,SAAQ,GAAE,yBAAwB;AAAA;AAC/E;;;ADWO,IAAAA,sBAAA;AApFF,IAAM,cAAc,aAAAC,QAAM,cAAuC,MAA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,gBAEvC,SAAS;AAAA,gBACT,cAAY,OAAO;AAAA,gBACnB,OAAO,OAAO;AAAA,gBAEb,gBAAM;AAAA;AAAA,YACT;AAAA,YAED,gBACC;AAAA,cAAC;AAAA;AAAA,gBACC,WAAW,kCACT,aAAa,eAAe,WAAW;AAAA,gBAEzC,SAAS;AAAA,gBACT,cAAY,OAAO;AAAA,gBACnB,OAAO,OAAO;AAAA,gBAEb,gBAAM;AAAA;AAAA,YACT;AAAA;AAAA;AAAA,MAEJ;AAAA,OAEJ;AAAA,IAEF,6CAAC,SAAI,OAAO,EAAE,cAAc,SAAS,GAAI,wBAAa;AAAA,IACrD,aAAa,6CAAC,eAAY;AAAA,KAC7B;AAEJ;","names":["import_jsx_runtime","React","import_react","import_react","React","import_jsx_runtime","import_jsx_runtime","ReactMarkdown","remarkGfm","remarkMath","rehypeRaw","import_react","import_jsx_runtime","content"]}
|
|
@@ -65,14 +65,30 @@ module.exports = __toCommonJS(LegacyRenderMessage_exports);
|
|
|
65
65
|
|
|
66
66
|
// src/components/chat/messages/UserMessage.tsx
|
|
67
67
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
68
|
+
var getTextContent = (content) => {
|
|
69
|
+
if (typeof content === "undefined") {
|
|
70
|
+
return void 0;
|
|
71
|
+
}
|
|
72
|
+
if (typeof content === "string") {
|
|
73
|
+
return content;
|
|
74
|
+
}
|
|
75
|
+
return content.map((part) => {
|
|
76
|
+
if (part.type === "text") {
|
|
77
|
+
return part.text;
|
|
78
|
+
}
|
|
79
|
+
return void 0;
|
|
80
|
+
}).filter((value) => typeof value === "string" && value.length > 0).join(" ").trim() || void 0;
|
|
81
|
+
};
|
|
68
82
|
var UserMessage = (props) => {
|
|
69
83
|
const { message, ImageRenderer: ImageRenderer2 } = props;
|
|
70
|
-
const isImageMessage = message && "image" in message && message.image;
|
|
84
|
+
const isImageMessage = message && "image" in message && Boolean(message.image);
|
|
71
85
|
if (isImageMessage) {
|
|
72
86
|
const imageMessage = message;
|
|
73
|
-
|
|
87
|
+
const content2 = getTextContent(imageMessage == null ? void 0 : imageMessage.content);
|
|
88
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "copilotKitMessage copilotKitUserMessage", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ImageRenderer2, { image: imageMessage.image, content: content2 }) });
|
|
74
89
|
}
|
|
75
|
-
|
|
90
|
+
const content = getTextContent(message == null ? void 0 : message.content);
|
|
91
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "copilotKitMessage copilotKitUserMessage", children: content });
|
|
76
92
|
};
|
|
77
93
|
|
|
78
94
|
// src/components/chat/ChatContext.tsx
|
|
@@ -690,6 +706,7 @@ var AssistantMessage = (props) => {
|
|
|
690
706
|
onThumbsUp,
|
|
691
707
|
onThumbsDown,
|
|
692
708
|
isCurrentMessage,
|
|
709
|
+
feedback,
|
|
693
710
|
markdownTagRenderers
|
|
694
711
|
} = props;
|
|
695
712
|
const [copied, setCopied] = (0, import_react4.useState)(false);
|
|
@@ -711,12 +728,14 @@ var AssistantMessage = (props) => {
|
|
|
711
728
|
onRegenerate();
|
|
712
729
|
};
|
|
713
730
|
const handleThumbsUp = () => {
|
|
714
|
-
if (onThumbsUp && message)
|
|
731
|
+
if (onThumbsUp && message) {
|
|
715
732
|
onThumbsUp(message);
|
|
733
|
+
}
|
|
716
734
|
};
|
|
717
735
|
const handleThumbsDown = () => {
|
|
718
|
-
if (onThumbsDown && message)
|
|
736
|
+
if (onThumbsDown && message) {
|
|
719
737
|
onThumbsDown(message);
|
|
738
|
+
}
|
|
720
739
|
};
|
|
721
740
|
const LoadingIcon = () => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: icons.activityIcon });
|
|
722
741
|
const content = (message == null ? void 0 : message.content) || "";
|
|
@@ -752,7 +771,7 @@ var AssistantMessage = (props) => {
|
|
|
752
771
|
onThumbsUp && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
753
772
|
"button",
|
|
754
773
|
{
|
|
755
|
-
className:
|
|
774
|
+
className: `copilotKitMessageControlButton ${feedback === "thumbsUp" ? "active" : ""}`,
|
|
756
775
|
onClick: handleThumbsUp,
|
|
757
776
|
"aria-label": labels.thumbsUp,
|
|
758
777
|
title: labels.thumbsUp,
|
|
@@ -762,7 +781,7 @@ var AssistantMessage = (props) => {
|
|
|
762
781
|
onThumbsDown && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
763
782
|
"button",
|
|
764
783
|
{
|
|
765
|
-
className:
|
|
784
|
+
className: `copilotKitMessageControlButton ${feedback === "thumbsDown" ? "active" : ""}`,
|
|
766
785
|
onClick: handleThumbsDown,
|
|
767
786
|
"aria-label": labels.thumbsDown,
|
|
768
787
|
title: labels.thumbsDown,
|
|
@@ -823,6 +842,7 @@ function RenderMessage(_a) {
|
|
|
823
842
|
var _a2;
|
|
824
843
|
const {
|
|
825
844
|
message,
|
|
845
|
+
messages,
|
|
826
846
|
inProgress,
|
|
827
847
|
index,
|
|
828
848
|
isCurrentMessage,
|
|
@@ -830,6 +850,7 @@ function RenderMessage(_a) {
|
|
|
830
850
|
onCopy,
|
|
831
851
|
onThumbsUp,
|
|
832
852
|
onThumbsDown,
|
|
853
|
+
messageFeedback,
|
|
833
854
|
markdownTagRenderers
|
|
834
855
|
} = props;
|
|
835
856
|
switch (message.role) {
|
|
@@ -852,6 +873,7 @@ function RenderMessage(_a) {
|
|
|
852
873
|
subComponent: (_a2 = message.generativeUI) == null ? void 0 : _a2.call(message),
|
|
853
874
|
rawData: message,
|
|
854
875
|
message,
|
|
876
|
+
messages,
|
|
855
877
|
isLoading: inProgress && isCurrentMessage && !message.content,
|
|
856
878
|
isGenerating: inProgress && isCurrentMessage && !!message.content,
|
|
857
879
|
isCurrentMessage,
|
|
@@ -859,6 +881,7 @@ function RenderMessage(_a) {
|
|
|
859
881
|
onCopy,
|
|
860
882
|
onThumbsUp,
|
|
861
883
|
onThumbsDown,
|
|
884
|
+
feedback: (messageFeedback == null ? void 0 : messageFeedback[message.id]) || null,
|
|
862
885
|
markdownTagRenderers,
|
|
863
886
|
ImageRenderer: ImageRenderer2
|
|
864
887
|
},
|
|
@@ -872,6 +895,7 @@ var import_runtime_client_gql = require("@copilotkit/runtime-client-gql");
|
|
|
872
895
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
873
896
|
var LegacyRenderMessage = ({
|
|
874
897
|
message,
|
|
898
|
+
messages,
|
|
875
899
|
inProgress,
|
|
876
900
|
index,
|
|
877
901
|
isCurrentMessage,
|
|
@@ -900,6 +924,7 @@ var LegacyRenderMessage = ({
|
|
|
900
924
|
RenderTextMessage,
|
|
901
925
|
{
|
|
902
926
|
message,
|
|
927
|
+
messages,
|
|
903
928
|
inProgress,
|
|
904
929
|
index,
|
|
905
930
|
isCurrentMessage,
|
|
@@ -917,6 +942,7 @@ var LegacyRenderMessage = ({
|
|
|
917
942
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
918
943
|
RenderActionExecutionMessage,
|
|
919
944
|
{
|
|
945
|
+
messages,
|
|
920
946
|
message,
|
|
921
947
|
inProgress,
|
|
922
948
|
index,
|
|
@@ -931,6 +957,7 @@ var LegacyRenderMessage = ({
|
|
|
931
957
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
932
958
|
RenderAgentStateMessage,
|
|
933
959
|
{
|
|
960
|
+
messages,
|
|
934
961
|
message,
|
|
935
962
|
inProgress,
|
|
936
963
|
index,
|
|
@@ -944,6 +971,7 @@ var LegacyRenderMessage = ({
|
|
|
944
971
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
945
972
|
RenderResultMessage,
|
|
946
973
|
{
|
|
974
|
+
messages,
|
|
947
975
|
message,
|
|
948
976
|
inProgress,
|
|
949
977
|
index,
|
|
@@ -957,6 +985,7 @@ var LegacyRenderMessage = ({
|
|
|
957
985
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
958
986
|
RenderImageMessage,
|
|
959
987
|
{
|
|
988
|
+
messages,
|
|
960
989
|
message,
|
|
961
990
|
inProgress,
|
|
962
991
|
index,
|
|
@@ -969,6 +998,7 @@ var LegacyRenderMessage = ({
|
|
|
969
998
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
970
999
|
RenderMessage,
|
|
971
1000
|
{
|
|
1001
|
+
messages,
|
|
972
1002
|
message,
|
|
973
1003
|
inProgress,
|
|
974
1004
|
index,
|