@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 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/chat/messages/RenderMessage.tsx","../../../../src/components/chat/messages/UserMessage.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","../../../../src/components/chat/messages/AssistantMessage.tsx","../../../../src/components/chat/messages/ImageRenderer.tsx"],"sourcesContent":["import { RenderMessageProps } from \"../props\";\nimport { UserMessage as DefaultUserMessage } from \"./UserMessage\";\nimport { AssistantMessage as DefaultAssistantMessage } from \"./AssistantMessage\";\nimport { ImageRenderer as DefaultImageRenderer } from \"./ImageRenderer\";\n\nexport function RenderMessage({\n UserMessage = DefaultUserMessage,\n AssistantMessage = DefaultAssistantMessage,\n ImageRenderer = DefaultImageRenderer,\n ...props\n}: RenderMessageProps) {\n const {\n message,\n inProgress,\n index,\n isCurrentMessage,\n onRegenerate,\n onCopy,\n onThumbsUp,\n onThumbsDown,\n markdownTagRenderers,\n } = props;\n\n switch (message.role) {\n case \"user\":\n return (\n <UserMessage\n key={index}\n rawData={message}\n data-message-role=\"user\"\n message={message}\n ImageRenderer={ImageRenderer}\n />\n );\n case \"assistant\":\n return (\n <AssistantMessage\n key={index}\n data-message-role=\"assistant\"\n subComponent={message.generativeUI?.()}\n rawData={message}\n message={message}\n isLoading={inProgress && isCurrentMessage && !message.content}\n isGenerating={inProgress && isCurrentMessage && !!message.content}\n isCurrentMessage={isCurrentMessage}\n onRegenerate={() => onRegenerate?.(message.id)}\n onCopy={onCopy}\n onThumbsUp={onThumbsUp}\n onThumbsDown={onThumbsDown}\n markdownTagRenderers={markdownTagRenderers}\n ImageRenderer={ImageRenderer}\n />\n );\n }\n}\n","import { UserMessageProps } from \"../props\";\n\nexport const UserMessage = (props: UserMessageProps) => {\n const { message, ImageRenderer } = props;\n const isImageMessage = message && \"image\" in message && message.image;\n\n // Image message\n if (isImageMessage) {\n const imageMessage = message;\n\n return (\n <div className=\"copilotKitMessage copilotKitUserMessage\">\n <ImageRenderer image={imageMessage.image!} content={imageMessage.content} />\n </div>\n );\n }\n\n // Regular text message\n return <div className=\"copilotKitMessage copilotKitUserMessage\">{message?.content}</div>;\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","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, { useState } from \"react\";\nimport { ImageRendererProps } from \"../props\";\n\n/**\n * Default image rendering component that can be customized by users.\n * Uses CSS classes for styling so users can override styles.\n */\nexport const ImageRenderer: React.FC<ImageRendererProps> = ({ image, content, className = \"\" }) => {\n const [imageError, setImageError] = useState(false);\n const imageSrc = `data:image/${image.format};base64,${image.bytes}`;\n const altText = content || \"User uploaded image\";\n\n const handleImageError = () => {\n setImageError(true);\n };\n\n if (imageError) {\n return (\n <div className={`copilotKitImageRendering copilotKitImageRenderingError ${className}`}>\n <div className=\"copilotKitImageRenderingErrorMessage\">Failed to load image</div>\n {content && <div className=\"copilotKitImageRenderingContent\">{content}</div>}\n </div>\n );\n }\n\n return (\n <div className={`copilotKitImageRendering ${className}`}>\n <img\n src={imageSrc}\n alt={altText}\n className=\"copilotKitImageRenderingImage\"\n onError={handleImageError}\n />\n {content && <div className=\"copilotKitImageRenderingContent\">{content}</div>}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACYQ;AAVD,IAAM,cAAc,CAAC,UAA4B;AACtD,QAAM,EAAE,SAAS,eAAAA,eAAc,IAAI;AACnC,QAAM,iBAAiB,WAAW,WAAW,WAAW,QAAQ;AAGhE,MAAI,gBAAgB;AAClB,UAAM,eAAe;AAErB,WACE,4CAAC,SAAI,WAAU,2CACb,sDAACA,gBAAA,EAAc,OAAO,aAAa,OAAQ,SAAS,aAAa,SAAS,GAC5E;AAAA,EAEJ;AAGA,SAAO,4CAAC,SAAI,WAAU,2CAA2C,6CAAS,SAAQ;AACpF;;;ACnBA,mBAAyC;;;ACWnC,IAAAC,sBAAA;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,E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AAA,EAEN;AACF;","names":["ImageRenderer","import_jsx_runtime","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","import_react","import_jsx_runtime","import_jsx_runtime","UserMessage","AssistantMessage","ImageRenderer","_a"]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/chat/messages/RenderMessage.tsx","../../../../src/components/chat/messages/UserMessage.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","../../../../src/components/chat/messages/AssistantMessage.tsx","../../../../src/components/chat/messages/ImageRenderer.tsx"],"sourcesContent":["import { RenderMessageProps } from \"../props\";\nimport { UserMessage as DefaultUserMessage } from \"./UserMessage\";\nimport { AssistantMessage as DefaultAssistantMessage } from \"./AssistantMessage\";\nimport { ImageRenderer as DefaultImageRenderer } from \"./ImageRenderer\";\n\nexport function RenderMessage({\n UserMessage = DefaultUserMessage,\n AssistantMessage = DefaultAssistantMessage,\n ImageRenderer = DefaultImageRenderer,\n ...props\n}: RenderMessageProps) {\n const {\n message,\n messages,\n inProgress,\n index,\n isCurrentMessage,\n onRegenerate,\n onCopy,\n onThumbsUp,\n onThumbsDown,\n messageFeedback,\n markdownTagRenderers,\n } = props;\n\n switch (message.role) {\n case \"user\":\n return (\n <UserMessage\n key={index}\n rawData={message}\n data-message-role=\"user\"\n message={message}\n ImageRenderer={ImageRenderer}\n />\n );\n case \"assistant\":\n return (\n <AssistantMessage\n key={index}\n data-message-role=\"assistant\"\n subComponent={message.generativeUI?.()}\n rawData={message}\n message={message}\n messages={messages}\n isLoading={inProgress && isCurrentMessage && !message.content}\n isGenerating={inProgress && isCurrentMessage && !!message.content}\n isCurrentMessage={isCurrentMessage}\n onRegenerate={() => onRegenerate?.(message.id)}\n onCopy={onCopy}\n onThumbsUp={onThumbsUp}\n onThumbsDown={onThumbsDown}\n feedback={messageFeedback?.[message.id] || null}\n markdownTagRenderers={markdownTagRenderers}\n ImageRenderer={ImageRenderer}\n />\n );\n }\n}\n","import { UserMessageProps } from \"../props\";\n\ntype UserMessageContent = NonNullable<UserMessageProps[\"message\"]>[\"content\"];\n\nconst getTextContent = (content: UserMessageContent | undefined): string | undefined => {\n if (typeof content === \"undefined\") {\n return undefined;\n }\n\n if (typeof content === \"string\") {\n return content;\n }\n\n return content\n .map((part) => {\n if (part.type === \"text\") {\n return part.text;\n }\n return undefined;\n })\n .filter((value): value is string => typeof value === \"string\" && value.length > 0)\n .join(\" \")\n .trim() || undefined;\n};\n\nexport const UserMessage = (props: UserMessageProps) => {\n const { message, ImageRenderer } = props;\n const isImageMessage = message && \"image\" in message && Boolean(message.image);\n\n if (isImageMessage) {\n const imageMessage = message!;\n const content = getTextContent(imageMessage?.content);\n\n return (\n <div className=\"copilotKitMessage copilotKitUserMessage\">\n <ImageRenderer image={imageMessage.image!} content={content} />\n </div>\n );\n }\n\n const content = getTextContent(message?.content);\n\n return <div className=\"copilotKitMessage copilotKitUserMessage\">{content}</div>;\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","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, { useState } from \"react\";\nimport { ImageRendererProps } from \"../props\";\n\n/**\n * Default image rendering component that can be customized by users.\n * Uses CSS classes for styling so users can override styles.\n */\nexport const ImageRenderer: React.FC<ImageRendererProps> = ({ image, content, className = \"\" }) => {\n const [imageError, setImageError] = useState(false);\n const imageSrc = `data:image/${image.format};base64,${image.bytes}`;\n const altText = content || \"User uploaded image\";\n\n const handleImageError = () => {\n setImageError(true);\n };\n\n if (imageError) {\n return (\n <div className={`copilotKitImageRendering copilotKitImageRenderingError ${className}`}>\n <div className=\"copilotKitImageRenderingErrorMessage\">Failed to load image</div>\n {content && <div className=\"copilotKitImageRenderingContent\">{content}</div>}\n </div>\n );\n }\n\n return (\n <div className={`copilotKitImageRendering ${className}`}>\n <img\n src={imageSrc}\n alt={altText}\n className=\"copilotKitImageRenderingImage\"\n onError={handleImageError}\n />\n {content && <div className=\"copilotKitImageRenderingContent\">{content}</div>}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACmCQ;AA/BR,IAAM,iBAAiB,CAAC,YAAgE;AACtF,MAAI,OAAO,YAAY,aAAa;AAClC,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,YAAY,UAAU;AAC/B,WAAO;AAAA,EACT;AAEA,SAAO,QACJ,IAAI,CAAC,SAAS;AACb,QAAI,KAAK,SAAS,QAAQ;AACxB,aAAO,KAAK;AAAA,IACd;AACA,WAAO;AAAA,EACT,CAAC,EACA,OAAO,CAAC,UAA2B,OAAO,UAAU,YAAY,MAAM,SAAS,CAAC,EAChF,KAAK,GAAG,EACR,KAAK,KAAK;AACf;AAEO,IAAM,cAAc,CAAC,UAA4B;AACtD,QAAM,EAAE,SAAS,eAAAA,eAAc,IAAI;AACnC,QAAM,iBAAiB,WAAW,WAAW,WAAW,QAAQ,QAAQ,KAAK;AAE7E,MAAI,gBAAgB;AAClB,UAAM,eAAe;AACrB,UAAMC,WAAU,eAAe,6CAAc,OAAO;AAEpD,WACE,4CAAC,SAAI,WAAU,2CACb,sDAACD,gBAAA,EAAc,OAAO,aAAa,OAAQ,SAASC,UAAS,GAC/D;AAAA,EAEJ;AAEA,QAAM,UAAU,eAAe,mCAAS,OAAO;AAE/C,SAAO,4CAAC,SAA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AAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,UAAQ,QAAQ,MAAM;AAAA,IACpB,KAAK;AACH,aACE;AAAA,QAACH;AAAA,QAAA;AAAA,UAEC,SAAS;AAAA,UACT,qBAAkB;AAAA,UAClB;AAAA,UACA,eAAeE;AAAA;AAAA,QAJV;AAAA,MAKP;AAAA,IAEJ,KAAK;AACH,aACE;AAAA,QAACD;AAAA,QAAA;AAAA,UAEC,qBAAkB;AAAA,UAClB,eAAcE,MAAA,QAAQ,iBAAR,gBAAAA,IAAA;AAAA,UACd,SAAS;AAAA,UACT;AAAA,UACA;AAAA,UACA,WAAW,cAAc,oBAAoB,CAAC,QAAQ;AAAA,UACtD,cAAc,cAAc,oBAAoB,CAAC,CAAC,QAAQ;AAAA,UAC1D;AAAA,UACA,cAAc,MAAM,6CAAe,QAAQ;AAAA,UAC3C;AAAA,UACA;AAAA,UACA;AAAA,UACA,WAAU,mDAAkB,QAAQ,QAAO;AAAA,UAC3C;AAAA,UACA,eAAeD;AAAA;AAAA,QAfV;AAAA,MAgBP;AAAA,EAEN;AACF;","names":["ImageRenderer","content","import_jsx_runtime","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","import_react","import_jsx_runtime","import_jsx_runtime","UserMessage","AssistantMessage","ImageRenderer","_a"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RenderMessage
|
|
3
|
-
} from "../../../chunk-
|
|
4
|
-
import "../../../chunk-
|
|
3
|
+
} from "../../../chunk-MPF6BJUF.mjs";
|
|
4
|
+
import "../../../chunk-IHFR6PYG.mjs";
|
|
5
5
|
import "../../../chunk-DBKRAOH7.mjs";
|
|
6
|
-
import "../../../chunk-
|
|
6
|
+
import "../../../chunk-3YWFGNSM.mjs";
|
|
7
7
|
import "../../../chunk-JZ3RFQQ6.mjs";
|
|
8
8
|
import "../../../chunk-IEMQ2SQW.mjs";
|
|
9
9
|
import "../../../chunk-IK2BPURM.mjs";
|
|
@@ -24,14 +24,30 @@ __export(UserMessage_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(UserMessage_exports);
|
|
26
26
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
27
|
+
var getTextContent = (content) => {
|
|
28
|
+
if (typeof content === "undefined") {
|
|
29
|
+
return void 0;
|
|
30
|
+
}
|
|
31
|
+
if (typeof content === "string") {
|
|
32
|
+
return content;
|
|
33
|
+
}
|
|
34
|
+
return content.map((part) => {
|
|
35
|
+
if (part.type === "text") {
|
|
36
|
+
return part.text;
|
|
37
|
+
}
|
|
38
|
+
return void 0;
|
|
39
|
+
}).filter((value) => typeof value === "string" && value.length > 0).join(" ").trim() || void 0;
|
|
40
|
+
};
|
|
27
41
|
var UserMessage = (props) => {
|
|
28
42
|
const { message, ImageRenderer } = props;
|
|
29
|
-
const isImageMessage = message && "image" in message && message.image;
|
|
43
|
+
const isImageMessage = message && "image" in message && Boolean(message.image);
|
|
30
44
|
if (isImageMessage) {
|
|
31
45
|
const imageMessage = message;
|
|
32
|
-
|
|
46
|
+
const content2 = getTextContent(imageMessage == null ? void 0 : imageMessage.content);
|
|
47
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "copilotKitMessage copilotKitUserMessage", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ImageRenderer, { image: imageMessage.image, content: content2 }) });
|
|
33
48
|
}
|
|
34
|
-
|
|
49
|
+
const content = getTextContent(message == null ? void 0 : message.content);
|
|
50
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "copilotKitMessage copilotKitUserMessage", children: content });
|
|
35
51
|
};
|
|
36
52
|
// Annotate the CommonJS export names for ESM import in node:
|
|
37
53
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/chat/messages/UserMessage.tsx"],"sourcesContent":["import { UserMessageProps } from \"../props\";\n\nexport const UserMessage = (props: UserMessageProps) => {\n const { message, ImageRenderer } = props;\n const isImageMessage = message && \"image\" in message && message.image;\n\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/chat/messages/UserMessage.tsx"],"sourcesContent":["import { UserMessageProps } from \"../props\";\n\ntype UserMessageContent = NonNullable<UserMessageProps[\"message\"]>[\"content\"];\n\nconst getTextContent = (content: UserMessageContent | undefined): string | undefined => {\n if (typeof content === \"undefined\") {\n return undefined;\n }\n\n if (typeof content === \"string\") {\n return content;\n }\n\n return content\n .map((part) => {\n if (part.type === \"text\") {\n return part.text;\n }\n return undefined;\n })\n .filter((value): value is string => typeof value === \"string\" && value.length > 0)\n .join(\" \")\n .trim() || undefined;\n};\n\nexport const UserMessage = (props: UserMessageProps) => {\n const { message, ImageRenderer } = props;\n const isImageMessage = message && \"image\" in message && Boolean(message.image);\n\n if (isImageMessage) {\n const imageMessage = message!;\n const content = getTextContent(imageMessage?.content);\n\n return (\n <div className=\"copilotKitMessage copilotKitUserMessage\">\n <ImageRenderer image={imageMessage.image!} content={content} />\n </div>\n );\n }\n\n const content = getTextContent(message?.content);\n\n return <div className=\"copilotKitMessage copilotKitUserMessage\">{content}</div>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmCQ;AA/BR,IAAM,iBAAiB,CAAC,YAAgE;AACtF,MAAI,OAAO,YAAY,aAAa;AAClC,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,YAAY,UAAU;AAC/B,WAAO;AAAA,EACT;AAEA,SAAO,QACJ,IAAI,CAAC,SAAS;AACb,QAAI,KAAK,SAAS,QAAQ;AACxB,aAAO,KAAK;AAAA,IACd;AACA,WAAO;AAAA,EACT,CAAC,EACA,OAAO,CAAC,UAA2B,OAAO,UAAU,YAAY,MAAM,SAAS,CAAC,EAChF,KAAK,GAAG,EACR,KAAK,KAAK;AACf;AAEO,IAAM,cAAc,CAAC,UAA4B;AACtD,QAAM,EAAE,SAAS,cAAc,IAAI;AACnC,QAAM,iBAAiB,WAAW,WAAW,WAAW,QAAQ,QAAQ,KAAK;AAE7E,MAAI,gBAAgB;AAClB,UAAM,eAAe;AACrB,UAAMA,WAAU,eAAe,6CAAc,OAAO;AAEpD,WACE,4CAAC,SAAI,WAAU,2CACb,sDAAC,iBAAc,OAAO,aAAa,OAAQ,SAASA,UAAS,GAC/D;AAAA,EAEJ;AAEA,QAAM,UAAU,eAAe,mCAAS,OAAO;AAE/C,SAAO,4CAAC,SAAI,WAAU,2CAA2C,mBAAQ;AAC3E;","names":["content"]}
|
|
@@ -93,6 +93,10 @@ interface MessagesProps {
|
|
|
93
93
|
* Callback function for thumbs down feedback
|
|
94
94
|
*/
|
|
95
95
|
onThumbsDown?: (message: Message) => void;
|
|
96
|
+
/**
|
|
97
|
+
* Map of message IDs to their feedback state
|
|
98
|
+
*/
|
|
99
|
+
messageFeedback?: Record<string, "thumbsUp" | "thumbsDown">;
|
|
96
100
|
/**
|
|
97
101
|
* A list of markdown components to render in assistant message.
|
|
98
102
|
* Useful when you want to render custom elements in the message (e.g a reference tag element)
|
|
@@ -137,6 +141,7 @@ interface AssistantMessageProps {
|
|
|
137
141
|
* The message content from the assistant
|
|
138
142
|
*/
|
|
139
143
|
message?: AIMessage;
|
|
144
|
+
messages?: Message[];
|
|
140
145
|
/**
|
|
141
146
|
* Indicates if this is the last message
|
|
142
147
|
*/
|
|
@@ -165,6 +170,10 @@ interface AssistantMessageProps {
|
|
|
165
170
|
* Callback function for thumbs down feedback
|
|
166
171
|
*/
|
|
167
172
|
onThumbsDown?: (message: Message) => void;
|
|
173
|
+
/**
|
|
174
|
+
* The feedback state for this message ("thumbsUp" or "thumbsDown")
|
|
175
|
+
*/
|
|
176
|
+
feedback?: "thumbsUp" | "thumbsDown" | null;
|
|
168
177
|
/**
|
|
169
178
|
* A list of markdown components to render in assistant message.
|
|
170
179
|
* Useful when you want to render custom elements in the message (e.g a reference tag element)
|
|
@@ -218,6 +227,7 @@ interface ErrorMessageProps {
|
|
|
218
227
|
}
|
|
219
228
|
interface RenderMessageProps {
|
|
220
229
|
message: Message;
|
|
230
|
+
messages: Message[];
|
|
221
231
|
inProgress: boolean;
|
|
222
232
|
index: number;
|
|
223
233
|
isCurrentMessage: boolean;
|
|
@@ -241,6 +251,10 @@ interface RenderMessageProps {
|
|
|
241
251
|
* Callback function for thumbs down feedback
|
|
242
252
|
*/
|
|
243
253
|
onThumbsDown?: (message: Message) => void;
|
|
254
|
+
/**
|
|
255
|
+
* Map of message IDs to their feedback state
|
|
256
|
+
*/
|
|
257
|
+
messageFeedback?: Record<string, "thumbsUp" | "thumbsDown">;
|
|
244
258
|
/**
|
|
245
259
|
* A list of markdown components to render in assistant message.
|
|
246
260
|
* Useful when you want to render custom elements in the message (e.g a reference tag element)
|
|
@@ -254,10 +268,12 @@ interface InputProps {
|
|
|
254
268
|
onStop?: () => void;
|
|
255
269
|
onUpload?: () => void;
|
|
256
270
|
hideStopButton?: boolean;
|
|
271
|
+
chatReady?: boolean;
|
|
257
272
|
}
|
|
258
273
|
interface RenderSuggestionsListProps {
|
|
259
274
|
suggestions: CopilotChatSuggestion[];
|
|
260
275
|
onSuggestionClick: (message: string) => void;
|
|
276
|
+
isLoading: boolean;
|
|
261
277
|
}
|
|
262
278
|
interface ImageRendererProps {
|
|
263
279
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/chat/props.ts"],"sourcesContent":["import { AIMessage, Message, UserMessage, CopilotErrorEvent } from \"@copilotkit/shared\";\nimport { CopilotChatSuggestion } from \"../../types/suggestions\";\nimport { ReactNode } from \"react\";\nimport { ImageData } from \"@copilotkit/shared\";\n\n/**\n * Event hooks for CopilotKit chat events.\n * These hooks only work when publicApiKey is provided.\n */\nexport interface CopilotObservabilityHooks {\n /**\n * Called when a message is sent by the user\n */\n onMessageSent?: (message: string) => void;\n\n /**\n * Called when the chat is minimized/closed\n */\n onChatMinimized?: () => void;\n\n /**\n * Called when the chat is expanded/opened\n */\n onChatExpanded?: () => void;\n\n /**\n * Called when a message is regenerated\n */\n onMessageRegenerated?: (messageId: string) => void;\n\n /**\n * Called when a message is copied\n */\n onMessageCopied?: (content: string) => void;\n\n /**\n * Called when feedback is given (thumbs up/down)\n */\n onFeedbackGiven?: (messageId: string, type: \"thumbsUp\" | \"thumbsDown\") => void;\n\n /**\n * Called when chat generation starts\n */\n onChatStarted?: () => void;\n\n /**\n * Called when chat generation stops\n */\n onChatStopped?: () => void;\n\n /**\n * Called when an error occurs in the chat\n * This enables chat-specific error handling UX while preserving system-wide error monitoring\n */\n onError?: (errorEvent: CopilotErrorEvent) => void;\n}\n\nexport interface ButtonProps {}\n\nexport interface WindowProps {\n clickOutsideToClose: boolean;\n hitEscapeToClose: boolean;\n shortcut: string;\n children?: React.ReactNode;\n}\n\nexport interface HeaderProps {}\n\nexport interface SuggestionsProps {\n title: string;\n message: string;\n partial?: boolean;\n className?: string;\n onClick: (message: string) => void;\n}\n\nexport type ComponentsMap<T extends Record<string, object> = Record<string, object>> = {\n [K in keyof T]: React.FC<{ children?: ReactNode } & T[K]>;\n};\n\nexport interface MessagesProps {\n messages: Message[];\n inProgress: boolean;\n children?: React.ReactNode;\n chatError?: ChatError | null;\n AssistantMessage: React.ComponentType<AssistantMessageProps>;\n UserMessage: React.ComponentType<UserMessageProps>;\n ErrorMessage?: React.ComponentType<ErrorMessageProps>;\n RenderMessage: React.ComponentType<RenderMessageProps>;\n ImageRenderer: React.ComponentType<ImageRendererProps>;\n\n /**\n * Callback function to regenerate the assistant's response\n */\n onRegenerate?: (messageId: string) => void;\n\n /**\n * Callback function when the message is copied\n */\n onCopy?: (message: string) => void;\n\n /**\n * Callback function for thumbs up feedback\n */\n onThumbsUp?: (message: Message) => void;\n\n /**\n * Callback function for thumbs down feedback\n */\n onThumbsDown?: (message: Message) => void;\n\n /**\n * A list of markdown components to render in assistant message.\n * Useful when you want to render custom elements in the message (e.g a reference tag element)\n */\n markdownTagRenderers?: ComponentsMap;\n\n /**\n * @deprecated Use RenderMessage instead\n */\n RenderTextMessage?: React.ComponentType<RenderMessageProps>;\n\n /**\n * @deprecated Use RenderMessage instead\n */\n RenderActionExecutionMessage?: React.ComponentType<RenderMessageProps>;\n\n /**\n * @deprecated Use RenderMessage instead\n */\n RenderAgentStateMessage?: React.ComponentType<RenderMessageProps>;\n\n /**\n * @deprecated Use RenderMessage instead\n */\n RenderResultMessage?: React.ComponentType<RenderMessageProps>;\n\n /**\n * @deprecated Use RenderMessage instead\n */\n RenderImageMessage?: React.ComponentType<RenderMessageProps>;\n}\n\nexport interface Renderer {\n content: string;\n}\n\nexport interface UserMessageProps {\n message?: UserMessage;\n ImageRenderer: React.ComponentType<ImageRendererProps>;\n\n /**\n * @deprecated use message instead\n *\n * The raw data from the assistant's response\n */\n rawData: any;\n}\n\nexport interface AssistantMessageProps {\n /**\n * The message content from the assistant\n */\n\n message?: AIMessage;\n\n /**\n * Indicates if this is the last message\n */\n isCurrentMessage?: boolean;\n\n /**\n * Whether a response is loading, this is when the LLM is thinking of a response but hasn't finished yet.\n */\n isLoading: boolean;\n\n /**\n * Whether a response is generating, this is when the LLM is actively generating and streaming content.\n */\n isGenerating: boolean;\n\n /**\n * Callback function to regenerate the assistant's response\n */\n onRegenerate?: () => void;\n\n /**\n * Callback function when the message is copied\n */\n onCopy?: (message: string) => void;\n\n /**\n * Callback function for thumbs up feedback\n */\n onThumbsUp?: (message: Message) => void;\n\n /**\n * Callback function for thumbs down feedback\n */\n onThumbsDown?: (message: Message) => void;\n\n /**\n * A list of markdown components to render in assistant message.\n * Useful when you want to render custom elements in the message (e.g a reference tag element)\n */\n markdownTagRenderers?: ComponentsMap;\n\n /**\n * A custom image rendering component to use instead of the default.\n */\n ImageRenderer?: React.ComponentType<ImageRendererProps>;\n\n /**\n * @deprecated use message instead\n *\n * The raw data from the assistant's response\n */\n rawData: any;\n\n /**\n *\n * @deprecated\n *\n * use `message.generativeUI()` instead.\n *\n * For example:\n *\n * ```tsx\n * const CustomAssistantMessage = ({ message }: AssistantMessageProps) => {\n * const subComponent = message?.generativeUI?.();\n * return <div>{subComponent}</div>;\n * };\n *\n * ```\n */\n subComponent?: React.JSX.Element;\n}\n\nexport interface ErrorMessageProps {\n /**\n * The message content from the assistant\n */\n\n error: ChatError;\n\n /**\n * Indicates if this is the last message\n */\n isCurrentMessage?: boolean;\n\n /**\n * Callback function to regenerate the assistant's response\n */\n onRegenerate?: () => void;\n\n /**\n * Callback function when the message is copied\n */\n onCopy?: (message: string) => void;\n}\n\nexport interface RenderMessageProps {\n message: Message;\n inProgress: boolean;\n index: number;\n isCurrentMessage: boolean;\n actionResult?: string;\n AssistantMessage?: React.ComponentType<AssistantMessageProps>;\n UserMessage?: React.ComponentType<UserMessageProps>;\n ImageRenderer?: React.ComponentType<ImageRendererProps>;\n\n /**\n * Callback function to regenerate the assistant's response\n */\n onRegenerate?: (messageId: string) => void;\n\n /**\n * Callback function when the message is copied\n */\n onCopy?: (message: string) => void;\n\n /**\n * Callback function for thumbs up feedback\n */\n onThumbsUp?: (message: Message) => void;\n\n /**\n * Callback function for thumbs down feedback\n */\n onThumbsDown?: (message: Message) => void;\n\n /**\n * A list of markdown components to render in assistant message.\n * Useful when you want to render custom elements in the message (e.g a reference tag element)\n */\n markdownTagRenderers?: ComponentsMap;\n}\n\nexport interface InputProps {\n inProgress: boolean;\n onSend: (text: string) => Promise<Message>;\n isVisible?: boolean;\n onStop?: () => void;\n onUpload?: () => void;\n hideStopButton?: boolean;\n}\n\nexport interface RenderSuggestionsListProps {\n suggestions: CopilotChatSuggestion[];\n onSuggestionClick: (message: string) => void;\n}\n\nexport interface ImageRendererProps {\n /**\n * The image data containing format and bytes\n */\n image: ImageData;\n\n /**\n * Optional content to display alongside the image\n */\n content?: string;\n\n /**\n * Additional CSS class name for styling\n */\n className?: string;\n}\n\nexport interface ChatError {\n message: string;\n operation?: string;\n timestamp: number;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/chat/props.ts"],"sourcesContent":["import { AIMessage, Message, UserMessage, CopilotErrorEvent } from \"@copilotkit/shared\";\nimport { CopilotChatSuggestion } from \"../../types/suggestions\";\nimport { ReactNode } from \"react\";\nimport { ImageData } from \"@copilotkit/shared\";\n\n/**\n * Event hooks for CopilotKit chat events.\n * These hooks only work when publicApiKey is provided.\n */\nexport interface CopilotObservabilityHooks {\n /**\n * Called when a message is sent by the user\n */\n onMessageSent?: (message: string) => void;\n\n /**\n * Called when the chat is minimized/closed\n */\n onChatMinimized?: () => void;\n\n /**\n * Called when the chat is expanded/opened\n */\n onChatExpanded?: () => void;\n\n /**\n * Called when a message is regenerated\n */\n onMessageRegenerated?: (messageId: string) => void;\n\n /**\n * Called when a message is copied\n */\n onMessageCopied?: (content: string) => void;\n\n /**\n * Called when feedback is given (thumbs up/down)\n */\n onFeedbackGiven?: (messageId: string, type: \"thumbsUp\" | \"thumbsDown\") => void;\n\n /**\n * Called when chat generation starts\n */\n onChatStarted?: () => void;\n\n /**\n * Called when chat generation stops\n */\n onChatStopped?: () => void;\n\n /**\n * Called when an error occurs in the chat\n * This enables chat-specific error handling UX while preserving system-wide error monitoring\n */\n onError?: (errorEvent: CopilotErrorEvent) => void;\n}\n\nexport interface ButtonProps {}\n\nexport interface WindowProps {\n clickOutsideToClose: boolean;\n hitEscapeToClose: boolean;\n shortcut: string;\n children?: React.ReactNode;\n}\n\nexport interface HeaderProps {}\n\nexport interface SuggestionsProps {\n title: string;\n message: string;\n partial?: boolean;\n className?: string;\n onClick: (message: string) => void;\n}\n\nexport type ComponentsMap<T extends Record<string, object> = Record<string, object>> = {\n [K in keyof T]: React.FC<{ children?: ReactNode } & T[K]>;\n};\n\nexport interface MessagesProps {\n messages: Message[];\n inProgress: boolean;\n children?: React.ReactNode;\n chatError?: ChatError | null;\n AssistantMessage: React.ComponentType<AssistantMessageProps>;\n UserMessage: React.ComponentType<UserMessageProps>;\n ErrorMessage?: React.ComponentType<ErrorMessageProps>;\n RenderMessage: React.ComponentType<RenderMessageProps>;\n ImageRenderer: React.ComponentType<ImageRendererProps>;\n\n /**\n * Callback function to regenerate the assistant's response\n */\n onRegenerate?: (messageId: string) => void;\n\n /**\n * Callback function when the message is copied\n */\n onCopy?: (message: string) => void;\n\n /**\n * Callback function for thumbs up feedback\n */\n onThumbsUp?: (message: Message) => void;\n\n /**\n * Callback function for thumbs down feedback\n */\n onThumbsDown?: (message: Message) => void;\n\n /**\n * Map of message IDs to their feedback state\n */\n messageFeedback?: Record<string, \"thumbsUp\" | \"thumbsDown\">;\n\n /**\n * A list of markdown components to render in assistant message.\n * Useful when you want to render custom elements in the message (e.g a reference tag element)\n */\n markdownTagRenderers?: ComponentsMap;\n\n /**\n * @deprecated Use RenderMessage instead\n */\n RenderTextMessage?: React.ComponentType<RenderMessageProps>;\n\n /**\n * @deprecated Use RenderMessage instead\n */\n RenderActionExecutionMessage?: React.ComponentType<RenderMessageProps>;\n\n /**\n * @deprecated Use RenderMessage instead\n */\n RenderAgentStateMessage?: React.ComponentType<RenderMessageProps>;\n\n /**\n * @deprecated Use RenderMessage instead\n */\n RenderResultMessage?: React.ComponentType<RenderMessageProps>;\n\n /**\n * @deprecated Use RenderMessage instead\n */\n RenderImageMessage?: React.ComponentType<RenderMessageProps>;\n}\n\nexport interface Renderer {\n content: string;\n}\n\nexport interface UserMessageProps {\n message?: UserMessage;\n ImageRenderer: React.ComponentType<ImageRendererProps>;\n\n /**\n * @deprecated use message instead\n *\n * The raw data from the assistant's response\n */\n rawData: any;\n}\n\nexport interface AssistantMessageProps {\n /**\n * The message content from the assistant\n */\n\n message?: AIMessage;\n messages?: Message[];\n\n /**\n * Indicates if this is the last message\n */\n isCurrentMessage?: boolean;\n\n /**\n * Whether a response is loading, this is when the LLM is thinking of a response but hasn't finished yet.\n */\n isLoading: boolean;\n\n /**\n * Whether a response is generating, this is when the LLM is actively generating and streaming content.\n */\n isGenerating: boolean;\n\n /**\n * Callback function to regenerate the assistant's response\n */\n onRegenerate?: () => void;\n\n /**\n * Callback function when the message is copied\n */\n onCopy?: (message: string) => void;\n\n /**\n * Callback function for thumbs up feedback\n */\n onThumbsUp?: (message: Message) => void;\n\n /**\n * Callback function for thumbs down feedback\n */\n onThumbsDown?: (message: Message) => void;\n\n /**\n * The feedback state for this message (\"thumbsUp\" or \"thumbsDown\")\n */\n feedback?: \"thumbsUp\" | \"thumbsDown\" | null;\n\n /**\n * A list of markdown components to render in assistant message.\n * Useful when you want to render custom elements in the message (e.g a reference tag element)\n */\n markdownTagRenderers?: ComponentsMap;\n\n /**\n * A custom image rendering component to use instead of the default.\n */\n ImageRenderer?: React.ComponentType<ImageRendererProps>;\n\n /**\n * @deprecated use message instead\n *\n * The raw data from the assistant's response\n */\n rawData: any;\n\n /**\n *\n * @deprecated\n *\n * use `message.generativeUI()` instead.\n *\n * For example:\n *\n * ```tsx\n * const CustomAssistantMessage = ({ message }: AssistantMessageProps) => {\n * const subComponent = message?.generativeUI?.();\n * return <div>{subComponent}</div>;\n * };\n *\n * ```\n */\n subComponent?: React.JSX.Element;\n}\n\nexport interface ErrorMessageProps {\n /**\n * The message content from the assistant\n */\n\n error: ChatError;\n\n /**\n * Indicates if this is the last message\n */\n isCurrentMessage?: boolean;\n\n /**\n * Callback function to regenerate the assistant's response\n */\n onRegenerate?: () => void;\n\n /**\n * Callback function when the message is copied\n */\n onCopy?: (message: string) => void;\n}\n\nexport interface RenderMessageProps {\n message: Message;\n messages: Message[];\n inProgress: boolean;\n index: number;\n isCurrentMessage: boolean;\n actionResult?: string;\n AssistantMessage?: React.ComponentType<AssistantMessageProps>;\n UserMessage?: React.ComponentType<UserMessageProps>;\n ImageRenderer?: React.ComponentType<ImageRendererProps>;\n\n /**\n * Callback function to regenerate the assistant's response\n */\n onRegenerate?: (messageId: string) => void;\n\n /**\n * Callback function when the message is copied\n */\n onCopy?: (message: string) => void;\n\n /**\n * Callback function for thumbs up feedback\n */\n onThumbsUp?: (message: Message) => void;\n\n /**\n * Callback function for thumbs down feedback\n */\n onThumbsDown?: (message: Message) => void;\n\n /**\n * Map of message IDs to their feedback state\n */\n messageFeedback?: Record<string, \"thumbsUp\" | \"thumbsDown\">;\n\n /**\n * A list of markdown components to render in assistant message.\n * Useful when you want to render custom elements in the message (e.g a reference tag element)\n */\n markdownTagRenderers?: ComponentsMap;\n}\n\nexport interface InputProps {\n inProgress: boolean;\n onSend: (text: string) => Promise<Message>;\n isVisible?: boolean;\n onStop?: () => void;\n onUpload?: () => void;\n hideStopButton?: boolean;\n chatReady?: boolean;\n}\n\nexport interface RenderSuggestionsListProps {\n suggestions: CopilotChatSuggestion[];\n onSuggestionClick: (message: string) => void;\n isLoading: boolean;\n}\n\nexport interface ImageRendererProps {\n /**\n * The image data containing format and bytes\n */\n image: ImageData;\n\n /**\n * Optional content to display alongside the image\n */\n content?: string;\n\n /**\n * Additional CSS class name for styling\n */\n className?: string;\n}\n\nexport interface ChatError {\n message: string;\n operation?: string;\n timestamp: number;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -16,9 +16,4 @@ import '../types/suggestions.js';
|
|
|
16
16
|
import 'react';
|
|
17
17
|
import 'react/jsx-runtime';
|
|
18
18
|
import './chat/Modal.js';
|
|
19
|
-
import '@copilotkit/react-core/dist/types/coagent-state';
|
|
20
|
-
import '@copilotkit/react-core/dist/hooks/use-tree';
|
|
21
|
-
import '@copilotkit/react-core/dist/copilot-context-cf9de848';
|
|
22
|
-
import '@copilotkit/react-core/dist/types/coagent-action';
|
|
23
|
-
import '@copilotkit/runtime-client-gql';
|
|
24
19
|
import 'react-markdown';
|