""" workflow_manager.py =================== Workflow template storage for the Discord ComfyUI bot. This module provides a WorkflowManager class responsible solely for holding the loaded workflow template. Node inspection and injection are handled by :class:`~workflow_inspector.WorkflowInspector`. """ from __future__ import annotations import logging from typing import Dict, Optional, Any logger = logging.getLogger(__name__) class WorkflowManager: """ Stores and provides access to the current workflow template. Parameters ---------- workflow_template : Optional[Dict[str, Any]] An initial workflow dict. If None, no template is loaded and one must be set via :meth:`set_workflow_template`. """ def __init__(self, workflow_template: Optional[Dict[str, Any]] = None) -> None: self._workflow_template = workflow_template def set_workflow_template(self, workflow: Dict[str, Any]) -> None: """ Set or replace the workflow template. Parameters ---------- workflow : Dict[str, Any] Workflow dictionary in ComfyUI API format. """ self._workflow_template = workflow logger.info("Workflow template updated (%d nodes)", len(workflow)) def get_workflow_template(self) -> Optional[Dict[str, Any]]: """ Return the current workflow template. Returns ------- Optional[Dict[str, Any]] The loaded template, or None if none has been set. """ return self._workflow_template