Txt.openChat({prompt, target, conversationName, segments, mode})
Argument | Type | Description |
---|---|---|
prompt | string (optional) | Generates a hidden prompt that triggers the AI to answer directly to the user. |
target | DOM Element (optional) | A target element on the page that you can attach the AI popover to, usually this is the button the user clicked on. |
conversationName | string (optional) | A conversation name of this particular chat session. You can use this to separate different conversations. The conversation name will show up in the top left corner of the popover. |
segments | { name: string, id: string, description: string } [] (optional) | An array of segments that will allow the AI to search in information silos defined on the dashboard. |
mode | 'popover' | 'sidebar' | 'conversation-center' (optional) | Defines if the chat will open in a popover, or in an overlay conversation center. Note: to start a chat in popover mode, a target must be defined. |
Set chat metadata
Any chat metadata you set will be visible in the Unless dashboard when reviewing a conversation. Chat metadata can also be directly used by (API) actions. The metadata can already be set before opening the AI component.
Txt.set('chatMetadata', { name: 'Marcel Panse', email: '[email protected]' })
Current AI component state
Txt.isChatOpen()
Close the AI component
Txt.closeChat()