ComfyUI-Copilot Documentation

repository·main·Indexed 26 days ago

https://github.com/ath-maas/comfyui-copilot

An intelligent assistant for ComfyUI (v2.0.28) designed to automate workflow development, debugging, and parameter optimization. It uses LLM-powered agents to generate, rewrite, and tune workflows, provide node and model recommendations, and offer automated error detection. Supports integration with OpenAI and LMStudio, requiring an active internet connection for remote LLM communication.

Tokens
8.8K
Snippets
18
Records
63
Agent score
87%

What's inside ComfyUI-Copilot

  1. Explore the Parameter Debug Interface components

    main

    The Parameter Debug Interface is a modular component system within ComfyUI Copilot designed for parameter debugging. It is organized into several functional directories:

    • Core Components: ParameterDebugInterfaceV2.tsx (enhanced wrapper) and ParameterDebugInterfaceNew.tsx (original component).
    • Types: types/parameterDebugTypes.ts contains common type definitions.
    • Utilities: Specialized logic is split into utils/ including localStorageUtils.ts, textInputUtils.ts, parameterUtils.ts, interfaceUtils.ts, and searchUtils.ts.
    • UI Elements: screens/ and modals/ contain the various view layers, while styles/highlightPulseStyle.ts manages CSS animations.
    • Exports: All components and utilities are accessible via index.ts.
  2. Integrate LMStudio as a local LLM provider

    main

    You can use LMStudio to run language models locally, ensuring privacy and zero API costs. Follow these steps to set up the integration:

    1. Prepare LMStudio

    1. Download and install LMStudio from https://lmstudio.ai/.
    2. Download a compatible OpenAI-compatible model (e.g., Llama 3.1, CodeLlama, or Mistral 7B).
    3. In LMStudio, navigate to the Developer tab and click Start Server. The default server runs on http://localhost:1234.

    2. Configure ComfyUI-Copilot

    In the ComfyUI-Copilot LLM configuration settings, apply the following parameters:

    • Base URL: http://localhost:1234/v1 (ensure the /v1 suffix is included).
    • API Key: Leave empty.
    • Model: Select the specific model you have loaded in LMStudio.

    3. Verify Connection

    Click the Verify Connection button in the interface. A successful setup will display: LMStudio connection successful.

  3. Activate ComfyUI-Copilot and Configure API Keys

    main

    After installing and running ComfyUI, follow these steps to activate the service:

    1. Start Service: Locate and click the Copilot activation button on the left panel of the ComfyUI interface.
    2. Generate API Key: Click the key icon button, enter your email address in the popup, and wait for the API Key to be sent to your email. Paste the received key into the input field and click Save.
    3. Configure Custom Models: If you wish to use your own OpenAI models, click the settings icon to configure the dialogue model and the workflow generation model.

    Important Notice: Due to service adjustments, built-in node information queries, workflow recommendations, and workflow generation services may be unavailable. To use Agent capabilities, you must provide your own API Key and Base URL in the settings page.

  4. Install ComfyUI-Copilot manually

    main

    The recommended installation method is to clone the repository directly into your ComfyUI/custom_nodes directory and install the requirements. This is generally more reliable than using ComfyUI Manager.

    For Linux/macOS/Standard Python:

    1. Navigate to ComfyUI/custom_nodes.
    2. Clone the repository.
    3. Install requirements via pip.

    For Windows (using ComfyUI embedded Python): Use the python_embedded\python.exe executable to ensure dependencies are installed into the correct environment.

    # Standard installation
    cd ComfyUI/custom_nodes
    git clone https://github.com/AIDC-AI/ComfyUI-Copilot.git
    cd ComfyUI-Copilot
    pip install -r requirements.txt
    
    # Windows embedded Python installation
    python_embedded\python.exe -m pip install -r requirements.txt
  5. Activate ComfyUI-Copilot and Configure API

    main

    After installing and running ComfyUI, follow these steps to activate the service:

    1. Launch Service: Click the Copilot activation button on the left side of the ComfyUI panel.
    2. Generate API Key: Click the * button in the Copilot interface. Enter your email address in the popup. An API Key will be sent to your email.
    3. Enter API Key: Paste the received API Key into the input box and click save to activate.
    4. Configure Models: Click the * button to separately configure the chat model and the workflow generate model (e.g., using OpenAI or LMStudio).

    Important Service Notice: The default API service for Node information query, Job recommendations, and Workflow generation has been suspended. To use Agent-related capabilities, you must enter your own API Key and Base URL in the Settings page.

  6. Install ComfyUI-Copilot via ComfyUI Manager

    main

    You can install the extension using the ComfyUI Manager:

    1. Open ComfyUI Manager.
    2. Click on Custom Nodes Manager.
    3. Search for ComfyUI-Copilot.
    4. Click the install button.

    Note:

    • It is recommended to run ComfyUI with sudo python main.py to ensure the Manager has necessary permissions.
    • If updates fail, try deleting the folder or performing an uninstall/reinstall.
    • The Git installation method is generally more stable than the Manager method.
  7. Configure ComfyUI-Copilot to use LMStudio

    main

    To use local language models via LMStudio, configure the LLM/API settings in the ComfyUI-Copilot interface.

    Configuration Requirements:

    • API Key: Leave this completely empty. LMStudio does not require an API key.
    • Server URL: Enter the LMStudio server address. You must append /v1 to the end of the URL.

    Steps:

    1. Open ComfyUI-Copilot in your browser.
    2. Click the settings/configuration button.
    3. Locate the "LLM Configuration" or "API Configuration" section.
    4. Enter the Server URL (e.g., http://localhost:1234/v1).
    5. Click "Verify" to test the connection.
    6. Click "Save".
  8. Use Core Features of ComfyUI-Copilot v2.0

    main

    ComfyUI-Copilot v2.0 provides several intelligent workflow development features:

    • Generate Workflow: Type a description (e.g., I want a workflow for xxx) to receive 3 library workflows and 1 AI-generated workflow. Use one-click import to add them to the canvas.
    • Workflow Debug: Click the Debug button in the upper right of the input box or on the canvas to automatically detect errors, identify issues, and receive repair suggestions. It can also prompt you to download missing models.
    • Workflow Rewriting: Modify existing workflows by describing changes (e.g., Help me add xxx to the current canvas).
      • Tip: Use the Clear Context button frequently to manage conversation length and prevent interruptions.
    • Parameter Tuning (GenLab): Switch to the GenLab tab to set parameter ranges. The system will batch execute combinations and provide visual comparison results.
    • Node & Model Recommendations:
      • Ask for nodes: I want a node for xxx.
      • Ask for models/loras: I want a Lora that generates xxx images.
    • Node Query: Select a node and use the query button or type What's the usage, input and output of node xxx to see descriptions and usage tips.
    • Downstream Recommendations: Select a node to see recommended downstream subgraphs based on your current canvas.
  9. Test LMStudio Integration

    main

    To ensure your LMStudio integration is working correctly, follow these testing steps:

    1. Start LMStudio server with a model loaded.
    2. Configure ComfyUI-Copilot with your LMStudio URL.
    3. Test connection using the verify button in the UI.
    4. Load models: Verify that the models loaded in LMStudio appear in the ComfyUI-Copilot model dropdown.
    5. Test chat functionality: Send a simple query to ensure the LLM responds.
    6. Test features: Verify that ComfyUI-Copilot features like workflow generation and debugging function using the local model.