mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-24 22:52:12 -03:00
feat: Add default root paths for LoRA and checkpoint if only one exists
This commit is contained in:
@@ -50,6 +50,13 @@ class Config:
|
|||||||
'unet': self.unet_roots,
|
'unet': self.unet_roots,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Add default roots if there's only one item and key doesn't exist
|
||||||
|
if len(self.loras_roots) == 1 and "default_lora_root" not in settings:
|
||||||
|
settings["default_lora_root"] = self.loras_roots[0]
|
||||||
|
|
||||||
|
if self.checkpoints_roots and len(self.checkpoints_roots) == 1 and "default_checkpoint_root" not in settings:
|
||||||
|
settings["default_checkpoint_root"] = self.checkpoints_roots[0]
|
||||||
|
|
||||||
# Save settings
|
# Save settings
|
||||||
with open(settings_path, 'w', encoding='utf-8') as f:
|
with open(settings_path, 'w', encoding='utf-8') as f:
|
||||||
json.dump(settings, f, indent=2)
|
json.dump(settings, f, indent=2)
|
||||||
|
|||||||
Reference in New Issue
Block a user