mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-10-03 08:45:31 -03:00
fix(downloads): close routing gaps and map CivitAI ModelType.UNet to the checkpoint branch
Cross-checked both baseModel lists against CivitAI's official baseModelRecords (packages/civitai-shared src/basemodel.constants.ts): - CHECKPOINT_BASE_MODELS gains SD 2.0/2.1 768, SD 2.1 Unclip, SDXL 0.9 / 1.0 LCM / Turbo / Distilled, Playground v2 and Stable Cascade (unCLIP-style but CheckpointLoader-loaded). - DIFFUSION_MODEL_BASE_MODELS gains SVD XT, LTXV 2.5, Flux 3 Video, Wan Image 2.7, Wan Video 2.7 / 3.0, HiDream-O1, Boogu and the Ming Image Design families. API-only (Kling/Sora/Veo/Imagen...), 3D and audio baseModels are intentionally skipped. - Pony V7 exclusion now backed by live-API evidence (model 1901521 is AuraFlow-architecture shipping .gguf variants). CivitAI has no model-level diffusion ModelType: DiT models are uploaded as "Checkpoint" or "UNet", with only uploader-chosen file types to tell them apart. model.type "unet" previously fell through type derivation and failed with 'not supported for download'; it now goes through the checkpoint branch in both the download manager and the download routing endpoint, so the standard chain (file type -> baseModel lists -> unknown default) applies.
This commit is contained in:
@@ -2200,6 +2200,54 @@ async def test_download_uses_raw_file_name_from_mini_endpoint(
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_unet_model_type_download_lands_in_unet_roots(
|
||||
monkeypatch, scanners, metadata_provider, tmp_path
|
||||
):
|
||||
"""CivitAI ModelType.UNet goes through the checkpoint branch: its
|
||||
UNet-typed files route to the unet roots like any diffusion model."""
|
||||
manager = DownloadManager()
|
||||
unet_root = tmp_path / "unet"
|
||||
get_settings_manager().settings["default_unet_root"] = str(unet_root)
|
||||
metadata_provider.payload = {
|
||||
"id": 42,
|
||||
"model": {"type": "UNet", "tags": ["fantasy"]},
|
||||
"baseModel": "MiniMax H3",
|
||||
"creator": {"username": "Author"},
|
||||
"files": [
|
||||
{
|
||||
"id": 1001,
|
||||
"type": "UNet",
|
||||
"primary": True,
|
||||
"name": "minimax_h3.safetensors",
|
||||
"downloadUrl": "https://example.invalid/file.safetensors",
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
captured = {}
|
||||
|
||||
async def fake_execute_download(self, **kwargs):
|
||||
captured["file_path"] = kwargs["metadata"].file_path
|
||||
return {"success": True}
|
||||
|
||||
monkeypatch.setattr(
|
||||
DownloadManager, "_execute_download", fake_execute_download, raising=False
|
||||
)
|
||||
|
||||
result = await manager.download_from_civitai(
|
||||
model_version_id=42,
|
||||
save_dir=str(tmp_path),
|
||||
use_default_paths=True,
|
||||
progress_callback=None,
|
||||
source=None,
|
||||
)
|
||||
|
||||
assert result["success"] is True, result
|
||||
assert captured["file_path"].startswith(str(unet_root))
|
||||
assert captured["file_path"].endswith("minimax_h3.safetensors")
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_download_falls_back_to_rest_name_when_mini_fails(
|
||||
monkeypatch, scanners, metadata_provider, tmp_path
|
||||
|
||||
Reference in New Issue
Block a user