Working with online chat and node chat

Describe the problem/error/question

Please share your workflow

This is how I installed chat on the site

<script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
<div>Текст</div>

<link href="https://nn.mirrox-hub.ru/webhook/ffa96977-51a8-4a83-bfe9-a345394adc2a" rel="stylesheet" />
<script type="module">
    import { createChat } from 'https://nn.mirrox-hub.ru/webhook/b87ab0ec-6a76-4c88-9003-efcee0df90c3';

    createChat({
        webhookUrl: 'https://nn.mirrox-hub.ru/webhook/87b86322-47fa-48d3-8968-93c0ae2ffe31'
    });
</script>

It seems like I wrote in the code so that the history is stored. But for some reason, when the page is refreshed, the site changes sessionId

Okay, I understand that the first time you open a page, in theory you can somehow pull up the history from the database, but I don’t understand in what format the data should be returned to a request from a chat like loadPreviousSession

For chat mode you need to give {“output”:“{{ $json.body.chatInput }}”} in the last node

But it’s not clear from the documentation how to save adi sessions and load the history in what format. I understand that you need to give something like metadata, but in what format should you give the array of messages?

n the lower node the code Respond to Webhook1 was downloaded from here https://cdn.jsdelivr.net/npm/@n8n/chat/chat.bundle.es.js

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:
  • n8n version: 1.19.1
  • Database postgres:
  • n8n EXECUTIONS_PROCESS setting main:
  • Running n8n via Docker :
  • Operating system: Linux

Hey @mirrox,

The metadata can be any javascript you want but for chat history I would expect the memory nodes to be used as well which may help. It does look like this was raised as an issue internally the other day and was potentially fixed in 1.32.0 (fix(editor): Fix retrieving of messages from memory in chat modal by OlegIvaniv · Pull Request #8807 · n8n-io/n8n · GitHub) so an upgrade could be worth doing.