feat: Add Comfy Agent service for NODE3 image/video generation
- Create comfy-agent service with FastAPI + NATS integration - ComfyUI client with HTTP/WebSocket support - REST API: /generate/image, /generate/video, /status, /result - NATS subjects: agent.invoke.comfy, comfy.request.* - Async job queue with progress tracking - Docker compose configuration for NODE3 - Update PROJECT-MASTER-INDEX.md with NODE2/NODE3 docs Co-Authored-By: Warp <agent@warp.dev>
This commit is contained in:
25
services/comfy-agent/app/jobs.py
Normal file
25
services/comfy-agent/app/jobs.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# services/comfy-agent/app/jobs.py
|
||||
import uuid
|
||||
from typing import Dict, Optional
|
||||
from .models import JobStatus, GenType
|
||||
|
||||
class JobStore:
|
||||
def __init__(self) -> None:
|
||||
self._jobs: Dict[str, JobStatus] = {}
|
||||
|
||||
def create(self, gen_type: GenType) -> JobStatus:
|
||||
job_id = f"job_{uuid.uuid4().hex}"
|
||||
js = JobStatus(job_id=job_id, type=gen_type, status="queued", progress=0.0)
|
||||
self._jobs[job_id] = js
|
||||
return js
|
||||
|
||||
def get(self, job_id: str) -> Optional[JobStatus]:
|
||||
return self._jobs.get(job_id)
|
||||
|
||||
def update(self, job_id: str, **patch) -> JobStatus:
|
||||
js = self._jobs[job_id]
|
||||
updated = js.model_copy(update=patch)
|
||||
self._jobs[job_id] = updated
|
||||
return updated
|
||||
|
||||
JOB_STORE = JobStore()
|
||||
Reference in New Issue
Block a user