mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-21 21:22:11 -03:00
- Introduced CheckpointsRoutes for managing checkpoints-related endpoints and handling the checkpoints page. - Added checkpoints.html template for rendering the checkpoints interface with a work-in-progress message. - Implemented checkpoints.js to manage the initialization of the Checkpoints page and its components. - Updated LoraManager to include checkpoints routes in the application setup, enhancing overall functionality.
45 lines
1.4 KiB
Python
45 lines
1.4 KiB
Python
import os
|
|
from aiohttp import web
|
|
import jinja2
|
|
import logging
|
|
from ..config import config
|
|
from ..services.settings_manager import settings
|
|
|
|
logger = logging.getLogger(__name__)
|
|
logging.getLogger('asyncio').setLevel(logging.CRITICAL)
|
|
|
|
class CheckpointsRoutes:
|
|
"""Route handlers for Checkpoints management endpoints"""
|
|
|
|
def __init__(self):
|
|
self.template_env = jinja2.Environment(
|
|
loader=jinja2.FileSystemLoader(config.templates_path),
|
|
autoescape=True
|
|
)
|
|
|
|
async def handle_checkpoints_page(self, request: web.Request) -> web.Response:
|
|
"""Handle GET /checkpoints request"""
|
|
try:
|
|
template = self.template_env.get_template('checkpoints.html')
|
|
rendered = template.render(
|
|
is_initializing=False,
|
|
settings=settings,
|
|
request=request
|
|
)
|
|
|
|
return web.Response(
|
|
text=rendered,
|
|
content_type='text/html'
|
|
)
|
|
|
|
except Exception as e:
|
|
logger.error(f"Error handling checkpoints request: {e}", exc_info=True)
|
|
return web.Response(
|
|
text="Error loading checkpoints page",
|
|
status=500
|
|
)
|
|
|
|
def setup_routes(self, app: web.Application):
|
|
"""Register routes with the application"""
|
|
app.router.add_get('/checkpoints', self.handle_checkpoints_page)
|