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

In the old process, an optional variable input was added, and using this variable for branch judgment caused an error in the previous session. #13730

Closed
5 tasks done
abnormalboy opened this issue Feb 14, 2025 · 2 comments
Labels
🐞 bug Something isn't working 🌊 feat:workflow Workflow related stuff.

Comments

@abnormalboy
Copy link

Self Checks

  • This is only for bug report, if you would like to ask a question, 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).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.15.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Once I don't set a variable in the first place, I have no chance to set it again, because the old session will malfunction.
I will demonstrate my example below, I want to add the feature of switching models to my workflow:

  1. My old business:
Image 2.My new business: Image

3.Old session error:

Image

I think adjusting inputs to dynamic will solve everything

✔️ Expected Behavior

Old sessions don't go wrong

❌ Actual Behavior

The old session went wrong.

@dosubot dosubot bot added 🌊 feat:workflow Workflow related stuff. 🐞 bug Something isn't working labels Feb 14, 2025
Copy link

dosubot bot commented Feb 14, 2025

Hey there, @abnormalboy! 👋 I'm here to help you out with any bugs, questions, or contributions you have in mind. I'm Dosu, a bot designed to assist you while you wait for a human maintainer. Let's squash those bugs together!

I found some similar discussions that might be relevant to your issue:

  1. The inputs of the conversation cannot be modified after the conversation is created? - This discussion is still open and might provide insights into handling input modifications in existing sessions [1].

  2. Error in item: Invalid variable. - This is another open discussion that deals with errors related to variables, which might be similar to the issue you're facing [2].

  3. Based on historical conversations, I want to re-transmit the inputs field - This discussion is also open and discusses re-transmitting input fields based on historical data, which could be relevant to your situation [3].

To address your issue of dynamic inputs to prevent errors in old sessions, you can ensure that the inputs are updated with default values or conditions that handle the absence of certain variables. This can be achieved by checking if the configuration is ready and then setting the query_variable_selector conditionally. Here's an example of how you might implement this:

useEffect(() => {
  const isReady = defaultConfig && Object.keys(defaultConfig).length > 0;
  if (isReady) {
    let query_variable_selector: ValueSelector = [];
    if (isChatMode && inputs.query_variable_selector.length === 0 && startNodeId)
      query_variable_selector = [startNodeId, 'sys.query'];
    setInputs({
      ...inputs,
      ...defaultConfig,
      query_variable_selector: inputs.query_variable_selector.length > 0 ? inputs.query_variable_selector : query_variable_selector,
    });
  }
}, [defaultConfig]);

This approach helps in making the inputs dynamic and prevents errors in old sessions by providing fallback values [4][5].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@crazywoola
Copy link
Member

The new configuration only applies for the new conversation.

So the error encountered is an expected behavior.

Image

This has been resolved in below pr.
Ensure the 'inputs' field in /chat-messages takes effect every time (#7955)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working 🌊 feat:workflow Workflow related stuff.
Projects
None yet
Development

No branches or pull requests

2 participants