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
| Variable | What it holds |
|---|---|
state.query | The text currently in the search box. |
state.results | The array of exchanges so far (questions, answers, forms, welcome). |
state.isLoading | true while a query is running — use it to show the loader. |
state.config | The full assistant configuration (settings, hints, forms, translations). |
state.name | The assistant's display name. |
state.instance | The connector instance (also reachable as skdwn.instance). |
state.attachmentResponses | Summaries generated for attachments. |
state.followUps | Suggested 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 fromonclick/oninput.skdwn.instance.templates— every active template by name.skdwn.instance.startOptions— the options the page started the assistant with (including youradditionalContext).
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.