Dify 0.9.1 - Agent - Using via API session problem
Self Checks
- [X] This is only for bug report, if you would like to ask a question, please head to Discussions.
- [X] I have searched for existing issues search for existing issues, including closed ones.
- [X] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
- [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
- [X] Please do not modify this template :) and fill in all the required fields.
Dify version
0.9.1
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
I created an Agent and I am accessing the agent via API. When I start the conversation with the bot, the message history session does not remain. The bot always starts the conversation from the beginning. This same error does not occur when I test the bot within Dify. The problem occurs when I use it via API. Webhook.
✔️ Expected Behavior
That the bot would continue with the memory without restarting the conversation.
❌ Actual Behavior
The bot should continue to respond to messages as the user converses with it and not restart the conversation.
Do not test with chatflow and this problem only started to occur in version 0.9.1, the same problem does not occur in version 0.8.3.
Hello @wilsonfe! I'm here to assist you with any bugs, questions, and contributions you might have regarding Dify. Let's squash those bugs together! 😊
I found some similar issues and discussions that might be relevant to your problem with session management in Dify 0.9.1:
-
There is an open issue titled Custom API Chatbot with nodejs no history of the conversation Included, which discusses a similar problem where the chatbot does not remember the previous conversation when using the API. The suggested solution is to ensure that the
conversation_idis correctly managed in your API requests. You should retrieve theconversation_idafter the initial chat request and use the sameconversation_idfor subsequent requests to maintain the conversation context [1]. -
Another related issue is Agent bot was lack of history conversation messages, which is closed. It suggests using the
ContextandHistoryvariables to maintain the context of each agent query. These variables allow you to reference the content and historical dialogue records for generating responses. This approach is applicable to the Text completion model of conversational applications [2].
These solutions might help you address the session persistence issue you're experiencing with Dify 0.9.1. Make sure to manage the conversation_id properly in your API requests to maintain the conversation history.
To continue talking to Dosu, mention @dosu.
I'm experiencing the same thing for version 1.9.0
me too
Duplicated fixed in #8965