Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions comfy_api/feature_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# Default server capabilities
SERVER_FEATURE_FLAGS: dict[str, Any] = {
"supports_preview_metadata": True,
"supports_progress_text_metadata": True,
"max_upload_size": args.max_upload_size * 1024 * 1024, # Convert MB to bytes
"extension": {"manager": {"supports_v4": True}},
"node_replacements": True,
Expand Down
14 changes: 11 additions & 3 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
from app.node_replace_manager import NodeReplaceManager
from typing import Optional, Union
from api_server.routes.internal.internal_routes import InternalRoutes
from comfy_execution.utils import get_executing_context
from protocol import BinaryEventTypes

# Import cache control middleware
Expand Down Expand Up @@ -1282,7 +1283,14 @@ def send_progress_text(
text = text.encode("utf-8")
node_id_bytes = str(node_id).encode("utf-8")

# Pack the node_id length as a 4-byte unsigned integer, followed by the node_id bytes
message = struct.pack(">I", len(node_id_bytes)) + node_id_bytes + text
target_sid = sid if sid is not None else self.client_id
message = b""

self.send_sync(BinaryEventTypes.TEXT, message, sid)
if feature_flags.supports_feature(self.sockets_metadata, target_sid, "supports_progress_text_metadata"):
current = get_executing_context()
prompt_id_bytes = str(current.prompt_id).encode("utf-8") if current is not None else b""
message = struct.pack(">I", len(prompt_id_bytes)) + prompt_id_bytes

message += struct.pack(">I", len(node_id_bytes)) + node_id_bytes + text

self.send_sync(BinaryEventTypes.TEXT, message, target_sid)
Loading