The State Object

Every template renders with two top-level variables: state (everything about the current conversation) and skdwn (the live assistant instance). Read from them to decide what to show.

state

VariableWhat it holds
state.queryThe text currently in the search box.
state.resultsThe array of exchanges so far (questions, answers, forms, welcome).
state.isLoadingtrue while a query is running — use it to show the loader.
state.configThe full assistant configuration (settings, hints, forms, translations).
state.nameThe assistant's display name.
state.instanceThe connector instance (also reachable as skdwn.instance).
state.attachmentResponsesSummaries generated for attachments.
state.followUpsSuggested follow-up questions, when present.

skdwn

skdwn.instance is the running assistant. The parts you'll use in templates:

  • skdwn.instance.config — the merged configuration.
  • skdwn.instance.helpers — the handlers you call from onclick/oninput.
  • skdwn.instance.templates — every active template by name.
  • skdwn.instance.startOptions — the options the page started the assistant with (including your additionalContext).

Reading State

{% if state.isLoading %}
  {% include 'loading' %}
{% elsif state.results.length == 0 %}
  {% include 'welcome' %}
{% else %}
  {% include 'results' %}
{% endif %}

Turn on debug while you build

Start the assistant with isDebug: true and Seekdown logs the state before each render, so you can see exactly what your template has to work with. You can also drop {{ state | log }} into a template to print the state inline.

Go Deeper


Contact us

Still need help?

Tell us what you want your website assistant to answer. We will help you map the right content, controls, and launch path.