Archived
26 lines
906 B
Python
26 lines
906 B
Python
from server import PromptServer
|
|
from .progress import add_progress_hook
|
|
from .routes import SetupRoutes
|
|
from .workflows import *
|
|
|
|
# Your custom progress callback
|
|
def my_progress_callback(value, total, preview_image, prompt_id, node_id):
|
|
print(f"Progress: {value}/{total}, Prompt: {prompt_id}, Node: {node_id}, Preview: {preview_image}")
|
|
|
|
# Broadcast to ALL WebSocket clients using ComfyUI's system (sid=None means broadcast to all)
|
|
PromptServer.instance.send_sync("imagelab_progress", {
|
|
'value': value,
|
|
'total': total,
|
|
# 'preview_image': preview_image,
|
|
'prompt_id': prompt_id,
|
|
'node_id': node_id,
|
|
'progress_percent': round((value / total * 100), 2) if total > 0 else 0
|
|
}, sid=None)
|
|
|
|
add_progress_hook(my_progress_callback)
|
|
|
|
# Register API routes
|
|
SetupRoutes(PromptServer.instance)
|
|
|
|
NODE_CLASS_MAPPINGS = {}
|
|
NODE_DISPLAY_NAME_MAPPINGS = {} |