### Manual Installation using Git Clone Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/README.md Install the LoRA Manager by cloning the repository and installing requirements. ```bash git clone https://github.com/willmiao/ComfyUI-Lora-Manager.git cd ComfyUI-Lora-Manager pip install -r requirements.txt ``` -------------------------------- ### Example aria2c Path on macOS (Intel) Source: https://github.com/willmiao/comfyui-lora-manager/wiki/Aria2-Download-Backend-(Experimental) Example of a full executable path for aria2c on macOS with Intel processors, installed via Homebrew. ```text /usr/local/bin/aria2c ``` -------------------------------- ### Install Frontend Dependencies Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/AGENTS.md Installs JavaScript dependencies for the standalone web UI using npm. Run this in the project root. ```bash npm install ``` -------------------------------- ### Example aria2c Path on Linux Source: https://github.com/willmiao/comfyui-lora-manager/wiki/Aria2-Download-Backend-(Experimental) Example of a full executable path for aria2c on Linux, typically found in /usr/bin after package installation. ```text /usr/bin/aria2c ``` -------------------------------- ### Simplified Test Setup with Fixtures Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/docs/testing/backend-testing-improvement-plan.md Demonstrates refactoring a complex test setup into a cleaner version using fixtures, making the test logic more readable. ```python async def test_start_download_bootstraps_progress_and_task( download_manager_with_fake_backend, release_event ): # Setup in fixtures, test is clean manager = download_manager_with_fake_backend result = await manager.start_download({"model_types": ["lora"]}) assert result["success"] is True assert manager._is_downloading is True ``` -------------------------------- ### Install Backend Dependencies Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/CLAUDE.md Installs the necessary Python packages for the backend development. Includes core requirements and development-specific ones. ```bash pip install -r requirements.txt pip install -r requirements-dev.txt ``` -------------------------------- ### Example aria2c Path on macOS (Apple Silicon) Source: https://github.com/willmiao/comfyui-lora-manager/wiki/Aria2-Download-Backend-(Experimental) Example of a full executable path for aria2c on macOS with Apple Silicon (M1/M2/etc.), installed via Homebrew. ```text /opt/homebrew/bin/aria2c ``` -------------------------------- ### User-Added Custom Images Example Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/docs/metadata-json-schema.md An example demonstrating how to include user-added custom images within the Civitai configuration. ```json { "civitai": { "trainedWords": ["custom_style"], "customImages": [ { "url": "", "id": "example_1", "nsfwLevel": 0, "width": 832, "height": 1216, "type": "image", "meta": { "prompt": "example prompt", "seed": 12345 }, "hasMeta": true, "hasPositivePrompt": true } ] } } ``` -------------------------------- ### Install Frontend Dependencies Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/CLAUDE.md Installs Node.js dependencies for the frontend, including Vue widgets. ```bash npm install cd vue-widgets && npm install && cd .. ``` -------------------------------- ### Example aria2c Path on Windows Source: https://github.com/willmiao/comfyui-lora-manager/wiki/Aria2-Download-Backend-(Experimental) Example of a full executable path for aria2c on Windows, used when the aria2 directory is not added to the system PATH. ```text C:\tools\aria2\aria2c.exe ``` -------------------------------- ### Filename Pattern Examples Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/README.md Examples of how to use various patterns to format generated image filenames, including seed, dimensions, model names, dates, and prompts. ```text image_%seed% → image_1234567890 ``` ```text gen_%width%x%height% → gen_512x768 ``` ```text %model:10%_%seed% → dreamshape_1234567890 ``` ```text %date:yyyy-MM-dd% → 2025-04-28 ``` ```text %pprompt:20%_%seed% → beautiful landscape_1234567890 ``` ```text %model%_%date:yyMMdd%_%seed% → dreamshaper_v8_250428_1234567890 ``` -------------------------------- ### Install Dependencies Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/README.md Command to install the necessary Python dependencies for LoRA Manager. ```bash pip install -r requirements.txt ``` -------------------------------- ### Wildcard Example: Text File Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/README.md Demonstrates how to use a simple text file for wildcard expansion in TextLM/PromptLM. Place this file in the 'wildcards' folder. ```txt # wildcards/color.txt red blue green ``` -------------------------------- ### Wildcard Example: YAML File Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/README.md Shows how to define nested wildcards using a YAML file for TextLM/PromptLM. Place this file in the 'wildcards' folder. ```yaml # wildcards/colors.yaml palette: warm: - red - orange ``` -------------------------------- ### Minimal Clipboard-Only Setup Source: https://github.com/willmiao/comfyui-lora-manager/wiki/Remote-Open-for-Example-Images Configure LoRA Manager to copy the local path to the clipboard for manual pasting into file explorers. ```yaml openMode: Copy local path localRoot: /Volumes/lora-manager/example_images ``` -------------------------------- ### Non-Civitai Configuration Without Trigger Words Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/docs/metadata-json-schema.md A non-Civitai configuration example where no specific trigger words are defined. ```json { "civitai": {} } ``` -------------------------------- ### Example Priority Tag Entry Source: https://github.com/willmiao/comfyui-lora-manager/wiki/Priority-Tags-Configuration-Guide A sample entry list showing canonical tags and their aliases. Aliases are in parentheses and separated by pipes. ```text character, concept, style(toon|toon_style) ``` -------------------------------- ### Run Standalone Backend Server Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/CLAUDE.md Starts the standalone Python server for the LoRA Manager. Defaults to port 8188. ```bash python standalone.py --port 8188 ``` -------------------------------- ### Goal: Alias Shorthand Tags Source: https://github.com/willmiao/comfyui-lora-manager/wiki/Priority-Tags-Configuration-Guide Example priority list configuration using shorthand aliases for longer canonical tag names. ```text realistic(real|realisim), photorealistic(photo_real) ``` -------------------------------- ### Example Image Route Architecture Diagram Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/docs/architecture/example_images_routes.md A Mermaid diagram illustrating the layered architecture of the example image routing stack, showing the flow between HTTP, Application, and Side Effects layers. ```mermaid graph TD subgraph HTTP A[ExampleImagesRouteRegistrar] -->|binds| B[ExampleImagesRoutes controller] end subgraph Application B --> C[ExampleImagesHandlerSet] C --> D1[Handlers] D1 --> E1[Use cases] E1 --> F1[Download manager / processor / file manager] end subgraph Side Effects F1 --> G1[Filesystem] F1 --> G2[Model metadata] F1 --> G3[WebSocket progress] end ``` -------------------------------- ### Windows SMB Mount Configuration Source: https://github.com/willmiao/comfyui-lora-manager/wiki/Remote-Open-for-Example-Images Configure LoRA Manager to open example images in Explorer on Windows via an SMB mount using a custom URI. ```yaml openMode: Open custom URI localRoot: Z:\lora-manager\example_images uriTemplate: file:///{{encoded_local_path}} ``` -------------------------------- ### Apple Shortcuts Configuration Source: https://github.com/willmiao/comfyui-lora-manager/wiki/Remote-Open-for-Example-Images Configure LoRA Manager to open example images using Apple Shortcuts on macOS, passing the local path as text input. ```yaml openMode: Open custom URI localRoot: /Volumes/lora-manager/example_images uriTemplate: shortcuts://run-shortcut?name=Open%20Finder&input=text&text={{encoded_local_path}} ``` -------------------------------- ### Alias Syntax Example Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/docs/priority_tags_help.md Illustrates the correct syntax for defining aliases within parentheses, separated by '|', for a canonical tag. ```plaintext character(char|chars) ``` -------------------------------- ### Run Standalone with Custom Host/Port Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/README.md Command to launch LoRA Manager standalone with specified host and port. Ensure dependencies are installed first. ```bash python custom_nodes\comfyui-lora-manager\standalone.py --host 127.0.0.1 --port 9000 ``` -------------------------------- ### Vue Build Config Function Example Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/AGENTS.md An example of a function that builds a configuration object based on component state in a Vue application. Uses TypeScript for type safety. ```typescript interface Config { /* ... */ } const buildConfig = (): Config => { // Logic to build config based on state return { /* config object */ }; }; ``` -------------------------------- ### Goal: Prefer People Over Styles Source: https://github.com/willmiao/comfyui-lora-manager/wiki/Priority-Tags-Configuration-Guide Example priority list configuration to prioritize 'people' related tags over 'style' tags. ```text character, portraits, style(anime|toon) ``` -------------------------------- ### Run Vue Widget Dev Mode Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/CLAUDE.md Starts the Vue widget development server, which watches for changes and rebuilds automatically. ```bash cd vue-widgets && npm run dev ``` -------------------------------- ### ComfyUI Node Widget Registration Example Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/AGENTS.md Shows how to register a new node widget within ComfyUI using `app.registerExtension()`. This is the entry point for custom nodes. ```javascript app.registerExtension({ name: "MyCustomNode", registerNodes: function() { // Node registration logic here } }); ``` -------------------------------- ### Python Imports and Formatting Example Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/AGENTS.md Illustrates Python import grouping and the use of `from __future__ import annotations`. Follows PEP 8 with 4-space indentation and type hints. ```python from __future__ import annotations import os import sys import aiohttp import pytest from py.services import X from py.utils import Y ``` -------------------------------- ### Python Async Response Example Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/AGENTS.md Illustrates returning JSON responses in an async context using `aiohttp.web.json_response`. This is standard for API endpoints. ```python from aiohttp import web async def handler(request): return web.json_response({'message': 'success'}) ``` -------------------------------- ### macOS SMB Mount Configuration Source: https://github.com/willmiao/comfyui-lora-manager/wiki/Remote-Open-for-Example-Images Configure LoRA Manager to open example images in Finder on macOS via an SMB mount using a custom URI. ```yaml openMode: Open custom URI localRoot: /Volumes/lora-manager/example_images uriTemplate: file://{{encoded_local_path}} ``` -------------------------------- ### Vue Composition API Import Example Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/AGENTS.md Demonstrates importing reactive utilities like `ref` and `computed` from Vue's Composition API. Also shows type-only imports. ```javascript import { ref, computed } from 'vue'; import type { Foo } from './types'; ``` -------------------------------- ### Python Standalone Detection Example Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/AGENTS.md Demonstrates how to detect if the application is running in standalone mode using an environment variable. This allows for different configurations based on the deployment environment. ```python import os is_standalone = os.environ.get("LORA_MANAGER_STANDALONE", "0") == "1" if is_standalone: print("Running in standalone mode.") else: print("Running as ComfyUI plugin.") ``` -------------------------------- ### Python Async Test Example Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/AGENTS.md Demonstrates marking an asynchronous test function with `@pytest.mark.asyncio`. Requires `pytest-asyncio`. ```python @pytest.mark.asyncio async def test_something(): assert True ``` -------------------------------- ### Python Route Registrar Example Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/AGENTS.md Demonstrates the `ModelRouteRegistrar` for setting up API endpoints related to models. It defines routes like `/loras/*`, `/checkpoints/*`, etc. ```python class ModelRouteRegistrar: def __init__(self, app: web.Application, model_service: BaseModelService): self.app = app self.model_service = model_service def register_routes(self): self.app.router.add_get('/loras', self.list_loras_handler) self.app.router.add_get('/checkpoints', self.list_checkpoints_handler) # ... other routes ``` -------------------------------- ### Backend Testing with Coverage Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/README.md Commands to install development dependencies and run pytest with coverage reports for the backend. Artifacts are stored in the coverage/backend directory. ```bash pip install -r requirements-dev.txt COVERAGE_FILE=coverage/backend/.coverage pytest \ --cov=py \ --cov=standalone \ --cov-report=term-missing \ --cov-report=html:coverage/backend/html \ --cov-report=xml:coverage/backend/coverage.xml \ --cov-report=json:coverage/backend/coverage.json ``` -------------------------------- ### Run Standalone for Non-ComfyUI Users Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/README.md Command to run LoRA Manager in standalone mode for users not using ComfyUI. Ensure dependencies are installed first. ```bash python standalone.py ``` -------------------------------- ### Priority Tag Configuration Examples Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/docs/custom_priority_tags_format.md Illustrates the custom priority tag format for different model types like lora, checkpoint, and embedding, showing canonical tags and their aliases. ```plaintext lora: celebrity(celeb|celebrity), stylized, character(char) checkpoint: realistic(realism|realistic), anime(anime-style|toon) embedding: face, celeb(celebrity|celeb) ``` -------------------------------- ### Vue Composable Pattern Example Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/AGENTS.md Illustrates the Vue composable pattern using `useXxxState(widget)`. It returns reactive refs and methods for managing component state. ```javascript function useMyState(widget) { const count = ref(0); const increment = () => { count.value++; }; return { count, increment }; } ``` -------------------------------- ### Python Path Normalization Example Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/AGENTS.md Highlights the importance of normalizing paths, especially when dealing with symlinks. This ensures consistent path handling across different operating systems and environments. ```python import os original_path = "/path/to/symlink" normalized_path = os.path.normpath(os.path.realpath(original_path)) print(f"Original: {original_path}") print(f"Normalized: {normalized_path}") ``` -------------------------------- ### Python Singleton with Async Lock Example Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/AGENTS.md Shows how to implement a thread-safe singleton using `asyncio.Lock`. This pattern is used for managing shared resources like `ModelScanner`. ```python class ModelScanner: _instance = None _lock = asyncio.Lock() async def __new__(cls): if cls._instance is None: async with cls._lock: # Double-check locking if cls._instance is None: cls._instance = super().__new__(cls) await cls._instance.init() return cls._instance async def init(self): # Initialization logic here ``` -------------------------------- ### Python WebSocket Manager Example Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/AGENTS.md Illustrates the `WebSocketManager` for handling real-time communication via WebSockets. This is used for broadcasting updates, such as model changes. ```python class WebSocketManager: async def broadcast(self, message: str): # Sends a message to all connected clients pass async def send_to_client(self, client_id: str, message: str): # Sends a message to a specific client pass ``` -------------------------------- ### Save Image Node Filename Pattern: Width and Height Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/README.md Example of using %width% and %height% patterns to include image dimensions in the saved image filename. ```text %width%_%height% ``` -------------------------------- ### JavaScript ES Module Import Example Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/AGENTS.md Shows how to import modules in JavaScript using ES module syntax, specifically importing `app` from ComfyUI's core scripts. ```javascript import { app } from "../../scripts/app.js"; ``` -------------------------------- ### Install Vue Widget Dependencies Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/AGENTS.md Installs Node.js dependencies specifically for the Vue widgets. Navigate to the 'vue-widgets' directory first. ```bash cd vue-widgets npm install ``` -------------------------------- ### Build Production Bundle for Vue Widgets Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/AGENTS.md Creates a production-ready bundle for the Vue widgets. Use this for deployment after development is complete. ```bash npm run build ``` -------------------------------- ### Install aria2 on macOS Source: https://github.com/willmiao/comfyui-lora-manager/wiki/Aria2-Download-Backend-(Experimental) Install aria2 using Homebrew on macOS. This command typically makes aria2c available in the system PATH. ```bash brew install aria2 ``` -------------------------------- ### Install aria2 on Linux (Arch) Source: https://github.com/willmiao/comfyui-lora-manager/wiki/Aria2-Download-Backend-(Experimental) Install aria2 using the pacman package manager on Arch Linux. This command makes aria2c available in the system PATH. ```bash sudo pacman -S aria2 ``` -------------------------------- ### Install aria2 on Linux (Fedora) Source: https://github.com/willmiao/comfyui-lora-manager/wiki/Aria2-Download-Backend-(Experimental) Install aria2 using the dnf package manager on Fedora-based Linux distributions. This command makes aria2c available in the system PATH. ```bash sudo dnf install aria2 ``` -------------------------------- ### Install aria2 on Linux (Debian/Ubuntu) Source: https://github.com/willmiao/comfyui-lora-manager/wiki/Aria2-Download-Backend-(Experimental) Install aria2 using the apt package manager on Debian-based Linux distributions. This command makes aria2c available in the system PATH. ```bash sudo apt install aria2 ``` -------------------------------- ### Simple Text Widget: Vue Component Setup Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/docs/dom-widgets/value-persistence-best-practices.md Vue component setup for a simple text widget, ensuring the DOM element reference is correctly assigned and cleaned up. ```typescript onMounted(() => { if (textareaRef.value) { props.widget.inputEl = textareaRef.value } }) onUnmounted(() => { if (props.widget.inputEl === textareaRef.value) { props.widget.inputEl = undefined } }) ``` -------------------------------- ### Goal: Group Sci-Fi Variants Source: https://github.com/willmiao/comfyui-lora-manager/wiki/Priority-Tags-Configuration-Guide Example priority list configuration for grouping different variations of sci-fi tags. ```text sci-fi(scifi|science_fiction), cyberpunk(cyber|punk) ``` -------------------------------- ### JavaScript Named Export Example Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/AGENTS.md Illustrates exporting named functions in JavaScript modules, a common practice for reusable code. ```javascript export function foo() { console.log('bar'); } ``` -------------------------------- ### Run All Frontend Tests Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/CLAUDE.md Executes all frontend tests, including both vanilla JavaScript and Vue widget tests. ```bash npm test ``` -------------------------------- ### Run ComfyUI LoRA Manager Standalone Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/README.md Command to launch LoRA Manager independently from ComfyUI. Ensure dependencies are installed first. ```bash python custom_nodes\comfyui-lora-manager\standalone.py ``` -------------------------------- ### Immediate Theme Application Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/templates/base.html Applies the theme (light or dark) immediately based on user preference stored in local storage or system preference. ```javascript (function() { const STORAGE_PREFIX = 'lora_manager_'; const savedTheme = localStorage.getItem(STORAGE_PREFIX + 'theme') || 'auto'; const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches; if (savedTheme === 'dark' || (savedTheme === 'auto' && prefersDark)) { document.documentElement.setAttribute('data-theme', 'dark'); } else { document.documentElement.setAttribute('data-theme', 'light'); } })(); ``` -------------------------------- ### Path Template with {first_tag} Source: https://github.com/willmiao/comfyui-lora-manager/wiki/Priority-Tags-Configuration-Guide Illustrates how the {first_tag} placeholder in a path template uses the priority list and model tags to determine folder names. ```text /{model_type}/{first_tag} ``` -------------------------------- ### Save Image Node Filename Pattern: Seed Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/README.md Example of using the %seed% pattern to include the generation seed in the saved image filename. ```text %seed% ``` -------------------------------- ### Custom Image Structure Example Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/docs/metadata-json-schema.md Defines the structure for a custom image entry, including URL, ID, NSFW level, dimensions, and generation metadata. ```json { "url": "", "id": "short_id", "nsfwLevel": 0, "width": 832, "height": 1216, "type": "image", "meta": { "prompt": "...", "negativePrompt": "...", "steps": 20, "cfgScale": 7, "seed": 123456 }, "hasMeta": true, "hasPositivePrompt": true } ``` -------------------------------- ### Python Service Registry Singleton Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/AGENTS.md Illustrates the `ServiceRegistry` singleton pattern for Dependency Injection. Services are accessed via a `get_instance()` classmethod. ```python class ServiceRegistry: _instance = None _lock = asyncio.Lock() async def __new__(cls): if cls._instance is None: async with cls._lock: if cls._instance is None: cls._instance = super().__new__(cls) await cls._instance.init() return cls._instance async def init(self): # Initialize services here pass # Usage: # registry = await ServiceRegistry.get_instance() ``` -------------------------------- ### Set Widget Minimum and Preferred Height with Options Source: https://github.com/willmiao/comfyui-lora-manager/blob/main/docs/dom_widget_dev_guide.md Use the `getMinHeight` and `getHeight` options to define widget dimensions. This method improves performance by avoiding expensive DOM measurements. ```javascript const widget = node.addDOMWidget("MyWidget", "custom", element, { // Specify minimum height in pixels getMinHeight: () => 150, // Or specify preferred height (pixels or percentage string) // getHeight: () => "50%", }); ```