Share feedback, ideas and get community help

Updated 3 months ago

Bot "forgets" previous messages (Several conversation ids for the same interaction)

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.

Example Conversation


Previous messages

[ 🤓 user message 5]

----------------------------------------
DEBUG
user_id: l67hlo5o6gb2xmaqbew5oac5
conversation_id: a1642f44-da81-4efc-80ec-e58385031b77
----------------------------------------

[ 🤖 bot response 5]
[ 🤓 user message 6]

----------------------------------------
DEBUG
user_id: l67hlo5o6gb2xmaqbew5oac5
conversation_id: a1642f44-da81-4efc-80ec-e58385031b77
----------------------------------------

[ 🤖 bot response 6]
[ 🤓 user message 7]

----------------------------------------
DEBUG
user_id: l67hlo5o6gb2xmaqbew5oac5
conversation_id:
----------------------------------------

[ 🤖 bot response 7]
[ 🤓 user message 8]

----------------------------------------
DEBUG
user_id: l67hlo5o6gb2xmaqbew5oac5
conversation_id: b41df4c7-bca1-4314-b245-3db3e9dcb7ca
----------------------------------------

[ 🤖 bot response 8: Hello, how can I help you? 😊 ]
Attachments
Screenshot_2024-03-29_162722.png
Screenshot_2024-03-29_162758.png
1
J
g
B
18 comments
@Hélio Potelicki: Pra você acompanhar aqui 🙂
Bot "forgets" previous messages (Several conversation ids for the same interaction)
Follow-up: Still haven't figured it out. The variable gets reset at semmingly random intervals
Is it one bot?

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).

Hope you solve this!
Indeed, the Dify AI block was unstable for this
We pushed a fix 2 weeks ago
v2.24.0 will be released in a couple of hours
@João Morossini Idk if you figure the Conversation ID problem but this is it.
Attachment
Screenshot_2024-04-03_at_12.12.38_AM.png
Yes, that's how I'm using it as well, but the problem remains. Every once in a while, Typebot resets the conversation_id
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
Hmmm ok, I'll try to reproduce!
I need a way to reproduce. Can you tell us details about your Dify agent?
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
Dear @Baptiste have you had any luck with this issue? Thanks in advance
Will work on that fairly soon 👍
Add a reply
Sign up and join the conversation on Discord