mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-25 07:05:43 -03:00
feat: enhance folder path retrieval for diffusion models and improve warning messages
This commit is contained in:
@@ -13,15 +13,28 @@ class MockFolderPaths:
|
|||||||
with open(settings_path, 'r', encoding='utf-8') as f:
|
with open(settings_path, 'r', encoding='utf-8') as f:
|
||||||
settings = json.load(f)
|
settings = json.load(f)
|
||||||
|
|
||||||
# Return paths if they exist in settings
|
# For diffusion_models, combine unet and diffusers paths
|
||||||
if 'folder_paths' in settings and folder_name in settings['folder_paths']:
|
if folder_name == "diffusion_models":
|
||||||
paths = settings['folder_paths'][folder_name]
|
paths = []
|
||||||
|
if 'folder_paths' in settings:
|
||||||
|
if 'unet' in settings['folder_paths']:
|
||||||
|
paths.extend(settings['folder_paths']['unet'])
|
||||||
|
if 'diffusers' in settings['folder_paths']:
|
||||||
|
paths.extend(settings['folder_paths']['diffusers'])
|
||||||
# Filter out paths that don't exist
|
# Filter out paths that don't exist
|
||||||
valid_paths = [p for p in paths if os.path.exists(p)]
|
valid_paths = [p for p in paths if os.path.exists(p)]
|
||||||
if valid_paths:
|
if valid_paths:
|
||||||
return valid_paths
|
return valid_paths
|
||||||
else:
|
else:
|
||||||
print(f"Warning: No valid paths found for {folder_name}")
|
print(f"Warning: No valid paths found for {folder_name}")
|
||||||
|
# For other folder names, return their paths directly
|
||||||
|
elif 'folder_paths' in settings and folder_name in settings['folder_paths']:
|
||||||
|
paths = settings['folder_paths'][folder_name]
|
||||||
|
valid_paths = [p for p in paths if os.path.exists(p)]
|
||||||
|
if valid_paths:
|
||||||
|
return valid_paths
|
||||||
|
else:
|
||||||
|
print(f"Warning: No valid paths found for {folder_name}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error loading folder paths from settings: {e}")
|
print(f"Error loading folder paths from settings: {e}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user