fix(other-models): make clip_vision opt-in like controlnet

DEFAULT_ENABLED_OTHER_SUB_TYPES managed vae, upscaler, text_encoder and
clip_vision while controlnet was the sole opt-in type. That split was not
defensible on demand breadth: ControlNet is the broader category by install
base, and clip_vision is the narrower one (IPAdapter/SVD image conditioning,
usually one to three files) whose CivitAI type is retired upstream.

Keep the default set to the dependency-style assets every pipeline needs and
where "which one am I actually using" is the real problem - VAE, upscalers
and text encoders - and treat clip_vision and controlnet symmetrically as
opt-in. The feature is still unreleased, so the change needs no migration.

- Sync all five surfaces holding a default: DEFAULT_ENABLED_OTHER_SUB_TYPES,
  DEFAULT_SETTINGS, both DEFAULT_SETTINGS_BASE/createDefaultSettings lists,
  updateOtherModelsControls()'s fallback and the Jinja fallback.
- The selection is persisted per user, so only the untouched default moves;
  existing default_other_roots entries for a disabled sub_type are preserved.
- Fix the Jinja fallback using `or`, which treated an all-unchecked empty
  allow-list as "unset" and re-checked every box on render; `is none` keeps
  the empty list empty.
- Document the revised defaults and rationale in the plan.

Tests assert the new default trio, the normalize fallback, that both opt-in
types stay out of the default scan, and the auto-set iteration test now
enables clip_vision explicitly since it exercises the loop, not the default.
This commit is contained in:
Will Miao
2026-09-13 20:12:49 +08:00
parent 4d87ae7637
commit 3302147a43
6 changed files with 74 additions and 8 deletions
+26
View File
@@ -1248,6 +1248,30 @@ def test_other_models_disabled_by_default(manager):
assert manager.is_other_sub_type_enabled("vae") is False
def test_default_enabled_other_sub_types_are_the_dependency_trio(manager):
"""clip_vision and controlnet are workflow-driven, so both stay opt-in."""
manager.settings["enable_other_models"] = True
assert manager.get_enabled_other_sub_types() == [
"vae",
"upscaler",
"text_encoder",
]
assert manager.is_other_sub_type_enabled("clip_vision") is False
assert manager.is_other_sub_type_enabled("controlnet") is False
def test_enabled_other_sub_types_falls_back_to_defaults(manager):
manager.settings["enable_other_models"] = True
manager.settings["enabled_other_sub_types"] = None
assert manager.get_enabled_other_sub_types() == [
"vae",
"upscaler",
"text_encoder",
]
def test_auto_set_default_other_roots_skipped_when_feature_off(manager):
manager.settings["enable_other_models"] = False
manager.settings["default_other_roots"] = {}
@@ -1270,6 +1294,8 @@ def test_set_enabled_other_sub_types_normalizes(manager):
def test_auto_set_default_other_roots(manager):
manager.settings["enable_other_models"] = True
manager.settings["default_other_roots"] = {}
# clip_vision is opt-in, so enable it explicitly for this iteration test.
manager.settings["enabled_other_sub_types"] = ["vae", "upscaler", "clip_vision"]
manager.settings["folder_paths"] = {
"vae": ["/vae"],
"upscale_models": ["/upscalers"],