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
46.75k stars 6.61k forks source link

Output Variables are not available to all node #8813

Closed rabbitrepo closed 2 days ago

rabbitrepo commented 2 days ago

Self Checks

Dify version

0.8.3

Cloud or Self Hosted

Cloud

Steps to reproduce

Screenshot 2567-09-26 at 21 45 58

-- The entire flow --

Screenshot 2567-09-26 at 21 53 13

Having the CODE node at the start of the flow. Set the Output Variables.

Screenshot 2567-09-26 at 21 53 29

The Output Variables are not accessible to other nodes.

Screenshot 2567-09-26 at 21 54 21

The Output Variables only accessible to the END node.

✔️ Expected Behavior

The Output Variable should be available to all node afterwards.

❌ Actual Behavior

The Output Variables only accessible to the END node.

rabbitrepo commented 2 days ago

Allowing this would make more complex workflows possible and improve Dify's capability by a lot. Hopefully, we can support this soon! 🥺

dosubot[bot] commented 2 days ago

Hey there, @rabbitrepo! I'm here to help you with any bugs, questions, or contributions you have for Dify. Let's work together to make things easier for you.

The issue you're encountering with output variables only being accessible to the END node in Dify version 0.8.3 is due to the design of the workflow system. According to the documentation, "When referencing variables, only upstream node variables in the process can be referenced." This means that nodes can only access variables from previous nodes in the workflow, and the final output is specifically managed and made available at the END node. This design ensures that the workflow completes its execution before producing the final result, maintaining the integrity and sequence of operations within the workflow [1][2].

There are no existing configurations or settings in Dify that allow output variables to be accessible to nodes other than the END node. This limitation is inherent to the current workflow design.

For more complex workflows and variable sharing between nodes, you might need to implement custom logic within your workflow processing or node handling. This could involve modifying node output structures or ensuring that variables are passed along between nodes as needed.

If you are looking for examples or templates that demonstrate complex workflows with variable sharing between nodes, I wasn't able to find specific examples in the documentation. However, you might want to explore the official resources and community discussions for potential workarounds or updates on this feature [1][2].

To continue talking to Dosu, mention @dosu.

crazywoola commented 2 days ago

This is not a bug, actually it is by design feature. For example, the LLM node accepts the string as prompt, but somehow you passed an image or a file to it in the prompt(it should be in other parameters), then it will not be recognized at all, and it will introduce more complex scenarios.