-
Notifications
You must be signed in to change notification settings - Fork 44.6k
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(blocks): Add support for mutually exclusive input fields #8856
base: dev
Are you sure you want to change the base?
feat(blocks): Add support for mutually exclusive input fields #8856
Conversation
### Changes - Introduced `mutually_exclusive` parameter in `SchemaField` to manage input exclusivity. - Implemented logic in `NodeGenericInputField` to disable inputs based on mutual exclusivity. - Updated related components to support the new `disabled` state for inputs. - Enhanced `BlockIOSubSchemaMeta` to include `mutually_exclusive` property.
…fields ### Changes - Added `mutually_exclusive` parameter to `SchemaField` for `text_input_1`, `text_input_2`, and `text_input_3` to group them under "group_1". - Updated `number_input_1` and `number_input_2` to belong to "group2" for mutual exclusivity.
✅ Deploy Preview for auto-gpt-docs-dev ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for auto-gpt-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
from backend.data.model import SchemaField | ||
|
||
|
||
class TestMutualExclusiveBlock(Block): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is a good addition - for the tests however, I wonder if you could put the tests in one of the real blocks to show it working?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good feature, but I'm not sure about the implementation. JSON schema has oneOf
keyword which seems perfect for this purpose. What do you think?
I always prefer using an existing mechanism or standard rather than inventing our own, unless that makes implementation unreasonably complex.
How would that look? I figure if we did that we'd need to implement the rest: allOf, anyOf, oneOf, not, if, then, etc See also #8852 Imo this isn't worth blocking over and json schema is far more complex than meets the eye |
This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request. |
Changes
mutually_exclusive
parameter inSchemaField
to manage input exclusivity.NodeGenericInputField
to disable inputs based on mutual exclusivity.disabled
state for inputs.BlockIOSubSchemaMeta
to includemutually_exclusive
property.Screen.Recording.2024-12-02.at.5.08.42.PM.mov