Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Inputs and variables in chatflow. #4241

Open
4 tasks done
santiagoblanco22 opened this issue May 10, 2024 · 6 comments
Open
4 tasks done

Issue with Inputs and variables in chatflow. #4241

santiagoblanco22 opened this issue May 10, 2024 · 6 comments

Comments

@santiagoblanco22
Copy link

Self Checks

  • This is only for bug report, if you would like to ask a quesion, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • Pleas do not modify this template :) and fill in all the required fields.

Dify version

0.6.7

Cloud or Self Hosted

Cloud

Steps to reproduce

Try to send params the first time and works.
But If I send the second with the conversationId in the payload for refresh the value, not works.
Other thing, in my opinion is a bad idea:
Variables referenced within a node can only be those from preceding process nodes to ensure coherence and avoid duplication.
Maybe I want to save a variable for a future use in the first node. I don't know how to persist variables for use in the next chat iteration :(

✔️ Expected Behavior

You can send inputs params in all messages and save variables.

❌ Actual Behavior

Ignore the value of the input in the second message.

Copy link

dosubot bot commented May 10, 2024

To address the issue of persisting variables for use in subsequent chat iterations in Dify, and the challenge with input values being ignored in the second message, consider the following approach:

  1. Leverage System Variables: Utilize system variables like sys.conversation_id to maintain context across the chat session. These variables are automatically persisted and can serve as references for storing and retrieving session-specific data.

  2. Employ the VariableAssigner Node: Use the VariableAssigner node within your chatflow to create or update variables. This allows for the dynamic assignment of values based on user interactions, API call results, or predefined logic, facilitating the persistence of data across different parts of the chatflow.

  3. Strategically Pass Variables Between Nodes: Ensure your chatflow is designed to logically progress variable assignments from one node to the next. This method helps in maintaining coherence and avoiding duplication by using the output of preceding nodes as input for subsequent ones.

  4. External Persistence for Cross-Iteration Variables: For variables you wish to persist across chat iterations beyond the current session, consider integrating an external database or service. By keying this external storage with sys.conversation_id, you can effectively manage conversation states, retrieving and updating them as needed.

This approach should help overcome the limitations you've encountered with variable persistence and input handling in Dify version 0.6.7. For more detailed guidance on using the VariableAssigner node and system variables, refer to the Dify documentation or the specific components within the repository.

Details

Sources


About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

@santiagoblanco22
Copy link
Author

@dosu let me know if you understand the problem.

Copy link

dosubot bot commented May 10, 2024

Yes, I understand the problem. You're facing two main issues: first, input values sent in the second message are being ignored, and second, you're looking for a way to persist variables across chat iterations for future use. The solutions provided aim to address both concerns by suggesting the use of system variables and the VariableAssigner node for maintaining context and persisting data across chat sessions. Additionally, integrating an external storage solution for variables that need to be accessed in future chat iterations can help manage conversation states effectively. If these solutions do not resolve your issue or if there's a specific aspect of the problem that hasn't been addressed, please provide more details so I can offer further assistance.

Details

About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

@santiagoblanco22
Copy link
Author

@dosu but manage a external storage for a state is a lot of work.

Copy link

dosubot bot commented May 11, 2024

To streamline the management of input parameters and variable persistence in Dify without the need for external databases, consider leveraging Dify's built-in features for conversation applications. Here's a more focused approach:

  1. Utilize Expert Mode for Advanced Control: When composing your application, switch to Expert Mode. This gives you precise control over prompts, allowing for effective management of variables and context to ensure input parameters are recognized across messages.

  2. Employ Form Variables in Prompts: Use form variables within your prompts to dynamically incorporate user input. This method ensures that the AI consistently recognizes and utilizes input parameters throughout the conversation.

  3. Incorporate Opening Dialogue and Context: Add an opening dialogue to set the stage for the interaction and use the "Conversation remarkers" feature to acknowledge user input from the start. If needed, include a knowledge base in the context section to inform the AI's responses based on previous interactions.

  4. Debug and Adjust: Leverage the debugging feature to test and refine your prompts and model parameters. This helps ensure that variables are correctly persisted and input parameters are accurately recognized throughout the conversation.

  5. Publish and Share: Once your application meets your requirements, publish it and share it with others for easy access. For customization, consider forking the open-source WebApp template.

For detailed guidance, refer to the Dify documentation and the Prompt Engineering guide. The Node.js client SDK can also provide insights into interacting with Dify's API.

This approach should help you manage input parameters and persist variables effectively within your Dify chat applications, streamlining the process and enhancing user interactions.

Details

Sources


About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

@iamjoel
Copy link
Collaborator

iamjoel commented May 11, 2024

@santiagoblanco22 Can you describe the specific scenario where this feature is required?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants