This commit is contained in:
Makki Shizu 2025-04-11 09:49:49 -04:00 committed by GitHub
commit e74c43cb0e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -99,10 +99,10 @@ class CustomNodeManager:
files = [ files = [
file file
for folder in folder_paths.get_folder_paths("custom_nodes") for folder in folder_paths.get_folder_paths("custom_nodes")
for file in glob.glob( for pattern in ["*/*example*/*.json", "*/*workflow*/*.json"]
os.path.join(folder, "*/example_workflows/*.json") for file in glob.glob(os.path.join(folder, pattern))
)
] ]
files = list({os.path.normpath(f) for f in files})
workflow_templates_dict = ( workflow_templates_dict = (
{} {}
) # custom_nodes folder name -> example workflow names ) # custom_nodes folder name -> example workflow names
@ -118,15 +118,23 @@ class CustomNodeManager:
# Serve workflow templates from custom nodes. # Serve workflow templates from custom nodes.
for module_name, module_dir in loadedModules: for module_name, module_dir in loadedModules:
workflows_dir = os.path.join(module_dir, "example_workflows") workflow_patterns = ["*example*", "*workflow*"]
if os.path.exists(workflows_dir): workflows_dirs = [
webapp.add_routes( os.path.join(module_dir, d)
[ for pattern in workflow_patterns
web.static( for d in glob.glob(os.path.join(module_dir, pattern))
"/api/workflow_templates/" + module_name, workflows_dir if os.path.isdir(d)
) and ("example" in d.lower() or "workflow" in d.lower())
] ]
) for workflows_dir in workflows_dirs:
if os.path.exists(workflows_dir):
webapp.add_routes(
[
web.static(
"/api/workflow_templates/" + module_name, workflows_dir
)
]
)
@routes.get("/i18n") @routes.get("/i18n")
async def get_i18n(request): async def get_i18n(request):