-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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 route to list model types #4846
Add route to list model types #4846
Conversation
server.py
Outdated
|
||
@routes.get("/models") | ||
def list_model_types(request): | ||
return web.json_response(list(folder_paths.folder_names_and_paths)) |
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.
probably only need to grab the keys here? the values are local system paths which shouldn't be sent over network api
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.
The endpoint should be something like GET /models/paths
or GET /models/folders
.
Since it is only returning the types of models or available folders.
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.
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.
The endpoint should be something like
GET /models/paths
orGET /models/folders
. Since it is only returning the types of models or available folders.
Wouldn't that interfere with if someone were to have an extra model path named either one of those? Probably unlikely but I think it would be better if there wasn't a chance for route conflict.
I can change the route if needed its just that setting it to /models
seemed the most logical.
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.
yes that format would be a conflict. It works as /models
, if a different name is needed it'd have to be eg /model_folders
or something
…/ComfyUI into model-types-list-route
Adds a route to list all valid model types as a JSON list.
This will benefit those working with the api as it will allow for an easy way to list model types.
I have seen people in the past request a feature like this ( such as #830 ) and this adds it in a safe and simple way.