include node id in message

This commit is contained in:
bymyself 2025-05-09 12:54:43 -07:00
parent 25e9031ab9
commit a3a21ed6db

View File

@ -880,7 +880,14 @@ class PromptServer():
return json_data
def send_progress_text(self, text: Union[bytes, bytearray, str], sid=None):
def send_progress_text(
self, text: Union[bytes, bytearray, str], node_id: str, sid=None
):
if isinstance(text, str):
text = text.encode("utf-8")
self.send_sync(BinaryEventTypes.TEXT, text, sid)
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
self.send_sync(BinaryEventTypes.TEXT, message, sid)