Restore '/controlnet/control_types' API endpoint #713
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Restores the '/controlnet/control_types' API endpoint, which is immensely useful for anyone using ControlNet via the API
Description
I recently opened an Issue on the main ControlNet extension repo Mikubill/sd-webui-controlnet#2737 suggesting that they add a new API endpoint to allow users to retrieve filtered data based on a Control Type, just like in the UI.
I was both shocked and immensely disappointed when they finally replied, stating that the endpoint does already exist!
I understand that Forge is a massive overhaul to A1111, so perhaps this aspect was removed to get everything working, and then just never reimplemented.
Whatever the case, this endpoint is truly amazing for using ControlNet via API. With only the 'models' and 'modules' endpoints, how the heck is someone to make a dynamic script? They would essentially have to take a fat chunk of existing ControlNet code, plus these few added functions, just to filter the data appropriately.
I'm an amateur coder, at best, however I'm quite confident about this implementation.
This uses your existing functions as best as possible, I believe, including your filter list and the check for currently loaded SD model version.
Please merge this.
Thank you
Screenshots/videos:
response_1714160176770.json
Checklist: