simple chat workflow. The chat trigger is set to load previous sessions. The memory node is Session ID = Define below and Key = CurrentSession. When the workflow loads, it does not load previous sessions nor does it load the “CurrentSession”. The sesssion id is always a new id and there is no chat history. How do I get it to retain the chat history on load?
I have the same issue - it seems like the n8n chat library always creates a new session ID even if you have loadPreviousSession: true in the createChat config.
I can see the sessionID in the localSession of the browser but its not sending it for some reason
Hi, I’ve been having trouble with this as well, and I was able to HACK together a ‘solution’ but I’m pretty sure (hope) it wasn’t meant to work like this. Here’s that ‘working’ example: https://jsfiddle.net/cqeuwp2m/1/
correction: in that example, I mentioned setting the chat node to ‘manual’. The right move is leaving it set to ‘off’. otherwise the chat node will grind a bit trying to loadPreviousSession, against a sessionId with no history, and pass an undefined chatInput to the agent node.
So
in the chat node, leave Load Previous Session off
in the html config, set up a valid uuid, and pass it in the metadata as n8nchatui.sessionKey
later in the html config, pass loadPreviousSession: true,
after the chat node, add a set node with pass-thru chatInput, action, and metadata, and a redefined sessionId based on the uuid packed in metadata