fix(downloads): route unknown checkpoint baseModels to diffusion models by default

CivitAI labels new DiT architectures (MiniMax H3, future Flux/Wan/Qwen
variants) as model.type "Checkpoint" with plain "Model" file entries,
so the DIFFUSION_MODEL_BASE_MODELS allowlist could never keep up and
such downloads were mis-routed to the checkpoint roots (e.g. model
2877206 / version 3374439). The set of true full-checkpoint families is
closed, so the baseModel fallback is inverted:

1. file type UNet/Diffusion Model -> unet (unchanged)
2. baseModel in DIFFUSION_MODEL_BASE_MODELS (now incl. MiniMax H3) -> unet
3. baseModel in new CHECKPOINT_BASE_MODELS (SD 1.x/2.x/3.x, SDXL, Pony,
   Illustrious, NoobAI) -> checkpoint
4. unknown/empty baseModel -> new unknown_base_model_routing setting,
   defaulting to diffusion models

The setting is exposed under Settings > Downloads, validated in
SettingsManager, and threaded into both the download manager and the
download routing endpoint so they keep agreeing.
This commit is contained in:
Will Miao
2026-10-02 09:58:01 +08:00
parent 2193ec8f38
commit 3aa32120df
22 changed files with 270 additions and 8 deletions
+15
View File
@@ -130,6 +130,9 @@ DEFAULT_SETTINGS: Dict[str, Any] = {
"metadata_refresh_skip_paths": [],
"skip_previously_downloaded_model_versions": False,
"download_skip_base_models": [],
# Routing target for checkpoint downloads whose baseModel is neither a
# known diffusion model nor a known full checkpoint (CHECKPOINT_BASE_MODELS).
"unknown_base_model_routing": "diffusion_model",
"backup_auto_enabled": True,
"backup_retention_count": 5,
"use_new_license_icons": True,
@@ -1628,6 +1631,16 @@ class SettingsManager:
return normalized
return "alongside"
@staticmethod
def _normalize_unknown_base_model_routing(value: Any) -> str:
"""Return a valid unknown-base-model routing target, falling back to ``diffusion_model``."""
if isinstance(value, str):
normalized = value.strip().lower()
if normalized in ("diffusion_model", "checkpoint"):
return normalized
return "diffusion_model"
def _refresh_sidecar_storage_config(self) -> None:
"""Rebuild dependent config state after sidecar storage settings change."""
@@ -1840,6 +1853,8 @@ class SettingsManager:
self._migrate_recipes_directory(current_recipes_dir, target_recipes_dir)
elif key == "sidecar_storage_mode":
value = self._normalize_sidecar_storage_mode(value)
elif key == "unknown_base_model_routing":
value = self._normalize_unknown_base_model_routing(value)
elif key == "sidecar_storage_path":
value = self._normalize_recipes_path_value(value)
self.settings[key] = value