fix(control): rebuild unit model lists when the model type changes

The t2iadapter, xs and lite caches ignored sd_model_type, and the control-models endpoint never refreshes, so a first request with no model loaded returned ['None'] until restart.
This commit is contained in:
CalamitousFelicitousness
2026-10-06 08:12:30 +01:00
parent b7d69c32a7
commit 6f7fd09693
4 changed files with 13 additions and 6 deletions
+1
View File
@@ -38,6 +38,7 @@
- control: controlnet with a separate init image uses the unit's processed image
- control: controlnet with *init image same as control* uses the unit's processed image
- control: multiple units on controlnet-union
- control: t2i-adapter, controlnet-xs and controllite model lists follow the loaded model type
## Update for 2026-10-01
+4 -2
View File
@@ -24,6 +24,7 @@ predefined_sdxl = {
'Replicate anime XL': 'kohya-ss/controlnet-lllite/controllllite_v01032064e_sdxl_replicate_anime_v2',
}
models = {}
models_type = None # sd_model_type the cached list was built for
all_models = {}
all_models.update(predefined_sd15)
all_models.update(predefined_sdxl)
@@ -45,10 +46,11 @@ def find_models():
def list_models(refresh=False):
import modules.shared
global models # pylint: disable=global-statement
if not refresh and len(models) > 0:
global models, models_type # pylint: disable=global-statement
if not refresh and len(models) > 0 and models_type == modules.shared.sd_model_type:
return models
models = {}
models_type = modules.shared.sd_model_type
if modules.shared.sd_model_type == 'none':
models = ['None']
elif modules.shared.sd_model_type == 'sdxl':
+4 -2
View File
@@ -40,6 +40,7 @@ predefined_sdxl = {
}
models = {}
models_type = None # sd_model_type the cached list was built for
all_models = {}
all_models.update(predefined_sd15)
all_models.update(predefined_sdxl)
@@ -49,10 +50,11 @@ load_lock = threading.Lock()
def list_models(refresh=False):
import modules.shared
global models # pylint: disable=global-statement
if not refresh and len(models) > 0:
global models, models_type # pylint: disable=global-statement
if not refresh and len(models) > 0 and models_type == modules.shared.sd_model_type:
return models
models = {}
models_type = modules.shared.sd_model_type
if modules.shared.sd_model_type == 'none':
models = ['None']
elif modules.shared.sd_model_type == 'sdxl':
+4 -2
View File
@@ -20,6 +20,7 @@ predefined_sdxl = {
'Depth': 'UmerHA/ConrolNetXS-SDXL-depth',
}
models = {}
models_type = None # sd_model_type the cached list was built for
all_models = {}
all_models.update(predefined_sd15)
all_models.update(predefined_sdxl)
@@ -40,11 +41,12 @@ def find_models():
def list_models(refresh=False):
global models # pylint: disable=global-statement
global models, models_type # pylint: disable=global-statement
import modules.shared
if not refresh and len(models) > 0:
if not refresh and len(models) > 0 and models_type == modules.shared.sd_model_type:
return models
models = {}
models_type = modules.shared.sd_model_type
if modules.shared.sd_model_type == 'none':
models = ['None']
elif modules.shared.sd_model_type == 'sdxl':