feat: Add default root paths for LoRA and checkpoint if only one exists

This commit is contained in:
Will Miao
2025-07-20 09:45:09 +08:00
parent 357c4e9c08
commit bcf3b2cf55

View File

@@ -50,6 +50,13 @@ class Config:
'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
with open(settings_path, 'w', encoding='utf-8') as f:
json.dump(settings, f, indent=2)