dify icon indicating copy to clipboard operation
dify copied to clipboard

Dify 0.9.1 - Agent - Using via API session problem

Open wilsonfe opened this issue 1 year ago • 1 comments

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.

wilsonfe avatar Oct 03 '24 17:10 wilsonfe

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:

  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_id is correctly managed in your API requests. You should retrieve the conversation_id after the initial chat request and use the same conversation_id for subsequent requests to maintain the conversation context [1].

  2. Another related issue is Agent bot was lack of history conversation messages, which is closed. It suggests using the Context and History variables 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.

dosubot[bot] avatar Oct 03 '24 17:10 dosubot[bot]

I'm experiencing the same thing for version 1.9.0

JVini0166 avatar Oct 04 '24 02:10 JVini0166

me too

averyyan avatar Oct 04 '24 09:10 averyyan

Duplicated fixed in #8965

crazywoola avatar Oct 04 '24 09:10 crazywoola