Configuration Reference

Configuration Reference#

This page lists the options of initNeoSdk() and NeoSdk.mount(). On a <neo-chat> element, each option except onWarning and items is a property of the same name. On <neo-items>, set filters, sort, initialFilters, and onFiltersChange as properties of the element. For the attributes of <neo-chat>, see the Element Attributes section. For how each option fits into a page, see the Embedding Neo Chat in Your Own App or Site page.

Options#

Option

Description

baseUrl

The URL of your proxy, including its mount path. Required.

projectId

The Squirro project to answer from. Required.

auth

anonymous, token, or none. Defaults to token when getToken is set, and to none otherwise.

getToken

Returns your session token, as a string, as { token, expiresAt } with the expiry in epoch milliseconds, or as { token, expiresIn } with the lifetime in seconds. Used with auth: 'token'.

tokenTtlMs

How long a token without an expiry is trusted, in milliseconds. Defaults to five minutes.

theme

The colors, corner rounding, font, mode, and preset of the chat.

layout

{ mode: 'inline' }, or { mode: 'floating', ... } with the position, labels, and size of the floating panel.

context

The page context for answers: 'auto', options, or a function.

links

{ site?, internal?, external?, navigate? }: which links belong to your site, and what a click does.

events

Lifecycle notifications, such as onAnswerCompleted.

welcome

{ title?, message?, suggestions? }: what the empty chat shows.

strings

Replacement text for the labels of the chat, for another language or your own wording. The defaults of the welcome are welcomeTitle, welcomeMessage, and welcomeSuggestionsLabel. conversationLabel, Conversation by default, names the conversation area, which is a region rather than the main element of the page.

documentStrings

Replacement text for the document view of this instance: the overlay that its citations or search results open, and a NeoItemDetail or <neo-item-detail> in it. It covers Close, Retry, the pager, the error card, Open original, and the rest. Each element of the script-tag embed is its own instance, so set it on each element whose documents should be translated, including <neo-items> for the documents that its results open. For every key, see the docs/documents.md file in the package.

callbacks

Hooks into the chat, for example transformQuestion to rewrite a question before it is sent, or onLinkClick to take over a link click.

capabilities

Turns optional chat features on or off.

attachments covers the upload menu, dropped and pasted files, and turning a long paste into a file. It is off by default. Turn it on only when your proxy accepts uploads, with allowUploads: true. Otherwise, every attachment fails.

inlineActions, the tooltip on selected answer text, is on, and offers Copy and Quote. Explain and Translate are left out, because the chat has nothing to run them through, unless callbacks.onExecuteSelectionStream supplies a stream. For what the proxy does with those requests when every reader shares the service account, see the docs/proxy.md file in the package.

items

The defaults for every search widget of this instance: filters, sort, initialFilters, and onFiltersChange.

onWarning

Receives the warnings of the SDK, such as a refused download. Defaults to console.warn.

pdfViewer

{ licenseKey?, assetsUrl? }: where the viewer files are served from, by default <baseUrl>/assets/nutrient/, and a license key only for a viewer that the proxy does not serve, since the proxy serves the key of the deployment. Use one of each per page.

Theme Keys#

The theme option takes the following color keys. For mode, dark, fontFamily, fontSize, and preset, see the Colors and Fonts section of the Add the Chat to Your Page page.

Key

What it sets

primary

Buttons, links, and highlights.

primaryForeground

Text on primary. Calculated automatically when left out.

background, foreground

The surface and the body text of the chat.

muted, mutedForeground

Secondary surfaces and quieter text.

border, accent, destructive

Borders, hover surfaces, and errors.

radius

Corner rounding, for example '6px'.

Events#

The events option reports the following events:

Event

Fires when

onConversationStarted

The first question of a new conversation is sent.

onQuestionSent

A question is sent.

onAnswerCompleted

An answer is final. It carries the answer text and its sources, and a reason, such as completed, or stopped when the reader clicks Stop.

onAnswerFailed

An answer ends in an error.

onInterrupt

The agent is waiting for the reader to approve an action.

onOpenChange

The floating panel opens or closes.

Element Attributes#

The <neo-chat> element supports these attributes:

Attribute

Description

base-url

The URL of your proxy. Required.

project-id

The Squirro project to answer from. Required.

auth

anonymous, token, or none. See the Signing Readers In section of the Add the Chat to Your Page page.

layout

inline, the default, or floating. See the Inline or Floating section of the Add the Chat to Your Page page.

theme-mode

light, dark, or auto.

theme-preset

neutral, the default, or squirro.

token-ttl-ms

How long a token without an expiry is trusted, in milliseconds. The tokenTtlMs property takes precedence over it.

context

auto reads the page that the reader is on. See the Answer about the Page the Reader Is On section of the Connecting the Chat to Your Page page.

link-site

Space-separated origins or URL prefixes that count as your site. See the Links in Answers section of the Connecting the Chat to Your Page page.

link-internal

new-tab, the default, or same-tab, for links into your site.

link-external

new-tab, the default, or block, for every other link.

attachments

When present, or set to true, lets readers attach files. Off by default. See capabilities in the Options section.

welcome-title, welcome-message

The heading of the empty chat and the line under it. See the Welcome the Reader section of the Add the Chat to Your Page page.

welcome-suggestions

Questions that the empty chat offers, separated by |. For a question that itself contains a |, set the welcome property instead.