refactor: update import paths for config in AutomaticMetadataParser and RecipeFormatParser. Fixes https://github.com/willmiao/ComfyUI-Lora-Manager/issues/168

This commit is contained in:
Will Miao
2025-05-07 04:39:06 +08:00
parent c9f902a8af
commit bfd4eb3e11
2 changed files with 1 additions and 21 deletions

View File

@@ -4,7 +4,6 @@ import re
import json import json
import logging import logging
from typing import Dict, Any from typing import Dict, Any
from py.config import config
from ..base import RecipeMetadataParser from ..base import RecipeMetadataParser
from ..constants import GEN_PARAM_KEYS from ..constants import GEN_PARAM_KEYS
@@ -255,25 +254,6 @@ class AutomaticMetadataParser(RecipeMetadataParser):
except Exception as e: except Exception as e:
logger.error(f"Error fetching Civitai info for LoRA {lora_name}: {e}") logger.error(f"Error fetching Civitai info for LoRA {lora_name}: {e}")
# Check if we can find it locally
if lora_hash and recipe_scanner:
lora_scanner = recipe_scanner._lora_scanner
exists_locally = lora_scanner.has_lora_hash(lora_hash)
if exists_locally:
try:
lora_cache = await lora_scanner.get_cached_data()
lora_item = next((item for item in lora_cache.raw_data
if item['sha256'].lower() == lora_hash.lower()), None)
if lora_item:
lora_entry['existsLocally'] = True
lora_entry['localPath'] = lora_item['file_path']
lora_entry['file_name'] = lora_item['file_name']
lora_entry['size'] = lora_item['size']
if 'preview_url' in lora_item:
lora_entry['thumbnailUrl'] = config.get_preview_static_url(lora_item['preview_url'])
except Exception as e:
logger.error(f"Error getting local lora path: {e}")
loras.append(lora_entry) loras.append(lora_entry)
# Try to get base model from resources or make educated guess # Try to get base model from resources or make educated guess

View File

@@ -4,7 +4,7 @@ import re
import json import json
import logging import logging
from typing import Dict, Any from typing import Dict, Any
from py.config import config from ...config import config
from ..base import RecipeMetadataParser from ..base import RecipeMetadataParser
from ..constants import GEN_PARAM_KEYS from ..constants import GEN_PARAM_KEYS