UNPKG

@copilotkit/react-ui

Version:

<div align="center"> <a href="https://copilotkit.ai" target="_blank"> <img src="https://github.com/copilotkit/copilotkit/raw/main/assets/banner.png" alt="CopilotKit Logo"> </a>

131 lines (128 loc) 3.79 kB
import { Message } from '@copilotkit/runtime-client-gql'; 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; } interface MessagesProps { messages: Message[]; inProgress: boolean; children?: React.ReactNode; AssistantMessage: React.ComponentType<AssistantMessageProps>; UserMessage: React.ComponentType<UserMessageProps>; RenderTextMessage: React.ComponentType<RenderMessageProps>; RenderActionExecutionMessage: React.ComponentType<RenderMessageProps>; RenderAgentStateMessage: React.ComponentType<RenderMessageProps>; RenderResultMessage: React.ComponentType<RenderMessageProps>; /** * 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: string) => void; /** * Callback function for thumbs down feedback */ onThumbsDown?: (message: string) => void; } interface Renderer { content: string; } interface UserMessageProps { message?: string; rawData: any; } interface AssistantMessageProps { /** * The message content from the assistant */ message?: string; /** * Indicates if this is the last message */ isCurrentMessage?: boolean; /** * The raw data from the assistant's response */ rawData: any; /** * A component that was decided to render by the LLM. * When working with useCopilotActions and useCoAgentStateRender, this will be * the render component that was specified. */ subComponent?: React.JSX.Element; /** * 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: string) => void; /** * Callback function for thumbs down feedback */ onThumbsDown?: (message: string) => void; } interface RenderMessageProps { message: Message; inProgress: boolean; index: number; isCurrentMessage: boolean; actionResult?: string; AssistantMessage: React.ComponentType<AssistantMessageProps>; UserMessage: React.ComponentType<UserMessageProps>; /** * 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: string) => void; /** * Callback function for thumbs down feedback */ onThumbsDown?: (message: string) => void; } interface InputProps { inProgress: boolean; onSend: (text: string) => Promise<Message>; isVisible?: boolean; onStop?: () => void; } export { AssistantMessageProps, ButtonProps, HeaderProps, InputProps, MessagesProps, RenderMessageProps, Renderer, SuggestionsProps, UserMessageProps, WindowProps };