Files
ubuntu-bare-metal/stacks/server-ui/comfyui_config.py
T
tomasz-syn-grzegorza 73e4fc005e Add stack Update, ComfyUI model manager, and slim ComfyUI stack.
Server UI gains Update on stack cards, ComfyUI Models tab with workflow
scan and downloads, and centralized comfyui_config. Model catalog and
download scripts move from stacks/comfyui to server-ui so ComfyUI stays a
minimal Docker wrapper for easier image updates.
2026-07-05 18:45:17 +00:00

54 lines
1.5 KiB
Python

"""Shared ComfyUI paths and constants for Server UI integration."""
from __future__ import annotations
from pathlib import Path
COMFYUI_CONTAINER = "comfyui"
CONTAINER_MODELS_ROOT = "/root/ComfyUI/models"
CONTAINER_WORKFLOWS_ROOT = "/root/ComfyUI/user/default/workflows"
HOST_DATA_SUBDIR = "apps/comfyui"
STACK_ID = "comfyui"
CATALOG_FILENAME = "comfyui-models.catalog.yaml"
def server_ui_root(base: Path | None = None) -> Path:
return base or Path(__file__).resolve().parent
def catalog_path(base: Path | None = None) -> Path:
return server_ui_root(base) / CATALOG_FILENAME
def scripts_dir(base: Path | None = None) -> Path:
return server_ui_root(base) / "scripts" / "comfyui"
def stack_env_path(repo_root: Path) -> Path:
return repo_root / "stacks" / "comfyui" / ".env"
def host_models_root(data_root: Path) -> Path:
return data_root / HOST_DATA_SUBDIR / "models"
def host_workflows_dir(data_root: Path) -> Path:
return data_root / HOST_DATA_SUBDIR / "workflows"
def host_custom_nodes_dir(data_root: Path) -> Path:
return data_root / HOST_DATA_SUBDIR / "custom_nodes"
def container_model_path(relative: str) -> str:
return f"{CONTAINER_MODELS_ROOT}/{relative.lstrip('/')}"
def container_workflow_path(relative: str) -> str:
return f"{CONTAINER_WORKFLOWS_ROOT}/{relative.lstrip('/')}"
def host_to_container_model_path(host_path: Path, data_root: Path) -> str:
rel = host_path.resolve().relative_to(host_models_root(data_root).resolve())
return container_model_path(rel.as_posix())