mirror of
https://github.com/HuangYuChuh/ComfyUI_Skills_OpenClaw.git
synced 2026-08-14 08:52:22 +00:00
Merge pull request #95 from HuangYuChuh/docs/readme-cli-first
docs: restructure README with CLI as primary interface
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
# ComfyUI Skills for OpenClaw
|
||||
|
||||

|
||||
|
||||
<p>
|
||||
<a href="./README.zh.md">
|
||||
<img src="https://img.shields.io/badge/简体中文-README.zh.md-blue?style=flat-square" alt="简体中文" />
|
||||
@@ -9,426 +10,298 @@
|
||||
|
||||
**[▶ Demo Video (Bilibili)](https://www.bilibili.com/video/BV1a6cUzVEE6/)**
|
||||
|
||||
> **NEW:** [ComfyUI Skill CLI](https://github.com/HuangYuChuh/ComfyUI_Skill_CLI) is now available — a standalone, `pip install` ready CLI with `--json` output. Any AI agent that can run shell commands can now use ComfyUI Skills directly.
|
||||
> ```bash
|
||||
> pip install comfyui-skill-cli
|
||||
> comfyui-skill --json list
|
||||
> comfyui-skill --json run local/txt2img --args '{"prompt": "a white cat"}'
|
||||
> ```
|
||||
Turn your ComfyUI workflows into callable skills for AI agents. Any agent that can run shell commands — Claude Code, Codex, OpenClaw — can discover, execute, and manage ComfyUI workflows through a single CLI.
|
||||
|
||||
This project is a ComfyUI skill integration layer for OpenClaw, Codex, and Claude Code. It turns the workflows you build and export from ComfyUI in API format into callable skills that these agents can trigger with natural language.
|
||||
|
||||
It converts natural language requests into structured skill arguments, maps them to ComfyUI workflow inputs, submits jobs to ComfyUI, waits for completion, then pulls generated images back to local disk.
|
||||
|
||||
For the upstream ComfyUI local server routes that back this skill, see [docs/comfyui-native-routes.md](./docs/comfyui-native-routes.md).
|
||||
|
||||
## Features
|
||||
|
||||
### Workflow-to-Skill Conversion
|
||||
- Turn your ComfyUI workflows into skills that OpenClaw, Codex, or Claude Code can call directly
|
||||
- Set up parameters in three steps: upload a workflow, pick the nodes to expose, then name and describe each parameter
|
||||
- Input nodes are detected automatically from the workflow — no need to hunt through the JSON by hand
|
||||
- When you update a workflow, preview the parameter changes first and carry over existing mappings
|
||||
- Supports bulk workflow import from a ComfyUI server or local JSON files
|
||||
|
||||
### Multi-Server Management
|
||||
- Manage multiple ComfyUI servers and route jobs to different machines as needed
|
||||
- Servers and workflows each have their own toggle — agents only see a workflow when both are enabled
|
||||
- Workflows with the same name on different servers stay separate, identified by `server/workflow` composite IDs
|
||||
- Set a per-server output directory and choose a default server
|
||||
|
||||
### Web UI
|
||||
- Frontend source lives in a [separate repository](https://github.com/HuangYuChuh/ComfyUI_Skills_OpenClaw-frontend); run `scripts/update_frontend.sh` to pull the latest build
|
||||
- Runtime update checks prefer pulling the main repo via git, and fall back to refreshing `ui/static/` from the frontend release when git update is unavailable
|
||||
- A local web interface for managing all servers and workflows in one place
|
||||
- Reorder workflows by dragging, or sort by name, status, or custom order
|
||||
- Search and filter workflows across all servers
|
||||
- Available in English, Simplified Chinese, and Traditional Chinese — switch languages from the UI
|
||||
|
||||
### Configuration Transfer
|
||||
- Export your current configuration and workflows into a single portable JSON file
|
||||
- Choose exactly which workflows to include before exporting
|
||||
- Preview what will change on the target machine before applying an import
|
||||
- Control whether to overwrite existing workflows or sync environment settings from the source machine
|
||||
|
||||
### Workflow Execution
|
||||
- Submit a job, wait for it to finish, and download the generated images to local storage automatically
|
||||
- Supports multi-image output in a single run
|
||||
- Agents can query all available workflows and their parameters from the command line for automated use
|
||||
|
||||
### CLI Tools
|
||||
- A full set of command-line tools for headless environments and scripting
|
||||
- Covers server management, workflow listing, job execution, and configuration import/export
|
||||
- **[ComfyUI Skill CLI](https://github.com/HuangYuChuh/ComfyUI_Skill_CLI)** — standalone, `pip install` ready CLI with `--json` output for AI agents
|
||||
|
||||
## ComfyUI Native API Scope
|
||||
|
||||
This repository should be understood as two layers:
|
||||
|
||||
- Native ComfyUI server routes on the target generation server, such as `/prompt`, `/history/{prompt_id}`, `/view`, `/ws`, and `/queue`
|
||||
- This project's own manager API under `/api/*`, used by the local UI to manage saved servers, workflows, and transfer bundles
|
||||
|
||||
The current skill implementation is centered on the native execution flow:
|
||||
|
||||
1. `POST /prompt`
|
||||
2. `GET /history/{prompt_id}`
|
||||
3. `GET /view`
|
||||
|
||||
That route-level reference is documented in [docs/comfyui-native-routes.md](./docs/comfyui-native-routes.md).
|
||||
[Install](#install) · [CLI Usage](#cli-usage) · [Web UI](#web-ui-optional) · [Workflow Setup](#workflow-setup) · [Multi-Server](#multi-server-management)
|
||||
|
||||
---
|
||||
|
||||
## Installation
|
||||
## Install
|
||||
|
||||
### Step 1: Clone the project
|
||||
|
||||
<details>
|
||||
<summary><strong>ComfyUI Skills for OpenClaw</strong></summary>
|
||||
|
||||
Manual install:
|
||||
<summary><strong>For OpenClaw</strong></summary>
|
||||
|
||||
```bash
|
||||
cd ~/.openclaw/workspace/skills
|
||||
git clone https://github.com/HuangYuChuh/ComfyUI_Skills_OpenClaw.git comfyui-skill-openclaw
|
||||
cd comfyui-skill-openclaw
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
python3 -m pip install -r requirements.txt
|
||||
pip install comfyui-skill-cli
|
||||
cp config.example.json config.json
|
||||
```
|
||||
|
||||
If `python3 --version` is below 3.10, create the virtual environment with any installed `python3.10+` interpreter, for example `python3.12 -m venv .venv`.
|
||||
|
||||
|
||||
|
||||
Let OpenClaw install it for you:
|
||||
|
||||
Send this prompt to OpenClaw:
|
||||
|
||||
```text
|
||||
Please install this ComfyUI skill into my OpenClaw workspace.
|
||||
|
||||
Target path:
|
||||
~/.openclaw/workspace/skills/comfyui-skill-openclaw/
|
||||
|
||||
Requirements:
|
||||
1. Run `cd ~/.openclaw/workspace/skills` first.
|
||||
2. Clone this repository into `comfyui-skill-openclaw`.
|
||||
3. Keep SKILL.md at the project root.
|
||||
4. Install Python dependencies from requirements.txt.
|
||||
5. Install the CLI tool: `pip install comfyui-skill-cli`.
|
||||
6. Run `cp config.example.json config.json`.
|
||||
7. Set the default ComfyUI server URL to http://127.0.0.1:8188 unless I specify another one.
|
||||
8. Make sure OpenClaw can discover and call this skill after installation.
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>ComfyUI Skills for Claude Code</strong></summary>
|
||||
|
||||
Manual install:
|
||||
<summary><strong>For Claude Code</strong></summary>
|
||||
|
||||
```bash
|
||||
cd ~/.claude/skills
|
||||
git clone https://github.com/HuangYuChuh/ComfyUI_Skills_OpenClaw.git comfyui-skill
|
||||
cd comfyui-skill
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
python3 -m pip install -r requirements.txt
|
||||
pip install comfyui-skill-cli
|
||||
cp config.example.json config.json
|
||||
```
|
||||
|
||||
If `python3 --version` is below 3.10, create the virtual environment with any installed `python3.10+` interpreter, for example `python3.12 -m venv .venv`.
|
||||
|
||||
|
||||
|
||||
Let Claude Code install it for you:
|
||||
|
||||
Send this prompt to Claude Code:
|
||||
|
||||
```text
|
||||
Please install this ComfyUI skill into my Claude Code skills directory.
|
||||
|
||||
Target path:
|
||||
~/.claude/skills/comfyui-skill/
|
||||
|
||||
Requirements:
|
||||
1. Run `cd ~/.claude/skills` first (create the directory if it doesn't exist).
|
||||
2. Clone this repository into `comfyui-skill`.
|
||||
3. Keep SKILL.md at the project root.
|
||||
4. Install Python dependencies from requirements.txt.
|
||||
5. Install the CLI tool: `pip install comfyui-skill-cli`.
|
||||
6. Run `cp config.example.json config.json`.
|
||||
7. Set the default ComfyUI server URL to http://127.0.0.1:8188 unless I specify another one.
|
||||
8. Make sure Claude Code can discover and call this skill after installation.
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>ComfyUI Skills for Codex</strong></summary>
|
||||
|
||||
Manual install:
|
||||
<summary><strong>For Codex</strong></summary>
|
||||
|
||||
```bash
|
||||
cd ~/.codex/skills
|
||||
git clone https://github.com/HuangYuChuh/ComfyUI_Skills_OpenClaw.git comfyui-skill
|
||||
cd comfyui-skill
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
python3 -m pip install -r requirements.txt
|
||||
pip install comfyui-skill-cli
|
||||
cp config.example.json config.json
|
||||
```
|
||||
|
||||
If `python3 --version` is below 3.10, create the virtual environment with any installed `python3.10+` interpreter, for example `python3.12 -m venv .venv`.
|
||||
|
||||
|
||||
|
||||
Let Codex install it for you:
|
||||
|
||||
Send this prompt to Codex:
|
||||
|
||||
```text
|
||||
Please install this ComfyUI skill into my Codex skills directory.
|
||||
|
||||
Target path:
|
||||
~/.codex/skills/comfyui-skill/
|
||||
|
||||
Requirements:
|
||||
1. Run `cd ~/.codex/skills` first (create the directory if it doesn't exist).
|
||||
2. Clone this repository into `comfyui-skill`.
|
||||
3. Keep SKILL.md at the project root.
|
||||
4. Install Python dependencies from requirements.txt.
|
||||
5. Install the CLI tool: `pip install comfyui-skill-cli`.
|
||||
6. Run `cp config.example.json config.json`.
|
||||
7. Set the default ComfyUI server URL to http://127.0.0.1:8188 unless I specify another one.
|
||||
8. Make sure Codex can discover and call this skill after installation.
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## Updating
|
||||
|
||||
To update the skill, run the update script and restart the UI or your agent runtime:
|
||||
|
||||
```bash
|
||||
./update.sh
|
||||
```
|
||||
|
||||
This pulls the latest code, syncs frontend assets, and installs any new Python dependencies in one step.
|
||||
|
||||
If you prefer updating manually, you can also run `git pull` followed by `pip install -r requirements.txt`.
|
||||
|
||||
If you use the update prompt in the Web UI, it follows the same repository-first update flow.
|
||||
|
||||
## ComfyUI Workflow Setup
|
||||
|
||||
Before you start, make sure your ComfyUI server is already running. The default local address is `http://127.0.0.1:8188`.
|
||||
|
||||
### UI Setup (Recommended)
|
||||
|
||||
- macOS/Linux: `./ui/run_ui.sh`, or double-click `ui/run_ui.command`
|
||||
- Windows: `ui\run_ui.bat`
|
||||
- Visit: `http://localhost:18189`
|
||||
- Upload a workflow JSON exported from ComfyUI with **Save (API Format)**
|
||||
- Add your first ComfyUI server in the UI
|
||||
- Select which parameters should be exposed to OpenClaw and save the mapping
|
||||
|
||||
### Config File Setup
|
||||
|
||||
#### 1) Edit `config.json`
|
||||
|
||||
Configure the server first. Minimal example:
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"servers": [
|
||||
{
|
||||
"id": "local", // Server ID, also used as the directory name and workflow prefix
|
||||
"name": "Local", // Display name
|
||||
"url": "http://127.0.0.1:8188", // ComfyUI server URL
|
||||
"enabled": true, // Whether this server is enabled
|
||||
"output_dir": "./outputs" // Image output directory
|
||||
}
|
||||
],
|
||||
"default_server": "local" // Default server ID
|
||||
}
|
||||
```
|
||||
|
||||
#### 2) Place Workflow Files
|
||||
|
||||
Each workflow uses its own directory, for example:
|
||||
|
||||
```bash
|
||||
data/local/Default/
|
||||
workflow.json # ComfyUI API-format workflow export
|
||||
schema.json # Parameter mapping exposed to OpenClaw/Agent
|
||||
```
|
||||
|
||||
#### 3) Write `schema.json`
|
||||
|
||||
`schema.json` should include at least:
|
||||
|
||||
- `description`
|
||||
- `enabled`
|
||||
- `parameters`
|
||||
|
||||
Minimal example:
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"description": "Default test workflow", // Human-readable description for OpenClaw/Agent
|
||||
"enabled": true, // Whether this workflow is enabled
|
||||
"parameters": {
|
||||
"prompt": { // Parameter name exposed to OpenClaw/Agent
|
||||
"node_id": 10, // Node ID in workflow.json
|
||||
"field": "prompt", // Input field name under that node
|
||||
"required": true, // Whether this field is required
|
||||
"type": "string", // Parameter type
|
||||
"description": "Prompt text" // Parameter description
|
||||
},
|
||||
"seed": {
|
||||
"node_id": 10,
|
||||
"field": "seed",
|
||||
"required": false,
|
||||
"type": "int",
|
||||
"description": "Random seed"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Notes:
|
||||
|
||||
- The workflow ID comes directly from the directory name. For example, if the directory is `data/local/Default/`, the workflow ID is `Default`
|
||||
- Each entry in `parameters` defines one input exposed to OpenClaw/Agent
|
||||
- `node_id` and `field` must match the actual node and input field in `workflow.json`
|
||||
|
||||
If you want a full example, refer to:
|
||||
|
||||
- `data/local/Default/workflow.json`
|
||||
- `data/local/Default/schema.json`
|
||||
- These two files are generic examples. Before running them, replace node `4`'s `ckpt_name` in `workflow.json` with a checkpoint name that exists on your ComfyUI server.
|
||||
|
||||
#### 4) Install the CLI
|
||||
|
||||
```bash
|
||||
pip install comfyui-skill-cli
|
||||
```
|
||||
|
||||
Or with [pipx](https://pipx.pypa.io/) (recommended, avoids polluting global Python):
|
||||
### Step 2: Install the CLI
|
||||
|
||||
```bash
|
||||
pipx install comfyui-skill-cli
|
||||
```
|
||||
|
||||
#### 5) Verify the Configuration
|
||||
|
||||
List the available workflows:
|
||||
Or with pip:
|
||||
|
||||
```bash
|
||||
comfyui-skill --json list
|
||||
pip install comfyui-skill-cli
|
||||
```
|
||||
|
||||
Run a test generation:
|
||||
### Step 3: Verify
|
||||
|
||||
```bash
|
||||
comfyui-skill --json run <server_id>/<workflow_id> --args '{"prompt":"test"}'
|
||||
comfyui-skill server status
|
||||
comfyui-skill list
|
||||
```
|
||||
|
||||
Example:
|
||||
That's it. The CLI reads `config.json` and `data/` from the project directory.
|
||||
|
||||
> **Web UI dependencies** (optional, only needed if you want the management interface):
|
||||
> ```bash
|
||||
> pip install -r requirements.txt
|
||||
> ```
|
||||
|
||||
---
|
||||
|
||||
## CLI Usage
|
||||
|
||||
The CLI is the primary way to interact with ComfyUI Skills. All commands support `--json` for structured output.
|
||||
|
||||
### Quick Start
|
||||
|
||||
```bash
|
||||
comfyui-skill --json run local/Default --args '{"prompt":"A premium product photo"}'
|
||||
# Check server
|
||||
comfyui-skill server status
|
||||
|
||||
# List workflows
|
||||
comfyui-skill list
|
||||
|
||||
# Execute a workflow
|
||||
comfyui-skill run local/txt2img --args '{"prompt": "a white cat"}'
|
||||
|
||||
# Import a new workflow from JSON
|
||||
comfyui-skill workflow import ./my-workflow.json --check-deps
|
||||
|
||||
# Upload an image for img2img workflows
|
||||
comfyui-skill upload ./photo.png
|
||||
```
|
||||
|
||||
On success, the output looks like this:
|
||||
### Full Command Reference
|
||||
|
||||
```json
|
||||
| Category | Command | Description |
|
||||
|----------|---------|-------------|
|
||||
| **Discovery** | `comfyui-skill list` | List all workflows with parameters |
|
||||
| | `comfyui-skill info <workflow_id>` | Show workflow details and parameter schema |
|
||||
| **Execution** | `comfyui-skill run <workflow_id> --args '{...}'` | Execute workflow (blocking) |
|
||||
| | `comfyui-skill submit <workflow_id> --args '{...}'` | Submit workflow (non-blocking) |
|
||||
| | `comfyui-skill status <prompt_id>` | Check execution status |
|
||||
| | `comfyui-skill upload <image_path>` | Upload image to ComfyUI |
|
||||
| **Workflow** | `comfyui-skill workflow import <json_path>` | Import from local JSON (auto-detect format) |
|
||||
| | `comfyui-skill workflow import --from-server` | Import from ComfyUI server |
|
||||
| | `comfyui-skill workflow enable/disable <workflow_id>` | Toggle workflow |
|
||||
| | `comfyui-skill workflow delete <workflow_id>` | Delete workflow |
|
||||
| **Server** | `comfyui-skill server list` | List servers |
|
||||
| | `comfyui-skill server status [<server_id>]` | Check server health |
|
||||
| | `comfyui-skill server add --id <server_id> --url <url>` | Add server |
|
||||
| | `comfyui-skill server enable/disable <server_id>` | Toggle server |
|
||||
| | `comfyui-skill server remove <server_id>` | Remove server |
|
||||
| **Dependencies** | `comfyui-skill deps check <workflow_id>` | Check missing nodes and models |
|
||||
| | `comfyui-skill deps install <workflow_id> --all` | Install all missing deps |
|
||||
| **Config** | `comfyui-skill config export --output <path>` | Export config bundle |
|
||||
| | `comfyui-skill config import <path>` | Import config bundle |
|
||||
| **History** | `comfyui-skill history list <workflow_id>` | List execution history |
|
||||
| | `comfyui-skill history show <workflow_id> <run_id>` | Show run details |
|
||||
|
||||
> `<workflow_id>` format: `server_id/workflow_name` (e.g. `local/txt2img`). Omit the server prefix to use the default server.
|
||||
|
||||
For full CLI documentation, see [ComfyUI Skill CLI](https://github.com/HuangYuChuh/ComfyUI_Skill_CLI).
|
||||
|
||||
---
|
||||
|
||||
## Web UI (Optional)
|
||||
|
||||
A local web interface for visual workflow management. Not required for Agent usage — the CLI covers all functionality.
|
||||
|
||||
### Launch
|
||||
|
||||
```bash
|
||||
pip install -r requirements.txt # first time only
|
||||
./ui/run_ui.sh # macOS/Linux
|
||||
# or: ui\run_ui.bat # Windows
|
||||
```
|
||||
|
||||
Visit `http://localhost:18189`.
|
||||
|
||||
### Capabilities
|
||||
|
||||
- Upload workflows exported from ComfyUI (API Format)
|
||||
- Configure parameter mappings with a visual editor
|
||||
- Manage multiple servers and workflows in one place
|
||||
- Drag to reorder, search and filter across servers
|
||||
- Available in English, Simplified Chinese, and Traditional Chinese
|
||||
|
||||
Frontend source lives in a [separate repository](https://github.com/HuangYuChuh/ComfyUI_Skills_OpenClaw-frontend).
|
||||
|
||||
---
|
||||
|
||||
## Workflow Setup
|
||||
|
||||
Before you start, make sure your ComfyUI server is running (default: `http://127.0.0.1:8188`).
|
||||
|
||||
### Option A: Import via CLI (Recommended)
|
||||
|
||||
```bash
|
||||
# Import a workflow JSON — auto-detects format, converts if needed, generates schema
|
||||
comfyui-skill workflow import ./my-workflow.json
|
||||
|
||||
# Check and install dependencies
|
||||
comfyui-skill deps check local/my-workflow
|
||||
comfyui-skill deps install local/my-workflow --all
|
||||
|
||||
# Verify
|
||||
comfyui-skill run local/my-workflow --args '{"prompt": "test"}'
|
||||
```
|
||||
|
||||
### Option B: Import via Web UI
|
||||
|
||||
1. Open the Web UI at `http://localhost:18189`
|
||||
2. Upload a workflow JSON exported from ComfyUI with **Save (API Format)**
|
||||
3. Select which parameters to expose to agents
|
||||
4. Save the mapping
|
||||
|
||||
### Option C: Manual Setup
|
||||
|
||||
<details>
|
||||
<summary>Expand for manual config file setup</summary>
|
||||
|
||||
#### 1) Edit `config.json`
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"status": "completed",
|
||||
"prompt_id": "...",
|
||||
"images": ["./outputs/<prompt_id>_...png"]
|
||||
"servers": [
|
||||
{
|
||||
"id": "local",
|
||||
"name": "Local",
|
||||
"url": "http://127.0.0.1:8188",
|
||||
"enabled": true,
|
||||
"output_dir": "./outputs"
|
||||
}
|
||||
],
|
||||
"default_server": "local"
|
||||
}
|
||||
```
|
||||
|
||||
### Agent-Assisted Setup
|
||||
#### 2) Place workflow files
|
||||
|
||||
- Let OpenClaw or another agent edit `config.json`
|
||||
- Let the agent write `workflow.json` and `schema.json` into the target workflow directory
|
||||
- After writing the files, let the agent run a verification step
|
||||
```
|
||||
data/local/my-workflow/
|
||||
workflow.json # ComfyUI API-format export
|
||||
schema.json # Parameter mapping
|
||||
```
|
||||
|
||||
#### 3) Write `schema.json`
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"description": "My workflow",
|
||||
"enabled": true,
|
||||
"parameters": {
|
||||
"prompt": {
|
||||
"node_id": 10,
|
||||
"field": "prompt",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"description": "Prompt text"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### Workflow Requirements
|
||||
|
||||
**An API-format workflow plus a `Save Image` output node** is the baseline requirement for stable use. To avoid failed or empty runs:
|
||||
|
||||
1. **The workflow must be exported in ComfyUI API format**
|
||||
- In ComfyUI, click **Save (API Format)**
|
||||
- Place the exported JSON at `data/<server_id>/<workflow_id>/workflow.json`
|
||||
|
||||
2. **The workflow must end with a `Save Image` node**
|
||||
- The current client downloads results from ComfyUI output images
|
||||
- Without a `Save Image` node (or equivalent image output), the workflow may finish but return no downloadable image
|
||||
- **Must be exported in ComfyUI API format** (click **Save (API Format)** in ComfyUI)
|
||||
- **Must end with a `Save Image` node** (or equivalent image output node)
|
||||
|
||||
---
|
||||
|
||||
## Multi-Server Management
|
||||
|
||||
You can configure multiple ComfyUI servers so OpenClaw can route jobs across different hardware targets such as a local GPU or a remote instance.
|
||||
Manage multiple ComfyUI servers and route jobs to different hardware.
|
||||
|
||||
### Core Concepts
|
||||
- **Dual-Layer Toggles**: Both *servers* and *individual workflows* can be enabled or disabled. A workflow is only visible to the AI agent if **both** the server and the workflow itself are enabled.
|
||||
- **Namespacing**: Workflows are identified with a composite ID: `<server_id>/<workflow_id>` (e.g., `local/sdxl-base` vs. `remote-a100/sdxl-base`).
|
||||
|
||||
### CLI Configuration
|
||||
On headless machines, use the CLI tool (`pip install comfyui-skill-cli`):
|
||||
- **Dual-layer toggles**: Both servers and workflows have independent enable/disable. Agents only see workflows where both are enabled.
|
||||
- **Namespacing**: Workflows are identified as `<server_id>/<workflow_id>` (e.g. `local/txt2img` vs `remote-a100/txt2img`).
|
||||
|
||||
### CLI
|
||||
|
||||
```bash
|
||||
comfyui-skill server add --id remote --name "Remote GPU" --url http://10.0.0.1:8188
|
||||
comfyui-skill server list
|
||||
comfyui-skill server add --id remote --name "Remote Node" --url http://10.0.0.1:8188
|
||||
comfyui-skill server disable remote
|
||||
```
|
||||
*You can still manage all server settings through the web UI.*
|
||||
|
||||
### Configuration Migration
|
||||
|
||||
If you move this skill to another path or another machine, use the built-in bundle flow to transfer the current configuration and workflow mappings.
|
||||
|
||||
UI flow:
|
||||
|
||||
- Click `Export Config` on the main page to download `openclaw-skill-export.json`
|
||||
- Before export, you can expand each server and uncheck workflows you do not want to include; all workflows are selected by default and servers are collapsed by default
|
||||
- Open the UI on the target machine and click `Import Config`
|
||||
- Select the exported JSON bundle
|
||||
- Review the preview summary, then decide whether to also apply the source machine's default server, URL, and output directory
|
||||
|
||||
CLI flow:
|
||||
|
||||
```bash
|
||||
comfyui-skill config export --output ./openclaw-skill-export.json
|
||||
comfyui-skill config import ./openclaw-skill-export.json --dry-run
|
||||
comfyui-skill config import ./openclaw-skill-export.json
|
||||
# Export
|
||||
comfyui-skill config export --output ./backup.json
|
||||
|
||||
# Preview import
|
||||
comfyui-skill config import ./backup.json --dry-run
|
||||
|
||||
# Apply import
|
||||
comfyui-skill config import ./backup.json
|
||||
```
|
||||
|
||||
Optional flags:
|
||||
*All server settings can also be managed through the Web UI.*
|
||||
|
||||
- `--apply-environment`: also apply bundle default server, URL, and output directory during import
|
||||
- `--no-overwrite`: skip existing workflows instead of overwriting them
|
||||
---
|
||||
|
||||
Default import behavior:
|
||||
## Updating
|
||||
|
||||
- Existing workflows with the same ID are overwritten
|
||||
- Existing servers are merged instead of replaced
|
||||
- The target machine keeps its current `url`, `output_dir`, and `default_server` unless `--apply-environment` is used
|
||||
```bash
|
||||
./update.sh
|
||||
```
|
||||
|
||||
This pulls the latest code, syncs frontend assets, and installs new dependencies. You can also run `git pull` manually.
|
||||
|
||||
To update the CLI:
|
||||
|
||||
```bash
|
||||
pipx upgrade comfyui-skill-cli
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Common Issues
|
||||
|
||||
- If ComfyUI returns HTTP 400 on `/prompt`, the workflow payload or one of the parameter values is usually invalid.
|
||||
- `size` must match values accepted by the underlying node (e.g. `3:4,1728x2304`).
|
||||
- If `config.json` points to the wrong server URL, job queueing will fail.
|
||||
- **HTTP 400 on `/prompt`**: The workflow payload or parameter values are invalid.
|
||||
- **No images returned**: The workflow is missing a `Save Image` node.
|
||||
- **Connection failed**: Check that `config.json` has the correct server URL.
|
||||
|
||||
---
|
||||
|
||||
@@ -438,61 +311,27 @@ See [CHANGELOG.md](./CHANGELOG.md) for the full release history.
|
||||
|
||||
---
|
||||
|
||||
## Roadmap
|
||||
|
||||
- [ ] Workflow version history and rollback
|
||||
- [x] Upgrade preview before applying a new workflow version
|
||||
- [x] Parameter migration support when upgrading a workflow
|
||||
- [x] Authentication support for remote ComfyUI servers
|
||||
- [x] Better schema validation before queueing
|
||||
- [x] Richer error reporting from ComfyUI node errors
|
||||
- [ ] Execution history with parameter and result tracking
|
||||
- [ ] Webhook callbacks on task completion
|
||||
- [ ] Scheduled workflow execution (cron-style)
|
||||
- [ ] Guided workflow rewrite recipes for agents
|
||||
- [ ] Native ComfyUI plugin with AI-assisted parameter mapping — describe what a workflow does in natural language inside ComfyUI, and let the AI automatically infer node-field relationships to generate `schema.json`, eliminating manual parameter configuration
|
||||
- [ ] AI agent workflow generation — describe your image/video generation goal in natural language, and let the AI agent automatically construct, connect, and configure a complete ComfyUI workflow graph from scratch
|
||||
|
||||
---
|
||||
|
||||
## Project Structure
|
||||
|
||||
```text
|
||||
ComfyUI_Skills_OpenClaw/
|
||||
├── SKILL.md # Agent instruction spec (how to call registry/client)
|
||||
├── README.md
|
||||
├── README.zh.md
|
||||
├── LICENSE
|
||||
├── .gitignore
|
||||
├── requirements.txt # Python deps (FastAPI, requests, etc.)
|
||||
├── config.example.json # Example runtime config
|
||||
├── config.json # Actual local runtime config (gitignored)
|
||||
├── asset/
|
||||
│ └── banner-ui-dashboard-20260322.png
|
||||
├── SKILL.md # Agent instruction spec
|
||||
├── config.example.json # Example config
|
||||
├── config.json # Local config (gitignored)
|
||||
├── requirements.txt # Python deps for Web UI only
|
||||
├── data/
|
||||
│ ├── <server_id>/
|
||||
│ │ └── <workflow_id>/
|
||||
│ │ ├── workflow.json # ComfyUI workflow API export
|
||||
│ │ └── schema.json # Exposed parameter mapping
|
||||
│ └── <server_id>/
|
||||
│ └── <workflow_id>/
|
||||
│ ├── workflow.json # ComfyUI API-format workflow
|
||||
│ └── schema.json # Parameter mapping
|
||||
├── scripts/
|
||||
│ ├── update_frontend.sh # Pull latest frontend build from GitHub Releases
|
||||
│ └── shared/ # Shared config & utils (used by Web UI backend)
|
||||
│ ├── config.py
|
||||
│ ├── json_utils.py
|
||||
│ └── runtime_config.py
|
||||
│ ├── update_frontend.sh # Pull latest frontend build
|
||||
│ └── shared/ # Shared utils (Web UI backend)
|
||||
├── ui/
|
||||
│ ├── app.py # FastAPI app – routes only
|
||||
│ ├── open_ui.py # Agent-friendly UI launcher
|
||||
│ ├── services.py # Business logic (workflow CRUD)
|
||||
│ ├── models.py # Pydantic request/response models
|
||||
│ ├── json_store.py # Low-level JSON file read/write helpers
|
||||
│ ├── settings.py # App-level settings
|
||||
│ ├── run_ui.sh # Start UI (macOS/Linux)
|
||||
│ ├── run_ui.command # Double-click launcher (macOS)
|
||||
│ ├── run_ui.bat # Launcher (Windows)
|
||||
│ └── static/ # Modular ES6 frontend (HTML/CSS/JS)
|
||||
│ ├── app.py # FastAPI backend
|
||||
│ ├── open_ui.py # UI launcher
|
||||
│ └── static/ # Frontend (HTML/CSS/JS)
|
||||
└── outputs/
|
||||
└── .gitkeep
|
||||
```
|
||||
|
||||
---
|
||||
@@ -500,30 +339,14 @@ ComfyUI_Skills_OpenClaw/
|
||||
<details>
|
||||
<summary>Project Keywords And Resources</summary>
|
||||
|
||||
## Project Keywords
|
||||
### Project Keywords
|
||||
|
||||
This repository is organized around the following search intents:
|
||||
- OpenClaw · ComfyUI · ComfyUI Skills · ComfyUI workflow automation
|
||||
- AI image generation skill · OpenClaw ComfyUI integration
|
||||
|
||||
- OpenClaw
|
||||
- ComfyUI
|
||||
- ComfyUI Skills
|
||||
- ComfyUI workflow automation
|
||||
- OpenClaw ComfyUI integration
|
||||
- AI image generation skill
|
||||
- Xiao Long Xia (small crawfish / 小龙虾, project nickname)
|
||||
### Core Files
|
||||
|
||||
Core files for project understanding and retrieval:
|
||||
- `README.md` (English overview)
|
||||
- `README.zh.md` (Chinese overview)
|
||||
- `SKILL.md` (agent execution contract)
|
||||
- `docs/llms.txt` and `docs/llms-full.txt` (LLM-oriented summaries)
|
||||
|
||||
---
|
||||
|
||||
## Project Resources
|
||||
|
||||
- Project summary: `docs/llms.txt`
|
||||
- Extended project context: `docs/llms-full.txt`
|
||||
- Project discovery checklist: `docs/PROJECT_DISCOVERY_CHECKLIST.md`
|
||||
- `SKILL.md` — Agent execution contract
|
||||
- `docs/llms.txt` / `docs/llms-full.txt` — LLM-oriented summaries
|
||||
|
||||
</details>
|
||||
|
||||
+217
-400
@@ -4,429 +4,296 @@
|
||||
|
||||
**[▶ 演示视频(Bilibili)](https://www.bilibili.com/video/BV1a6cUzVEE6/)**
|
||||
|
||||
> **NEW:** [ComfyUI Skill CLI](https://github.com/HuangYuChuh/ComfyUI_Skill_CLI) 现已发布 — 独立 CLI 工具,支持 `pip install`,所有命令输出 `--json` 结构化数据。任何能执行 Shell 命令的 AI Agent 都可以直接调用 ComfyUI Skills。
|
||||
> ```bash
|
||||
> pip install comfyui-skill-cli
|
||||
> comfyui-skill --json list
|
||||
> comfyui-skill --json run local/txt2img --args '{"prompt": "a white cat"}'
|
||||
> ```
|
||||
把 ComfyUI 工作流变成 AI Agent 可调用的技能。任何能执行 Shell 命令的 Agent — Claude Code、Codex、OpenClaw — 都可以通过一个 CLI 发现、执行和管理 ComfyUI 工作流。
|
||||
|
||||
这是一个面向 OpenClaw、Codex 和 Claude Code 的 ComfyUI Skill 集成层:支持调用你在 ComfyUI 中自行编排并导出(API格式)的 Workflow,将其封装为可被这些 Agent 通过自然语言触发的 Skills。
|
||||
|
||||
它会把自然语言请求转成结构化的 Skill 参数,映射到 ComfyUI 工作流输入后提交执行,等待任务完成并将生成图片下载到本地。
|
||||
|
||||
上游 ComfyUI 本地服务路由说明见:[`docs/comfyui-native-routes.zh.md`](./docs/comfyui-native-routes.zh.md)。
|
||||
|
||||
---
|
||||
|
||||
## 功能特性
|
||||
|
||||
### 工作流转 Skill
|
||||
- 把你在 ComfyUI 里搭好的工作流,直接变成 OpenClaw、Codex、Claude Code 能调用的技能
|
||||
- 三步完成参数配置:上传工作流 → 选择要暴露的节点 → 设定参数名称和说明
|
||||
- 上传工作流后自动识别可配置的输入节点,不需要手动逐个查找
|
||||
- 工作流更新时可以先预览参数变化,已有的映射关系会自动迁移
|
||||
- 支持从 ComfyUI 服务器或本地 JSON 文件批量导入工作流
|
||||
|
||||
### 多服务器管理
|
||||
- 同时管理多台 ComfyUI 服务器,按需把生图任务分发到不同机器
|
||||
- 服务器和工作流各自有独立开关,只有两者都开启时 Agent 才能看到
|
||||
- 同名工作流在不同服务器上互不干扰,通过 `服务器/工作流` 的组合 ID 区分
|
||||
- 可以为每台服务器单独设置输出目录,并指定默认服务器
|
||||
|
||||
### 管理界面
|
||||
- 前端源码位于[独立仓库](https://github.com/HuangYuChuh/ComfyUI_Skills_OpenClaw-frontend);运行 `scripts/update_frontend.sh` 可拉取最新构建
|
||||
- 运行时更新检查会优先走主仓库 git 更新;如果 git 更新不可用,会回退为从前端 release 更新 `ui/static/`
|
||||
- 提供本地 Web 界面,统一管理所有服务器和工作流
|
||||
- 支持拖拽调整工作流顺序,也可按名称、启用状态等方式排序
|
||||
- 可跨服务器搜索和筛选工作流
|
||||
- 支持英文、简体中文、繁体中文三种语言,界面内一键切换
|
||||
|
||||
### 配置迁移
|
||||
- 一键导出当前配置和工作流,打包为一个 JSON 文件
|
||||
- 导出时可以按需选择,只打包你需要的工作流
|
||||
- 导入前先预览变更内容,确认无误后再执行
|
||||
- 可控制是否覆盖已有工作流、是否同步源机器的环境设置
|
||||
|
||||
### 工作流执行
|
||||
- 提交生图任务后自动等待完成,生成的图片直接下载到本地
|
||||
- 支持单次生成多张图片
|
||||
- Agent 可通过命令行查询所有可用工作流及其参数,便于自动化调用
|
||||
|
||||
### CLI 工具
|
||||
- 提供完整的命令行工具集,适合无界面环境或脚本化使用
|
||||
- 涵盖服务器管理、工作流查询、任务执行、配置导入导出四项核心操作
|
||||
- **[ComfyUI Skill CLI](https://github.com/HuangYuChuh/ComfyUI_Skill_CLI)** — 独立 CLI 工具,支持 `pip install`,所有命令输出 `--json` 结构化数据,适配 AI Agent 调用
|
||||
|
||||
## ComfyUI 原生 API 范围
|
||||
|
||||
这个仓库建议按两层来理解:
|
||||
|
||||
- ComfyUI 原生服务路由(目标生图服务),例如 `/prompt`、`/history/{prompt_id}`、`/view`、`/ws`、`/queue`
|
||||
- 本项目自己的管理 API(`/api/*`),用于本地 UI 管理服务器、工作流和配置迁移
|
||||
|
||||
当前 Skill 的核心执行链路是:
|
||||
|
||||
1. `POST /prompt`
|
||||
2. `GET /history/{prompt_id}`
|
||||
3. `GET /view`
|
||||
|
||||
更细的路由说明见:[`docs/comfyui-native-routes.zh.md`](./docs/comfyui-native-routes.zh.md)。
|
||||
[安装](#安装) · [CLI 使用](#cli-使用) · [Web UI](#web-ui可选) · [工作流配置](#工作流配置) · [多服务器](#多服务器管理)
|
||||
|
||||
---
|
||||
|
||||
## 安装
|
||||
|
||||
<details>
|
||||
<summary><strong>ComfyUI Skills for OpenClaw</strong></summary>
|
||||
### 第一步:克隆项目
|
||||
|
||||
手动安装:
|
||||
<details>
|
||||
<summary><strong>用于 OpenClaw</strong></summary>
|
||||
|
||||
```bash
|
||||
cd ~/.openclaw/workspace/skills
|
||||
git clone https://github.com/HuangYuChuh/ComfyUI_Skills_OpenClaw.git comfyui-skill-openclaw
|
||||
cd comfyui-skill-openclaw
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
python3 -m pip install -r requirements.txt
|
||||
pip install comfyui-skill-cli
|
||||
cp config.example.json config.json
|
||||
```
|
||||
|
||||
如果 `python3 --version` 低于 3.10,请改用任意已安装的 `python3.10+` 解释器创建虚拟环境,例如 `python3.12 -m venv .venv`。
|
||||
|
||||
|
||||
|
||||
让 OpenClaw 帮你安装:
|
||||
|
||||
把下面这段话发给 OpenClaw 即可:
|
||||
|
||||
```text
|
||||
请帮我把这个 ComfyUI skill 安装到我的 OpenClaw workspace 里。
|
||||
|
||||
目标路径:
|
||||
~/.openclaw/workspace/skills/comfyui-skill-openclaw/
|
||||
|
||||
要求:
|
||||
1. 先执行 `cd ~/.openclaw/workspace/skills`。
|
||||
2. 将这个仓库克隆为 `comfyui-skill-openclaw` 目录。
|
||||
3. 保留根目录下的 SKILL.md。
|
||||
4. 安装 requirements.txt 里的 Python 依赖。
|
||||
5. 安装 CLI 工具:`pip install comfyui-skill-cli`。
|
||||
6. 执行 `cp config.example.json config.json`。
|
||||
7. 如果我没有额外指定,就默认把 ComfyUI 地址设置为 http://127.0.0.1:8188。
|
||||
8. 安装完成后,确保 OpenClaw 可以发现并调用这个 skill。
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>ComfyUI Skills for Claude Code</strong></summary>
|
||||
|
||||
手动安装:
|
||||
<summary><strong>用于 Claude Code</strong></summary>
|
||||
|
||||
```bash
|
||||
cd ~/.claude/skills
|
||||
git clone https://github.com/HuangYuChuh/ComfyUI_Skills_OpenClaw.git comfyui-skill
|
||||
cd comfyui-skill
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
python3 -m pip install -r requirements.txt
|
||||
pip install comfyui-skill-cli
|
||||
cp config.example.json config.json
|
||||
```
|
||||
|
||||
如果 `python3 --version` 低于 3.10,请改用任意已安装的 `python3.10+` 解释器创建虚拟环境,例如 `python3.12 -m venv .venv`。
|
||||
|
||||
|
||||
|
||||
让 Claude Code 帮你安装:
|
||||
|
||||
把下面这段话发给 Claude Code 即可:
|
||||
|
||||
```text
|
||||
请帮我把这个 ComfyUI skill 安装到我的 Claude Code skills 目录里。
|
||||
|
||||
目标路径:
|
||||
~/.claude/skills/comfyui-skill/
|
||||
|
||||
要求:
|
||||
1. 先执行 `cd ~/.claude/skills`(如果目录不存在请先创建)。
|
||||
2. 将这个仓库克隆为 `comfyui-skill` 目录。
|
||||
3. 保留根目录下的 SKILL.md。
|
||||
4. 安装 requirements.txt 里的 Python 依赖。
|
||||
5. 安装 CLI 工具:`pip install comfyui-skill-cli`。
|
||||
6. 执行 `cp config.example.json config.json`。
|
||||
7. 如果我没有额外指定,就默认把 ComfyUI 地址设置为 http://127.0.0.1:8188。
|
||||
8. 安装完成后,确保 Claude Code 可以发现并调用这个 skill。
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>ComfyUI Skills for Codex</strong></summary>
|
||||
|
||||
手动安装:
|
||||
<summary><strong>用于 Codex</strong></summary>
|
||||
|
||||
```bash
|
||||
cd ~/.codex/skills
|
||||
git clone https://github.com/HuangYuChuh/ComfyUI_Skills_OpenClaw.git comfyui-skill
|
||||
cd comfyui-skill
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
python3 -m pip install -r requirements.txt
|
||||
pip install comfyui-skill-cli
|
||||
cp config.example.json config.json
|
||||
```
|
||||
|
||||
如果 `python3 --version` 低于 3.10,请改用任意已安装的 `python3.10+` 解释器创建虚拟环境,例如 `python3.12 -m venv .venv`。
|
||||
|
||||
|
||||
|
||||
让 Codex 帮你安装:
|
||||
|
||||
把下面这段话发给 Codex 即可:
|
||||
|
||||
```text
|
||||
请帮我把这个 ComfyUI skill 安装到我的 Codex skills 目录里。
|
||||
|
||||
目标路径:
|
||||
~/.codex/skills/comfyui-skill/
|
||||
|
||||
要求:
|
||||
1. 先执行 `cd ~/.codex/skills`(如果目录不存在请先创建)。
|
||||
2. 将这个仓库克隆为 `comfyui-skill` 目录。
|
||||
3. 保留根目录下的 SKILL.md。
|
||||
4. 安装 requirements.txt 里的 Python 依赖。
|
||||
5. 安装 CLI 工具:`pip install comfyui-skill-cli`。
|
||||
6. 执行 `cp config.example.json config.json`。
|
||||
7. 如果我没有额外指定,就默认把 ComfyUI 地址设置为 http://127.0.0.1:8188。
|
||||
8. 安装完成后,确保 Codex 可以发现并调用这个 skill。
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## 更新
|
||||
|
||||
更新这个 skill 时,运行更新脚本,然后重启 UI 或 Agent 运行环境:
|
||||
|
||||
```bash
|
||||
./update.sh
|
||||
```
|
||||
|
||||
这会拉取最新代码、同步前端资源、并安装新增的 Python 依赖,一步到位。
|
||||
|
||||
如果你习惯手动更新,也可以执行 `git pull` 后再跑 `pip install -r requirements.txt`。
|
||||
|
||||
如果你是在 Web UI 里点更新提示,走的也是同一条“优先更新整个仓库”的流程。
|
||||
|
||||
## 配置 ComfyUI 工作流
|
||||
|
||||
开始配置前,请先确保 ComfyUI 服务已经运行,本地 ComfyUI 默认地址是 `http://127.0.0.1:8188`。
|
||||
|
||||
### 通过 UI 配置(推荐)
|
||||
|
||||
- macOS/Linux:`./ui/run_ui.sh`,或双击 `ui/run_ui.command`
|
||||
- Windows:`ui\run_ui.bat`
|
||||
- 访问:`http://localhost:18189`
|
||||
- 上传从 ComfyUI 导出的工作流 JSON,格式必须是 **Save (API Format)**
|
||||
- 在 UI 中添加第一个 ComfyUI 服务器
|
||||
- 选择要暴露给 OpenClaw 的参数并保存映射
|
||||
|
||||
### 通过配置文件配置
|
||||
|
||||
#### 1)编辑 `config.json`
|
||||
|
||||
先配置服务器信息。最小示例如下:
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"servers": [
|
||||
{
|
||||
"id": "local", // 服务器 ID,后面会作为目录名和工作流调用前缀
|
||||
"name": "Local", // 服务器显示名称
|
||||
"url": "http://127.0.0.1:8188", // ComfyUI 服务地址
|
||||
"enabled": true, // 是否启用这个服务器
|
||||
"output_dir": "./outputs" // 图片输出目录
|
||||
}
|
||||
],
|
||||
"default_server": "local" // 默认服务器 ID
|
||||
}
|
||||
```
|
||||
|
||||
#### 2)放置工作流文件
|
||||
|
||||
每个工作流使用一个独立目录,例如:
|
||||
|
||||
```bash
|
||||
data/local/Default/
|
||||
workflow.json # 从 ComfyUI 导出的 API 格式工作流
|
||||
schema.json # 对外暴露给 OpenClaw/Agent 的参数映射
|
||||
```
|
||||
|
||||
#### 3)编写 `schema.json`
|
||||
|
||||
`schema.json` 至少需要包含:
|
||||
|
||||
- `description`
|
||||
- `enabled`
|
||||
- `parameters`
|
||||
|
||||
最小示例如下:
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"description": "默认测试工作流", // 给 OpenClaw/Agent 看的工作流说明
|
||||
"enabled": true, // 是否启用这个工作流
|
||||
"parameters": {
|
||||
"prompt": { // 暴露给 OpenClaw/Agent 的参数名
|
||||
"node_id": 10, // workflow.json 里的节点 ID
|
||||
"field": "prompt", // 该节点 inputs 里的字段名
|
||||
"required": true, // 是否必填
|
||||
"type": "string", // 参数类型
|
||||
"description": "提示词" // 参数说明
|
||||
},
|
||||
"seed": {
|
||||
"node_id": 10,
|
||||
"field": "seed",
|
||||
"required": false,
|
||||
"type": "int",
|
||||
"description": "随机种子"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
说明:
|
||||
|
||||
- 工作流 ID 直接由目录名决定;例如目录是 `data/local/Default/`,工作流 ID 就是 `Default`
|
||||
- `parameters` 里的每个字段,表示一个要暴露给 OpenClaw/Agent 的输入参数
|
||||
- `node_id` 和 `field` 需要对应到 `workflow.json` 里实际的节点和输入字段
|
||||
|
||||
如果你想看完整示例,可以直接参考仓库里的现成文件:
|
||||
|
||||
- `data/local/Default/workflow.json`
|
||||
- `data/local/Default/schema.json`
|
||||
- 这两个文件是通用示例;运行前请先把 `workflow.json` 里节点 `4` 的 `ckpt_name` 改成你本地 ComfyUI 可用的 checkpoint 名称
|
||||
|
||||
#### 4)安装 CLI 工具
|
||||
|
||||
```bash
|
||||
pip install comfyui-skill-cli
|
||||
```
|
||||
|
||||
或者用 [pipx](https://pipx.pypa.io/)(推荐,不污染全局 Python 环境):
|
||||
### 第二步:安装 CLI
|
||||
|
||||
```bash
|
||||
pipx install comfyui-skill-cli
|
||||
```
|
||||
|
||||
#### 5)验证配置是否成功
|
||||
|
||||
查看工作流列表:
|
||||
或用 pip:
|
||||
|
||||
```bash
|
||||
comfyui-skill --json list
|
||||
pip install comfyui-skill-cli
|
||||
```
|
||||
|
||||
执行一次测试生图:
|
||||
### 第三步:验证
|
||||
|
||||
```bash
|
||||
comfyui-skill --json run <server_id>/<workflow_id> --args '{"prompt":"test"}'
|
||||
comfyui-skill server status
|
||||
comfyui-skill list
|
||||
```
|
||||
|
||||
例如:
|
||||
搞定。CLI 会从项目目录读取 `config.json` 和 `data/`。
|
||||
|
||||
> **Web UI 依赖**(可选,仅在需要管理界面时安装):
|
||||
> ```bash
|
||||
> pip install -r requirements.txt
|
||||
> ```
|
||||
|
||||
---
|
||||
|
||||
## CLI 使用
|
||||
|
||||
CLI 是与 ComfyUI Skills 交互的主要方式。所有命令支持 `--json` 输出结构化数据。
|
||||
|
||||
### 快速开始
|
||||
|
||||
```bash
|
||||
comfyui-skill --json run local/Default --args '{"prompt":"一张高质感产品摄影图"}'
|
||||
# 检查服务器
|
||||
comfyui-skill server status
|
||||
|
||||
# 列出工作流
|
||||
comfyui-skill list
|
||||
|
||||
# 执行工作流
|
||||
comfyui-skill run local/txt2img --args '{"prompt": "a white cat"}'
|
||||
|
||||
# 从 JSON 导入新工作流
|
||||
comfyui-skill workflow import ./my-workflow.json --check-deps
|
||||
|
||||
# 上传图片(用于图生图工作流)
|
||||
comfyui-skill upload ./photo.png
|
||||
```
|
||||
|
||||
成功后会返回类似:
|
||||
### 完整命令参考
|
||||
|
||||
```json
|
||||
| 分类 | 命令 | 说明 |
|
||||
|------|------|------|
|
||||
| **发现** | `comfyui-skill list` | 列出所有工作流及参数 |
|
||||
| | `comfyui-skill info <workflow_id>` | 查看工作流详情和参数 schema |
|
||||
| **执行** | `comfyui-skill run <workflow_id> --args '{...}'` | 执行工作流(阻塞等待) |
|
||||
| | `comfyui-skill submit <workflow_id> --args '{...}'` | 提交工作流(非阻塞) |
|
||||
| | `comfyui-skill status <prompt_id>` | 查询执行状态 |
|
||||
| | `comfyui-skill upload <image_path>` | 上传图片到 ComfyUI |
|
||||
| **工作流** | `comfyui-skill workflow import <json_path>` | 从本地 JSON 导入(自动检测格式) |
|
||||
| | `comfyui-skill workflow import --from-server` | 从 ComfyUI 服务器导入 |
|
||||
| | `comfyui-skill workflow enable/disable <workflow_id>` | 启用/禁用工作流 |
|
||||
| | `comfyui-skill workflow delete <workflow_id>` | 删除工作流 |
|
||||
| **服务器** | `comfyui-skill server list` | 列出服务器 |
|
||||
| | `comfyui-skill server status [<server_id>]` | 检查服务器状态 |
|
||||
| | `comfyui-skill server add --id <server_id> --url <url>` | 添加服务器 |
|
||||
| | `comfyui-skill server enable/disable <server_id>` | 启用/禁用服务器 |
|
||||
| | `comfyui-skill server remove <server_id>` | 移除服务器 |
|
||||
| **依赖** | `comfyui-skill deps check <workflow_id>` | 检查缺失的节点和模型 |
|
||||
| | `comfyui-skill deps install <workflow_id> --all` | 安装所有缺失依赖 |
|
||||
| **配置** | `comfyui-skill config export --output <path>` | 导出配置 |
|
||||
| | `comfyui-skill config import <path>` | 导入配置 |
|
||||
| **历史** | `comfyui-skill history list <workflow_id>` | 查看执行历史 |
|
||||
| | `comfyui-skill history show <workflow_id> <run_id>` | 查看运行详情 |
|
||||
|
||||
> `<workflow_id>` 格式:`服务器ID/工作流名称`(如 `local/txt2img`)。省略服务器前缀则使用默认服务器。
|
||||
|
||||
完整 CLI 文档见 [ComfyUI Skill CLI](https://github.com/HuangYuChuh/ComfyUI_Skill_CLI)。
|
||||
|
||||
---
|
||||
|
||||
## Web UI(可选)
|
||||
|
||||
本地 Web 管理界面,用于可视化管理工作流。Agent 使用不需要 Web UI — CLI 已覆盖全部功能。
|
||||
|
||||
### 启动
|
||||
|
||||
```bash
|
||||
pip install -r requirements.txt # 仅首次需要
|
||||
./ui/run_ui.sh # macOS/Linux
|
||||
# 或: ui\run_ui.bat # Windows
|
||||
```
|
||||
|
||||
访问 `http://localhost:18189`。
|
||||
|
||||
### 功能
|
||||
|
||||
- 上传从 ComfyUI 导出的工作流(API 格式)
|
||||
- 可视化编辑参数映射
|
||||
- 统一管理多台服务器和工作流
|
||||
- 拖拽排序、跨服务器搜索和筛选
|
||||
- 支持英文、简体中文、繁体中文
|
||||
|
||||
前端源码位于[独立仓库](https://github.com/HuangYuChuh/ComfyUI_Skills_OpenClaw-frontend)。
|
||||
|
||||
---
|
||||
|
||||
## 工作流配置
|
||||
|
||||
开始前请确保 ComfyUI 服务已运行(默认地址:`http://127.0.0.1:8188`)。
|
||||
|
||||
### 方式一:通过 CLI 导入(推荐)
|
||||
|
||||
```bash
|
||||
# 导入工作流 JSON — 自动检测格式、自动转换、自动生成 schema
|
||||
comfyui-skill workflow import ./my-workflow.json
|
||||
|
||||
# 检查并安装依赖
|
||||
comfyui-skill deps check local/my-workflow
|
||||
comfyui-skill deps install local/my-workflow --all
|
||||
|
||||
# 验证
|
||||
comfyui-skill run local/my-workflow --args '{"prompt": "test"}'
|
||||
```
|
||||
|
||||
### 方式二:通过 Web UI 导入
|
||||
|
||||
1. 打开 `http://localhost:18189`
|
||||
2. 上传从 ComfyUI 导出的工作流 JSON(**Save (API Format)**)
|
||||
3. 选择要暴露给 Agent 的参数
|
||||
4. 保存映射
|
||||
|
||||
### 方式三:手动配置
|
||||
|
||||
<details>
|
||||
<summary>展开查看手动配置步骤</summary>
|
||||
|
||||
#### 1)编辑 `config.json`
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"status": "completed",
|
||||
"prompt_id": "...",
|
||||
"images": ["./outputs/<prompt_id>_...png"]
|
||||
"servers": [
|
||||
{
|
||||
"id": "local",
|
||||
"name": "Local",
|
||||
"url": "http://127.0.0.1:8188",
|
||||
"enabled": true,
|
||||
"output_dir": "./outputs"
|
||||
}
|
||||
],
|
||||
"default_server": "local"
|
||||
}
|
||||
```
|
||||
|
||||
### 通过 Agent 配置
|
||||
#### 2)放置工作流文件
|
||||
|
||||
- 让 OpenClaw 或其他 Agent 帮你编辑 `config.json`
|
||||
- 让 Agent 将 workflow JSON 和 schema JSON 写入对应目录
|
||||
- 写入完成后,再让 Agent 帮你执行一次验证
|
||||
```
|
||||
data/local/my-workflow/
|
||||
workflow.json # ComfyUI API 格式导出
|
||||
schema.json # 参数映射
|
||||
```
|
||||
|
||||
#### 3)编写 `schema.json`
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"description": "我的工作流",
|
||||
"enabled": true,
|
||||
"parameters": {
|
||||
"prompt": {
|
||||
"node_id": 10,
|
||||
"field": "prompt",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"description": "提示词"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### 工作流要求
|
||||
|
||||
**API 格式工作流 + Save Image 输出节点** 是稳定可用的基础要求。为了稳定执行,请确保:
|
||||
|
||||
1. **工作流必须导出为 ComfyUI API 格式**
|
||||
- 在 ComfyUI 中点击 **Save (API Format)**
|
||||
- 将导出的 JSON 放到 `data/<server_id>/<workflow_id>/workflow.json`
|
||||
|
||||
2. **工作流末端必须包含 `Save Image` 节点**
|
||||
- 当前客户端是从 ComfyUI 的输出图像中下载结果
|
||||
- 如果没有 `Save Image`(或等价的图像输出),可能会“执行成功但拿不到图片”
|
||||
|
||||
- **必须导出为 ComfyUI API 格式**(在 ComfyUI 中点击 **Save (API Format)**)
|
||||
- **末端必须包含 `Save Image` 节点**(否则可能执行成功但拿不到图片)
|
||||
|
||||
---
|
||||
|
||||
## 多服务器管理
|
||||
|
||||
可以配置多个不同的 ComfyUI 服务器,方便 OpenClaw/Agent 将生图任务分发到不同算力节点(例如本机 GPU、远程实例等)。
|
||||
管理多台 ComfyUI 服务器,将任务分发到不同算力。
|
||||
|
||||
### 核心概念
|
||||
- **双层控制开关**:`服务器` 和 `独立工作流` 均有各自的开启/关闭状态。OpenClaw 只能发现**两者均开启**的工作流。
|
||||
- **命名空间组合**:OpenClaw 识别工作流的唯一标识为 `<server_id>/<workflow_id>` 的复合格式(例如:`local/test` 与 `remote/test`)。
|
||||
|
||||
### 命令行工具配置
|
||||
在无 GUI 环境下,可使用 CLI 工具(`pip install comfyui-skill-cli`)进行管理:
|
||||
- **双层开关**:服务器和工作流各有独立的启用/禁用开关,Agent 只能看到两者都启用的工作流。
|
||||
- **命名空间**:工作流以 `<server_id>/<workflow_id>` 格式标识(如 `local/txt2img` 与 `remote-a100/txt2img` 互不干扰)。
|
||||
|
||||
### CLI
|
||||
|
||||
```bash
|
||||
comfyui-skill server add --id remote --name "Remote GPU" --url http://10.0.0.1:8188
|
||||
comfyui-skill server list
|
||||
comfyui-skill server add --id remote --name "Remote Node" --url http://10.0.0.1:8188
|
||||
comfyui-skill server disable remote
|
||||
```
|
||||
*所有服务器配置依然可以通过前端 Web UI 界面来进行图形化无缝管理。*
|
||||
|
||||
### 配置迁移
|
||||
|
||||
如果你更换了部署路径,或者想把当前 Skill 的工作流映射迁移到另一台机器,可以直接使用内置的 bundle 机制。
|
||||
|
||||
UI 方式:
|
||||
|
||||
- 在主界面点击 `导出配置`,浏览器会下载一个 `openclaw-skill-export.json`
|
||||
- 导出前可以按服务器展开,并取消勾选不想导出的 workflow;默认全部选中,服务器默认折叠
|
||||
- 在目标机器打开 UI,点击 `导入配置`
|
||||
- 选择刚才导出的 JSON 文件
|
||||
- 系统会先显示预检结果,再确认是否同时应用源机器的默认服务器、URL 和输出目录
|
||||
|
||||
CLI 方式:
|
||||
|
||||
```bash
|
||||
comfyui-skill config export --output ./openclaw-skill-export.json
|
||||
comfyui-skill config import ./openclaw-skill-export.json --dry-run
|
||||
comfyui-skill config import ./openclaw-skill-export.json
|
||||
# 导出
|
||||
comfyui-skill config export --output ./backup.json
|
||||
|
||||
# 预览导入
|
||||
comfyui-skill config import ./backup.json --dry-run
|
||||
|
||||
# 执行导入
|
||||
comfyui-skill config import ./backup.json
|
||||
```
|
||||
|
||||
可选参数:
|
||||
*所有服务器配置也可以通过 Web UI 管理。*
|
||||
|
||||
- `--apply-environment`:导入时同时应用 bundle 中的环境配置
|
||||
- `--no-overwrite`:导入时如果工作流已存在,则跳过而不是覆盖
|
||||
---
|
||||
|
||||
默认导入策略:
|
||||
## 更新
|
||||
|
||||
- 同名工作流默认覆盖
|
||||
- 已存在服务器会做合并导入
|
||||
- 默认保留目标机器当前的 `url`、`output_dir` 和 `default_server`
|
||||
```bash
|
||||
./update.sh
|
||||
```
|
||||
|
||||
更新 CLI:
|
||||
|
||||
```bash
|
||||
pipx upgrade comfyui-skill-cli
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 常见问题
|
||||
|
||||
- `/prompt` 返回 HTTP 400:通常是工作流 payload 或参数值不合法。
|
||||
- `size` 值必须符合目标节点支持的枚举(例如 `3:4,1728x2304`)。
|
||||
- `config.json` 里的 ComfyUI 地址错误会导致无法提交任务。
|
||||
- **`/prompt` 返回 HTTP 400**:工作流 payload 或参数值不合法。
|
||||
- **没有返回图片**:工作流缺少 `Save Image` 节点。
|
||||
- **连接失败**:检查 `config.json` 中的服务器地址是否正确。
|
||||
|
||||
---
|
||||
|
||||
@@ -436,61 +303,27 @@ comfyui-skill config import ./openclaw-skill-export.json
|
||||
|
||||
---
|
||||
|
||||
## 路线图
|
||||
|
||||
- [ ] 支持工作流版本历史和回滚
|
||||
- [x] 上传新版本前先预览参数变化
|
||||
- [x] 工作流升级时支持参数迁移
|
||||
- [x] 远程 ComfyUI 服务器鉴权支持
|
||||
- [x] 增强提交前参数校验
|
||||
- [x] 更清晰展示 ComfyUI 返回的节点错误
|
||||
- [ ] 执行历史记录(参数 + 结果追溯)
|
||||
- [ ] 任务完成后 Webhook 回调通知
|
||||
- [ ] 定时执行工作流(cron 风格)
|
||||
- [ ] 引导式工作流改写模板(Rewrite Recipe)
|
||||
- [ ] ComfyUI 原生插件 + AI 参数自动映射 —— 直接在 ComfyUI 内用自然语言描述工作流的用途,由 AI 自动推断节点与字段的对应关系并生成 `schema.json`,彻底免除手动配置参数的负担
|
||||
- [ ] AI Agent 自动生成工作流 —— 用自然语言描述你的图像或视频生成目标,由 AI Agent 自动从零构建、连接并配置完整的 ComfyUI 工作流图
|
||||
|
||||
---
|
||||
|
||||
## 项目结构
|
||||
|
||||
```text
|
||||
ComfyUI_Skills_OpenClaw/
|
||||
├── SKILL.md # Agent 指令规范(如何调用 registry/client)
|
||||
├── README.md
|
||||
├── README.zh.md
|
||||
├── LICENSE
|
||||
├── .gitignore
|
||||
├── requirements.txt # Python 依赖(FastAPI、requests 等)
|
||||
├── SKILL.md # Agent 指令规范
|
||||
├── config.example.json # 配置示例
|
||||
├── config.json # 本地实际配置(默认 gitignore)
|
||||
├── asset/
|
||||
│ └── banner-ui-dashboard-20260322.png
|
||||
├── config.json # 本地配置(gitignored)
|
||||
├── requirements.txt # Web UI 的 Python 依赖
|
||||
├── data/
|
||||
│ ├── <server_id>/
|
||||
│ │ └── <workflow_id>/
|
||||
│ │ ├── workflow.json # ComfyUI API 格式工作流
|
||||
│ │ └── schema.json # 对外参数映射
|
||||
│ └── <server_id>/
|
||||
│ └── <workflow_id>/
|
||||
│ ├── workflow.json # ComfyUI API 格式工作流
|
||||
│ └── schema.json # 参数映射
|
||||
├── scripts/
|
||||
│ ├── update_frontend.sh # 从 GitHub Releases 拉取最新前端构建
|
||||
│ └── shared/ # 共用的配置与工具(Web UI 后端使用)
|
||||
│ ├── config.py
|
||||
│ ├── json_utils.py
|
||||
│ └── runtime_config.py
|
||||
│ ├── update_frontend.sh # 拉取最新前端构建
|
||||
│ └── shared/ # 共用工具(Web UI 后端使用)
|
||||
├── ui/
|
||||
│ ├── app.py # FastAPI 路由层
|
||||
│ ├── open_ui.py # 供 Agent 调用的 UI 启动入口
|
||||
│ ├── services.py # 业务逻辑(工作流增删改查)
|
||||
│ ├── models.py # Pydantic 请求/响应模型
|
||||
│ ├── json_store.py # JSON 文件读写封装
|
||||
│ ├── settings.py # 应用级配置
|
||||
│ ├── run_ui.sh # 启动脚本(macOS/Linux)
|
||||
│ ├── run_ui.command # macOS 双击启动
|
||||
│ ├── run_ui.bat # Windows 启动
|
||||
│ └── static/ # 模块化 ES6 前端(HTML/CSS/JS)
|
||||
│ ├── app.py # FastAPI 后端
|
||||
│ ├── open_ui.py # UI 启动器
|
||||
│ └── static/ # 前端(HTML/CSS/JS)
|
||||
└── outputs/
|
||||
└── .gitkeep
|
||||
```
|
||||
|
||||
---
|
||||
@@ -498,30 +331,14 @@ ComfyUI_Skills_OpenClaw/
|
||||
<details>
|
||||
<summary>项目关键词与资料</summary>
|
||||
|
||||
## 项目关键词
|
||||
### 项目关键词
|
||||
|
||||
本仓库围绕以下检索意图进行内容组织:
|
||||
- OpenClaw · ComfyUI · ComfyUI Skills · ComfyUI 工作流自动化
|
||||
- AI 生图技能 · OpenClaw + ComfyUI 集成
|
||||
|
||||
- OpenClaw
|
||||
- ComfyUI
|
||||
- ComfyUI Skills
|
||||
- ComfyUI 工作流自动化
|
||||
- OpenClaw + ComfyUI 集成
|
||||
- AI 生图技能(Image Generation Skill)
|
||||
- 小龙虾(项目昵称,Xiao Long Xia / small crawfish)
|
||||
### 核心文件
|
||||
|
||||
用于项目理解与检索的核心文件:
|
||||
- `README.md`(英文说明)
|
||||
- `README.zh.md`(中文说明)
|
||||
- `SKILL.md`(Agent 调用规范)
|
||||
- `docs/llms.txt` 与 `docs/llms-full.txt`(面向 LLM 的摘要文件)
|
||||
|
||||
---
|
||||
|
||||
## 项目资料
|
||||
|
||||
- 项目摘要:`docs/llms.txt`
|
||||
- 项目扩展上下文:`docs/llms-full.txt`
|
||||
- 项目传播清单:`docs/PROJECT_DISCOVERY_CHECKLIST.md`
|
||||
- `SKILL.md` — Agent 调用规范
|
||||
- `docs/llms.txt` / `docs/llms-full.txt` — 面向 LLM 的摘要
|
||||
|
||||
</details>
|
||||
|
||||
Reference in New Issue
Block a user