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
+8 -2
View File
@@ -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.
-7
View File
@@ -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"
]
}
}
+21 -15
View File
@@ -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")