-
Notifications
You must be signed in to change notification settings - Fork 44.7k
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
Add Input Dependencies and Exclusive Options to Prevent Conflicting Inputs #8731
Comments
Have you taken a look at the llm block for how it handles providers? Also I think this may tie in well with dynamic outputs |
This was referenced Dec 2, 2024
github-merge-queue bot
pushed a commit
that referenced
this issue
Dec 16, 2024
- resolves part of #8731 ### 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. > Currently, I’m disabling the input from the same group (I haven’t added any frontend validation to prevent users from bypassing it). https://github.com/user-attachments/assets/71fb9fe4-943b-4724-8acb-6aed2232ed6b --------- Co-authored-by: Nicholas Tindle <nicholas.tindle@agpt.co>
github-merge-queue bot
pushed a commit
that referenced
this issue
Dec 17, 2024
- Resolves part of #8731 ### Changes - Added `depends_on` parameter to SchemaField in `model.py` to specify field dependencies. - Updated `useAgentGraph` hook to validate input fields based on their dependencies, ensuring required fields are set when dependent fields are filled. - Modified `BlockIOSubSchemaMeta` to include `depends_on` as an optional property. https://github.com/user-attachments/assets/64fd47b3-34dc-48fa-ad90-1c9c5cd4c4a3 --------- Co-authored-by: Zamil Majdy <zamil.majdy@agpt.co> Co-authored-by: Nicholas Tindle <nicholas.tindle@agpt.co>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We need to implement functionality on both the frontend and backend to handle input dependencies and mutual exclusivity in blocks. This includes disabling dependent inputs when prerequisites are not met and ensuring only one input from a group of mutually exclusive options can be selected.
Examples
Suppose we have a block that helps you to create a tweet.
Possible inputs in this could be:
-
text
-
media_ids
-
place_ids
-
quote_ids
-
dm_deep_link
-
poll_options
-
poll_minutes
(must be used with poll_options)With text, we could only provide one option from the above inputs. If the user provides more than one option, they might get an error. Suppose they have given
poll_options
as well asmedia_ids
; they get a 400 bad request.Now, what do you need to do?
You need to add functionality on both frontend and backend so that:
If one input depends upon another input and you fill only one, then you can't run the block; you get a frontend error.
You are able to make a way so that if you have 5 inputs and you need to fill only one, once you fill it, all the other inputs are disabled. Or if some user tries to send data (I know he can't after disabled but as an extra security layer), if he sends it then he gets a frontend error.
My tips that you can consider:
depends
field in the input.If you haven't written anything in
poll_options
, thenpoll_duration_minutes
is disabled.network
similar toDocker.
If 3 inputs are on the same network, then you can only select one.If multiple inputs are on the same network, then you can only fill one.
The text was updated successfully, but these errors were encountered: