langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
53.23k stars 7.77k forks source link

[Embedded chatbot] GET input params passed in iframe src are lost after clicking "Reset Conversation" #11025

Open johnpccd opened 5 days ago

johnpccd commented 5 days ago

Self Checks

Dify version

0.11.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Embed a chatbot on a website using an iframe. Pass input values as GET params as per this PR. This requires gzipping and base64 encoding the values before sending. Open the website, chatbot works fine the first time. Press Reset Conversation

✔️ Expected Behavior

The conversation is restarted with the same input variables as before

❌ Actual Behavior

The input values are cleared

dosubot[bot] commented 5 days ago

The issue you're experiencing is that the input parameters passed via the iframe src are not retained after clicking "Reset Conversation." This happens because the current implementation of the reset functionality does not reapply the input parameters after a reset.

To address this, you can leverage the session management mechanism provided by Dify, specifically the "Conversation Variables" feature. This allows you to temporarily store information within the same Chatflow session, ensuring it can be referenced across multiple rounds of chatting. By using conversation variables, you can retain the input parameters and reinitialize them after a reset [1].

Additionally, you might need to modify the handleRestart function or the related logic to ensure that the input parameters are reapplied when the conversation is reset. This could involve storing the initial input parameters in a persistent state or variable that is not cleared during the reset process and then reapplying them when initializing the new session.

To continue talking to Dosu, mention @dosu.

johnpccd commented 5 days ago

The issue you're experiencing is that the input parameters passed via the iframe src are not retained after clicking "Reset Conversation." This happens because the current implementation of the reset functionality does not reapply the input parameters after a reset.

To address this, you can leverage the session management mechanism provided by Dify, specifically the "Conversation Variables" feature. This allows you to temporarily store information within the same Chatflow session, ensuring it can be referenced across multiple rounds of chatting. By using conversation variables, you can retain the input parameters and reinitialize them after a reset [1].

Additionally, you might need to modify the handleRestart function or the related logic to ensure that the input parameters are reapplied when the conversation is reset. This could involve storing the initial input parameters in a persistent state or variable that is not cleared during the reset process and then reapplying them when initializing the new session.

To continue talking to Dosu, mention @dosu.

Conversation Variables are (and should) not be retained when you click "Reset Conversation"