mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-25 15:15:44 -03:00
feat: Enhance model file retrieval by ensuring primary model is selected from files list. Fixes https://github.com/willmiao/ComfyUI-Lora-Manager/issues/127
This commit is contained in:
@@ -88,16 +88,16 @@ class DownloadManager:
|
|||||||
version_info = None
|
version_info = None
|
||||||
error_msg = None
|
error_msg = None
|
||||||
|
|
||||||
if download_url:
|
if model_hash:
|
||||||
# Extract version ID from download URL
|
# Get model by hash
|
||||||
version_id = download_url.split('/')[-1]
|
version_info = await civitai_client.get_model_by_hash(model_hash)
|
||||||
version_info, error_msg = await civitai_client.get_model_version_info(version_id)
|
|
||||||
elif model_version_id:
|
elif model_version_id:
|
||||||
# Use model version ID directly
|
# Use model version ID directly
|
||||||
version_info, error_msg = await civitai_client.get_model_version_info(model_version_id)
|
version_info, error_msg = await civitai_client.get_model_version_info(model_version_id)
|
||||||
elif model_hash:
|
elif download_url:
|
||||||
# Get model by hash
|
# Extract version ID from download URL
|
||||||
version_info = await civitai_client.get_model_by_hash(model_hash)
|
version_id = download_url.split('/')[-1]
|
||||||
|
version_info, error_msg = await civitai_client.get_model_version_info(version_id)
|
||||||
|
|
||||||
|
|
||||||
if not version_info:
|
if not version_info:
|
||||||
|
|||||||
@@ -97,8 +97,9 @@ class RecipeMetadataParser(ABC):
|
|||||||
|
|
||||||
# Process file information if available
|
# Process file information if available
|
||||||
if 'files' in civitai_info:
|
if 'files' in civitai_info:
|
||||||
|
# Find the primary model file (type="Model" and primary=true) in the files list
|
||||||
model_file = next((file for file in civitai_info.get('files', [])
|
model_file = next((file for file in civitai_info.get('files', [])
|
||||||
if file.get('type') == 'Model'), None)
|
if file.get('type') == 'Model' and file.get('primary') == True), None)
|
||||||
|
|
||||||
if model_file:
|
if model_file:
|
||||||
# Get size
|
# Get size
|
||||||
|
|||||||
Reference in New Issue
Block a user