Phase 1: Core Client (tensors/comfyui.py)

Add ComfyUI API client module with:
- Basic query functions: get_system_stats(), get_queue_status(),
  get_loaded_models(), get_history(), clear_queue(), get_object_info()
- Workflow execution: queue_prompt(), run_workflow() with progress tracking
- Text-to-image: generate_image() with embedded SDXL/Flux workflow template
- Data classes: GenerationResult, WorkflowResult
- Helper: get_image() to download generated images

Follows existing api.py patterns with console: Console | None for optional
Rich progress output, httpx for HTTP requests, and proper error handling.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Adam Ladachowski
2026-02-16 16:03:49 +01:00
parent e9d1745c62
commit e776f9846e
2 changed files with 777 additions and 5 deletions
+6 -5
View File
@@ -1,17 +1,18 @@
# TODO: ComfyUI CLI & API Integration
## Phase 1: Core Client (`tensors/comfyui.py`)
- [ ] Step 1.1: Create ComfyUI client module with basic query functions
- [x] Step 1.1: Create ComfyUI client module with basic query functions
- `get_system_stats()` - System stats (GPU, RAM)
- `get_queue_status()` - Queue status
- `get_loaded_models()` - List loaded checkpoints/loras
- `get_history()` - View history
- [ ] Step 1.2: Add workflow execution with WebSocket progress tracking
- Also: `clear_queue()`, `get_object_info()`, `get_image()`
- [x] Step 1.2: Add workflow execution with WebSocket progress tracking
- `queue_prompt()` - Queue a workflow
- `run_workflow()` - Run workflow with progress callback
- [ ] Step 1.3: Add simple text-to-image generation
- `run_workflow()` - Run workflow with progress callback (uses polling)
- [x] Step 1.3: Add simple text-to-image generation
- `generate_image()` - Text-to-image with embedded workflow template
- Include SDXL/Flux-compatible default workflow
- Include SDXL/Flux-compatible default workflow (DEFAULT_WORKFLOW_TEMPLATE)
## Phase 2: CLI Commands (`tensors/cli.py`)
- [ ] Step 2.1: Add `comfy` subcommand group with status commands