mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-08-08 23:10:15 -03:00
Fix ~950 basedpyright errors across the backend: - Convert ineffective # type: ignore comments to # pyright: ignore[rule] - Add missing generic type arguments (Dict[str, Any], list[Any], ...) - Annotate dynamic dict literals and runtime-initialized attributes - Widen CivitAI provider tuple signatures in recipe parsers - Remove dead LoraRoutes handlers calling nonexistent LoraService methods - Suppress unavoidable ServiceRegistry import cycles (basedpyright counts function-local imports as cycle edges)
37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
import logging
|
|
from typing import List
|
|
|
|
from ..utils.models import EmbeddingMetadata
|
|
from ..config import config
|
|
from .model_scanner import ModelScanner
|
|
from .model_hash_index import ModelHashIndex
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
class EmbeddingScanner(ModelScanner):
|
|
"""Service for scanning and managing embedding files"""
|
|
|
|
def __init__(self):
|
|
# Define supported file extensions
|
|
file_extensions = {'.ckpt', '.pt', '.pt2', '.bin', '.pth', '.safetensors', '.pkl', '.sft'}
|
|
super().__init__(
|
|
model_type="embedding",
|
|
model_class=EmbeddingMetadata,
|
|
file_extensions=file_extensions,
|
|
hash_index=ModelHashIndex()
|
|
)
|
|
|
|
def get_model_roots(self) -> List[str]:
|
|
"""Get embedding root directories (including extra paths)"""
|
|
roots: List[str] = []
|
|
roots.extend(config.embeddings_roots or [])
|
|
roots.extend(config.extra_embeddings_roots or [])
|
|
# Remove duplicates while preserving order
|
|
seen: set[str] = set()
|
|
unique_roots: List[str] = []
|
|
for root in roots:
|
|
if root and root not in seen:
|
|
seen.add(root)
|
|
unique_roots.append(root)
|
|
return unique_roots
|