From eaec4e5f13ae5f8706adf752838a140b5d75a37c Mon Sep 17 00:00:00 2001 From: Will Miao <13051207myq@gmail.com> Date: Sun, 27 Apr 2025 09:41:33 +0800 Subject: [PATCH] feat: update README and settings.json.example for standalone mode; enhance standalone.py to redirect status requests to loras page --- README.md | 10 ++++++++-- settings.json.example | 7 ------- standalone.py | 36 +++++++++++++++++++++--------------- 3 files changed, 29 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 82f2b248..5a00ec6c 100644 --- a/README.md +++ b/README.md @@ -179,20 +179,26 @@ You can now run LoRA Manager independently from ComfyUI: 1. **For ComfyUI users**: - Launch ComfyUI with LoRA Manager at least once to initialize the necessary path information in the `settings.json` file. + - Make sure dependencies are installed: `pip install -r requirements.txt` - From your ComfyUI root directory, run: ```bash python custom_nodes\comfyui-lora-manager\standalone.py ``` + - Access the interface at: `http://localhost:8188/loras` + - You can specify a different host or port with arguments: + ```bash + python custom_nodes\comfyui-lora-manager\standalone.py --host 127.0.0.1 --port 9000 + ``` 2. **For non-ComfyUI users**: - Copy the provided `settings.json.example` file to create a new file named `settings.json` - Edit `settings.json` to include your correct model folder paths and CivitAI API key + - Install required dependencies: `pip install -r requirements.txt` - Run standalone mode: ```bash python standalone.py ``` - -3. Access the interface through your browser as usual. + - Access the interface through your browser at: `http://localhost:8188/loras` This standalone mode provides a lightweight option for managing your model and recipe collection without needing to run the full ComfyUI environment, making it useful even for users who primarily use other stable diffusion interfaces. diff --git a/settings.json.example b/settings.json.example index f3f032e6..b7f9d637 100644 --- a/settings.json.example +++ b/settings.json.example @@ -9,13 +9,6 @@ "checkpoints": [ "C:/path/to/your/checkpoints_folder", "C:/path/to/another/checkpoints_folder" - ], - "diffusers": [ - "C:/path/to/your/diffusers_folder" - ], - "unet": [ - "C:/path/to/your/unet_folder", - "C:/path/to/your/diffusion_models_folder" ] } } diff --git a/standalone.py b/standalone.py index b775eb54..61d8cf7f 100644 --- a/standalone.py +++ b/standalone.py @@ -129,13 +129,17 @@ class StandaloneServer: self.app.router.add_get('/', self.handle_status) async def handle_status(self, request): - """Handle status request""" - return web.json_response({ - "status": "running", - "mode": "standalone", - "loras_roots": config.loras_roots, - "checkpoints_roots": config.checkpoints_roots - }) + """Handle status request by redirecting to loras page""" + # Redirect to loras page instead of showing status + raise web.HTTPFound('/loras') + + # Original JSON response (commented out) + # return web.json_response({ + # "status": "running", + # "mode": "standalone", + # "loras_roots": config.loras_roots, + # "checkpoints_roots": config.checkpoints_roots + # }) async def on_startup(self, app): """Startup handler""" @@ -150,13 +154,15 @@ class StandaloneServer: # In standalone mode, we don't have the same websocket system pass - async def start(self, host='0.0.0.0', port=8188): + async def start(self, host='127.0.0.1', port=8188): """Start the server""" runner = web.AppRunner(self.app) await runner.setup() site = web.TCPSite(runner, host, port) await site.start() - logger.info(f"Server started at http://{host}:{port}") + + # Log the server address with a clickable localhost URL regardless of the actual binding + logger.info(f"Server started at http://127.0.0.1:{port}") # Keep the server running while True: @@ -301,13 +307,13 @@ def parse_args(): """Parse command line arguments""" parser = argparse.ArgumentParser(description="LoRA Manager Standalone Server") parser.add_argument("--host", type=str, default="0.0.0.0", - help="Host to bind the server to") + help="Host address to bind the server to (default: 0.0.0.0)") parser.add_argument("--port", type=int, default=8188, - help="Port to bind the server to") - parser.add_argument("--loras", type=str, nargs="+", - help="Additional paths to LoRA model directories (optional if settings.json has paths)") - parser.add_argument("--checkpoints", type=str, nargs="+", - help="Additional paths to checkpoint model directories (optional if settings.json has paths)") + help="Port to bind the server to (default: 8188, access via http://localhost:8188/loras)") + # parser.add_argument("--loras", type=str, nargs="+", + # help="Additional paths to LoRA model directories (optional if settings.json has paths)") + # parser.add_argument("--checkpoints", type=str, nargs="+", + # help="Additional paths to checkpoint model directories (optional if settings.json has paths)") parser.add_argument("--log-level", type=str, default="INFO", choices=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"], help="Logging level")