diff --git a/py/lora_manager.py b/py/lora_manager.py index 489b48fe..a7ab3fb8 100644 --- a/py/lora_manager.py +++ b/py/lora_manager.py @@ -5,6 +5,7 @@ from .config import config from .routes.lora_routes import LoraRoutes from .routes.api_routes import ApiRoutes from .routes.recipe_routes import RecipeRoutes +from .routes.checkpoints_routes import CheckpointsRoutes from .services.lora_scanner import LoraScanner from .services.recipe_scanner import RecipeScanner from .services.file_monitor import LoraFileMonitor @@ -59,12 +60,14 @@ class LoraManager: # Setup feature routes routes = LoraRoutes() + checkpoints_routes = CheckpointsRoutes() # Setup file monitoring monitor = LoraFileMonitor(routes.scanner, config.loras_roots) monitor.start() routes.setup_routes(app) + checkpoints_routes.setup_routes(app) ApiRoutes.setup_routes(app, monitor) RecipeRoutes.setup_routes(app) @@ -130,4 +133,4 @@ class LoraManager: async def _cleanup(cls, app): """Cleanup resources""" if 'lora_monitor' in app: - app['lora_monitor'].stop() \ No newline at end of file + app['lora_monitor'].stop() diff --git a/py/routes/checkpoints_routes.py b/py/routes/checkpoints_routes.py new file mode 100644 index 00000000..0a79d6f9 --- /dev/null +++ b/py/routes/checkpoints_routes.py @@ -0,0 +1,44 @@ +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) diff --git a/static/js/checkpoints.js b/static/js/checkpoints.js new file mode 100644 index 00000000..ea149a2f --- /dev/null +++ b/static/js/checkpoints.js @@ -0,0 +1,36 @@ +import { appCore } from './core.js'; +import { state, initPageState } from './state/index.js'; + +// Initialize the Checkpoints page +class CheckpointsPageManager { + constructor() { + // Initialize any necessary state + this.initialized = false; + } + + async initialize() { + if (this.initialized) return; + + // Initialize page state + initPageState('checkpoints'); + + // Initialize core application + await appCore.initialize(); + + // Initialize page-specific components + this._initializeWorkInProgress(); + + this.initialized = true; + } + + _initializeWorkInProgress() { + // Add any work-in-progress specific initialization here + console.log('Checkpoints Manager is under development'); + } +} + +// Initialize everything when DOM is ready +document.addEventListener('DOMContentLoaded', async () => { + const checkpointsPage = new CheckpointsPageManager(); + await checkpointsPage.initialize(); +}); diff --git a/templates/checkpoints.html b/templates/checkpoints.html new file mode 100644 index 00000000..f4a4d6b8 --- /dev/null +++ b/templates/checkpoints.html @@ -0,0 +1,27 @@ +{% extends "base.html" %} + +{% block title %}Checkpoints Manager{% endblock %} +{% block page_id %}checkpoints{% endblock %} + +{% block preload %} + +{% endblock %} + +{% block init_title %}Initializing Checkpoints Manager{% endblock %} +{% block init_message %}Setting up checkpoints interface. This may take a few moments...{% endblock %} +{% block init_check_url %}/api/checkpoints?page=1&page_size=1{% endblock %} + +{% block content %} +
This feature is currently under development and will be available soon.
+Please check back later for updates!
+