-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
feat(ui): connection validation rework #6386
Conversation
@skunkworxdark This does render some of the nodes in your XY pack obsolete, hopefully that's a good thing! |
6bab1a1
to
2601ac0
Compare
@psychedelicious After a brief look at the changes, I have no issues with this PR. I assume that these changes don't alter the behaviour of the existing nodes like So the potential footgun moment only comes if the new |
@skunkworxdark
Yep, that's right. I'm nervous about breaking the seal of our relatively foolproof connection validation logic though. Maybe we can hint to the user that the connection they are making is risky - like highlighting the field with a warning color. I'll try some things out. |
2601ac0
to
be674a9
Compare
That does sound like a good way of visualising a potential problem that would normally be hidden from the user. So if a connection is accepted on the wider type then highlight it with a different colour or line style. |
As I was working through the edge cases, I was increasingly unsure of connection validation. I've rewritten all of it - with full test coverage. This teased out a number of unknown edge cases, now resolved. The connection validation logic also much cleaner. For example, before we had ~3 different places where connection validation logic was implemented, each in a slightly different way. The logic is now consolidated to a handful of utilities (each fully tested). There are is still some a jank around edge updating but the core is sooo much better. |
|
…tion We now keep track of the original field type, derived from the python type annotation in addition to the override type provided by `ui_type`. This makes `ui_type` work more like it sound like it should work - change the UI input component only. Connection validation is extend to also check the original types. If there is any match between two fields' "final" or original types, we consider the connection valid.This change is backwards-compatible; there is no workflow migration needed.
This new field type accepts _any_ model. A field renderer lets the user select any available model.
This node allows a user to select _any_ model, outputting a `ModelIdentifierField` for that model.
Remove our DIY'd reducers, consolidating all node and edge mutations to use `edgesChanged` and `nodesChanged`, which are called by reactflow. This makes the API for manipulating nodes and edges less tangly and error-prone.
eef6bb0
to
1fefe3b
Compare
ca49a4d
to
31d43cc
Compare
I tried to add a warning when falling back on the original type, but propagating a warning got hairy. For now, that node is marked as prototype and its description explains the dangers. Hopefully that's enough to prevent footguns - worst case scenario - you get an error, not a big deal. I'm happy with where this is now. I did some careful testing and fixed a couple outstanding issues. |
Summary
Major Changes:
feat(ui): add originalType to FieldType, improved connection validation
We now keep track of the original field type, derived from the python type annotation in addition to the override type provided by
ui_type
.This makes
ui_type
work more like it sound like it should work - change the UI input component only.Connection validation is extend to also check the original types. If there is any match between two fields' "final" or original types, we consider the connection valid.This change is backwards-compatible; there is no workflow migration needed.
feat(ui): add ModelIdentifierField field type
This new field type accepts any model. A field renderer lets the user select any available model.
feat(nodes): add ModelIdentifierInvocation
This node allows a user to select any model, outputting a
ModelIdentifierField
for that model.Minor Changes:
Related Issues / Discussions
Closes #6380
QA Instructions
The implementation in this PR is maximally flexible.
The increased flexibility comes at the cost of greater potential for footgun. Because model fields accept connections, and we allow any model field as an input, users could accidentally connect invalid fields. For example, a LoRA model could be connected to a ControlNet model input.
We could reduce the flexibility in a few ways:
ModelIdentifierInvocation
.Merge Plan
n/a
Checklist