mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-08-14 09:43:22 -03:00
fix(download): accept newer CivitAI file types for primary file selection
Downloads failed with "No suitable file found in metadata" for models whose only file uses newer CivitAI file types (e.g. 'Enhancement LoRA' for Anima/AIR image-editing LoRAs) because the primary-file allowlist only covered legacy types. - unify the weights-type allowlist as MODEL_WEIGHT_FILE_TYPES (py/utils/constants.py) and apply it across download, recipe and metadata-refresh lookups - mirror CivitAI's getPrimaryFile() semantics: prefer weights-type primary, fall back to weights files, then trust CivitAI's primary flag (excluding non-downloadable artifacts like Config/Archive/Workflow) - mirror the allowlist in the frontend via shared isModelWeightFile() helper - add regression tests for the Enhancement LoRA primary-file download, primary-flag fallback and weights-over-non-weights-primary preference
This commit is contained in:
@@ -62,6 +62,20 @@ MODEL_FILE_EXTENSIONS = {
|
||||
".gguf",
|
||||
}
|
||||
|
||||
# CivitAI ModelFile.type values eligible as the main download file.
|
||||
# Mirrors CivitAI's getPrimaryFile() (model-helpers.ts): weight types are
|
||||
# preferred, but any file CivitAI marks `primary` is accepted — newer types
|
||||
# like 'Enhancement LoRA' (Anima/AIR image-editing LoRAs) are valid primary
|
||||
# files despite not being in the traditional weights allowlist.
|
||||
MODEL_WEIGHT_FILE_TYPES = (
|
||||
"Model",
|
||||
"Pruned Model",
|
||||
"Negative",
|
||||
"UNet",
|
||||
"Diffusion Model",
|
||||
"Enhancement LoRA",
|
||||
)
|
||||
|
||||
# Valid sub-types for each scanner type
|
||||
VALID_LORA_SUB_TYPES = ["lora", "locon", "dora"]
|
||||
VALID_CHECKPOINT_SUB_TYPES = ["checkpoint", "diffusion_model"]
|
||||
|
||||
Reference in New Issue
Block a user