@copilotkit/react-ui 1.10.0-next.0 → 1.10.0-next.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +112 -0
- package/dist/{chunk-O7KTFUAN.mjs → chunk-226ZMOE3.mjs} +2 -2
- package/dist/{chunk-WHDNKXMP.mjs → chunk-BJHJBS5M.mjs} +46 -6
- package/dist/chunk-BJHJBS5M.mjs.map +1 -0
- package/dist/{chunk-Z4XPPVZT.mjs → chunk-EYRKZDP5.mjs} +1 -1
- package/dist/chunk-EYRKZDP5.mjs.map +1 -0
- package/dist/{chunk-SGFUVPDB.mjs → chunk-FFJHOZX6.mjs} +2 -2
- package/dist/{chunk-WPVTPQ7X.mjs → chunk-GBP47ONN.mjs} +2 -2
- package/dist/chunk-GBP47ONN.mjs.map +1 -0
- package/dist/{chunk-GVKA7RQQ.mjs → chunk-GDSZGYCE.mjs} +2 -2
- package/dist/{chunk-LXCD3K7B.mjs → chunk-GJ4SX4JE.mjs} +152 -36
- package/dist/chunk-GJ4SX4JE.mjs.map +1 -0
- package/dist/{chunk-VLNT34X3.mjs → chunk-J5ZZR6YB.mjs} +2 -2
- package/dist/chunk-J5ZZR6YB.mjs.map +1 -0
- package/dist/{chunk-QN7T3GWI.mjs → chunk-JY2CSDKN.mjs} +4 -6
- package/dist/chunk-JY2CSDKN.mjs.map +1 -0
- package/dist/chunk-MIVUCSGO.mjs +126 -0
- package/dist/chunk-MIVUCSGO.mjs.map +1 -0
- package/dist/{chunk-JHUTTP5C.mjs → chunk-T5QU6KSB.mjs} +5 -1
- package/dist/chunk-T5QU6KSB.mjs.map +1 -0
- package/dist/{chunk-Q2467VHZ.mjs → chunk-W26XFBEG.mjs} +2 -2
- package/dist/chunk-W26XFBEG.mjs.map +1 -0
- package/dist/chunk-Y44VLEUH.mjs +222 -0
- package/dist/chunk-Y44VLEUH.mjs.map +1 -0
- package/dist/components/chat/Chat.d.ts +52 -15
- package/dist/components/chat/Chat.js +1136 -869
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +9 -8
- package/dist/components/chat/Header.js +6 -8
- package/dist/components/chat/Header.js.map +1 -1
- package/dist/components/chat/Header.mjs +3 -3
- package/dist/components/chat/Messages.d.ts +1 -1
- package/dist/components/chat/Messages.js +984 -23
- package/dist/components/chat/Messages.js.map +1 -1
- package/dist/components/chat/Messages.mjs +9 -1
- package/dist/components/chat/Modal.d.ts +2 -2
- package/dist/components/chat/Modal.js +1267 -931
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +13 -12
- package/dist/components/chat/Popup.d.ts +1 -1
- package/dist/components/chat/Popup.js +1269 -933
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +14 -13
- package/dist/components/chat/Sidebar.d.ts +1 -1
- package/dist/components/chat/Sidebar.js +1269 -933
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +14 -13
- package/dist/components/chat/Suggestion.js +1 -1
- package/dist/components/chat/Suggestion.js.map +1 -1
- package/dist/components/chat/Suggestion.mjs +1 -1
- package/dist/components/chat/Suggestions.js +1 -1
- package/dist/components/chat/Suggestions.js.map +1 -1
- package/dist/components/chat/Suggestions.mjs +2 -2
- package/dist/components/chat/index.d.ts +2 -2
- package/dist/components/chat/index.js +1271 -935
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +20 -19
- package/dist/components/chat/messages/LegacyRenderMessage.d.ts +28 -0
- package/dist/components/chat/messages/LegacyRenderMessage.js +980 -0
- package/dist/components/chat/messages/LegacyRenderMessage.js.map +1 -0
- package/dist/components/chat/messages/LegacyRenderMessage.mjs +17 -0
- package/dist/components/chat/messages/LegacyRenderMessage.mjs.map +1 -0
- package/dist/components/chat/messages/RenderMessage.js +4 -0
- package/dist/components/chat/messages/RenderMessage.js.map +1 -1
- package/dist/components/chat/messages/RenderMessage.mjs +1 -1
- package/dist/components/chat/props.d.ts +94 -2
- package/dist/components/chat/props.js.map +1 -1
- package/dist/components/dev-console/console.d.ts +1 -0
- package/dist/components/dev-console/console.js +6 -8
- package/dist/components/dev-console/console.js.map +1 -1
- package/dist/components/dev-console/console.mjs +2 -2
- package/dist/components/dev-console/index.d.ts +1 -3
- package/dist/components/dev-console/index.js +7 -9
- package/dist/components/dev-console/index.js.map +1 -1
- package/dist/components/dev-console/index.mjs +2 -2
- package/dist/components/dev-console/utils.d.ts +2 -2
- package/dist/components/dev-console/utils.js +2 -4
- package/dist/components/dev-console/utils.js.map +1 -1
- package/dist/components/dev-console/utils.mjs +1 -1
- package/dist/components/index.d.ts +3 -5
- package/dist/components/index.js +1272 -936
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +20 -19
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/hooks/use-copilot-chat-suggestions.d.ts +1 -1
- package/dist/hooks/use-copilot-chat-suggestions.js.map +1 -1
- package/dist/hooks/use-copilot-chat-suggestions.mjs +1 -1
- package/dist/index.d.ts +3 -5
- package/dist/index.js +1303 -967
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -20
- package/package.json +6 -6
- package/src/components/chat/Chat.tsx +242 -24
- package/src/components/chat/Messages.tsx +58 -5
- package/src/components/chat/Modal.tsx +128 -41
- package/src/components/chat/Popup.tsx +21 -1
- package/src/components/chat/Sidebar.tsx +23 -1
- package/src/components/chat/Suggestion.tsx +1 -1
- package/src/components/chat/messages/LegacyRenderMessage.tsx +143 -0
- package/src/components/chat/messages/RenderMessage.tsx +3 -0
- package/src/components/chat/props.ts +110 -1
- package/src/components/dev-console/utils.ts +1 -6
- package/src/hooks/use-copilot-chat-suggestions.tsx +1 -1
- package/dist/chunk-GJ3MFNBX.mjs +0 -144
- package/dist/chunk-GJ3MFNBX.mjs.map +0 -1
- package/dist/chunk-JHUTTP5C.mjs.map +0 -1
- package/dist/chunk-LXCD3K7B.mjs.map +0 -1
- package/dist/chunk-Q2467VHZ.mjs.map +0 -1
- package/dist/chunk-QN7T3GWI.mjs.map +0 -1
- package/dist/chunk-VLNT34X3.mjs.map +0 -1
- package/dist/chunk-WHDNKXMP.mjs.map +0 -1
- package/dist/chunk-WPVTPQ7X.mjs.map +0 -1
- package/dist/chunk-Z4XPPVZT.mjs.map +0 -1
- /package/dist/{chunk-O7KTFUAN.mjs.map → chunk-226ZMOE3.mjs.map} +0 -0
- /package/dist/{chunk-SGFUVPDB.mjs.map → chunk-FFJHOZX6.mjs.map} +0 -0
- /package/dist/{chunk-GVKA7RQQ.mjs.map → chunk-GDSZGYCE.mjs.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/Chat.tsx"],"sourcesContent":["/**\n * <br/>\n * <img src=\"https://cdn.copilotkit.ai/docs/copilotkit/images/CopilotChat.gif\" width=\"500\" />\n *\n * A chatbot panel component for the CopilotKit framework. The component allows for a high degree\n * of customization through various props and custom CSS.\n *\n * ## Install Dependencies\n *\n * This component is part of the [@copilotkit/react-ui](https://npmjs.com/package/@copilotkit/react-ui) package.\n *\n * ```shell npm2yarn \\\"@copilotkit/react-ui\"\\\n * npm install @copilotkit/react-core @copilotkit/react-ui\n * ```\n *\n * ## Usage\n *\n * ```tsx\n * import { CopilotChat } from \"@copilotkit/react-ui\";\n * import \"@copilotkit/react-ui/styles.css\";\n *\n * <CopilotChat\n * labels={{\n * title: \"Your Assistant\",\n * initial: \"Hi! 👋 How can I assist you today?\",\n * }}\n * />\n * ```\n *\n * ### With Observability Hooks\n *\n * To monitor user interactions, provide the `observabilityHooks` prop.\n * **Note:** This requires a `publicApiKey` in the `<CopilotKit>` provider.\n *\n * ```tsx\n * <CopilotKit publicApiKey=\"YOUR_PUBLIC_API_KEY\">\n * <CopilotChat\n * observabilityHooks={{\n * onMessageSent: (message) => {\n * console.log(\"Message sent:\", message);\n * },\n * }}\n * />\n * </CopilotKit>\n * ```\n *\n * ### Look & Feel\n *\n * By default, CopilotKit components do not have any styles. You can import CopilotKit's stylesheet at the root of your project:\n * ```tsx title=\"YourRootComponent.tsx\"\n * ...\n * import \"@copilotkit/react-ui/styles.css\"; // [!code highlight]\n *\n * export function YourRootComponent() {\n * return (\n * <CopilotKit>\n * ...\n * </CopilotKit>\n * );\n * }\n * ```\n * For more information about how to customize the styles, check out the [Customize Look & Feel](/guides/custom-look-and-feel/customize-built-in-ui-components) guide.\n */\n\nimport {\n ChatContext,\n ChatContextProvider,\n CopilotChatIcons,\n CopilotChatLabels,\n} from \"./ChatContext\";\nimport { Messages as DefaultMessages } from \"./Messages\";\nimport { Input as DefaultInput } from \"./Input\";\nimport { RenderMessage as DefaultRenderMessage } from \"./messages/RenderMessage\";\nimport { AssistantMessage as DefaultAssistantMessage } from \"./messages/AssistantMessage\";\nimport { UserMessage as DefaultUserMessage } from \"./messages/UserMessage\";\nimport { ImageRenderer as DefaultImageRenderer } from \"./messages/ImageRenderer\";\nimport React, { useEffect, useRef, useState, useCallback, useMemo } from \"react\";\nimport {\n SystemMessageFunction,\n useCopilotChatInternal as useCopilotChat,\n useCopilotContext,\n useCopilotMessagesContext,\n} from \"@copilotkit/react-core\";\nimport type { SuggestionItem } from \"@copilotkit/react-core\";\nimport {\n CopilotKitError,\n CopilotKitErrorCode,\n CopilotErrorEvent,\n Message,\n Severity,\n ErrorVisibility,\n styledConsole,\n} from \"@copilotkit/shared\";\nimport { randomId } from \"@copilotkit/shared\";\nimport {\n AssistantMessageProps,\n ComponentsMap,\n CopilotObservabilityHooks,\n ImageRendererProps,\n InputProps,\n MessagesProps,\n RenderMessageProps,\n RenderSuggestionsListProps,\n UserMessageProps,\n} from \"./props\";\n\nimport { HintFunction, runAgent, stopAgent } from \"@copilotkit/react-core\";\nimport { ImageUploadQueue } from \"./ImageUploadQueue\";\nimport { Suggestions as DefaultRenderSuggestionsList } from \"./Suggestions\";\n\n/**\n * The type of suggestions to use in the chat.\n *\n * `auto` - Suggestions are generated automatically.\n * `manual` - Suggestions are controlled programmatically.\n * `SuggestionItem[]` - Static suggestions array.\n */\nexport type ChatSuggestions = \"auto\" | \"manual\" | SuggestionItem[];\n\n/**\n * Props for CopilotChat component.\n */\nexport interface CopilotChatProps {\n /**\n * Custom instructions to be added to the system message. Use this property to\n * provide additional context or guidance to the language model, influencing\n * its responses. These instructions can include specific directions,\n * preferences, or criteria that the model should consider when generating\n * its output, thereby tailoring the conversation more precisely to the\n * user's needs or the application's requirements.\n */\n instructions?: string;\n\n /**\n * Controls the behavior of suggestions in the chat interface.\n *\n * `auto` (default) - Suggestions are generated automatically:\n * - When the chat is first opened (empty state)\n * - After each message exchange completes\n * - Uses configuration from `useCopilotChatSuggestions` hooks\n *\n * `manual` - Suggestions are controlled programmatically:\n * - Use `setSuggestions()` to set custom suggestions\n * - Use `generateSuggestions()` to trigger AI generation\n * - Access via `useCopilotChat` hook\n *\n * `SuggestionItem[]` - Static suggestions array:\n * - Always shows the same suggestions\n * - No AI generation involved\n */\n suggestions?: ChatSuggestions;\n\n /**\n * A callback that gets called when the in progress state changes.\n */\n onInProgress?: (inProgress: boolean) => void;\n\n /**\n * A callback that gets called when a new message it submitted.\n */\n onSubmitMessage?: (message: string) => void | Promise<void>;\n\n /**\n * A custom stop generation function.\n */\n onStopGeneration?: OnStopGeneration;\n\n /**\n * A custom reload messages function.\n */\n onReloadMessages?: OnReloadMessages;\n\n /**\n * A callback function to regenerate the assistant's response\n */\n onRegenerate?: (messageId: string) => void;\n\n /**\n * A callback function when the message is copied\n */\n onCopy?: (message: string) => void;\n\n /**\n * A callback function for thumbs up feedback\n */\n onThumbsUp?: (message: Message) => void;\n\n /**\n * A 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 * Icons can be used to set custom icons for the chat window.\n */\n icons?: CopilotChatIcons;\n\n /**\n * Labels can be used to set custom labels for the chat window.\n */\n labels?: CopilotChatLabels;\n\n /**\n * Enable image upload button (image inputs only supported on some models)\n */\n imageUploadsEnabled?: boolean;\n\n /**\n * The 'accept' attribute for the file input used for image uploads.\n * Defaults to \"image/*\".\n */\n inputFileAccept?: string;\n\n /**\n * A function that takes in context string and instructions and returns\n * the system message to include in the chat request.\n * Use this to completely override the system message, when providing\n * instructions is not enough.\n */\n makeSystemMessage?: SystemMessageFunction;\n\n /**\n * A custom assistant message component to use instead of the default.\n */\n AssistantMessage?: React.ComponentType<AssistantMessageProps>;\n\n /**\n * A custom user message component to use instead of the default.\n */\n UserMessage?: React.ComponentType<UserMessageProps>;\n\n /**\n * A custom Messages component to use instead of the default.\n */\n Messages?: React.ComponentType<MessagesProps>;\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 /**\n * A custom RenderMessage component to use instead of the default.\n *\n * **Warning**: This is a break-glass solution to allow for custom\n * rendering of messages. You are most likely looking to swap out\n * the AssistantMessage and UserMessage components instead which\n * are also props.\n */\n RenderMessage?: React.ComponentType<RenderMessageProps>;\n\n /**\n * A custom suggestions list component to use instead of the default.\n */\n RenderSuggestionsList?: React.ComponentType<RenderSuggestionsListProps>;\n\n /**\n * A custom Input component to use instead of the default.\n */\n Input?: React.ComponentType<InputProps>;\n\n /**\n * A custom image rendering component to use instead of the default.\n */\n ImageRenderer?: React.ComponentType<ImageRendererProps>;\n\n /**\n * A class name to apply to the root element.\n */\n className?: string;\n\n /**\n * Children to render.\n */\n children?: React.ReactNode;\n\n hideStopButton?: boolean;\n\n /**\n * Event hooks for CopilotKit chat events.\n * These hooks only work when publicApiKey is provided.\n */\n observabilityHooks?: CopilotObservabilityHooks;\n\n /**\n * Custom error renderer for chat-specific errors.\n * When provided, errors will be displayed inline within the chat interface.\n */\n renderError?: (error: {\n message: string;\n operation?: string;\n timestamp: number;\n onDismiss: () => void;\n onRetry?: () => void;\n }) => React.ReactNode;\n}\n\ninterface OnStopGenerationArguments {\n /**\n * The name of the currently executing agent.\n */\n currentAgentName: string | undefined;\n\n /**\n * The messages in the chat.\n */\n messages: Message[];\n\n /**\n * Set the messages in the chat.\n */\n setMessages: (messages: Message[]) => void;\n\n /**\n * Stop chat generation.\n */\n stopGeneration: () => void;\n\n /**\n * Restart the currently executing agent.\n */\n restartCurrentAgent: () => void;\n\n /**\n * Stop the currently executing agent.\n */\n stopCurrentAgent: () => void;\n\n /**\n * Run the currently executing agent.\n */\n runCurrentAgent: (hint?: HintFunction) => Promise<void>;\n\n /**\n * Set the state of the currently executing agent.\n */\n setCurrentAgentState: (state: any) => void;\n}\n\nexport type OnReloadMessagesArguments = OnStopGenerationArguments & {\n /**\n * The message on which \"regenerate\" was pressed\n */\n messageId: string;\n};\n\nexport type OnStopGeneration = (args: OnStopGenerationArguments) => void;\n\nexport type OnReloadMessages = (args: OnReloadMessagesArguments) => void;\n\nexport type ImageUpload = {\n contentType: string;\n bytes: string;\n};\n\nexport function CopilotChat({\n instructions,\n suggestions = \"auto\",\n onSubmitMessage,\n makeSystemMessage,\n onInProgress,\n onStopGeneration,\n onReloadMessages,\n onRegenerate,\n onCopy,\n onThumbsUp,\n onThumbsDown,\n markdownTagRenderers,\n Messages = DefaultMessages,\n RenderMessage = DefaultRenderMessage,\n RenderSuggestionsList = DefaultRenderSuggestionsList,\n Input = DefaultInput,\n className,\n icons,\n labels,\n AssistantMessage = DefaultAssistantMessage,\n UserMessage = DefaultUserMessage,\n ImageRenderer = DefaultImageRenderer,\n imageUploadsEnabled,\n inputFileAccept = \"image/*\",\n hideStopButton,\n observabilityHooks,\n renderError,\n\n // Legacy props - deprecated\n RenderTextMessage,\n RenderActionExecutionMessage,\n RenderAgentStateMessage,\n RenderResultMessage,\n RenderImageMessage,\n}: CopilotChatProps) {\n const { additionalInstructions, setChatInstructions, copilotApiConfig, setBannerError } =\n useCopilotContext();\n\n // Destructure stable values to avoid object reference changes\n const { publicApiKey, chatApiEndpoint } = copilotApiConfig;\n const [selectedImages, setSelectedImages] = useState<Array<ImageUpload>>([]);\n const [chatError, setChatError] = useState<{\n message: string;\n operation?: string;\n timestamp: number;\n } | null>(null);\n const fileInputRef = useRef<HTMLInputElement>(null);\n\n // Helper function to trigger event hooks only if publicApiKey is provided\n const triggerObservabilityHook = useCallback(\n (hookName: keyof CopilotObservabilityHooks, ...args: any[]) => {\n if (publicApiKey && observabilityHooks?.[hookName]) {\n (observabilityHooks[hookName] as any)(...args);\n }\n if (observabilityHooks?.[hookName] && !publicApiKey) {\n setBannerError(\n new CopilotKitError({\n message: \"observabilityHooks requires a publicApiKey to function.\",\n code: CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR,\n severity: Severity.CRITICAL,\n visibility: ErrorVisibility.BANNER,\n }),\n );\n styledConsole.publicApiKeyRequired(\"observabilityHooks\");\n }\n },\n [publicApiKey, observabilityHooks, setBannerError],\n );\n\n // Helper function to trigger chat error and render error UI\n const triggerChatError = useCallback(\n (error: any, operation: string, originalError?: any) => {\n const errorMessage = error?.message || error?.toString() || \"An error occurred\";\n\n // Set chat error state for rendering\n setChatError({\n message: errorMessage,\n operation,\n timestamp: Date.now(),\n });\n\n // Also trigger observability hook if available\n if (publicApiKey && observabilityHooks?.onError) {\n const errorEvent: CopilotErrorEvent = {\n type: \"error\",\n timestamp: Date.now(),\n context: {\n source: \"ui\",\n request: {\n operation,\n url: chatApiEndpoint,\n startTime: Date.now(),\n },\n technical: {\n environment: \"browser\",\n userAgent: typeof navigator !== \"undefined\" ? navigator.userAgent : undefined,\n stackTrace: originalError instanceof Error ? originalError.stack : undefined,\n },\n },\n error,\n };\n observabilityHooks.onError(errorEvent);\n }\n\n // Show banner error if onError hook is used without publicApiKey\n if (observabilityHooks?.onError && !publicApiKey) {\n setBannerError(\n new CopilotKitError({\n message: \"observabilityHooks.onError requires a publicApiKey to function.\",\n code: CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR,\n severity: Severity.CRITICAL,\n visibility: ErrorVisibility.BANNER,\n }),\n );\n styledConsole.publicApiKeyRequired(\"observabilityHooks.onError\");\n }\n },\n [publicApiKey, chatApiEndpoint, observabilityHooks, setBannerError],\n );\n\n // Clipboard paste handler\n useEffect(() => {\n if (!imageUploadsEnabled) return;\n\n const handlePaste = async (e: ClipboardEvent) => {\n const target = e.target as HTMLElement;\n if (!target.parentElement?.classList.contains(\"copilotKitInput\")) return;\n\n const items = Array.from(e.clipboardData?.items || []);\n const imageItems = items.filter((item) => item.type.startsWith(\"image/\"));\n\n if (imageItems.length === 0) return;\n\n e.preventDefault(); // Prevent default paste behavior for images\n\n const imagePromises: Promise<ImageUpload | null>[] = imageItems.map((item) => {\n const file = item.getAsFile();\n if (!file) return Promise.resolve(null);\n\n return new Promise<ImageUpload | null>((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = (e) => {\n const base64String = (e.target?.result as string)?.split(\",\")[1];\n if (base64String) {\n resolve({\n contentType: file.type,\n bytes: base64String,\n });\n } else {\n resolve(null);\n }\n };\n reader.onerror = reject;\n reader.readAsDataURL(file);\n });\n });\n\n try {\n const loadedImages = (await Promise.all(imagePromises)).filter((img) => img !== null);\n setSelectedImages((prev) => [...prev, ...loadedImages]);\n } catch (error) {\n // Trigger chat-level error handler\n triggerChatError(error, \"processClipboardImages\", error);\n console.error(\"Error processing pasted images:\", error);\n }\n };\n\n document.addEventListener(\"paste\", handlePaste);\n return () => document.removeEventListener(\"paste\", handlePaste);\n }, [imageUploadsEnabled, triggerChatError]);\n\n useEffect(() => {\n if (!additionalInstructions?.length) {\n setChatInstructions(instructions || \"\");\n return;\n }\n\n /*\n Will result in a prompt like:\n\n You are a helpful assistant. \n Additionally, follow these instructions:\n - Do not answer questions about the weather.\n - Do not answer questions about the stock market.\"\n */\n const combinedAdditionalInstructions = [\n instructions,\n \"Additionally, follow these instructions:\",\n ...additionalInstructions.map((instruction) => `- ${instruction}`),\n ];\n\n setChatInstructions(combinedAdditionalInstructions.join(\"\\n\") || \"\");\n }, [instructions, additionalInstructions]);\n\n const {\n messages,\n isLoading,\n sendMessage,\n stopGeneration,\n reloadMessages,\n suggestions: currentSuggestions,\n } = useCopilotChatLogic(\n suggestions,\n makeSystemMessage,\n onInProgress,\n onSubmitMessage,\n onStopGeneration,\n onReloadMessages,\n );\n\n // Track loading state changes for chat start/stop events\n const prevIsLoading = useRef(isLoading);\n useEffect(() => {\n if (prevIsLoading.current !== isLoading) {\n if (isLoading) {\n triggerObservabilityHook(\"onChatStarted\");\n } else {\n triggerObservabilityHook(\"onChatStopped\");\n }\n prevIsLoading.current = isLoading;\n }\n }, [isLoading, triggerObservabilityHook]);\n\n // Wrapper for sendMessage to clear selected images\n const handleSendMessage = (text: string) => {\n const images = selectedImages;\n setSelectedImages([]);\n if (fileInputRef.current) {\n fileInputRef.current.value = \"\";\n }\n\n // Trigger message sent event\n triggerObservabilityHook(\"onMessageSent\", text);\n\n return sendMessage(text, images);\n };\n\n const chatContext = React.useContext(ChatContext);\n const isVisible = chatContext ? chatContext.open : true;\n\n const handleRegenerate = (messageId: string) => {\n if (onRegenerate) {\n onRegenerate(messageId);\n }\n\n // Trigger message regenerated event\n triggerObservabilityHook(\"onMessageRegenerated\", messageId);\n\n reloadMessages(messageId);\n };\n\n const handleCopy = (message: string) => {\n if (onCopy) {\n onCopy(message);\n }\n\n // Trigger message copied event\n triggerObservabilityHook(\"onMessageCopied\", message);\n };\n\n const handleImageUpload = async (event: React.ChangeEvent<HTMLInputElement>) => {\n if (!event.target.files || event.target.files.length === 0) {\n return;\n }\n\n const files = Array.from(event.target.files).filter((file) => file.type.startsWith(\"image/\"));\n if (files.length === 0) return;\n\n const fileReadPromises = files.map((file) => {\n return new Promise<{ contentType: string; bytes: string }>((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = (e) => {\n const base64String = (e.target?.result as string)?.split(\",\")[1] || \"\";\n if (base64String) {\n resolve({\n contentType: file.type,\n bytes: base64String,\n });\n }\n };\n reader.onerror = reject;\n reader.readAsDataURL(file);\n });\n });\n\n try {\n const loadedImages = await Promise.all(fileReadPromises);\n setSelectedImages((prev) => [...prev, ...loadedImages]);\n } catch (error) {\n // Trigger chat-level error handler\n triggerChatError(error, \"processUploadedImages\", error);\n console.error(\"Error reading files:\", error);\n }\n };\n\n const removeSelectedImage = (index: number) => {\n setSelectedImages((prev) => prev.filter((_, i) => i !== index));\n };\n\n const handleThumbsUp = (message: Message) => {\n if (onThumbsUp) {\n onThumbsUp(message);\n }\n\n // Trigger feedback given event\n triggerObservabilityHook(\"onFeedbackGiven\", message.id, \"thumbsUp\");\n };\n\n const handleThumbsDown = (message: Message) => {\n if (onThumbsDown) {\n onThumbsDown(message);\n }\n\n // Trigger feedback given event\n triggerObservabilityHook(\"onFeedbackGiven\", message.id, \"thumbsDown\");\n };\n\n return (\n <WrappedCopilotChat icons={icons} labels={labels} className={className}>\n {/* Render error above messages if present */}\n {chatError &&\n renderError &&\n renderError({\n ...chatError,\n onDismiss: () => setChatError(null),\n onRetry: () => {\n // Clear error and potentially retry based on operation\n setChatError(null);\n // TODO: Implement specific retry logic based on operation type\n },\n })}\n\n <Messages\n AssistantMessage={AssistantMessage}\n UserMessage={UserMessage}\n RenderMessage={RenderMessage}\n messages={messages}\n inProgress={isLoading}\n onRegenerate={handleRegenerate}\n onCopy={handleCopy}\n onThumbsUp={handleThumbsUp}\n onThumbsDown={handleThumbsDown}\n markdownTagRenderers={markdownTagRenderers}\n ImageRenderer={ImageRenderer}\n // Legacy props - passed through to Messages component\n RenderTextMessage={RenderTextMessage}\n RenderActionExecutionMessage={RenderActionExecutionMessage}\n RenderAgentStateMessage={RenderAgentStateMessage}\n RenderResultMessage={RenderResultMessage}\n RenderImageMessage={RenderImageMessage}\n >\n {currentSuggestions.length > 0 && (\n <RenderSuggestionsList\n onSuggestionClick={handleSendMessage}\n suggestions={currentSuggestions}\n />\n )}\n </Messages>\n\n {imageUploadsEnabled && (\n <>\n <ImageUploadQueue images={selectedImages} onRemoveImage={removeSelectedImage} />\n <input\n type=\"file\"\n multiple\n ref={fileInputRef}\n onChange={handleImageUpload}\n accept={inputFileAccept}\n style={{ display: \"none\" }}\n />\n </>\n )}\n <Input\n inProgress={isLoading}\n onSend={handleSendMessage}\n isVisible={isVisible}\n onStop={stopGeneration}\n onUpload={imageUploadsEnabled ? () => fileInputRef.current?.click() : undefined}\n hideStopButton={hideStopButton}\n />\n </WrappedCopilotChat>\n );\n}\n\nexport function WrappedCopilotChat({\n children,\n icons,\n labels,\n className,\n}: {\n children: React.ReactNode;\n icons?: CopilotChatIcons;\n labels?: CopilotChatLabels;\n className?: string;\n}) {\n const chatContext = React.useContext(ChatContext);\n if (!chatContext) {\n return (\n <ChatContextProvider icons={icons} labels={labels} open={true} setOpen={() => {}}>\n <div className={`copilotKitChat ${className ?? \"\"}`}>{children}</div>\n </ChatContextProvider>\n );\n }\n return <>{children}</>;\n}\n\nexport const useCopilotChatLogic = (\n chatSuggestions: ChatSuggestions,\n makeSystemMessage?: SystemMessageFunction,\n onInProgress?: (isLoading: boolean) => void,\n onSubmitMessage?: (messageContent: string) => Promise<void> | void,\n onStopGeneration?: OnStopGeneration,\n onReloadMessages?: OnReloadMessages,\n) => {\n const {\n messages,\n sendMessage,\n setMessages,\n reloadMessages: defaultReloadMessages,\n stopGeneration: defaultStopGeneration,\n runChatCompletion,\n isLoading,\n suggestions,\n setSuggestions,\n generateSuggestions,\n resetSuggestions: resetSuggestionsFromHook,\n isLoadingSuggestions,\n } = useCopilotChat({\n makeSystemMessage,\n });\n\n const generalContext = useCopilotContext();\n const messagesContext = useCopilotMessagesContext();\n\n // Get actions from context for message conversion\n const { actions } = generalContext;\n\n // Suggestion state management\n const [suggestionsFailed, setSuggestionsFailed] = useState(false);\n const hasGeneratedInitialSuggestions = useRef<boolean>(false);\n\n // Handle static suggestions (when suggestions prop is an array)\n useEffect(() => {\n if (Array.isArray(chatSuggestions)) {\n setSuggestions(chatSuggestions);\n hasGeneratedInitialSuggestions.current = true;\n }\n }, [JSON.stringify(chatSuggestions), setSuggestions]);\n\n // Error handling wrapper\n const generateSuggestionsWithErrorHandling = useCallback(\n async (context: string) => {\n try {\n await generateSuggestions();\n } catch (error) {\n console.error(\"Failed to generate suggestions:\", error);\n setSuggestionsFailed(true);\n }\n },\n [generateSuggestions],\n );\n\n // Automatic suggestion generation logic\n useEffect(() => {\n // Only proceed if in auto mode, not currently loading, and not failed\n if (chatSuggestions !== \"auto\" || isLoadingSuggestions || suggestionsFailed) {\n return;\n }\n\n // Don't run during chat loading (when the assistant is responding)\n if (isLoading) {\n return;\n }\n\n // Check if we have any configurations\n if (Object.keys(generalContext.chatSuggestionConfiguration).length === 0) {\n return;\n }\n\n // Generate initial suggestions when chat is empty\n if (messages.length === 0 && !hasGeneratedInitialSuggestions.current) {\n hasGeneratedInitialSuggestions.current = true;\n generateSuggestionsWithErrorHandling(\"initial\");\n return;\n }\n\n // Generate post-message suggestions after assistant responds\n if (messages.length > 0 && suggestions.length === 0) {\n generateSuggestionsWithErrorHandling(\"post-message\");\n return;\n }\n }, [\n chatSuggestions,\n isLoadingSuggestions,\n suggestionsFailed,\n messages.length,\n isLoading,\n suggestions.length,\n Object.keys(generalContext.chatSuggestionConfiguration).join(\",\"), // Use stable string instead of object reference\n generateSuggestionsWithErrorHandling,\n ]);\n\n // Reset suggestion state when switching away from auto mode\n useEffect(() => {\n if (chatSuggestions !== \"auto\") {\n hasGeneratedInitialSuggestions.current = false;\n setSuggestionsFailed(false);\n }\n }, [chatSuggestions]);\n\n // Memoize context to prevent infinite re-renders\n const stableContext = useMemo(\n () => ({\n ...generalContext,\n ...messagesContext,\n }),\n [\n // Only include stable dependencies\n generalContext.actions,\n messagesContext.messages.length,\n generalContext.isLoading,\n ],\n );\n\n // Wrapper for resetSuggestions that also resets local state\n const resetSuggestions = useCallback(() => {\n resetSuggestionsFromHook();\n setSuggestionsFailed(false);\n hasGeneratedInitialSuggestions.current = false;\n }, [resetSuggestionsFromHook]);\n\n useEffect(() => {\n onInProgress?.(isLoading);\n }, [onInProgress, isLoading]);\n\n const safelySendMessage = async (\n messageContent: string,\n imagesToUse?: Array<{ contentType: string; bytes: string }>,\n ) => {\n const images = imagesToUse || [];\n\n // Clear existing suggestions when user sends a message\n // This prevents stale suggestions from remaining visible during new conversation flow\n if (chatSuggestions === \"auto\" || chatSuggestions === \"manual\") {\n setSuggestions([]);\n }\n\n let firstMessage: Message | null = null;\n\n // Send text message if content provided\n if (messageContent.trim().length > 0) {\n const textMessage: Message = {\n id: randomId(),\n role: \"user\",\n content: messageContent,\n };\n\n // Call user-provided submit handler if available\n if (onSubmitMessage) {\n try {\n await onSubmitMessage(messageContent);\n } catch (error) {\n console.error(\"Error in onSubmitMessage:\", error);\n }\n }\n\n // Send the message and clear suggestions for auto/manual modes\n await sendMessage(textMessage, {\n followUp: images.length === 0,\n clearSuggestions: chatSuggestions === \"auto\" || chatSuggestions === \"manual\",\n });\n\n if (!firstMessage) {\n firstMessage = textMessage;\n }\n }\n\n // Send image messages\n if (images.length > 0) {\n for (let i = 0; i < images.length; i++) {\n const imageMessage = {\n id: randomId(),\n role: \"user\" as const,\n image: {\n format: images[i].contentType.replace(\"image/\", \"\"),\n bytes: images[i].bytes,\n },\n } as unknown as Message;\n await sendMessage(imageMessage, { followUp: i === images.length - 1 });\n if (!firstMessage) {\n firstMessage = imageMessage;\n }\n }\n }\n\n if (!firstMessage) {\n // Should not happen if send button is properly disabled, but handle just in case\n return { role: \"user\", content: \"\", id: randomId() } as Message; // Return a dummy message\n }\n\n // The hook implicitly triggers API call on appendMessage.\n // We return the first message sent (either text or first image)\n return firstMessage;\n };\n\n const currentAgentName = generalContext.agentSession?.agentName;\n const restartCurrentAgent = async (hint?: HintFunction) => {\n if (generalContext.agentSession) {\n generalContext.setAgentSession({\n ...generalContext.agentSession,\n nodeName: undefined,\n threadId: undefined,\n });\n generalContext.setCoagentStates((prevAgentStates) => {\n return {\n ...prevAgentStates,\n [generalContext.agentSession!.agentName]: {\n ...prevAgentStates[generalContext.agentSession!.agentName],\n threadId: undefined,\n nodeName: undefined,\n runId: undefined,\n },\n };\n });\n }\n };\n const runCurrentAgent = async (hint?: HintFunction) => {\n if (generalContext.agentSession) {\n await runAgent(\n generalContext.agentSession.agentName,\n stableContext,\n messagesContext.messages,\n sendMessage,\n runChatCompletion,\n );\n }\n };\n const stopCurrentAgent = () => {\n if (generalContext.agentSession) {\n stopAgent(generalContext.agentSession.agentName, stableContext);\n }\n };\n const setCurrentAgentState = (state: any) => {\n if (generalContext.agentSession) {\n generalContext.setCoagentStates((prevAgentStates) => {\n return {\n ...prevAgentStates,\n [generalContext.agentSession!.agentName]: {\n state,\n },\n } as any;\n });\n }\n };\n\n function stopGeneration() {\n // Clear suggestions when stopping generation\n setSuggestions([]);\n\n if (onStopGeneration) {\n onStopGeneration({\n messages: messages,\n setMessages,\n stopGeneration: defaultStopGeneration,\n currentAgentName,\n restartCurrentAgent,\n stopCurrentAgent,\n runCurrentAgent,\n setCurrentAgentState,\n });\n } else {\n defaultStopGeneration();\n }\n }\n function reloadMessages(messageId: string) {\n if (onReloadMessages) {\n onReloadMessages({\n messages: messages,\n setMessages,\n stopGeneration: defaultStopGeneration,\n currentAgentName,\n restartCurrentAgent,\n stopCurrentAgent,\n runCurrentAgent,\n setCurrentAgentState,\n messageId,\n });\n } else {\n defaultReloadMessages(messageId);\n }\n }\n\n return {\n messages,\n isLoading,\n suggestions,\n sendMessage: safelySendMessage,\n stopGeneration,\n reloadMessages,\n resetSuggestions,\n context: stableContext,\n actions,\n };\n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ACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT;AAAA,EACF;AACF;","names":["Messages","RenderMessage","Input","AssistantMessage","UserMessage","ImageRenderer","e","_a","_b"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotModal
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-Y44VLEUH.mjs";
|
|
4
4
|
import {
|
|
5
5
|
__spreadProps,
|
|
6
6
|
__spreadValues
|
|
@@ -18,4 +18,4 @@ function CopilotPopup(props) {
|
|
|
18
18
|
export {
|
|
19
19
|
CopilotPopup
|
|
20
20
|
};
|
|
21
|
-
//# sourceMappingURL=chunk-
|
|
21
|
+
//# sourceMappingURL=chunk-J5ZZR6YB.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/Popup.tsx"],"sourcesContent":["/**\n * <br/>\n * <img src=\"https://cdn.copilotkit.ai/docs/copilotkit/images/CopilotPopup.gif\" width=\"500\" />\n *\n * A chatbot popup component for the CopilotKit framework. The component allows for a high degree\n * of customization through various props and custom CSS.\n *\n * See [CopilotSidebar](/reference/components/chat/CopilotSidebar) for a sidebar version of this component.\n *\n * ## Install Dependencies\n *\n * This component is part of the [@copilotkit/react-ui](https://npmjs.com/package/@copilotkit/react-ui) package.\n *\n * ```shell npm2yarn \\\"@copilotkit/react-ui\"\\\n * npm install @copilotkit/react-core @copilotkit/react-ui\n * ```\n * ## Usage\n *\n * ```tsx\n * import { CopilotPopup } from \"@copilotkit/react-ui\";\n * import \"@copilotkit/react-ui/styles.css\";\n *\n * <CopilotPopup\n * labels={{\n * title: \"Your Assistant\",\n * initial: \"Hi! 👋 How can I assist you today?\",\n * }}\n * />\n * ```\n *\n * ### With Observability Hooks\n *\n * To monitor user interactions, provide the `observabilityHooks` prop.\n * **Note:** This requires a `publicApiKey` in the `<CopilotKit>` provider.\n *\n * ```tsx\n * <CopilotKit publicApiKey=\"YOUR_PUBLIC_API_KEY\">\n * <CopilotPopup\n * observabilityHooks={{\n * onChatExpanded: () => {\n * console.log(\"Popup opened\");\n * },\n * onChatMinimized: () => {\n * console.log(\"Popup closed\");\n * },\n * }}\n * />\n * </CopilotKit>\n * ```\n *\n * ### Look & Feel\n *\n * By default, CopilotKit components do not have any styles. You can import CopilotKit's stylesheet at the root of your project:\n * ```tsx title=\"YourRootComponent.tsx\"\n * ...\n * import \"@copilotkit/react-ui/styles.css\"; // [!code highlight]\n *\n * export function YourRootComponent() {\n * return (\n * <CopilotKit>\n * ...\n * </CopilotKit>\n * );\n * }\n * ```\n * For more information about how to customize the styles, check out the [Customize Look & Feel](/guides/custom-look-and-feel/customize-built-in-ui-components) guide.\n */\n\nimport { CopilotModal, CopilotModalProps } from \"./Modal\";\n\nexport function CopilotPopup(props: CopilotModalProps) {\n props = {\n ...props,\n className: props.className ? props.className + \" copilotKitPopup\" : \"copilotKitPopup\",\n };\n return <CopilotModal {...props}>{props.children}</CopilotModal>;\n}\n"],"mappings":";;;;;;;;;AA2ES;AALF,SAAS,aAAa,OAA0B;AACrD,UAAQ,iCACH,QADG;AAAA,IAEN,WAAW,MAAM,YAAY,MAAM,YAAY,qBAAqB;AAAA,EACtE;AACA,SAAO,oBAAC,+CAAiB,QAAjB,EAAyB,gBAAM,WAAS;AAClD;","names":[]}
|
|
@@ -6,9 +6,7 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
defaultCopilotContextCategories
|
|
8
8
|
} from "@copilotkit/react-core";
|
|
9
|
-
|
|
10
|
-
return showDevConsole;
|
|
11
|
-
}
|
|
9
|
+
import { shouldShowDevConsole } from "@copilotkit/react-core";
|
|
12
10
|
function getPublishedCopilotKitVersion(current, forceCheck = false) {
|
|
13
11
|
return __async(this, null, function* () {
|
|
14
12
|
const LOCAL_STORAGE_KEY = "__copilotkit_version_check__";
|
|
@@ -128,10 +126,10 @@ function logMessages(context) {
|
|
|
128
126
|
}
|
|
129
127
|
|
|
130
128
|
export {
|
|
131
|
-
shouldShowDevConsole,
|
|
132
129
|
getPublishedCopilotKitVersion,
|
|
133
130
|
logReadables,
|
|
134
131
|
logActions,
|
|
135
|
-
logMessages
|
|
132
|
+
logMessages,
|
|
133
|
+
shouldShowDevConsole
|
|
136
134
|
};
|
|
137
|
-
//# sourceMappingURL=chunk-
|
|
135
|
+
//# sourceMappingURL=chunk-JY2CSDKN.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/dev-console/utils.ts"],"sourcesContent":["import {\n CopilotContextParams,\n CopilotMessagesContextParams,\n defaultCopilotContextCategories,\n} from \"@copilotkit/react-core\";\nimport { CopilotKitVersion } from \"./types\";\nexport { shouldShowDevConsole } from \"@copilotkit/react-core\";\n\nexport async function getPublishedCopilotKitVersion(\n current: string,\n forceCheck: boolean = false,\n): Promise<CopilotKitVersion> {\n const LOCAL_STORAGE_KEY = \"__copilotkit_version_check__\";\n const serializedVersion = localStorage.getItem(LOCAL_STORAGE_KEY);\n if (serializedVersion && !forceCheck) {\n try {\n const parsedVersion: CopilotKitVersion = JSON.parse(serializedVersion);\n const oneHour = 60 * 60 * 1000;\n const now = new Date().getTime();\n\n if (\n parsedVersion.current === current &&\n now - new Date(parsedVersion.lastChecked).getTime() < oneHour\n ) {\n return parsedVersion;\n }\n } catch (error) {\n console.error(\"Failed to parse CopilotKitVersion from localStorage\", error);\n }\n }\n\n try {\n const response = await fetch(\"https://api.cloud.copilotkit.ai/check-for-updates\", {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n packages: [\n {\n packageName: \"@copilotkit/shared\",\n packageVersion: current,\n },\n ],\n }),\n });\n\n const data = await response.json();\n\n const version: CopilotKitVersion = {\n current,\n lastChecked: new Date().getTime(),\n latest: data.packages[0].latestVersion,\n severity: data.packages[0].severity,\n advisory: data.packages[0].advisory || null,\n };\n\n localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(version));\n return version;\n } catch (error) {\n console.error(\"Failed to check for updates\", error);\n throw error;\n }\n}\n\nexport function logReadables(context: CopilotContextParams) {\n console.log(\"%cCurrent Readables:\", \"font-size: 16px; font-weight: bold;\");\n\n const readables = context.getContextString([], defaultCopilotContextCategories).trim();\n if (readables.length === 0) {\n console.log(\"No readables found\");\n return;\n }\n console.log(readables);\n}\n\nexport function logActions(context: CopilotContextParams) {\n console.log(\"%cCurrent Actions:\", \"font-size: 16px; font-weight: bold;\");\n\n if (Object.values(context.actions).length === 0) {\n console.log(\"No actions found\");\n return;\n }\n for (const action of Object.values(context.actions)) {\n console.group(action.name);\n console.log(\"name\", action.name);\n console.log(\"description\", action.description);\n console.log(\"parameters\", action.parameters);\n\n console.groupEnd();\n }\n}\n\nexport function logMessages(context: CopilotMessagesContextParams) {\n console.log(\"%cCurrent Messages:\", \"font-size: 16px; font-weight: bold;\");\n\n if (context.messages.length === 0) {\n console.log(\"No messages found\");\n return;\n }\n\n const tableData = context.messages.map((message) => {\n if (message.isTextMessage()) {\n return {\n id: message.id,\n type: \"TextMessage\",\n role: message.role,\n name: undefined,\n scope: undefined,\n content: message.content,\n };\n } else if (message.isActionExecutionMessage()) {\n return {\n id: message.id,\n type: \"ActionExecutionMessage\",\n role: undefined,\n name: message.name,\n scope: message.parentMessageId,\n content: message.arguments,\n };\n } else if (message.isResultMessage()) {\n return {\n id: message.id,\n type: \"ResultMessage\",\n role: undefined,\n name: message.actionName,\n scope: message.actionExecutionId,\n content: message.result,\n };\n } else if (message.isAgentStateMessage()) {\n return {\n id: message.id,\n type: `AgentStateMessage (running: ${message.running})`,\n role: message.role,\n name: undefined,\n scope: message.threadId,\n content: message.state,\n };\n }\n });\n console.table(tableData);\n}\n"],"mappings":";;;;;AAAA;AAAA,EAGE;AAAA,OACK;AAEP,SAAS,4BAA4B;AAErC,SAAsB,8BACpB,SACA,aAAsB,OAC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AQ;AAAA,QACf,SAAS,QAAQ;AAAA,MACnB;AAAA,IACF,WAAW,QAAQ,oBAAoB,GAAG;AACxC,aAAO;AAAA,QACL,IAAI,QAAQ;AAAA,QACZ,MAAM,+BAA+B,QAAQ;AAAA,QAC7C,MAAM,QAAQ;AAAA,QACd,MAAM;AAAA,QACN,OAAO,QAAQ;AAAA,QACf,SAAS,QAAQ;AAAA,MACnB;AAAA,IACF;AAAA,EACF,CAAC;AACD,UAAQ,MAAM,SAAS;AACzB;","names":[]}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RenderMessage
|
|
3
|
+
} from "./chunk-T5QU6KSB.mjs";
|
|
4
|
+
|
|
5
|
+
// src/components/chat/messages/LegacyRenderMessage.tsx
|
|
6
|
+
import { aguiToGQL } from "@copilotkit/runtime-client-gql";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
var LegacyRenderMessage = ({
|
|
9
|
+
message,
|
|
10
|
+
inProgress,
|
|
11
|
+
index,
|
|
12
|
+
isCurrentMessage,
|
|
13
|
+
actionResult,
|
|
14
|
+
AssistantMessage,
|
|
15
|
+
UserMessage,
|
|
16
|
+
ImageRenderer,
|
|
17
|
+
onRegenerate,
|
|
18
|
+
onCopy,
|
|
19
|
+
onThumbsUp,
|
|
20
|
+
onThumbsDown,
|
|
21
|
+
markdownTagRenderers,
|
|
22
|
+
legacyProps
|
|
23
|
+
}) => {
|
|
24
|
+
var _a;
|
|
25
|
+
const {
|
|
26
|
+
RenderTextMessage,
|
|
27
|
+
RenderActionExecutionMessage,
|
|
28
|
+
RenderAgentStateMessage,
|
|
29
|
+
RenderResultMessage,
|
|
30
|
+
RenderImageMessage
|
|
31
|
+
} = legacyProps;
|
|
32
|
+
const deprecatedMessage = (_a = aguiToGQL(message)[0]) != null ? _a : void 0;
|
|
33
|
+
if (deprecatedMessage.isTextMessage() && RenderTextMessage) {
|
|
34
|
+
return /* @__PURE__ */ jsx(
|
|
35
|
+
RenderTextMessage,
|
|
36
|
+
{
|
|
37
|
+
message,
|
|
38
|
+
inProgress,
|
|
39
|
+
index,
|
|
40
|
+
isCurrentMessage,
|
|
41
|
+
AssistantMessage,
|
|
42
|
+
UserMessage,
|
|
43
|
+
onRegenerate,
|
|
44
|
+
onCopy,
|
|
45
|
+
onThumbsUp,
|
|
46
|
+
onThumbsDown,
|
|
47
|
+
markdownTagRenderers
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
if (deprecatedMessage.isActionExecutionMessage() && RenderActionExecutionMessage) {
|
|
52
|
+
return /* @__PURE__ */ jsx(
|
|
53
|
+
RenderActionExecutionMessage,
|
|
54
|
+
{
|
|
55
|
+
message,
|
|
56
|
+
inProgress,
|
|
57
|
+
index,
|
|
58
|
+
isCurrentMessage,
|
|
59
|
+
actionResult,
|
|
60
|
+
AssistantMessage,
|
|
61
|
+
UserMessage
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
if (deprecatedMessage.isAgentStateMessage() && RenderAgentStateMessage) {
|
|
66
|
+
return /* @__PURE__ */ jsx(
|
|
67
|
+
RenderAgentStateMessage,
|
|
68
|
+
{
|
|
69
|
+
message,
|
|
70
|
+
inProgress,
|
|
71
|
+
index,
|
|
72
|
+
isCurrentMessage,
|
|
73
|
+
AssistantMessage,
|
|
74
|
+
UserMessage
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
if (deprecatedMessage.isResultMessage() && RenderResultMessage) {
|
|
79
|
+
return /* @__PURE__ */ jsx(
|
|
80
|
+
RenderResultMessage,
|
|
81
|
+
{
|
|
82
|
+
message,
|
|
83
|
+
inProgress,
|
|
84
|
+
index,
|
|
85
|
+
isCurrentMessage,
|
|
86
|
+
AssistantMessage,
|
|
87
|
+
UserMessage
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
if (deprecatedMessage.isImageMessage() && RenderImageMessage) {
|
|
92
|
+
return /* @__PURE__ */ jsx(
|
|
93
|
+
RenderImageMessage,
|
|
94
|
+
{
|
|
95
|
+
message,
|
|
96
|
+
inProgress,
|
|
97
|
+
index,
|
|
98
|
+
isCurrentMessage,
|
|
99
|
+
AssistantMessage,
|
|
100
|
+
UserMessage
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
return /* @__PURE__ */ jsx(
|
|
105
|
+
RenderMessage,
|
|
106
|
+
{
|
|
107
|
+
message,
|
|
108
|
+
inProgress,
|
|
109
|
+
index,
|
|
110
|
+
isCurrentMessage,
|
|
111
|
+
AssistantMessage,
|
|
112
|
+
UserMessage,
|
|
113
|
+
ImageRenderer,
|
|
114
|
+
onRegenerate,
|
|
115
|
+
onCopy,
|
|
116
|
+
onThumbsUp,
|
|
117
|
+
onThumbsDown,
|
|
118
|
+
markdownTagRenderers
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export {
|
|
124
|
+
LegacyRenderMessage
|
|
125
|
+
};
|
|
126
|
+
//# sourceMappingURL=chunk-MIVUCSGO.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/messages/LegacyRenderMessage.tsx"],"sourcesContent":["import React from \"react\";\nimport { RenderMessageProps } from \"../props\";\nimport { RenderMessage as DefaultRenderMessage } from \"./RenderMessage\";\nimport { aguiToGQL } from \"@copilotkit/runtime-client-gql\";\n\n/**\n * Legacy message render props interface for backwards compatibility\n */\nexport interface LegacyRenderProps {\n RenderTextMessage?: React.ComponentType<RenderMessageProps>;\n RenderActionExecutionMessage?: React.ComponentType<RenderMessageProps>;\n RenderAgentStateMessage?: React.ComponentType<RenderMessageProps>;\n RenderResultMessage?: React.ComponentType<RenderMessageProps>;\n RenderImageMessage?: React.ComponentType<RenderMessageProps>;\n}\n\n/**\n * Props for the LegacyRenderMessage component\n */\nexport interface LegacyRenderMessageProps extends RenderMessageProps {\n legacyProps: LegacyRenderProps;\n}\n\n/**\n * Legacy message adapter component that maps old render props to new message types.\n * This component provides backwards compatibility for the deprecated render props.\n */\nexport const LegacyRenderMessage: React.FC<LegacyRenderMessageProps> = ({\n message,\n inProgress,\n index,\n isCurrentMessage,\n actionResult,\n AssistantMessage,\n UserMessage,\n ImageRenderer,\n onRegenerate,\n onCopy,\n onThumbsUp,\n onThumbsDown,\n markdownTagRenderers,\n legacyProps,\n}) => {\n const {\n RenderTextMessage,\n RenderActionExecutionMessage,\n RenderAgentStateMessage,\n RenderResultMessage,\n RenderImageMessage,\n } = legacyProps;\n\n const deprecatedMessage = aguiToGQL(message)[0] ?? undefined;\n\n // Route to appropriate legacy renderer based on message type\n if (deprecatedMessage.isTextMessage() && RenderTextMessage) {\n return (\n <RenderTextMessage\n message={message}\n inProgress={inProgress}\n index={index}\n isCurrentMessage={isCurrentMessage}\n AssistantMessage={AssistantMessage}\n UserMessage={UserMessage}\n onRegenerate={onRegenerate}\n onCopy={onCopy}\n onThumbsUp={onThumbsUp}\n onThumbsDown={onThumbsDown}\n markdownTagRenderers={markdownTagRenderers}\n />\n );\n }\n\n if (deprecatedMessage.isActionExecutionMessage() && RenderActionExecutionMessage) {\n return (\n <RenderActionExecutionMessage\n message={message}\n inProgress={inProgress}\n index={index}\n isCurrentMessage={isCurrentMessage}\n actionResult={actionResult}\n AssistantMessage={AssistantMessage}\n UserMessage={UserMessage}\n />\n );\n }\n\n if (deprecatedMessage.isAgentStateMessage() && RenderAgentStateMessage) {\n return (\n <RenderAgentStateMessage\n message={message}\n inProgress={inProgress}\n index={index}\n isCurrentMessage={isCurrentMessage}\n AssistantMessage={AssistantMessage}\n UserMessage={UserMessage}\n />\n );\n }\n\n if (deprecatedMessage.isResultMessage() && RenderResultMessage) {\n return (\n <RenderResultMessage\n message={message}\n inProgress={inProgress}\n index={index}\n isCurrentMessage={isCurrentMessage}\n AssistantMessage={AssistantMessage}\n UserMessage={UserMessage}\n />\n );\n }\n\n if (deprecatedMessage.isImageMessage() && RenderImageMessage) {\n return (\n <RenderImageMessage\n message={message}\n inProgress={inProgress}\n index={index}\n isCurrentMessage={isCurrentMessage}\n AssistantMessage={AssistantMessage}\n UserMessage={UserMessage}\n />\n );\n }\n\n // Fallback to default RenderMessage for any unhandled cases\n return (\n <DefaultRenderMessage\n message={message}\n inProgress={inProgress}\n index={index}\n isCurrentMessage={isCurrentMessage}\n AssistantMessage={AssistantMessage}\n UserMessage={UserMessage}\n ImageRenderer={ImageRenderer}\n onRegenerate={onRegenerate}\n onCopy={onCopy}\n onThumbsUp={onThumbsUp}\n onThumbsDown={onThumbsDown}\n markdownTagRenderers={markdownTagRenderers}\n />\n );\n};\n"],"mappings":";;;;;AAGA,SAAS,iBAAiB;AAqDpB;AA7BC,IAAM,sBAA0D,CAAC;AAAA,EACtE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AA1CN;AA2CE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAM,qBAAoB,eAAU,OAAO,EAAE,CAAC,MAApB,YAAyB;AAGnD,MAAI,kBAAkB,cAAc,KAAK,mBAAmB;AAC1D,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF;AAAA,EAEJ;AAEA,MAAI,kBAAkB,yBAAyB,KAAK,8BAA8B;AAChF,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF;AAAA,EAEJ;AAEA,MAAI,kBAAkB,oBAAoB,KAAK,yBAAyB;AACtE,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF;AAAA,EAEJ;AAEA,MAAI,kBAAkB,gBAAgB,KAAK,qBAAqB;AAC9D,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF;AAAA,EAEJ;AAEA,MAAI,kBAAkB,eAAe,KAAK,oBAAoB;AAC5D,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF;AAAA,EAEJ;AAGA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -23,6 +23,7 @@ function RenderMessage(_a) {
|
|
|
23
23
|
"AssistantMessage",
|
|
24
24
|
"ImageRenderer"
|
|
25
25
|
]);
|
|
26
|
+
var _a2;
|
|
26
27
|
const {
|
|
27
28
|
message,
|
|
28
29
|
inProgress,
|
|
@@ -39,6 +40,7 @@ function RenderMessage(_a) {
|
|
|
39
40
|
return /* @__PURE__ */ jsx(
|
|
40
41
|
UserMessage2,
|
|
41
42
|
{
|
|
43
|
+
rawData: message,
|
|
42
44
|
"data-message-role": "user",
|
|
43
45
|
message,
|
|
44
46
|
ImageRenderer: ImageRenderer2
|
|
@@ -50,6 +52,8 @@ function RenderMessage(_a) {
|
|
|
50
52
|
AssistantMessage2,
|
|
51
53
|
{
|
|
52
54
|
"data-message-role": "assistant",
|
|
55
|
+
subComponent: (_a2 = message.generativeUI) == null ? void 0 : _a2.call(message),
|
|
56
|
+
rawData: message,
|
|
53
57
|
message,
|
|
54
58
|
isLoading: inProgress && isCurrentMessage && !message.content,
|
|
55
59
|
isGenerating: inProgress && isCurrentMessage && !!message.content,
|
|
@@ -69,4 +73,4 @@ function RenderMessage(_a) {
|
|
|
69
73
|
export {
|
|
70
74
|
RenderMessage
|
|
71
75
|
};
|
|
72
|
-
//# sourceMappingURL=chunk-
|
|
76
|
+
//# sourceMappingURL=chunk-T5QU6KSB.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/messages/RenderMessage.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"],"mappings":";;;;;;;;;;;;;;AA0BQ;AArBD,SAAS,cAAc,IAKP;AALO,eAC5B;AAAA,iBAAAA,eAAc;AAAA,IACd,kBAAAC,oBAAmB;AAAA,IACnB,eAAAC,iBAAgB;AAAA,EARlB,IAK8B,IAIzB,kBAJyB,IAIzB;AAAA,IAHH;AAAA,IACA;AAAA,IACA;AAAA;AARF,MAAAC;AAWE,QAAM;AAAA,IACJ;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,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;AAAA,UACA,eAAeD;AAAA;AAAA,QAbV;AAAA,MAcP;AAAA,EAEN;AACF;","names":["UserMessage","AssistantMessage","ImageRenderer","_a"]}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-XWG3L6QC.mjs";
|
|
4
4
|
|
|
5
5
|
// src/components/chat/Suggestion.tsx
|
|
6
|
-
import { useCopilotChat } from "@copilotkit/react-core";
|
|
6
|
+
import { useCopilotChatInternal as useCopilotChat } from "@copilotkit/react-core";
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
|
8
8
|
function Suggestion({ title, onClick, partial, className }) {
|
|
9
9
|
if (!title)
|
|
@@ -27,4 +27,4 @@ function Suggestion({ title, onClick, partial, className }) {
|
|
|
27
27
|
export {
|
|
28
28
|
Suggestion
|
|
29
29
|
};
|
|
30
|
-
//# sourceMappingURL=chunk-
|
|
30
|
+
//# sourceMappingURL=chunk-W26XFBEG.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/Suggestion.tsx"],"sourcesContent":["import { useCopilotChatInternal as useCopilotChat } from \"@copilotkit/react-core\";\nimport { SmallSpinnerIcon } from \"./Icons\";\n\ninterface SuggestionsProps {\n title: string;\n message: string;\n partial?: boolean;\n className?: string;\n onClick: () => void;\n}\n\nexport function Suggestion({ title, onClick, partial, className }: SuggestionsProps) {\n if (!title) return null;\n const { isLoading } = useCopilotChat();\n\n return (\n <button\n disabled={partial || isLoading}\n onClick={(e) => {\n e.preventDefault();\n onClick();\n }}\n className={className || (partial ? \"suggestion loading\" : \"suggestion\")}\n data-test-id=\"suggestion\"\n >\n {partial ? SmallSpinnerIcon : <span>{title}</span>}\n </button>\n );\n}\n"],"mappings":";;;;;AAAA,SAAS,0BAA0B,sBAAsB;AAyBrB;AAd7B,SAAS,WAAW,EAAE,OAAO,SAAS,SAAS,UAAU,GAAqB;AACnF,MAAI,CAAC;AAAO,WAAO;AACnB,QAAM,EAAE,UAAU,IAAI,eAAe;AAErC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,UAAU,WAAW;AAAA,MACrB,SAAS,CAAC,MAAM;AACd,UAAE,eAAe;AACjB,gBAAQ;AAAA,MACV;AAAA,MACA,WAAW,cAAc,UAAU,uBAAuB;AAAA,MAC1D,gBAAa;AAAA,MAEZ,oBAAU,mBAAmB,oBAAC,UAAM,iBAAM;AAAA;AAAA,EAC7C;AAEJ;","names":[]}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Window
|
|
3
|
+
} from "./chunk-C3GSYRC3.mjs";
|
|
4
|
+
import {
|
|
5
|
+
Header
|
|
6
|
+
} from "./chunk-GDSZGYCE.mjs";
|
|
7
|
+
import {
|
|
8
|
+
Button
|
|
9
|
+
} from "./chunk-UFN2VWSR.mjs";
|
|
10
|
+
import {
|
|
11
|
+
CopilotChat
|
|
12
|
+
} from "./chunk-GJ4SX4JE.mjs";
|
|
13
|
+
import {
|
|
14
|
+
Input
|
|
15
|
+
} from "./chunk-DTRPPNSA.mjs";
|
|
16
|
+
import {
|
|
17
|
+
Messages
|
|
18
|
+
} from "./chunk-BJHJBS5M.mjs";
|
|
19
|
+
import {
|
|
20
|
+
AssistantMessage
|
|
21
|
+
} from "./chunk-GCKKSSBU.mjs";
|
|
22
|
+
import {
|
|
23
|
+
UserMessage
|
|
24
|
+
} from "./chunk-VVL6JFCJ.mjs";
|
|
25
|
+
import {
|
|
26
|
+
ChatContextProvider,
|
|
27
|
+
useChatContext
|
|
28
|
+
} from "./chunk-IEMQ2SQW.mjs";
|
|
29
|
+
import {
|
|
30
|
+
__objRest,
|
|
31
|
+
__spreadProps,
|
|
32
|
+
__spreadValues
|
|
33
|
+
} from "./chunk-MRXNTQOX.mjs";
|
|
34
|
+
|
|
35
|
+
// src/components/chat/Modal.tsx
|
|
36
|
+
import React, { useMemo, useCallback, useEffect, useRef } from "react";
|
|
37
|
+
import { useCopilotContext } from "@copilotkit/react-core";
|
|
38
|
+
import {
|
|
39
|
+
CopilotKitError,
|
|
40
|
+
CopilotKitErrorCode,
|
|
41
|
+
Severity,
|
|
42
|
+
ErrorVisibility,
|
|
43
|
+
styledConsole
|
|
44
|
+
} from "@copilotkit/shared";
|
|
45
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
46
|
+
var CopilotModalInner = (_a) => {
|
|
47
|
+
var _b = _a, {
|
|
48
|
+
observabilityHooks,
|
|
49
|
+
onSetOpen,
|
|
50
|
+
clickOutsideToClose,
|
|
51
|
+
hitEscapeToClose,
|
|
52
|
+
shortcut,
|
|
53
|
+
className,
|
|
54
|
+
children,
|
|
55
|
+
Window: Window2,
|
|
56
|
+
Button: Button2,
|
|
57
|
+
Header: Header2
|
|
58
|
+
} = _b, chatProps = __objRest(_b, [
|
|
59
|
+
"observabilityHooks",
|
|
60
|
+
"onSetOpen",
|
|
61
|
+
"clickOutsideToClose",
|
|
62
|
+
"hitEscapeToClose",
|
|
63
|
+
"shortcut",
|
|
64
|
+
"className",
|
|
65
|
+
"children",
|
|
66
|
+
"Window",
|
|
67
|
+
"Button",
|
|
68
|
+
"Header"
|
|
69
|
+
]);
|
|
70
|
+
const { copilotApiConfig, setBannerError } = useCopilotContext();
|
|
71
|
+
const { publicApiKey } = copilotApiConfig;
|
|
72
|
+
const triggerObservabilityHook = useCallback(
|
|
73
|
+
(hookName, ...args) => {
|
|
74
|
+
if (publicApiKey && (observabilityHooks == null ? void 0 : observabilityHooks[hookName])) {
|
|
75
|
+
observabilityHooks[hookName](...args);
|
|
76
|
+
}
|
|
77
|
+
if ((observabilityHooks == null ? void 0 : observabilityHooks[hookName]) && !publicApiKey) {
|
|
78
|
+
setBannerError(
|
|
79
|
+
new CopilotKitError({
|
|
80
|
+
message: "observabilityHooks requires a publicApiKey to function.",
|
|
81
|
+
code: CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR,
|
|
82
|
+
severity: Severity.CRITICAL,
|
|
83
|
+
visibility: ErrorVisibility.BANNER
|
|
84
|
+
})
|
|
85
|
+
);
|
|
86
|
+
styledConsole.publicApiKeyRequired("observabilityHooks");
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
[publicApiKey, observabilityHooks, setBannerError]
|
|
90
|
+
);
|
|
91
|
+
const { open } = useChatContext();
|
|
92
|
+
const prevOpen = useRef(open);
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
if (prevOpen.current !== open) {
|
|
95
|
+
onSetOpen == null ? void 0 : onSetOpen(open);
|
|
96
|
+
if (open) {
|
|
97
|
+
triggerObservabilityHook("onChatExpanded");
|
|
98
|
+
} else {
|
|
99
|
+
triggerObservabilityHook("onChatMinimized");
|
|
100
|
+
}
|
|
101
|
+
prevOpen.current = open;
|
|
102
|
+
}
|
|
103
|
+
}, [open, onSetOpen, triggerObservabilityHook]);
|
|
104
|
+
const memoizedHeader = useMemo(() => /* @__PURE__ */ jsx(Header2, {}), [Header2]);
|
|
105
|
+
const memoizedChildren = useMemo(() => children, [children]);
|
|
106
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
107
|
+
memoizedChildren,
|
|
108
|
+
/* @__PURE__ */ jsxs("div", { className, children: [
|
|
109
|
+
/* @__PURE__ */ jsx(Button2, {}),
|
|
110
|
+
/* @__PURE__ */ jsxs(
|
|
111
|
+
Window2,
|
|
112
|
+
{
|
|
113
|
+
clickOutsideToClose,
|
|
114
|
+
shortcut,
|
|
115
|
+
hitEscapeToClose,
|
|
116
|
+
children: [
|
|
117
|
+
memoizedHeader,
|
|
118
|
+
/* @__PURE__ */ jsx(CopilotChat, __spreadProps(__spreadValues({}, chatProps), { observabilityHooks }))
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
] })
|
|
123
|
+
] });
|
|
124
|
+
};
|
|
125
|
+
var CopilotModal = (_a) => {
|
|
126
|
+
var _b = _a, {
|
|
127
|
+
instructions,
|
|
128
|
+
defaultOpen = false,
|
|
129
|
+
clickOutsideToClose = true,
|
|
130
|
+
hitEscapeToClose = true,
|
|
131
|
+
onSetOpen,
|
|
132
|
+
onSubmitMessage,
|
|
133
|
+
onStopGeneration,
|
|
134
|
+
onReloadMessages,
|
|
135
|
+
shortcut = "/",
|
|
136
|
+
icons,
|
|
137
|
+
labels,
|
|
138
|
+
makeSystemMessage,
|
|
139
|
+
onInProgress,
|
|
140
|
+
Window: Window2 = Window,
|
|
141
|
+
Button: Button2 = Button,
|
|
142
|
+
Header: Header2 = Header,
|
|
143
|
+
Messages: Messages2 = Messages,
|
|
144
|
+
Input: Input2 = Input,
|
|
145
|
+
AssistantMessage: AssistantMessage2 = AssistantMessage,
|
|
146
|
+
UserMessage: UserMessage2 = UserMessage,
|
|
147
|
+
onThumbsUp,
|
|
148
|
+
onThumbsDown,
|
|
149
|
+
onCopy,
|
|
150
|
+
onRegenerate,
|
|
151
|
+
markdownTagRenderers,
|
|
152
|
+
className,
|
|
153
|
+
children,
|
|
154
|
+
observabilityHooks
|
|
155
|
+
} = _b, props = __objRest(_b, [
|
|
156
|
+
"instructions",
|
|
157
|
+
"defaultOpen",
|
|
158
|
+
"clickOutsideToClose",
|
|
159
|
+
"hitEscapeToClose",
|
|
160
|
+
"onSetOpen",
|
|
161
|
+
"onSubmitMessage",
|
|
162
|
+
"onStopGeneration",
|
|
163
|
+
"onReloadMessages",
|
|
164
|
+
"shortcut",
|
|
165
|
+
"icons",
|
|
166
|
+
"labels",
|
|
167
|
+
"makeSystemMessage",
|
|
168
|
+
"onInProgress",
|
|
169
|
+
"Window",
|
|
170
|
+
"Button",
|
|
171
|
+
"Header",
|
|
172
|
+
"Messages",
|
|
173
|
+
"Input",
|
|
174
|
+
"AssistantMessage",
|
|
175
|
+
"UserMessage",
|
|
176
|
+
"onThumbsUp",
|
|
177
|
+
"onThumbsDown",
|
|
178
|
+
"onCopy",
|
|
179
|
+
"onRegenerate",
|
|
180
|
+
"markdownTagRenderers",
|
|
181
|
+
"className",
|
|
182
|
+
"children",
|
|
183
|
+
"observabilityHooks"
|
|
184
|
+
]);
|
|
185
|
+
const [openState, setOpenState] = React.useState(defaultOpen);
|
|
186
|
+
return /* @__PURE__ */ jsx(ChatContextProvider, { icons, labels, open: openState, setOpen: setOpenState, children: /* @__PURE__ */ jsx(
|
|
187
|
+
CopilotModalInner,
|
|
188
|
+
__spreadProps(__spreadValues({
|
|
189
|
+
observabilityHooks,
|
|
190
|
+
onSetOpen,
|
|
191
|
+
clickOutsideToClose: clickOutsideToClose != null ? clickOutsideToClose : true,
|
|
192
|
+
hitEscapeToClose: hitEscapeToClose != null ? hitEscapeToClose : true,
|
|
193
|
+
shortcut: shortcut != null ? shortcut : "/",
|
|
194
|
+
className,
|
|
195
|
+
Window: Window2,
|
|
196
|
+
Button: Button2,
|
|
197
|
+
Header: Header2,
|
|
198
|
+
instructions,
|
|
199
|
+
onSubmitMessage,
|
|
200
|
+
onStopGeneration,
|
|
201
|
+
onReloadMessages,
|
|
202
|
+
makeSystemMessage,
|
|
203
|
+
onInProgress,
|
|
204
|
+
Messages: Messages2,
|
|
205
|
+
Input: Input2,
|
|
206
|
+
AssistantMessage: AssistantMessage2,
|
|
207
|
+
UserMessage: UserMessage2,
|
|
208
|
+
onThumbsUp,
|
|
209
|
+
onThumbsDown,
|
|
210
|
+
onCopy,
|
|
211
|
+
onRegenerate,
|
|
212
|
+
markdownTagRenderers
|
|
213
|
+
}, props), {
|
|
214
|
+
children
|
|
215
|
+
})
|
|
216
|
+
) });
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
export {
|
|
220
|
+
CopilotModal
|
|
221
|
+
};
|
|
222
|
+
//# sourceMappingURL=chunk-Y44VLEUH.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/Modal.tsx"],"sourcesContent":["import React, { useMemo, useCallback, useEffect, useRef } from \"react\";\nimport { ChatContextProvider, useChatContext } from \"./ChatContext\";\nimport { ButtonProps, HeaderProps, WindowProps, CopilotObservabilityHooks } from \"./props\";\nimport { Window as DefaultWindow } from \"./Window\";\nimport { Button as DefaultButton } from \"./Button\";\nimport { Header as DefaultHeader } from \"./Header\";\nimport { Messages as DefaultMessages } from \"./Messages\";\nimport { Input as DefaultInput } from \"./Input\";\nimport { CopilotChat, CopilotChatProps } from \"./Chat\";\nimport { AssistantMessage as DefaultAssistantMessage } from \"./messages/AssistantMessage\";\nimport { UserMessage as DefaultUserMessage } from \"./messages/UserMessage\";\nimport { useCopilotContext } from \"@copilotkit/react-core\";\nimport {\n CopilotKitError,\n CopilotKitErrorCode,\n Severity,\n ErrorVisibility,\n styledConsole,\n} from \"@copilotkit/shared\";\n\nexport interface CopilotModalProps extends CopilotChatProps {\n /**\n * Whether the chat window should be open by default.\n * @default false\n */\n defaultOpen?: boolean;\n\n /**\n * If the chat window should close when the user clicks outside of it.\n * @default true\n */\n clickOutsideToClose?: boolean;\n\n /**\n * If the chat window should close when the user hits the Escape key.\n * @default true\n */\n hitEscapeToClose?: boolean;\n\n /**\n * The shortcut key to open the chat window.\n * Uses Command-[shortcut] on a Mac and Ctrl-[shortcut] on Windows.\n * @default '/'\n */\n shortcut?: string;\n\n /**\n * A callback that gets called when the chat window opens or closes.\n */\n onSetOpen?: (open: boolean) => void;\n\n /**\n * A custom Window component to use instead of the default.\n */\n Window?: React.ComponentType<WindowProps>;\n\n /**\n * A custom Button component to use instead of the default.\n */\n Button?: React.ComponentType<ButtonProps>;\n\n /**\n * A custom Header component to use instead of the default.\n */\n Header?: React.ComponentType<HeaderProps>;\n}\n\n// Inner component that has access to the Copilot context\nconst CopilotModalInner = ({\n observabilityHooks,\n onSetOpen,\n clickOutsideToClose,\n hitEscapeToClose,\n shortcut,\n className,\n children,\n Window,\n Button,\n Header,\n ...chatProps\n}: Omit<CopilotModalProps, \"icons\" | \"labels\" | \"defaultOpen\"> & {\n Window: React.ComponentType<WindowProps>;\n Button: React.ComponentType<ButtonProps>;\n Header: React.ComponentType<HeaderProps>;\n clickOutsideToClose: boolean;\n hitEscapeToClose: boolean;\n shortcut: string;\n}) => {\n const { copilotApiConfig, setBannerError } = useCopilotContext();\n\n // Destructure stable values to avoid object reference changes\n const { publicApiKey } = copilotApiConfig;\n\n // Helper function to trigger event hooks only if publicApiKey is provided\n const triggerObservabilityHook = useCallback(\n (hookName: keyof CopilotObservabilityHooks, ...args: any[]) => {\n if (publicApiKey && observabilityHooks?.[hookName]) {\n (observabilityHooks[hookName] as any)(...args);\n }\n if (observabilityHooks?.[hookName] && !publicApiKey) {\n setBannerError(\n new CopilotKitError({\n message: \"observabilityHooks requires a publicApiKey to function.\",\n code: CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR,\n severity: Severity.CRITICAL,\n visibility: ErrorVisibility.BANNER,\n }),\n );\n styledConsole.publicApiKeyRequired(\"observabilityHooks\");\n }\n },\n [publicApiKey, observabilityHooks, setBannerError],\n );\n\n const { open } = useChatContext();\n const prevOpen = useRef(open);\n\n // Monitor open state changes and trigger event hooks\n useEffect(() => {\n if (prevOpen.current !== open) {\n onSetOpen?.(open);\n\n // Trigger chat minimize/expand events\n if (open) {\n triggerObservabilityHook(\"onChatExpanded\");\n } else {\n triggerObservabilityHook(\"onChatMinimized\");\n }\n prevOpen.current = open;\n }\n }, [open, onSetOpen, triggerObservabilityHook]);\n\n const memoizedHeader = useMemo(() => <Header />, [Header]);\n const memoizedChildren = useMemo(() => children, [children]);\n\n return (\n <>\n {memoizedChildren}\n <div className={className}>\n <Button></Button>\n <Window\n clickOutsideToClose={clickOutsideToClose}\n shortcut={shortcut}\n hitEscapeToClose={hitEscapeToClose}\n >\n {memoizedHeader}\n <CopilotChat {...chatProps} observabilityHooks={observabilityHooks} />\n </Window>\n </div>\n </>\n );\n};\n\nexport const CopilotModal = ({\n instructions,\n defaultOpen = false,\n clickOutsideToClose = true,\n hitEscapeToClose = true,\n onSetOpen,\n onSubmitMessage,\n onStopGeneration,\n onReloadMessages,\n shortcut = \"/\",\n icons,\n labels,\n makeSystemMessage,\n onInProgress,\n Window = DefaultWindow,\n Button = DefaultButton,\n Header = DefaultHeader,\n Messages = DefaultMessages,\n Input = DefaultInput,\n AssistantMessage = DefaultAssistantMessage,\n UserMessage = DefaultUserMessage,\n onThumbsUp,\n onThumbsDown,\n onCopy,\n onRegenerate,\n markdownTagRenderers,\n className,\n children,\n observabilityHooks,\n ...props\n}: CopilotModalProps) => {\n const [openState, setOpenState] = React.useState(defaultOpen);\n\n return (\n <ChatContextProvider icons={icons} labels={labels} open={openState} setOpen={setOpenState}>\n <CopilotModalInner\n observabilityHooks={observabilityHooks}\n onSetOpen={onSetOpen}\n clickOutsideToClose={clickOutsideToClose ?? true}\n hitEscapeToClose={hitEscapeToClose ?? true}\n shortcut={shortcut ?? \"/\"}\n className={className}\n Window={Window}\n Button={Button}\n Header={Header}\n instructions={instructions}\n onSubmitMessage={onSubmitMessage}\n onStopGeneration={onStopGeneration}\n onReloadMessages={onReloadMessages}\n makeSystemMessage={makeSystemMessage}\n onInProgress={onInProgress}\n Messages={Messages}\n Input={Input}\n AssistantMessage={AssistantMessage}\n UserMessage={UserMessage}\n onThumbsUp={onThumbsUp}\n onThumbsDown={onThumbsDown}\n onCopy={onCopy}\n onRegenerate={onRegenerate}\n markdownTagRenderers={markdownTagRenderers}\n {...props}\n >\n {children}\n </CopilotModalInner>\n </ChatContextProvider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,SAAS,SAAS,aAAa,WAAW,cAAc;AAW/D,SAAS,yBAAyB;AAClC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAkHgC,SAInC,UAJmC,KAQ/B,YAR+B;AAhEvC,IAAM,oBAAoB,CAAC,OAmBrB;AAnBqB,eACzB;AAAA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAAA;AAAA,IACA,QAAAC;AAAA,IACA,QAAAC;AAAA,EA9EF,IAoE2B,IAWtB,sBAXsB,IAWtB;AAAA,IAVH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAUA,QAAM,EAAE,kBAAkB,eAAe,IAAI,kBAAkB;AAG/D,QAAM,EAAE,aAAa,IAAI;AAGzB,QAAM,2BAA2B;AAAA,IAC/B,CAAC,aAA8C,SAAgB;AAC7D,UAAI,iBAAgB,yDAAqB,YAAW;AAClD,QAAC,mBAAmB,QAAQ,EAAU,GAAG,IAAI;AAAA,MAC/C;AACA,WA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AAA,IACT,QAAAC,UAAS;AAAA,IACT,QAAAC,UAAS;AAAA,IACT,UAAAC,YAAW;AAAA,IACX,OAAAC,SAAQ;AAAA,IACR,kBAAAC,oBAAmB;AAAA,IACnB,aAAAC,eAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EArLF,IAyJ6B,IA6BxB,kBA7BwB,IA6BxB;AAAA,IA5BH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAGA,QAAM,CAAC,WAAW,YAAY,IAAI,MAAM,SAAS,WAAW;AAE5D,SACE,oBAAC,uBAAoB,OAAc,QAAgB,MAAM,WAAW,SAAS,cAC3E;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,qBAAqB,oDAAuB;AAAA,MAC5C,kBAAkB,8CAAoB;AAAA,MACtC,UAAU,8BAAY;AAAA,MACtB;AAAA,MACA,QAAQN;AAAA,MACR,QAAQC;AAAA,MACR,QAAQC;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAUC;AAAA,MACV,OAAOC;AAAA,MACP,kBAAkBC;AAAA,MAClB,aAAaC;AAAA,MACb;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,OACI,QAzBL;AAAA,MA2BE;AAAA;AAAA,EACH,GACF;AAEJ;","names":["Window","Button","Header","Messages","Input","AssistantMessage","UserMessage"]}
|