mongodb-chatbot-ui
Classes
Type Aliases
ActionButtonTriggerProps
Ƭ ActionButtonTriggerProps: ChatbotTriggerProps
& { text?
: string
}
Defined in
packages/mongodb-chatbot-ui/src/ActionButtonTrigger.tsx:7
AssistantMessageMetadata
Ƭ AssistantMessageMetadata: Object
Index signature
▪ [k: string
]: unknown
Type declaration
Name | Type | Description |
---|---|---|
conversationId? | string | The conversation ID that this message is part of. If you add a message without specifying a conversation ID, which creates a new conversation, this field contains the ID of the new conversation. |
verifiedAnswer? | { _id : VerifiedAnswer ["_id" ] ; created : string ; updated : string | undefined } | If the message came from the verified answers collection, contains the metadata about the verified answer. |
verifiedAnswer._id | VerifiedAnswer ["_id" ] | - |
verifiedAnswer.created | string | - |
verifiedAnswer.updated | string | undefined | - |
Defined in
packages/mongodb-chatbot-ui/src/services/conversations.ts:20
ChatWindowProps
Ƭ ChatWindowProps: ChatbotViewProps
Defined in
packages/mongodb-chatbot-ui/src/ChatWindow.tsx:22
ChatbotProps
Ƭ ChatbotProps: OpenCloseHandlers
& RenameFields
<UseChatbotProps
, { chatbotName
: "name"
}> & { children
: React.ReactElement
| React.ReactElement
[] ; darkMode?
: boolean
; tck?
: string
; user?
: User
}
Defined in
packages/mongodb-chatbot-ui/src/Chatbot.tsx:13
ChatbotTextInputTriggerProps
Ƭ ChatbotTextInputTriggerProps: ChatbotTriggerProps
& UseTextInputTriggerArgs
The base props for a Chatbot trigger component that allows the user to input text.
Defined in
packages/mongodb-chatbot-ui/src/useTextInputTrigger.ts:15
ChatbotViewProps
Ƭ ChatbotViewProps: DarkModeProps
& Omit
<ChatMessageFeedProps
, "initialMessage"
> & { fatalErrorMessage?
: string
; initialMessageReferences?
: any
[] ; initialMessageSuggestedPrompts?
: string
[] ; initialMessageText?
: string
; inputBarId?
: string
; inputBarPlaceholder?
: string
; inputBottomText?
: string
; windowTitle?
: string
}
Defined in
packages/mongodb-chatbot-ui/src/ChatbotView.tsx:5
Conversation
Ƭ Conversation: ConversationState
& ConversationMethods
Defined in
packages/mongodb-chatbot-ui/src/useConversation.tsx:28
ConversationFetchOptions
Ƭ ConversationFetchOptions: Omit
<RequestInit
, "body"
| "method"
| "headers"
| "signal"
> & { headers?
: Headers
}
Options to include with every fetch request made by the ConversationService. This can be used to set headers, etc.
Defined in
packages/mongodb-chatbot-ui/src/services/conversations.ts:154
ConversationServiceConfig
Ƭ ConversationServiceConfig: Object
Type declaration
Name | Type |
---|---|
fetchOptions? | ConversationFetchOptions |
serverUrl | string |
Defined in
packages/mongodb-chatbot-ui/src/services/conversations.ts:161
ConversationStreamEvent
Ƭ ConversationStreamEvent: DeltaStreamEvent
| ReferencesStreamEvent
| MetadataStreamEvent
| FinishedStreamEvent
Defined in
packages/mongodb-chatbot-ui/src/services/conversations.ts:121
DarkModeProps
Ƭ DarkModeProps: Object
Type declaration
Name | Type |
---|---|
darkMode? | boolean |
Defined in
packages/mongodb-chatbot-ui/src/DarkMode.ts:1
DeltaStreamEvent
Ƭ DeltaStreamEvent: Object
Type declaration
Name | Type |
---|---|
data | string |
type | "delta" |
Defined in
packages/mongodb-chatbot-ui/src/services/conversations.ts:113
FinishedStreamEvent
Ƭ FinishedStreamEvent: Object
Type declaration
Name | Type |
---|---|
data | string |
type | "finished" |
Defined in
packages/mongodb-chatbot-ui/src/services/conversations.ts:119
FloatingActionButtonTriggerProps
Ƭ FloatingActionButtonTriggerProps: ActionButtonTriggerProps
Defined in
packages/mongodb-chatbot-ui/src/FloatingActionButtonTrigger.tsx:24
HotkeyTriggerProps
Ƭ HotkeyTriggerProps: Object
Type declaration
Name | Type |
---|---|
onKey | string |
Defined in
packages/mongodb-chatbot-ui/src/HotkeyTrigger.tsx:5
InputBarTriggerProps
Ƭ InputBarTriggerProps: ChatbotTextInputTriggerProps
& { bottomContent?
: React.ReactNode
; suggestedPrompts?
: string
[] }
Defined in
packages/mongodb-chatbot-ui/src/InputBarTrigger.tsx:43
MessageData
Ƭ MessageData: Object
Type declaration
Name | Type |
---|---|
content | string |
createdAt | string |
id | string |
metadata? | AssistantMessageMetadata |
rating? | boolean |
references? | any [] |
role | Role |
suggestedPrompts? | string [] |
Defined in
packages/mongodb-chatbot-ui/src/services/conversations.ts:9
MetadataStreamEvent
Ƭ MetadataStreamEvent: Object
Type declaration
Name | Type |
---|---|
data | AssistantMessageMetadata |
type | "metadata" |
Defined in
packages/mongodb-chatbot-ui/src/services/conversations.ts:115
ModalViewProps
Ƭ ModalViewProps: ChatbotViewProps
& { shouldClose?
: ModalProps
["shouldClose"
] }
Defined in
packages/mongodb-chatbot-ui/src/ModalView.tsx:47
PoweredByAtlasVectorSearchProps
Ƭ PoweredByAtlasVectorSearchProps: Object
Type declaration
Name | Type |
---|---|
className? | string |
linkStyle? | "learnMore" | "text" |
Defined in
packages/mongodb-chatbot-ui/src/PoweredByAtlasVectorSearch.tsx:5
ReferencesStreamEvent
Ƭ ReferencesStreamEvent: Object
Type declaration
Name | Type |
---|---|
data | any [] |
type | "references" |
Defined in
packages/mongodb-chatbot-ui/src/services/conversations.ts:114
Role
Ƭ Role: "user"
| "assistant"
Defined in
packages/mongodb-chatbot-ui/src/services/conversations.ts:7
UseTextInputTriggerArgs
Ƭ UseTextInputTriggerArgs: Object
Type declaration
Name | Type |
---|---|
fatalErrorMessage? | string |
placeholder? | string |
Defined in
packages/mongodb-chatbot-ui/src/useTextInputTrigger.ts:7
Variables
defaultChatbotFatalErrorMessage
• Const
defaultChatbotFatalErrorMessage: "Something went wrong. Try reloading the page and starting a new conversation."
Defined in
packages/mongodb-chatbot-ui/src/ui-text.ts:4
mongoDbVerifyInformationMessage
• Const
mongoDbVerifyInformationMessage: "This is an experimental generative AI chatbot. All information should be verified prior to use."
Defined in
packages/mongodb-chatbot-ui/src/ui-text.ts:1
Functions
ActionButtonTrigger
▸ ActionButtonTrigger(props
): Element
Parameters
Name | Type |
---|---|
props | ActionButtonTriggerProps |
Returns
Element
Defined in
packages/mongodb-chatbot-ui/src/ActionButtonTrigger.tsx:11
ChatWindow
▸ ChatWindow(props
): Element
Parameters
Name | Type |
---|---|
props | ChatbotViewProps |
Returns
Element
Defined in
packages/mongodb-chatbot-ui/src/ChatWindow.tsx:24
DevCenterChatbot
▸ DevCenterChatbot(props
): Element
Parameters
Name | Type |
---|---|
props | DevCenterChatbotProps |
Returns
Element
Defined in
packages/mongodb-chatbot-ui/src/DevCenterChatbot.tsx:25
DocsChatbot
▸ DocsChatbot(props
): Element
Parameters
Name | Type |
---|---|
props | DocsChatbotProps |
Returns
Element
Defined in
packages/mongodb-chatbot-ui/src/DocsChatbot.tsx:17
FloatingActionButtonTrigger
▸ FloatingActionButtonTrigger(«destructured»
): Element
Parameters
Name | Type |
---|---|
«destructured» | ActionButtonTriggerProps |
Returns
Element
Defined in
packages/mongodb-chatbot-ui/src/FloatingActionButtonTrigger.tsx:26
HotkeyTrigger
▸ HotkeyTrigger(«destructured»
): null
Parameters
Name | Type |
---|---|
«destructured» | HotkeyTriggerProps |
Returns
null
Defined in
packages/mongodb-chatbot-ui/src/HotkeyTrigger.tsx:9
InputBarTrigger
▸ InputBarTrigger(«destructured»
): Element
Parameters
Name | Type |
---|---|
«destructured» | InputBarTriggerProps |
Returns
Element
Defined in
packages/mongodb-chatbot-ui/src/InputBarTrigger.tsx:48
ModalView
▸ ModalView(props
): Element
Parameters
Name | Type |
---|---|
props | ModalViewProps |
Returns
Element
Defined in
packages/mongodb-chatbot-ui/src/ModalView.tsx:51
MongoDbInputBarPlaceholder
▸ MongoDbInputBarPlaceholder(): string
Returns
string
Defined in
packages/mongodb-chatbot-ui/src/InputBar.tsx:92
MongoDbLegalDisclosure
▸ MongoDbLegalDisclosure(): Element
Returns
Element
Defined in
packages/mongodb-chatbot-ui/src/MongoDbLegal.tsx:37
MongoDbLegalDisclosureText
▸ MongoDbLegalDisclosureText(): Element
Returns
Element
Defined in
packages/mongodb-chatbot-ui/src/MongoDbLegal.tsx:5
PoweredByAtlasVectorSearch
▸ PoweredByAtlasVectorSearch(«destructured»
): Element
Parameters
Name | Type |
---|---|
«destructured» | PoweredByAtlasVectorSearchProps |
Returns
Element
Defined in
packages/mongodb-chatbot-ui/src/PoweredByAtlasVectorSearch.tsx:10
default
▸ default(«destructured»
): Element
Parameters
Name | Type |
---|---|
«destructured» | ChatbotProps |
Returns
Element
Defined in
packages/mongodb-chatbot-ui/src/Chatbot.tsx:21
formatReferences
▸ formatReferences(references
, «destructured»?
): RichLinkProps
[]
Parameters
Name | Type |
---|---|
references | { metadata? : objectOutputType <{ sourceName : ZodOptional <ZodString > ; sourceType : ZodOptional <ZodString > ; tags : ZodOptional <ZodArray <ZodString , "many" >> }, ZodTypeAny , "passthrough" > ; title : string ; url : string }[] |
«destructured» | FormatReferencesOptions |
Returns
RichLinkProps
[]
Defined in
packages/mongodb-chatbot-ui/src/messageLinks.ts:15
getMessageLinks
▸ getMessageLinks(messageData
, options?
): RichLinkProps
[] | undefined
Parameters
Name | Type |
---|---|
messageData | MessageData |
options | Object |
options.tck? | string |
Returns
RichLinkProps
[] | undefined
Defined in
packages/mongodb-chatbot-ui/src/messageLinks.ts:35
useChatbot
▸ useChatbot(«destructured»
): ChatbotData
Parameters
Name | Type |
---|---|
«destructured» | UseChatbotProps |
Returns
ChatbotData
Defined in
packages/mongodb-chatbot-ui/src/useChatbot.tsx:35
useChatbotContext
▸ useChatbotContext(): ChatbotData
Returns
ChatbotData
Defined in
packages/mongodb-chatbot-ui/src/useChatbotContext.tsx:4
useConversation
▸ useConversation(params
): Object
Parameters
Name | Type |
---|---|
params | UseConversationParams |
Returns
Object
Name | Type |
---|---|
commentMessage | (messageId : string , comment : string ) => Promise <void > |
conversationId | undefined | string |
createConversation | () => Promise <void > |
error | undefined | string |
getMessage | (messageId : string ) => undefined | MessageData |
messages | MessageData [] |
rateMessage | (messageId : string , rating : boolean ) => Promise <void > |
streamingMessageId | undefined | string |
submit | (content : string ) => Promise <void > |
switchConversation | (conversationId : string ) => Promise <void > |
Defined in
packages/mongodb-chatbot-ui/src/useConversation.tsx:37
useTextInputTrigger
▸ useTextInputTrigger(args
): Object
A hook that provides the necessary props to create a Chatbot trigger component that allows the user to input text.
Parameters
Name | Type | Description |
---|---|---|
args | UseTextInputTriggerArgs | The arguments to configure the trigger. |
Returns
Object
The props to create a Chatbot trigger component that allows the user to input text.
Name | Type |
---|---|
awaitingReply | boolean |
canSubmit | boolean |
conversation | { commentMessage : (messageId : string , comment : string ) => Promise <void > ; conversationId : undefined | string = state.conversationId; createConversation : () => Promise <void > ; error : undefined | string = state.error; getMessage : (messageId : string ) => undefined | MessageData ; messages : MessageData [] = state.messages; rateMessage : (messageId : string , rating : boolean ) => Promise <void > ; streamingMessageId : undefined | string = state.streamingMessageId; submit : (content : string ) => Promise <void > ; switchConversation : (conversationId : string ) => Promise <void > } |
conversation.commentMessage | (messageId : string , comment : string ) => Promise <void > |
conversation.conversationId | undefined | string |
conversation.createConversation | () => Promise <void > |
conversation.error | undefined | string |
conversation.getMessage | (messageId : string ) => undefined | MessageData |
conversation.messages | MessageData [] |
conversation.rateMessage | (messageId : string , rating : boolean ) => Promise <void > |
conversation.streamingMessageId | undefined | string |
conversation.submit | (content : string ) => Promise <void > |
conversation.switchConversation | (conversationId : string ) => Promise <void > |
focused | boolean |
handleSubmit | (text : string ) => void | Promise <void > |
hasError | boolean |
inputPlaceholder | string |
inputText | string |
inputTextError | string |
isExperimental | boolean |
openChat | () => void |
setFocused | Dispatch <SetStateAction <boolean >> |
setInputText | Dispatch <SetStateAction <string >> |
setInputTextError | Dispatch <SetStateAction <string >> |
showError | false |
Example
const textInputTrigger = useTextInputTrigger({
placeholder: "Type something...",
fatalErrorMessage: "An error occurred. Please try again.",
});
return <MyInputBar
value={textInputTrigger.inputText}
placeholder={textInputTrigger.inputPlaceholder}
error={textInputTrigger.inputTextError || undefined}
onTextChange={newText => textInputTrigger.setInputText(newText)}
onSubmit={() => {
textInputTrigger.handleSubmit(textInputTrigger.inputText);
}}
/>;