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

Connection and variables are lost when block changes are made #11912

Open
5 tasks done
sotono-046 opened this issue Dec 20, 2024 · 3 comments
Open
5 tasks done

Connection and variables are lost when block changes are made #11912

sotono-046 opened this issue Dec 20, 2024 · 3 comments
Labels
💪 enhancement New feature or request

Comments

@sotono-046
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.14.1

Cloud or Self Hosted

Cloud

Steps to reproduce

  • Create a new block, any type is acceptable
  • Set variables in the block and make it have connections to other blocks
  • Select “Change Block” from the context menu
  • The existing block is replaced by the new block of your choice.
  • The variables set in the existing block and its connections to other blocks will be deleted.

✔️ Expected Behavior

  • Preserves the connection between the variable and the block when the block is changed
  • If variables are difficult, keep the connection
  • (If it is not compatible, there should be no connection)

❌ Actual Behavior

  • The variables set in the existing block and its connections to other blocks will be deleted.
@dosubot dosubot bot added the 🐞 bug Something isn't working label Dec 20, 2024
Copy link

dosubot bot commented Dec 20, 2024

Hello @sotono-046! 👋 I'm here to help you with bugs, questions, and becoming a contributor. I'm Dosu, a bot designed to assist you while you wait for a human maintainer.

The issue you're experiencing, where connections and variables are lost when a block is changed, seems to be related to how Dify handles block changes. Currently, there isn't specific documentation or code comments in the Dify codebase that explain the rationale behind deleting connections when a block is changed. However, the logic for handling variable preservation when a block is changed involves checking for affected nodes and updating them if a variable's name changes [1].

To address this issue, you might consider implementing a mechanism that checks for compatibility between the old and new block types before deciding whether to preserve or delete connections and variables. This could involve:

  1. Compatibility Check: Before changing a block, check if the new block type is compatible with the existing connections and variables. If compatible, preserve them.

  2. Preservation Logic: Implement logic to update the connections and variables to fit the new block type, if possible.

  3. User Confirmation: If compatibility cannot be ensured, prompt the user to confirm the deletion of connections and variables.

These steps could help in maintaining the integrity of your workflow when blocks are changed.

To continue talking to Dosu, mention @dosu.


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

@sotono-046
Copy link
Author

Sorry, I checked but forgot to attach the recording of the actual behavior, here it is!

2024-12-20.204740.mp4

@crazywoola crazywoola added 💪 enhancement New feature or request and removed 🐞 bug Something isn't working labels Dec 21, 2024
@crazywoola
Copy link
Member

Preserves the connection between the variable and the block when the block is changed
If variables are difficult, keep the connection
(If it is not compatible, there should be no connection)

I think we decided to do this because the 3 items is too complicated to achieve.

The variables set in the existing block and its connections to other blocks will be deleted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💪 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants