From d196348f5177c51fb913347693db14c3c0124a6a Mon Sep 17 00:00:00 2001 From: tazlin Date: Sat, 3 Jun 2023 08:26:09 -0400 Subject: [PATCH 1/2] fix: regression in webui with arrays and ram to leave free --- webui.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/webui.py b/webui.py index f11afac0..da71c698 100644 --- a/webui.py +++ b/webui.py @@ -301,12 +301,9 @@ def save_config(self, args): models_to_load = [] for key, value in args.items(): cfgkey = self._cfg(key.label) - if cfgkey == "priority_usernames": - config.priority_usernames = self.process_input_list(value) - elif cfgkey == "blacklist": - config.blacklist = self.process_input_list(value) - elif cfgkey == "censorlist": - config.censorlist = self.process_input_list(value) + if cfgkey == "priority_usernames" or cfgkey == "blacklist" or cfgkey == "censorlist": + config[cfgkey] = self.process_input_list(value) + continue elif cfgkey == "special_models_to_load" or cfgkey == "models_on_disk": models_to_load.extend(value) elif cfgkey == "special_top_models_to_load": @@ -316,12 +313,14 @@ def save_config(self, args): models_to_load.extend(value) elif cfgkey == "ram_to_leave_free" or cfgkey == "vram_to_leave_free": config[cfgkey] = str(value) + "%" + continue elif cfgkey == "dreamer_name" and (value == "An Awesome Dreamer" or not value): skipped_keys.append("dreamer_name") elif cfgkey == "scribe_name" and (value == "An Awesome Scribe" or not value): skipped_keys.append("scribe_name") elif cfgkey == "alchemist_name" and (value == "An Awesome Alchemist" or not value): skipped_keys.append("alchemist_name") + config[cfgkey] = value if cfgkey != "models_to_load" else None config["models_to_load"] = models_to_load From 6e871d4c8e522ec746821043ad080515dce5783b Mon Sep 17 00:00:00 2001 From: tazlin Date: Sat, 3 Jun 2023 08:27:57 -0400 Subject: [PATCH 2/2] refactor: simplify if chain in webui --- webui.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/webui.py b/webui.py index da71c698..a6fd927a 100644 --- a/webui.py +++ b/webui.py @@ -304,16 +304,17 @@ def save_config(self, args): if cfgkey == "priority_usernames" or cfgkey == "blacklist" or cfgkey == "censorlist": config[cfgkey] = self.process_input_list(value) continue - elif cfgkey == "special_models_to_load" or cfgkey == "models_on_disk": + if cfgkey == "ram_to_leave_free" or cfgkey == "vram_to_leave_free": + config[cfgkey] = str(value) + "%" + continue + + if cfgkey == "special_models_to_load" or cfgkey == "models_on_disk": models_to_load.extend(value) elif cfgkey == "special_top_models_to_load": if value and value != "None": models_to_load.append(value) elif cfgkey == "models_to_load": models_to_load.extend(value) - elif cfgkey == "ram_to_leave_free" or cfgkey == "vram_to_leave_free": - config[cfgkey] = str(value) + "%" - continue elif cfgkey == "dreamer_name" and (value == "An Awesome Dreamer" or not value): skipped_keys.append("dreamer_name") elif cfgkey == "scribe_name" and (value == "An Awesome Scribe" or not value):