Docs
๐Ÿ—๏ธ โ API
Components

Components API

Diagram

Below is a diagram of the components that make up the package.


Architecture

Components

Below is the API for the components.

Chat

PropDescriptionDefault
styleThe style to apply to the root element.
CSSProperties
classNameThe class name to apply to the root element.
string
viewTypeThe type of prompt to display. - Companion: Smaller prompt screen with session lists. - Console: Full screen experience. - Chat: Only chat, no sessions.
ChatViewType
console
sessions *The list of sessions to display.
Session[]
activeSessionIdThe ID of the currently active session.
string
themeCustom theme for the chat.
ChatTheme
remarkPluginsRemark plugins to apply to the request/response.
PluggableList[]
[remarkGfm, remarkYoutube, remarkMath]
isLoadingWhether to display a loading state.
boolean
disabledWhether to disable the chat.
boolean
onSelectSessionCallback function to handle when a session is selected.
(sessionId: string) => void
onDeleteSessionCallback function to handle when a session is deleted.
(sessionId: string) => void
onNewSessionCallback function to handle creating a new session.
() => void
onSendMessageCallback function to handle sending a new message.
(message: string) => void
onStopMessageCallback function to handle stopping the current action.
() => void
onFileUploadCallback function to handle file upload.
(file: File) => void

ChatInput

PropDescriptionDefault
defaultValueDefault value for the input field.
string
allowedFilesAllowed file types for upload.
string[]
placeholderPlaceholder text for the input field.
string
sendIconIcon to show for send.
ReactElement<any, string | JSXElementConstructor<any>>
<SendIcon />
stopIconIcon to show for send.
ReactElement<any, string | JSXElementConstructor<any>>
<StopIcon />
attachIconIcon to show for attach.
ReactElement<any, string | JSXElementConstructor<any>>

SessionList

PropDescriptionDefault

SessionListItem

PropDescriptionDefault
session *Session to display.
Session
deletableIndicates whether the session is deletable.
boolean
true
deleteIconIcon to show for delete.
ReactElement<any, string | JSXElementConstructor<any>>
<TrashIcon />
chatIconIcon to show for chat.
ReactElement<any, string | JSXElementConstructor<any>>
<ChatIcon className="mr-2" />
limitLimit for the ellipsis.
number
100

SessionGroups

PropDescriptionDefault
childrenRender function for the session groups.
(groups: GroupedSessions[]) => ReactNode

SessionGroup

PropDescriptionDefault

NewSessionButton

PropDescriptionDefault
newSessionTextText for the new session button.
ReactNode
New Session

SessionMessages

PropDescriptionDefault
newSessionContentContent to display when there are no sessions selected or a new session is started.
ReactNode
limitLimit the number of results returned. Clientside pagination.
number
10
showMoreTextText to display for the show more button.
string
Show more
childrenRender function for the session messages.
(conversations: Conversation[]) => ReactNode

SessionMessage

PropDescriptionDefault
conversation *Conversation to render.
Conversation
isLastWhether the message is the last one in the list. This let's the chat know when to show the loading cursor.
boolean

SessionMessagePanel

PropDescriptionDefault

SessionMessagesHeader

PropDescriptionDefault

SessionEmpty

PropDescriptionDefault

MessageSources

PropDescriptionDefault
sources *Sources to render.
ConversationSource[]

MessageSource

PropDescriptionDefault
limitLimit for the title.
number
50
urlURL of the source, if applicable
string
titleTitle or description of the source
string
imageImage URL of the source, if applicable.
string

MessageActions

PropDescriptionDefault
question *Question to be copied
string
responseResponse to be copied
string
copyIconIcon to show for copy.
ReactElement<any, string | JSXElementConstructor<any>>
thumbsUpIconIcon to show for thumbs up.
ReactElement<any, string | JSXElementConstructor<any>>
thumbsDownIconIcon to show for thumbs down.
ReactElement<any, string | JSXElementConstructor<any>>
refreshIconIcon to show for refresh.
ReactElement<any, string | JSXElementConstructor<any>>
onCopyCallback function to handle copying.
() => void
onUpvoteCallback function to handle upvoting.
() => void
onDownvoteCallback function to handle downvoting.
() => void
onRefreshCallback function to handle refreshing.
() => void

MessageQuestion

PropDescriptionDefault
question *Question to render.
string
filesArray of sources referenced in the conversation
ConversationFile[]

MessageResponse

PropDescriptionDefault
response *Response to render.
string
isLoadingWhether the response is loading.
boolean

MessageFiles

PropDescriptionDefault
files *Files to render.
ConversationFile[]

MessageFile

PropDescriptionDefault
fileIconIcon to show for delete.
ReactElement<any, string | JSXElementConstructor<any>>
<FileIcon />
limitLimit for the name.
number
100
name *Name of the file
string
typeType of the file
string
sizeSize of the file
number
urlURL of the file
string