refactor: Simplify model version existence checks and enhance version retrieval methods in scanners

This commit is contained in:
Will Miao
2025-07-09 10:26:03 +08:00
parent df9b554ce1
commit c692713ffb
3 changed files with 75 additions and 50 deletions

View File

@@ -82,6 +82,11 @@ class DownloadManager:
else:
return {'success': False, 'error': f'Model type "{model_type_from_info}" is not supported for download'}
scanner = model_type == 'checkpoint' and await self._get_checkpoint_scanner() or await self._get_lora_scanner()
if scanner.check_model_version_exists(model_id, model_version_id):
return {'success': False, 'error': 'Model version already exists in library'}
# Handle use_default_paths
if use_default_paths:
# Set save_dir based on model type