mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-09-13 07:47:06 +08:00
fix: decouple comfyui to python funcion from main file
This commit is contained in:
parent
d5a4da37cd
commit
039e51305d
@ -1 +1 @@
|
||||
Subproject commit d3b82726a7f185f25f3d0194702ea17df47ee167
|
||||
Subproject commit 2c75211aa0080368804401856c0b1c4c19558b72
|
||||
@ -69,7 +69,7 @@ def add_extra_model_paths() -> None:
|
||||
"""
|
||||
Parse the optional extra_model_paths.yaml file and add the parsed paths to the sys.path.
|
||||
"""
|
||||
from main import load_extra_path_config
|
||||
from main_utils import load_extra_path_config
|
||||
|
||||
extra_model_paths = find_path("extra_model_paths.yaml")
|
||||
|
||||
@ -81,7 +81,6 @@ def add_extra_model_paths() -> None:
|
||||
add_comfyui_directory_to_sys_path()
|
||||
add_extra_model_paths()
|
||||
|
||||
|
||||
from nodes import (
|
||||
NODE_CLASS_MAPPINGS,
|
||||
SaveImage,
|
||||
|
||||
22
main.py
22
main.py
@ -6,7 +6,7 @@ import importlib.util
|
||||
import folder_paths
|
||||
import time
|
||||
from comfy.cli_args import args
|
||||
|
||||
from main_utils import load_extra_path_config
|
||||
|
||||
def execute_prestartup_script():
|
||||
def execute_script(script_path):
|
||||
@ -176,26 +176,6 @@ def cleanup_temp():
|
||||
shutil.rmtree(temp_dir, ignore_errors=True)
|
||||
|
||||
|
||||
def load_extra_path_config(yaml_path):
|
||||
with open(yaml_path, 'r') as stream:
|
||||
config = yaml.safe_load(stream)
|
||||
for c in config:
|
||||
conf = config[c]
|
||||
if conf is None:
|
||||
continue
|
||||
base_path = None
|
||||
if "base_path" in conf:
|
||||
base_path = conf.pop("base_path")
|
||||
for x in conf:
|
||||
for y in conf[x].split("\n"):
|
||||
if len(y) == 0:
|
||||
continue
|
||||
full_path = y
|
||||
if base_path is not None:
|
||||
full_path = os.path.join(base_path, full_path)
|
||||
logging.info("Adding extra search path {} {}".format(x, full_path))
|
||||
folder_paths.add_model_folder_path(x, full_path)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if args.temp_directory:
|
||||
|
||||
24
main_utils.py
Normal file
24
main_utils.py
Normal file
@ -0,0 +1,24 @@
|
||||
import os
|
||||
import folder_paths
|
||||
import logging
|
||||
import yaml
|
||||
|
||||
def load_extra_path_config(yaml_path):
|
||||
with open(yaml_path, 'r') as stream:
|
||||
config = yaml.safe_load(stream)
|
||||
for c in config:
|
||||
conf = config[c]
|
||||
if conf is None:
|
||||
continue
|
||||
base_path = None
|
||||
if "base_path" in conf:
|
||||
base_path = conf.pop("base_path")
|
||||
for x in conf:
|
||||
for y in conf[x].split("\n"):
|
||||
if len(y) == 0:
|
||||
continue
|
||||
full_path = y
|
||||
if base_path is not None:
|
||||
full_path = os.path.join(base_path, full_path)
|
||||
logging.info("Adding extra search path {} {}".format(x, full_path))
|
||||
folder_paths.add_model_folder_path(x, full_path)
|
||||
Loading…
x
Reference in New Issue
Block a user