- 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>
17 lines
485 B
Python
17 lines
485 B
Python
# services/comfy-agent/app/storage.py
|
|
import os
|
|
from pathlib import Path
|
|
from .config import settings
|
|
|
|
def ensure_storage() -> None:
|
|
Path(settings.STORAGE_PATH).mkdir(parents=True, exist_ok=True)
|
|
|
|
def make_job_dir(job_id: str) -> str:
|
|
ensure_storage()
|
|
d = os.path.join(settings.STORAGE_PATH, job_id)
|
|
Path(d).mkdir(parents=True, exist_ok=True)
|
|
return d
|
|
|
|
def public_url(job_id: str, filename: str) -> str:
|
|
return f"{settings.PUBLIC_BASE_URL}/{job_id}/{filename}"
|