mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-25 15:15:44 -03:00
refactor: Remove legacy API route handlers from standalone manager
This commit is contained in:
@@ -1,37 +0,0 @@
|
|||||||
import logging
|
|
||||||
from aiohttp import web
|
|
||||||
|
|
||||||
from ..services.websocket_manager import ws_manager
|
|
||||||
from .update_routes import UpdateRoutes
|
|
||||||
from .lora_routes import LoraRoutes
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
class ApiRoutes:
|
|
||||||
"""Legacy API route handlers for backward compatibility"""
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
# Initialize the new LoRA routes
|
|
||||||
self.lora_routes = LoraRoutes()
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def setup_routes(cls, app: web.Application):
|
|
||||||
"""Register API routes using the new refactored architecture"""
|
|
||||||
routes = cls()
|
|
||||||
|
|
||||||
# Setup the refactored LoRA routes
|
|
||||||
routes.lora_routes.setup_routes(app)
|
|
||||||
|
|
||||||
# Setup WebSocket routes that are still shared
|
|
||||||
app.router.add_get('/ws/fetch-progress', ws_manager.handle_connection)
|
|
||||||
app.router.add_get('/ws/download-progress', ws_manager.handle_download_connection)
|
|
||||||
app.router.add_get('/ws/init-progress', ws_manager.handle_init_connection)
|
|
||||||
|
|
||||||
# Setup update routes that are not model-specific
|
|
||||||
UpdateRoutes.setup_routes(app)
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
async def cleanup(cls):
|
|
||||||
"""Add cleanup method for application shutdown"""
|
|
||||||
# Cleanup is now handled by ServiceRegistry and individual services
|
|
||||||
pass
|
|
||||||
@@ -315,7 +315,6 @@ class StandaloneLoraManager(LoraManager):
|
|||||||
|
|
||||||
# Setup feature routes
|
# Setup feature routes
|
||||||
from py.services.model_service_factory import ModelServiceFactory, register_default_model_types
|
from py.services.model_service_factory import ModelServiceFactory, register_default_model_types
|
||||||
from py.routes.api_routes import ApiRoutes
|
|
||||||
from py.routes.recipe_routes import RecipeRoutes
|
from py.routes.recipe_routes import RecipeRoutes
|
||||||
from py.routes.update_routes import UpdateRoutes
|
from py.routes.update_routes import UpdateRoutes
|
||||||
from py.routes.misc_routes import MiscRoutes
|
from py.routes.misc_routes import MiscRoutes
|
||||||
@@ -332,7 +331,6 @@ class StandaloneLoraManager(LoraManager):
|
|||||||
|
|
||||||
# Initialize routes
|
# Initialize routes
|
||||||
stats_routes.setup_routes(app)
|
stats_routes.setup_routes(app)
|
||||||
ApiRoutes.setup_routes(app)
|
|
||||||
RecipeRoutes.setup_routes(app)
|
RecipeRoutes.setup_routes(app)
|
||||||
UpdateRoutes.setup_routes(app)
|
UpdateRoutes.setup_routes(app)
|
||||||
MiscRoutes.setup_routes(app)
|
MiscRoutes.setup_routes(app)
|
||||||
@@ -343,7 +341,6 @@ class StandaloneLoraManager(LoraManager):
|
|||||||
|
|
||||||
# Add cleanup
|
# Add cleanup
|
||||||
app.on_shutdown.append(cls._cleanup)
|
app.on_shutdown.append(cls._cleanup)
|
||||||
app.on_shutdown.append(ApiRoutes.cleanup)
|
|
||||||
|
|
||||||
def parse_args():
|
def parse_args():
|
||||||
"""Parse command line arguments"""
|
"""Parse command line arguments"""
|
||||||
|
|||||||
Reference in New Issue
Block a user