Files
chrmc40 8e3dceae99 ComfyUI-PromptChain
A prompt-authoring and image-iteration suite for ComfyUI.
2026-06-17 19:35:25 -07:00

21 lines
637 B
Python

# Shared utilities used across multiple route modules.
import logging
import re
import server
logger = logging.getLogger("promptchain.shared")
# Accepts either the 16-char quick_hash used by the fingerprint cache
# or a full 64-char SHA256. Narrow per-endpoint if mixing the two
# becomes risky — callers currently treat the hash opaquely.
HASH_RE = re.compile(r"^[0-9a-f]{16,64}$")
def send_ws(event: str, data: dict):
"""Thread-safe WebSocket broadcast."""
try:
server.PromptServer.instance.send_sync(event, data)
except Exception:
logger.debug("WebSocket send failed for %s", event, exc_info=True)