serve workflow templates from custom_nodes#6193
serve workflow templates from custom_nodes#6193comfyanonymous merged 11 commits intoComfy-Org:masterfrom
Conversation
server.py
Outdated
|
|
||
| return web.json_response(extensions) | ||
|
|
||
| @routes.get("/workflow_templates") |
There was a problem hiding this comment.
We do have a plan to eventually move ComfyUI-Manager's custom node management features to core. Can we move this endpoint to a separate file app/custom_node_manager.py?
server.py
Outdated
|
|
||
| @routes.get("/workflow_templates") | ||
| async def get_workflow_templates(request): | ||
| files = glob.glob(os.path.join(folder_paths.custom_nodes_directory, '*/example_workflows/*.json')) |
There was a problem hiding this comment.
I think you can just call folder_paths.get_folder_paths("custom_nodes") here instead of adding a new global variable in folder_paths.
folder_paths.py
Outdated
| temp_directory = os.path.join(os.path.dirname(os.path.realpath(__file__)), "temp") | ||
| input_directory = os.path.join(os.path.dirname(os.path.realpath(__file__)), "input") | ||
| user_directory = os.path.join(os.path.dirname(os.path.realpath(__file__)), "user") | ||
| output_directory = os.path.join(base_path, "output") |
There was a problem hiding this comment.
nit: I don't think these changes are related to this PR although they seem to be good.
Let's revert them for now so that we are sure that this PR does not break anything related.
|
Note: test failure is due to python 3.8, which is fixed in 160ca08 @bezo97 Can you rebase the PR? @comfyanonymous PTAL |
app/custom_node_manager.py
Outdated
| @routes.get("/workflow_templates") | ||
| async def get_workflow_templates(request): | ||
| """Returns a web response that contains the map of custom_nodes names and their associated workflow templates. The ones without templates are omitted.""" | ||
| files = glob.glob(os.path.join(folder_paths.get_folder_paths("custom_nodes")[0], '*/example_workflows/*.json')) |
There was a problem hiding this comment.
This only seems to take into account the first custom node path?
There was a problem hiding this comment.
Sorry didn't realize the logic that there could be more, fixed now
…m/bezo97/ComfyUI into feature/custom_workflow_templates
This PR prepares the following feature request: Comfy-Org/ComfyUI_frontend#1008
Related frontend PR: Comfy-Org/ComfyUI_frontend#2032
Implementation details:
@routes.get("/workflow_templates")- This endpoint returns a map of custom_nodes names and their associated workflow template files. The ones without templates are omitted. Example:LOADED_MODULE_DIRSwhere we keep track of all successfully loaded custom_nodes and their directories (even when there is no class mapping and web directory)custom_nodes/*/example_workflows/*Question to reviewers:
/example_workflowsfolders sufficient or shall we support existing folder structures of popular custom_node repos by allowing/examples,/workflows, etc.?