From bfd4eb3e118ca1d16bd8ec2e5ee1956ac535b416 Mon Sep 17 00:00:00 2001 From: Will Miao <13051207myq@gmail.com> Date: Wed, 7 May 2025 04:39:06 +0800 Subject: [PATCH] refactor: update import paths for config in AutomaticMetadataParser and RecipeFormatParser. Fixes https://github.com/willmiao/ComfyUI-Lora-Manager/issues/168 --- py/recipes/parsers/automatic.py | 20 -------------------- py/recipes/parsers/recipe_format.py | 2 +- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/py/recipes/parsers/automatic.py b/py/recipes/parsers/automatic.py index 984752b5..898c3d4e 100644 --- a/py/recipes/parsers/automatic.py +++ b/py/recipes/parsers/automatic.py @@ -4,7 +4,6 @@ import re import json import logging from typing import Dict, Any -from py.config import config from ..base import RecipeMetadataParser from ..constants import GEN_PARAM_KEYS @@ -255,25 +254,6 @@ class AutomaticMetadataParser(RecipeMetadataParser): except Exception as 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) # Try to get base model from resources or make educated guess diff --git a/py/recipes/parsers/recipe_format.py b/py/recipes/parsers/recipe_format.py index 04f05940..1e46ff51 100644 --- a/py/recipes/parsers/recipe_format.py +++ b/py/recipes/parsers/recipe_format.py @@ -4,7 +4,7 @@ import re import json import logging from typing import Dict, Any -from py.config import config +from ...config import config from ..base import RecipeMetadataParser from ..constants import GEN_PARAM_KEYS