mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-25 15:15:44 -03:00
fix: update model type checks to include LoCon and lycoris in API routes. Fixes https://github.com/willmiao/ComfyUI-Lora-Manager/issues/159
This commit is contained in:
@@ -386,10 +386,10 @@ class ApiRoutes:
|
|||||||
versions = response.get('modelVersions', [])
|
versions = response.get('modelVersions', [])
|
||||||
model_type = response.get('type', '')
|
model_type = response.get('type', '')
|
||||||
|
|
||||||
# Check model type - should be LORA
|
# Check model type - should be LORA or LoCon
|
||||||
if model_type.lower() != 'lora':
|
if model_type.lower() not in ['lora', 'locon']:
|
||||||
return web.json_response({
|
return web.json_response({
|
||||||
'error': f"Model type mismatch. Expected LORA, got {model_type}"
|
'error': f"Model type mismatch. Expected LORA or LoCon, got {model_type}"
|
||||||
}, status=400)
|
}, status=400)
|
||||||
|
|
||||||
# Check local availability for each version
|
# Check local availability for each version
|
||||||
|
|||||||
@@ -136,15 +136,9 @@ class DownloadManager:
|
|||||||
# 3. Prepare download
|
# 3. Prepare download
|
||||||
file_name = file_info['name']
|
file_name = file_info['name']
|
||||||
save_path = os.path.join(save_dir, file_name)
|
save_path = os.path.join(save_dir, file_name)
|
||||||
file_size = file_info.get('sizeKB', 0) * 1024
|
|
||||||
|
|
||||||
# 4. Notify file monitor - use normalized path and file size
|
# 4. Notify file monitor - use normalized path and file size
|
||||||
file_monitor = await self._get_lora_monitor() if model_type == "lora" else await self._get_checkpoint_monitor()
|
# file monitor is despreted, so we don't need to use it
|
||||||
if file_monitor and file_monitor.handler:
|
|
||||||
file_monitor.handler.add_ignore_path(
|
|
||||||
save_path.replace(os.sep, '/'),
|
|
||||||
file_size
|
|
||||||
)
|
|
||||||
|
|
||||||
# 5. Prepare metadata based on model type
|
# 5. Prepare metadata based on model type
|
||||||
if model_type == "checkpoint":
|
if model_type == "checkpoint":
|
||||||
|
|||||||
@@ -426,10 +426,11 @@ class StandardMetadataParser(RecipeMetadataParser):
|
|||||||
resources = json.loads(resources_json)
|
resources = json.loads(resources_json)
|
||||||
# Filter loras and checkpoints
|
# Filter loras and checkpoints
|
||||||
for resource in resources:
|
for resource in resources:
|
||||||
if resource.get('type') == 'lora':
|
# Process both 'lora' and 'lycoris' types as loras
|
||||||
# 确保 weight 字段被正确保留
|
if resource.get('type') == 'lora' or resource.get('type') == 'lycoris':
|
||||||
|
# Ensure weight field is properly preserved
|
||||||
lora_entry = resource.copy()
|
lora_entry = resource.copy()
|
||||||
# 如果找不到 weight,默认为 1.0
|
# Default to 1.0 if weight not found
|
||||||
if 'weight' not in lora_entry:
|
if 'weight' not in lora_entry:
|
||||||
lora_entry['weight'] = 1.0
|
lora_entry['weight'] = 1.0
|
||||||
# Ensure modelVersionName is included
|
# Ensure modelVersionName is included
|
||||||
|
|||||||
Reference in New Issue
Block a user