feat: update README and settings.json.example for standalone mode; enhance standalone.py to redirect status requests to loras page

This commit is contained in:
Will Miao
2025-04-27 09:41:33 +08:00
parent 0e7ba27a7d
commit eaec4e5f13
3 changed files with 29 additions and 24 deletions

View File

@@ -179,20 +179,26 @@ You can now run LoRA Manager independently from ComfyUI:
1. **For ComfyUI users**: 1. **For ComfyUI users**:
- Launch ComfyUI with LoRA Manager at least once to initialize the necessary path information in the `settings.json` file. - 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: - From your ComfyUI root directory, run:
```bash ```bash
python custom_nodes\comfyui-lora-manager\standalone.py 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**: 2. **For non-ComfyUI users**:
- Copy the provided `settings.json.example` file to create a new file named `settings.json` - 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 - 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: - Run standalone mode:
```bash ```bash
python standalone.py python standalone.py
``` ```
- Access the interface through your browser at: `http://localhost:8188/loras`
3. Access the interface through your browser as usual.
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. 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.

View File

@@ -9,13 +9,6 @@
"checkpoints": [ "checkpoints": [
"C:/path/to/your/checkpoints_folder", "C:/path/to/your/checkpoints_folder",
"C:/path/to/another/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"
] ]
} }
} }

View File

@@ -129,13 +129,17 @@ class StandaloneServer:
self.app.router.add_get('/', self.handle_status) self.app.router.add_get('/', self.handle_status)
async def handle_status(self, request): async def handle_status(self, request):
"""Handle status request""" """Handle status request by redirecting to loras page"""
return web.json_response({ # Redirect to loras page instead of showing status
"status": "running", raise web.HTTPFound('/loras')
"mode": "standalone",
"loras_roots": config.loras_roots, # Original JSON response (commented out)
"checkpoints_roots": config.checkpoints_roots # return web.json_response({
}) # "status": "running",
# "mode": "standalone",
# "loras_roots": config.loras_roots,
# "checkpoints_roots": config.checkpoints_roots
# })
async def on_startup(self, app): async def on_startup(self, app):
"""Startup handler""" """Startup handler"""
@@ -150,13 +154,15 @@ class StandaloneServer:
# In standalone mode, we don't have the same websocket system # In standalone mode, we don't have the same websocket system
pass 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""" """Start the server"""
runner = web.AppRunner(self.app) runner = web.AppRunner(self.app)
await runner.setup() await runner.setup()
site = web.TCPSite(runner, host, port) site = web.TCPSite(runner, host, port)
await site.start() 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 # Keep the server running
while True: while True:
@@ -301,13 +307,13 @@ def parse_args():
"""Parse command line arguments""" """Parse command line arguments"""
parser = argparse.ArgumentParser(description="LoRA Manager Standalone Server") parser = argparse.ArgumentParser(description="LoRA Manager Standalone Server")
parser.add_argument("--host", type=str, default="0.0.0.0", 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, parser.add_argument("--port", type=int, default=8188,
help="Port to bind the server to") help="Port to bind the server to (default: 8188, access via http://localhost:8188/loras)")
parser.add_argument("--loras", type=str, nargs="+", # parser.add_argument("--loras", type=str, nargs="+",
help="Additional paths to LoRA model directories (optional if settings.json has paths)") # help="Additional paths to LoRA model directories (optional if settings.json has paths)")
parser.add_argument("--checkpoints", type=str, nargs="+", # parser.add_argument("--checkpoints", type=str, nargs="+",
help="Additional paths to checkpoint model directories (optional if settings.json has paths)") # help="Additional paths to checkpoint model directories (optional if settings.json has paths)")
parser.add_argument("--log-level", type=str, default="INFO", parser.add_argument("--log-level", type=str, default="INFO",
choices=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"], choices=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
help="Logging level") help="Logging level")