781 lines
23 KiB
TypeScript
781 lines
23 KiB
TypeScript
import { AIMessage, CopilotErrorEvent, CopilotErrorHandler, ImageData, Message, UserMessage as UserMessage$2 } from "@copilotkit/shared";
|
||
import React$1, { CSSProperties, ReactNode } from "react";
|
||
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
||
import { ChatSuggestions, OnReloadMessages, OnStopGeneration, SystemMessageFunction, UseCopilotChatSuggestionsConfiguration, shouldShowDevConsole } from "@copilotkit/react-core";
|
||
import { Components } from "react-markdown";
|
||
|
||
//#region src/types/suggestions.d.ts
|
||
interface CopilotChatSuggestion {
|
||
title: string;
|
||
message: string;
|
||
partial?: boolean;
|
||
isLoading?: boolean;
|
||
className?: string;
|
||
}
|
||
//#endregion
|
||
//#region src/components/chat/props.d.ts
|
||
/**
|
||
* Event hooks for CopilotKit chat events.
|
||
* These hooks only work when publicApiKey is provided.
|
||
*/
|
||
interface CopilotObservabilityHooks {
|
||
/**
|
||
* Called when a message is sent by the user
|
||
*/
|
||
onMessageSent?: (message: string) => void;
|
||
/**
|
||
* Called when the chat is minimized/closed
|
||
*/
|
||
onChatMinimized?: () => void;
|
||
/**
|
||
* Called when the chat is expanded/opened
|
||
*/
|
||
onChatExpanded?: () => void;
|
||
/**
|
||
* Called when a message is regenerated
|
||
*/
|
||
onMessageRegenerated?: (messageId: string) => void;
|
||
/**
|
||
* Called when a message is copied
|
||
*/
|
||
onMessageCopied?: (content: string) => void;
|
||
/**
|
||
* Called when feedback is given (thumbs up/down)
|
||
*/
|
||
onFeedbackGiven?: (messageId: string, type: "thumbsUp" | "thumbsDown") => void;
|
||
/**
|
||
* Called when chat generation starts
|
||
*/
|
||
onChatStarted?: () => void;
|
||
/**
|
||
* Called when chat generation stops
|
||
*/
|
||
onChatStopped?: () => void;
|
||
/**
|
||
* Called when an error occurs in the chat
|
||
* This enables chat-specific error handling UX while preserving system-wide error monitoring
|
||
*/
|
||
onError?: (errorEvent: CopilotErrorEvent) => void;
|
||
}
|
||
interface ButtonProps {}
|
||
interface WindowProps {
|
||
clickOutsideToClose: boolean;
|
||
hitEscapeToClose: boolean;
|
||
shortcut: string;
|
||
children?: React.ReactNode;
|
||
}
|
||
interface HeaderProps {}
|
||
interface SuggestionsProps {
|
||
title: string;
|
||
message: string;
|
||
partial?: boolean;
|
||
className?: string;
|
||
onClick: (message: string) => void;
|
||
}
|
||
type ComponentsMap<T extends Record<string, object> = Record<string, object>> = { [K in keyof T]: React.FC<{
|
||
children?: ReactNode;
|
||
} & T[K]> };
|
||
interface MessagesProps {
|
||
messages: Message[];
|
||
inProgress: boolean;
|
||
children?: React.ReactNode;
|
||
chatError?: ChatError | null;
|
||
AssistantMessage: React.ComponentType<AssistantMessageProps>;
|
||
UserMessage: React.ComponentType<UserMessageProps>;
|
||
ErrorMessage?: React.ComponentType<ErrorMessageProps>;
|
||
RenderMessage: React.ComponentType<RenderMessageProps>;
|
||
ImageRenderer: React.ComponentType<ImageRendererProps>;
|
||
/**
|
||
* Callback function to regenerate the assistant's response
|
||
*/
|
||
onRegenerate?: (messageId: string) => void;
|
||
/**
|
||
* Callback function when the message is copied
|
||
*/
|
||
onCopy?: (message: string) => void;
|
||
/**
|
||
* Callback function for thumbs up feedback
|
||
*/
|
||
onThumbsUp?: (message: Message) => void;
|
||
/**
|
||
* Callback function for thumbs down feedback
|
||
*/
|
||
onThumbsDown?: (message: Message) => void;
|
||
/**
|
||
* Map of message IDs to their feedback state
|
||
*/
|
||
messageFeedback?: Record<string, "thumbsUp" | "thumbsDown">;
|
||
/**
|
||
* A list of markdown components to render in assistant message.
|
||
* Useful when you want to render custom elements in the message (e.g a reference tag element)
|
||
*/
|
||
markdownTagRenderers?: ComponentsMap;
|
||
/**
|
||
* @deprecated Use RenderMessage instead
|
||
*/
|
||
RenderTextMessage?: React.ComponentType<RenderMessageProps>;
|
||
/**
|
||
* @deprecated Use RenderMessage instead
|
||
*/
|
||
RenderActionExecutionMessage?: React.ComponentType<RenderMessageProps>;
|
||
/**
|
||
* @deprecated Use RenderMessage instead
|
||
*/
|
||
RenderAgentStateMessage?: React.ComponentType<RenderMessageProps>;
|
||
/**
|
||
* @deprecated Use RenderMessage instead
|
||
*/
|
||
RenderResultMessage?: React.ComponentType<RenderMessageProps>;
|
||
/**
|
||
* @deprecated Use RenderMessage instead
|
||
*/
|
||
RenderImageMessage?: React.ComponentType<RenderMessageProps>;
|
||
}
|
||
interface Renderer {
|
||
content: string;
|
||
}
|
||
interface UserMessageProps {
|
||
message?: UserMessage$2;
|
||
ImageRenderer: React.ComponentType<ImageRendererProps>;
|
||
/**
|
||
* @deprecated use message instead
|
||
*
|
||
* The raw data from the assistant's response
|
||
*/
|
||
rawData: any;
|
||
}
|
||
interface AssistantMessageProps {
|
||
/**
|
||
* The message content from the assistant
|
||
*/
|
||
message?: AIMessage;
|
||
messages?: Message[];
|
||
/**
|
||
* Indicates if this is the last message
|
||
*/
|
||
isCurrentMessage?: boolean;
|
||
/**
|
||
* Whether a response is loading, this is when the LLM is thinking of a response but hasn't finished yet.
|
||
*/
|
||
isLoading: boolean;
|
||
/**
|
||
* Whether a response is generating, this is when the LLM is actively generating and streaming content.
|
||
*/
|
||
isGenerating: boolean;
|
||
/**
|
||
* Callback function to regenerate the assistant's response
|
||
*/
|
||
onRegenerate?: () => void;
|
||
/**
|
||
* Callback function when the message is copied
|
||
*/
|
||
onCopy?: (message: string) => void;
|
||
/**
|
||
* Callback function for thumbs up feedback
|
||
*/
|
||
onThumbsUp?: (message: Message) => void;
|
||
/**
|
||
* Callback function for thumbs down feedback
|
||
*/
|
||
onThumbsDown?: (message: Message) => void;
|
||
/**
|
||
* The feedback state for this message ("thumbsUp" or "thumbsDown")
|
||
*/
|
||
feedback?: "thumbsUp" | "thumbsDown" | null;
|
||
/**
|
||
* A list of markdown components to render in assistant message.
|
||
* Useful when you want to render custom elements in the message (e.g a reference tag element)
|
||
*/
|
||
markdownTagRenderers?: ComponentsMap;
|
||
/**
|
||
* A custom image rendering component to use instead of the default.
|
||
*/
|
||
ImageRenderer?: React.ComponentType<ImageRendererProps>;
|
||
/**
|
||
* @deprecated use message instead
|
||
*
|
||
* The raw data from the assistant's response
|
||
*/
|
||
rawData: any;
|
||
/**
|
||
*
|
||
* @deprecated
|
||
*
|
||
* use `message.generativeUI()` instead.
|
||
*
|
||
* For example:
|
||
*
|
||
* ```tsx
|
||
* const CustomAssistantMessage = ({ message }: AssistantMessageProps) => {
|
||
* const subComponent = message?.generativeUI?.();
|
||
* return <div>{subComponent}</div>;
|
||
* };
|
||
*
|
||
* ```
|
||
*/
|
||
subComponent?: React.JSX.Element;
|
||
}
|
||
interface ErrorMessageProps {
|
||
/**
|
||
* The message content from the assistant
|
||
*/
|
||
error: ChatError;
|
||
/**
|
||
* Indicates if this is the last message
|
||
*/
|
||
isCurrentMessage?: boolean;
|
||
/**
|
||
* Callback function to regenerate the assistant's response
|
||
*/
|
||
onRegenerate?: () => void;
|
||
/**
|
||
* Callback function when the message is copied
|
||
*/
|
||
onCopy?: (message: string) => void;
|
||
}
|
||
interface RenderMessageProps {
|
||
message: Message;
|
||
messages: Message[];
|
||
inProgress: boolean;
|
||
index: number;
|
||
isCurrentMessage: boolean;
|
||
actionResult?: string;
|
||
AssistantMessage?: React.ComponentType<AssistantMessageProps>;
|
||
UserMessage?: React.ComponentType<UserMessageProps>;
|
||
ImageRenderer?: React.ComponentType<ImageRendererProps>;
|
||
/**
|
||
* Callback function to regenerate the assistant's response
|
||
*/
|
||
onRegenerate?: (messageId: string) => void;
|
||
/**
|
||
* Callback function when the message is copied
|
||
*/
|
||
onCopy?: (message: string) => void;
|
||
/**
|
||
* Callback function for thumbs up feedback
|
||
*/
|
||
onThumbsUp?: (message: Message) => void;
|
||
/**
|
||
* Callback function for thumbs down feedback
|
||
*/
|
||
onThumbsDown?: (message: Message) => void;
|
||
/**
|
||
* Map of message IDs to their feedback state
|
||
*/
|
||
messageFeedback?: Record<string, "thumbsUp" | "thumbsDown">;
|
||
/**
|
||
* A list of markdown components to render in assistant message.
|
||
* Useful when you want to render custom elements in the message (e.g a reference tag element)
|
||
*/
|
||
markdownTagRenderers?: ComponentsMap;
|
||
}
|
||
interface InputProps {
|
||
inProgress: boolean;
|
||
onSend: (text: string) => Promise<Message>;
|
||
isVisible?: boolean;
|
||
onStop?: () => void;
|
||
onUpload?: () => void;
|
||
hideStopButton?: boolean;
|
||
chatReady?: boolean;
|
||
}
|
||
interface RenderSuggestionsListProps {
|
||
suggestions: CopilotChatSuggestion[];
|
||
onSuggestionClick: (message: string) => void;
|
||
isLoading: boolean;
|
||
}
|
||
interface ImageRendererProps {
|
||
/**
|
||
* The image data containing format and bytes
|
||
*/
|
||
image: ImageData;
|
||
/**
|
||
* Optional content to display alongside the image
|
||
*/
|
||
content?: string;
|
||
/**
|
||
* Additional CSS class name for styling
|
||
*/
|
||
className?: string;
|
||
}
|
||
interface ChatError {
|
||
message: string;
|
||
operation?: string;
|
||
timestamp: number;
|
||
}
|
||
//#endregion
|
||
//#region src/components/chat/ChatContext.d.ts
|
||
/**
|
||
* Icons for CopilotChat component.
|
||
*/
|
||
interface CopilotChatIcons {
|
||
/**
|
||
* The icon to use for the open chat button.
|
||
* @default <OpenIcon />
|
||
*/
|
||
openIcon?: React$1.ReactNode;
|
||
/**
|
||
* The icon to use for the close chat button.
|
||
* @default <CloseIcon />
|
||
*/
|
||
closeIcon?: React$1.ReactNode;
|
||
/**
|
||
* The icon to use for the close chat button in the header.
|
||
* @default <HeaderCloseIcon />
|
||
*/
|
||
headerCloseIcon?: React$1.ReactNode;
|
||
/**
|
||
* The icon to use for the send button.
|
||
* @default <SendIcon />
|
||
*/
|
||
sendIcon?: React$1.ReactNode;
|
||
/**
|
||
* The icon to use for the activity indicator.
|
||
* @default <ActivityIcon />
|
||
*/
|
||
activityIcon?: React$1.ReactNode;
|
||
/**
|
||
* The icon to use for the spinner.
|
||
* @default <SpinnerIcon />
|
||
*/
|
||
spinnerIcon?: React$1.ReactNode;
|
||
/**
|
||
* The icon to use for the stop button.
|
||
* @default <StopIcon />
|
||
*/
|
||
stopIcon?: React$1.ReactNode;
|
||
/**
|
||
* The icon to use for the regenerate button.
|
||
* @default <RegenerateIcon />
|
||
*/
|
||
regenerateIcon?: React$1.ReactNode;
|
||
/**
|
||
* The icons to use for push to talk.
|
||
* @default <PushToTalkIcon />
|
||
*/
|
||
pushToTalkIcon?: React$1.ReactNode;
|
||
/**
|
||
* The icons to use for copy assistant response
|
||
* @default <CopyIcon />
|
||
*/
|
||
copyIcon?: React$1.ReactNode;
|
||
/**
|
||
* The icon to use for thumbs up/response approval.
|
||
* @default <ThumbsUpIcon />
|
||
*/
|
||
thumbsUpIcon?: React$1.ReactNode;
|
||
/**
|
||
* The icon to use for thumbs down/response rejection.
|
||
* @default <ThumbsDownIcon />
|
||
*/
|
||
thumbsDownIcon?: React$1.ReactNode;
|
||
/**
|
||
* The icon to use for the upload button.
|
||
* @default <UploadIcon />
|
||
*/
|
||
uploadIcon?: React$1.ReactNode;
|
||
}
|
||
/**
|
||
* Labels for CopilotChat component.
|
||
*/
|
||
interface CopilotChatLabels {
|
||
/**
|
||
* The initial message(s) to display in the chat window.
|
||
*/
|
||
initial?: string | string[];
|
||
/**
|
||
* The title to display in the header.
|
||
* @default "CopilotKit"
|
||
*/
|
||
title?: string;
|
||
/**
|
||
* The placeholder to display in the input.
|
||
* @default "Type a message..."
|
||
*/
|
||
placeholder?: string;
|
||
/**
|
||
* The message to display when an error occurs.
|
||
* @default "❌ An error occurred. Please try again."
|
||
*/
|
||
error?: string;
|
||
/**
|
||
* The label to display on the stop button.
|
||
* @default "Stop generating"
|
||
*/
|
||
stopGenerating?: string;
|
||
/**
|
||
* The label to display on the regenerate button.
|
||
* @default "Regenerate response"
|
||
*/
|
||
regenerateResponse?: string;
|
||
/**
|
||
* The label for the copy button.
|
||
* @default "Copy to clipboard"
|
||
*/
|
||
copyToClipboard?: string;
|
||
/**
|
||
* The label for the thumbs up button.
|
||
* @default "Thumbs up"
|
||
*/
|
||
thumbsUp?: string;
|
||
/**
|
||
* The label for the thumbs down button.
|
||
* @default "Thumbs down"
|
||
*/
|
||
thumbsDown?: string;
|
||
/**
|
||
* The text to display when content is copied.
|
||
* @default "Copied!"
|
||
*/
|
||
copied?: string;
|
||
}
|
||
interface ChatContext {
|
||
labels: Required<CopilotChatLabels>;
|
||
icons: Required<CopilotChatIcons>;
|
||
open: boolean;
|
||
setOpen: (open: boolean) => void;
|
||
}
|
||
declare const ChatContext: React$1.Context<ChatContext | undefined>;
|
||
declare function useChatContext(): ChatContext;
|
||
//#endregion
|
||
//#region src/components/chat/Chat.d.ts
|
||
/**
|
||
* Props for CopilotChat component.
|
||
*/
|
||
interface CopilotChatProps {
|
||
/**
|
||
* Custom instructions to be added to the system message. Use this property to
|
||
* provide additional context or guidance to the language model, influencing
|
||
* its responses. These instructions can include specific directions,
|
||
* preferences, or criteria that the model should consider when generating
|
||
* its output, thereby tailoring the conversation more precisely to the
|
||
* user's needs or the application's requirements.
|
||
*/
|
||
instructions?: string;
|
||
/**
|
||
* Controls the behavior of suggestions in the chat interface.
|
||
*
|
||
* `auto` (default) - Suggestions are generated automatically:
|
||
* - When the chat is first opened (empty state)
|
||
* - After each message exchange completes
|
||
* - Uses configuration from `useCopilotChatSuggestions` hooks
|
||
*
|
||
* `manual` - Suggestions are controlled programmatically:
|
||
* - Use `setSuggestions()` to set custom suggestions
|
||
* - Use `generateSuggestions()` to trigger AI generation
|
||
* - Access via `useCopilotChat` hook
|
||
*
|
||
* `SuggestionItem[]` - Static suggestions array:
|
||
* - Always shows the same suggestions
|
||
* - No AI generation involved
|
||
*/
|
||
suggestions?: ChatSuggestions;
|
||
/**
|
||
* A callback that gets called when the in progress state changes.
|
||
*/
|
||
onInProgress?: (inProgress: boolean) => void;
|
||
/**
|
||
* A callback that gets called when a new message it submitted.
|
||
*/
|
||
onSubmitMessage?: (message: string) => void | Promise<void>;
|
||
/**
|
||
* A custom stop generation function.
|
||
*/
|
||
onStopGeneration?: OnStopGeneration;
|
||
/**
|
||
* A custom reload messages function.
|
||
*/
|
||
onReloadMessages?: OnReloadMessages;
|
||
/**
|
||
* A callback function to regenerate the assistant's response
|
||
*/
|
||
onRegenerate?: (messageId: string) => void;
|
||
/**
|
||
* A callback function when the message is copied
|
||
*/
|
||
onCopy?: (message: string) => void;
|
||
/**
|
||
* A callback function for thumbs up feedback
|
||
*/
|
||
onThumbsUp?: (message: Message) => void;
|
||
/**
|
||
* A callback function for thumbs down feedback
|
||
*/
|
||
onThumbsDown?: (message: Message) => void;
|
||
/**
|
||
* A list of markdown components to render in assistant message.
|
||
* Useful when you want to render custom elements in the message (e.g a reference tag element)
|
||
*/
|
||
markdownTagRenderers?: ComponentsMap;
|
||
/**
|
||
* Icons can be used to set custom icons for the chat window.
|
||
*/
|
||
icons?: CopilotChatIcons;
|
||
/**
|
||
* Labels can be used to set custom labels for the chat window.
|
||
*/
|
||
labels?: CopilotChatLabels;
|
||
/**
|
||
* Enable image upload button (image inputs only supported on some models)
|
||
*/
|
||
imageUploadsEnabled?: boolean;
|
||
/**
|
||
* The 'accept' attribute for the file input used for image uploads.
|
||
* Defaults to "image/*".
|
||
*/
|
||
inputFileAccept?: string;
|
||
/**
|
||
* A function that takes in context string and instructions and returns
|
||
* the system message to include in the chat request.
|
||
* Use this to completely override the system message, when providing
|
||
* instructions is not enough.
|
||
*/
|
||
makeSystemMessage?: SystemMessageFunction;
|
||
/**
|
||
* Disables inclusion of CopilotKit’s default system message. When true, no system message is sent (this also suppresses any custom message from <code>makeSystemMessage</code>).
|
||
*/
|
||
disableSystemMessage?: boolean;
|
||
/**
|
||
* A custom assistant message component to use instead of the default.
|
||
*/
|
||
AssistantMessage?: React$1.ComponentType<AssistantMessageProps>;
|
||
/**
|
||
* A custom user message component to use instead of the default.
|
||
*/
|
||
UserMessage?: React$1.ComponentType<UserMessageProps>;
|
||
/**
|
||
* A custom error message component to use instead of the default.
|
||
*/
|
||
ErrorMessage?: React$1.ComponentType<ErrorMessageProps>;
|
||
/**
|
||
* A custom Messages component to use instead of the default.
|
||
*/
|
||
Messages?: React$1.ComponentType<MessagesProps>;
|
||
/**
|
||
* @deprecated - use RenderMessage instead
|
||
*/
|
||
RenderTextMessage?: React$1.ComponentType<RenderMessageProps>;
|
||
/**
|
||
* @deprecated - use RenderMessage instead
|
||
*/
|
||
RenderActionExecutionMessage?: React$1.ComponentType<RenderMessageProps>;
|
||
/**
|
||
* @deprecated - use RenderMessage instead
|
||
*/
|
||
RenderAgentStateMessage?: React$1.ComponentType<RenderMessageProps>;
|
||
/**
|
||
* @deprecated - use RenderMessage instead
|
||
*/
|
||
RenderResultMessage?: React$1.ComponentType<RenderMessageProps>;
|
||
/**
|
||
* @deprecated - use RenderMessage instead
|
||
*/
|
||
RenderImageMessage?: React$1.ComponentType<RenderMessageProps>;
|
||
/**
|
||
* A custom RenderMessage component to use instead of the default.
|
||
*
|
||
* **Warning**: This is a break-glass solution to allow for custom
|
||
* rendering of messages. You are most likely looking to swap out
|
||
* the AssistantMessage and UserMessage components instead which
|
||
* are also props.
|
||
*/
|
||
RenderMessage?: React$1.ComponentType<RenderMessageProps>;
|
||
/**
|
||
* A custom suggestions list component to use instead of the default.
|
||
*/
|
||
RenderSuggestionsList?: React$1.ComponentType<RenderSuggestionsListProps>;
|
||
/**
|
||
* A custom Input component to use instead of the default.
|
||
*/
|
||
Input?: React$1.ComponentType<InputProps>;
|
||
/**
|
||
* A custom image rendering component to use instead of the default.
|
||
*/
|
||
ImageRenderer?: React$1.ComponentType<ImageRendererProps>;
|
||
/**
|
||
* A class name to apply to the root element.
|
||
*/
|
||
className?: string;
|
||
/**
|
||
* Children to render.
|
||
*/
|
||
children?: React$1.ReactNode;
|
||
hideStopButton?: boolean;
|
||
/**
|
||
* Event hooks for CopilotKit chat events.
|
||
* These hooks only work when publicApiKey is provided.
|
||
*/
|
||
observabilityHooks?: CopilotObservabilityHooks;
|
||
/**
|
||
* Custom error renderer for chat-specific errors.
|
||
* When provided, errors will be displayed inline within the chat interface.
|
||
*/
|
||
renderError?: (error: {
|
||
message: string;
|
||
operation?: string;
|
||
timestamp: number;
|
||
onDismiss: () => void;
|
||
onRetry?: () => void;
|
||
}) => React$1.ReactNode;
|
||
/**
|
||
* Optional handler for comprehensive debugging and observability.
|
||
*/
|
||
onError?: CopilotErrorHandler;
|
||
}
|
||
declare function CopilotChat({
|
||
instructions,
|
||
suggestions,
|
||
onSubmitMessage,
|
||
makeSystemMessage,
|
||
disableSystemMessage,
|
||
onInProgress,
|
||
onStopGeneration,
|
||
onReloadMessages,
|
||
onRegenerate,
|
||
onCopy,
|
||
onThumbsUp,
|
||
onThumbsDown,
|
||
markdownTagRenderers,
|
||
Messages,
|
||
RenderMessage,
|
||
RenderSuggestionsList,
|
||
Input,
|
||
className,
|
||
icons,
|
||
labels,
|
||
AssistantMessage,
|
||
UserMessage,
|
||
ImageRenderer,
|
||
ErrorMessage,
|
||
imageUploadsEnabled,
|
||
inputFileAccept,
|
||
hideStopButton,
|
||
observabilityHooks,
|
||
renderError,
|
||
onError,
|
||
RenderTextMessage,
|
||
RenderActionExecutionMessage,
|
||
RenderAgentStateMessage,
|
||
RenderResultMessage,
|
||
RenderImageMessage
|
||
}: CopilotChatProps): react_jsx_runtime0.JSX.Element;
|
||
//#endregion
|
||
//#region src/components/chat/Modal.d.ts
|
||
interface CopilotModalProps extends CopilotChatProps {
|
||
/**
|
||
* Whether the chat window should be open by default.
|
||
* @default false
|
||
*/
|
||
defaultOpen?: boolean;
|
||
/**
|
||
* If the chat window should close when the user clicks outside of it.
|
||
* @default true
|
||
*/
|
||
clickOutsideToClose?: boolean;
|
||
/**
|
||
* If the chat window should close when the user hits the Escape key.
|
||
* @default true
|
||
*/
|
||
hitEscapeToClose?: boolean;
|
||
/**
|
||
* The shortcut key to open the chat window.
|
||
* Uses Command-[shortcut] on a Mac and Ctrl-[shortcut] on Windows.
|
||
* @default '/'
|
||
*/
|
||
shortcut?: string;
|
||
/**
|
||
* A callback that gets called when the chat window opens or closes.
|
||
*/
|
||
onSetOpen?: (open: boolean) => void;
|
||
/**
|
||
* A custom Window component to use instead of the default.
|
||
*/
|
||
Window?: React$1.ComponentType<WindowProps>;
|
||
/**
|
||
* A custom Button component to use instead of the default.
|
||
*/
|
||
Button?: React$1.ComponentType<ButtonProps>;
|
||
/**
|
||
* A custom Header component to use instead of the default.
|
||
*/
|
||
Header?: React$1.ComponentType<HeaderProps>;
|
||
}
|
||
//#endregion
|
||
//#region src/components/chat/Popup.d.ts
|
||
declare function CopilotPopup(props: CopilotModalProps): react_jsx_runtime0.JSX.Element;
|
||
//#endregion
|
||
//#region src/components/chat/Sidebar.d.ts
|
||
declare function CopilotSidebar(props: CopilotModalProps): react_jsx_runtime0.JSX.Element;
|
||
//#endregion
|
||
//#region src/components/chat/Markdown.d.ts
|
||
type MarkdownProps = {
|
||
content: string;
|
||
components?: Components;
|
||
};
|
||
declare const Markdown: ({
|
||
content,
|
||
components
|
||
}: MarkdownProps) => react_jsx_runtime0.JSX.Element;
|
||
//#endregion
|
||
//#region src/components/chat/messages/AssistantMessage.d.ts
|
||
declare const AssistantMessage$1: (props: AssistantMessageProps) => react_jsx_runtime0.JSX.Element;
|
||
//#endregion
|
||
//#region src/components/chat/messages/UserMessage.d.ts
|
||
declare const UserMessage$1: (props: UserMessageProps) => react_jsx_runtime0.JSX.Element;
|
||
//#endregion
|
||
//#region src/components/chat/messages/ImageRenderer.d.ts
|
||
/**
|
||
* Default image rendering component that can be customized by users.
|
||
* Uses CSS classes for styling so users can override styles.
|
||
*/
|
||
declare const ImageRenderer$1: React$1.FC<ImageRendererProps>;
|
||
//#endregion
|
||
//#region src/components/chat/Suggestions.d.ts
|
||
declare function Suggestions({
|
||
suggestions,
|
||
onSuggestionClick,
|
||
isLoading
|
||
}: RenderSuggestionsListProps): react_jsx_runtime0.JSX.Element;
|
||
//#endregion
|
||
//#region src/components/chat/Suggestion.d.ts
|
||
interface SuggestionsProps$1 {
|
||
title: string;
|
||
message: string;
|
||
partial?: boolean;
|
||
className?: string;
|
||
onClick: () => void;
|
||
}
|
||
declare function Suggestion({
|
||
title,
|
||
onClick,
|
||
partial,
|
||
className
|
||
}: SuggestionsProps$1): react_jsx_runtime0.JSX.Element | null;
|
||
//#endregion
|
||
//#region src/components/dev-console/console.d.ts
|
||
declare function CopilotDevConsole(): react_jsx_runtime0.JSX.Element | null;
|
||
//#endregion
|
||
//#region src/hooks/use-copilot-chat-suggestions.d.ts
|
||
declare function useCopilotChatSuggestions(config: UseCopilotChatSuggestionsConfiguration, dependencies?: any[]): void;
|
||
//#endregion
|
||
//#region src/types/css.d.ts
|
||
interface CopilotKitCSSProperties extends CSSProperties {
|
||
"--copilot-kit-primary-color"?: string;
|
||
"--copilot-kit-contrast-color"?: string;
|
||
"--copilot-kit-background-color"?: string;
|
||
"--copilot-kit-input-background-color"?: string;
|
||
"--copilot-kit-secondary-color"?: string;
|
||
"--copilot-kit-secondary-contrast-color"?: string;
|
||
"--copilot-kit-separator-color"?: string;
|
||
"--copilot-kit-muted-color"?: string;
|
||
"--copilot-kit-error-background"?: string;
|
||
"--copilot-kit-error-border"?: string;
|
||
"--copilot-kit-error-text"?: string;
|
||
"--copilot-kit-shadow-sm"?: string;
|
||
"--copilot-kit-shadow-md"?: string;
|
||
"--copilot-kit-shadow-lg"?: string;
|
||
"--copilot-kit-dev-console-bg"?: string;
|
||
"--copilot-kit-dev-console-text"?: string;
|
||
}
|
||
//#endregion
|
||
export { AssistantMessage$1 as AssistantMessage, AssistantMessageProps, ButtonProps, ChatError, ComponentsMap, CopilotChat, type CopilotChatSuggestion, CopilotDevConsole, type CopilotKitCSSProperties, CopilotObservabilityHooks, CopilotPopup, CopilotSidebar, ErrorMessageProps, HeaderProps, ImageRenderer$1 as ImageRenderer, ImageRendererProps, InputProps, Markdown, MessagesProps, RenderMessageProps, Suggestion as RenderSuggestion, Suggestions as RenderSuggestionsList, RenderSuggestionsListProps, Renderer, SuggestionsProps, UserMessage$1 as UserMessage, UserMessageProps, WindowProps, shouldShowDevConsole, useChatContext, useCopilotChatSuggestions };
|
||
//# sourceMappingURL=index.d.cts.map
|