From 515aa1d2bde8c60cd3e4035e42fb0a24288e5416 Mon Sep 17 00:00:00 2001 From: Will Miao <13051207myq@gmail.com> Date: Sat, 12 Apr 2025 16:24:29 +0800 Subject: [PATCH] fix: Improve error logging and update lora monitor path handling --- py/routes/api_routes.py | 15 +++++++++------ static/js/api/baseModelApi.js | 1 - 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/py/routes/api_routes.py b/py/routes/api_routes.py index bc5cfedb..c064d66b 100644 --- a/py/routes/api_routes.py +++ b/py/routes/api_routes.py @@ -789,7 +789,7 @@ class ApiRoutes: }) except Exception as e: - logger.error(f"Error getting model metadata: {e}", exc_info=True) + logger.error(f"Error getting model metadata: {e}") return web.json_response({ 'success': False, 'error': str(e) @@ -921,11 +921,14 @@ class ApiRoutes: # Notify file monitor to ignore these events main_file_path = os.path.join(target_dir, f"{old_file_name}.safetensors") - if os.path.exists(main_file_path) and self.download_manager.file_monitor: - # Add old and new paths to ignore list - file_size = os.path.getsize(main_file_path) - self.download_manager.file_monitor.handler.add_ignore_path(main_file_path, file_size) - self.download_manager.file_monitor.handler.add_ignore_path(new_file_path, file_size) + if os.path.exists(main_file_path): + # Get lora monitor through ServiceRegistry instead of download_manager + lora_monitor = await ServiceRegistry.get_lora_monitor() + if lora_monitor: + # Add old and new paths to ignore list + file_size = os.path.getsize(main_file_path) + lora_monitor.handler.add_ignore_path(main_file_path, file_size) + lora_monitor.handler.add_ignore_path(new_file_path, file_size) for old_path, pattern in existing_files: # Get the file extension like .safetensors or .metadata.json diff --git a/static/js/api/baseModelApi.js b/static/js/api/baseModelApi.js index 20a669a3..b231b8f2 100644 --- a/static/js/api/baseModelApi.js +++ b/static/js/api/baseModelApi.js @@ -216,7 +216,6 @@ export async function resetAndReload(options = {}) { } = options; const pageState = getCurrentPageState(); - console.log('Resetting with state:', { ...pageState }); // Reset pagination and load more models if (typeof loadMoreFunction === 'function') {