From bcf3b2cf55c218898cb7e9ac19ee93689abca766 Mon Sep 17 00:00:00 2001 From: Will Miao <13051207myq@gmail.com> Date: Sun, 20 Jul 2025 09:45:09 +0800 Subject: [PATCH] feat: Add default root paths for LoRA and checkpoint if only one exists --- py/config.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/py/config.py b/py/config.py index eca858f4..9737fa45 100644 --- a/py/config.py +++ b/py/config.py @@ -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)