I just noticed this issue in my app. Somehow, the conversation_id changes during the interaction for no apparent reason. The app uses Dify as the AI engine. There's only one Dify block running in a loop. It gets the user_id created at the start of the flow and automatically generates a conversation_id, which should be used throughout the interaction.
However, at some point the conversation_id variable is reset, effectively splitting the conversation history.
Below, you will find an example conversation. I've omitted the actual messages because of privacy concerns. After each user message a text bubble is being used for debugging. It prints the current values of the user_id and the conversation_id variables.
You'll notice that after user message 7, the conversation_id variable becomes empty.
Could you save the id to a separate variable or even off bot in like a google sheet, then put in checks if it is empty and go grab it again by the user id? (as a work around but I don't know how large your bot is if the checks would be cumbersome to implement)
My issues with variables getting reset had to do with child bots (jumping from bot to bot if I didn't create all the variables in each bot then they would get emptied, but @Baptiste recently fixed that issue).
Thanks for the reply, @Baptiste but we've updated Typebot but the issue persists. Would it be possible to create a conversation_id outside of the Dify block and then use it? I've tried it using the "Set variable" block with the "Random ID" option and I also tried using JavaScript to create a random conversation_id in the same format that Dify creates the id, but neither attempt was successfull
Hmm well since the Conversation ID is created by Dify after the conv started you should save it in the variable like you do and somehow(maybe using a web-hook with a database connection or n8n) match that ID with the User ID , to continue that same conversation in the future. For example since im using evoapi I have it to reset every 10minutes if the user is idle for that time and it creates a new convID but I could use the RemoteJid to match the user with the convID for future chats. Haha sorry if this seems a bit confusing hope it gives you some light
Sure. It's a "Basic Assistant" with a knowledge base, and a single variable that comes from Typebot. I've tried adding a Dify block which runs only once at the start of the flow just for setting the conversation_id to be used downstream by the next Dify block that runs on a loop and provides answers to user queries. That also has not solved the problem. Every once in a while, it just changes the value of the conversation_id variable, splitting the conversation history. When that happens, the first message in the new conversation disappears from the chat interface and the next message goes back to normal