API
<qa-bot>
QABot custom element
Attributes
| Name | Description | Type | Default |
|---|---|---|---|
| avatar-src | Customize chatbot avatar url | string | undefined | |
| header-background-src | Customize chatbot header background image with url | string | undefined | |
| orientation | Orientation of the bot widget and animation. | 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right' | 'center' | 'bottom-right' |
| server | REQUIRED, specify the server url bot talks to. | string | undefined | |
| site | Specify site base location the links refer to, if not relative to current location. | string | undefined | |
| target | Specify of reference links. | string | undefined | '_self' |
| open | Set the chat-bot expanded or collapsed. | boolean | undefined | |
| theme | Choose between preset themes, auto, `light`, or `dark`. | 'auto' | 'dark' | 'light' | 'infer' | string | undefined | 'infer' |
| title | Title of the bot. | string | |
| description | Description of the bot. | string | undefined | |
| channel | Key for chat history storage. | string | undefined | |
| show-tip | Show or hide the tip beside badge, doesn't work on mobile view | boolean | undefined | false |
| powered-by-icon-src | Image url for `powered-by` footer. | string | undefined | |
| token | string | undefined | ||
| fg-color | string | undefined | ||
| bg-color | string | undefined |
Properties
| Name | Attribute | Description | Type | Default |
|---|---|---|---|---|
| botAvatar | avatar-src | string | undefined | ||
| title | title | string | ||
| description | description | string | undefined | ||
| headerBackground | header-background-src | string | undefined | ||
| orientation | orientation | 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right' | 'center' | 'bottom-right' | |
| token | token | string | undefined | ||
| server | server | string | undefined | ||
| site | site | string | undefined | ||
| target | target | string | undefined | '_self' | |
| channel | channel | string | undefined | ||
| theme | theme | 'auto' | 'dark' | 'light' | 'infer' | string | undefined | 'infer' | |
| fgColor | fg-color | string | undefined | ||
| bgColor | bg-color | string | undefined | ||
| inferredThemeVariables | object | { 'color-background': '', 'color-border': '', 'color-primary': '', 'color-action': '', 'color-action-secondary': '', 'color-action-contrast': '', 'color-action-contrast-secondary': '', 'color-card-header-background': '', 'color-card-header-color': '' } | ||
| poweredByIconSrc | powered-by-icon-src | string | undefined | ||
| open | open | boolean | undefined | ||
| showTip | show-tip | boolean | undefined | false | |
| busy | ||||
| scrolledToBottom | boolean | undefined | |||
| smallViewPort | boolean | undefined | |||
| preferences | ||||
| debugEnabled | boolean | undefined | false | ||
| __debugEventListener | (evt: CustomEvent) => void | undefined | |||
| answerRenderer | { [k in ANSWER_RENDER_TEMPLATE]: AnswerRenderer } | ANSWER_RENDERER_MAP | ||
| patches | PatchFunction[] | [...DEFAULT_PATCHES] | ||
| __syncOptionsRoutine | (event: Event) => void | |||
| __onScreenResizeRoutine | (event: Event) => void | |||
| __inferThemeRoutine | (_: any) => void |
Methods
| Name | Parameters | Description | Return | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| setQaPairTargeted |
| |||||||||||
| reInferTheme | ||||||||||||
| debugCommands |
| |||||||||||
| submitQuestion |
| |||||||||||
| submitTypedQuestion | ||||||||||||
| scrollDialogToBottom |
| |||||||||||
| scrollToAnswerByRequestId |
| |||||||||||
| toggleOpen | ||||||||||||
| closeCard | ||||||||||||
| openCard | ||||||||||||
| __loadFromSlot |
| |||||||||||
| loadPreferences | ||||||||||||
| __setUpThemeMightChangeObserver | ||||||||||||
| __suspendThemeMightChangeObserver |