From 2d72044d662ab137517bb7e885d9c7cae6de7811 Mon Sep 17 00:00:00 2001 From: Will Miao <13051207myq@gmail.com> Date: Mon, 24 Feb 2025 20:41:16 +0800 Subject: [PATCH] Reorganize python files --- __init__.py | 4 ++-- py/__init__.py | 0 config.py => py/config.py | 4 ++-- lora_manager.py => py/lora_manager.py | 0 {nodes => py/nodes}/lora_loader.py | 0 {routes => py/routes}/api_routes.py | 0 {routes => py/routes}/lora_routes.py | 0 {services => py/services}/__init__.py | 0 {services => py/services}/civitai_client.py | 0 {services => py/services}/download_manager.py | 0 {services => py/services}/file_monitor.py | 1 - {services => py/services}/lora_cache.py | 0 {services => py/services}/lora_scanner.py | 1 - {services => py/services}/settings_manager.py | 0 {services => py/services}/websocket_manager.py | 0 {utils => py/utils}/__init__.py | 0 {utils => py/utils}/file_utils.py | 0 {utils => py/utils}/lora_metadata.py | 0 {utils => py/utils}/model_utils.py | 2 +- {utils => py/utils}/models.py | 0 20 files changed, 5 insertions(+), 7 deletions(-) create mode 100644 py/__init__.py rename config.py => py/config.py (96%) rename lora_manager.py => py/lora_manager.py (100%) rename {nodes => py/nodes}/lora_loader.py (100%) rename {routes => py/routes}/api_routes.py (100%) rename {routes => py/routes}/lora_routes.py (100%) rename {services => py/services}/__init__.py (100%) rename {services => py/services}/civitai_client.py (100%) rename {services => py/services}/download_manager.py (100%) rename {services => py/services}/file_monitor.py (99%) rename {services => py/services}/lora_cache.py (100%) rename {services => py/services}/lora_scanner.py (99%) rename {services => py/services}/settings_manager.py (100%) rename {services => py/services}/websocket_manager.py (100%) rename {utils => py/utils}/__init__.py (100%) rename {utils => py/utils}/file_utils.py (100%) rename {utils => py/utils}/lora_metadata.py (100%) rename {utils => py/utils}/model_utils.py (94%) rename {utils => py/utils}/models.py (100%) diff --git a/__init__.py b/__init__.py index 4e6d9ea3..945bc570 100644 --- a/__init__.py +++ b/__init__.py @@ -1,5 +1,5 @@ -from .lora_manager import LoraManager -from .nodes.lora_loader import LoraManagerLoader +from .py.lora_manager import LoraManager +from .py.nodes.lora_loader import LoraManagerLoader NODE_CLASS_MAPPINGS = { LoraManagerLoader.NAME: LoraManagerLoader diff --git a/py/__init__.py b/py/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/config.py b/py/config.py similarity index 96% rename from config.py rename to py/config.py index 946493b6..0de5bdb8 100644 --- a/config.py +++ b/py/config.py @@ -10,8 +10,8 @@ class Config: """Global configuration for LoRA Manager""" def __init__(self): - self.templates_path = os.path.join(os.path.dirname(__file__), 'templates') - self.static_path = os.path.join(os.path.dirname(__file__), 'static') + self.templates_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'templates') + self.static_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'static') # 路径映射字典, target to link mapping self._path_mappings = {} # 静态路由映射字典, target to route mapping diff --git a/lora_manager.py b/py/lora_manager.py similarity index 100% rename from lora_manager.py rename to py/lora_manager.py diff --git a/nodes/lora_loader.py b/py/nodes/lora_loader.py similarity index 100% rename from nodes/lora_loader.py rename to py/nodes/lora_loader.py diff --git a/routes/api_routes.py b/py/routes/api_routes.py similarity index 100% rename from routes/api_routes.py rename to py/routes/api_routes.py diff --git a/routes/lora_routes.py b/py/routes/lora_routes.py similarity index 100% rename from routes/lora_routes.py rename to py/routes/lora_routes.py diff --git a/services/__init__.py b/py/services/__init__.py similarity index 100% rename from services/__init__.py rename to py/services/__init__.py diff --git a/services/civitai_client.py b/py/services/civitai_client.py similarity index 100% rename from services/civitai_client.py rename to py/services/civitai_client.py diff --git a/services/download_manager.py b/py/services/download_manager.py similarity index 100% rename from services/download_manager.py rename to py/services/download_manager.py diff --git a/services/file_monitor.py b/py/services/file_monitor.py similarity index 99% rename from services/file_monitor.py rename to py/services/file_monitor.py index 9410df3d..00d30a20 100644 --- a/services/file_monitor.py +++ b/py/services/file_monitor.py @@ -7,7 +7,6 @@ from watchdog.events import FileSystemEventHandler, FileCreatedEvent, FileDelete from typing import List from threading import Lock from .lora_scanner import LoraScanner -import platform from ..config import config logger = logging.getLogger(__name__) diff --git a/services/lora_cache.py b/py/services/lora_cache.py similarity index 100% rename from services/lora_cache.py rename to py/services/lora_cache.py diff --git a/services/lora_scanner.py b/py/services/lora_scanner.py similarity index 99% rename from services/lora_scanner.py rename to py/services/lora_scanner.py index ef7cc209..dcae1f51 100644 --- a/services/lora_scanner.py +++ b/py/services/lora_scanner.py @@ -1,7 +1,6 @@ import json import os import logging -import time import asyncio import shutil from typing import List, Dict, Optional diff --git a/services/settings_manager.py b/py/services/settings_manager.py similarity index 100% rename from services/settings_manager.py rename to py/services/settings_manager.py diff --git a/services/websocket_manager.py b/py/services/websocket_manager.py similarity index 100% rename from services/websocket_manager.py rename to py/services/websocket_manager.py diff --git a/utils/__init__.py b/py/utils/__init__.py similarity index 100% rename from utils/__init__.py rename to py/utils/__init__.py diff --git a/utils/file_utils.py b/py/utils/file_utils.py similarity index 100% rename from utils/file_utils.py rename to py/utils/file_utils.py diff --git a/utils/lora_metadata.py b/py/utils/lora_metadata.py similarity index 100% rename from utils/lora_metadata.py rename to py/utils/lora_metadata.py diff --git a/utils/model_utils.py b/py/utils/model_utils.py similarity index 94% rename from utils/model_utils.py rename to py/utils/model_utils.py index 593c1339..8a366c6c 100644 --- a/utils/model_utils.py +++ b/py/utils/model_utils.py @@ -1,4 +1,4 @@ -from typing import Dict, Optional +from typing import Optional # Base model mapping based on version string BASE_MODEL_MAPPING = { diff --git a/utils/models.py b/py/utils/models.py similarity index 100% rename from utils/models.py rename to py/utils/models.py