Closed mm-diff closed 1 hour ago
I implemented the following nodes in the same way as SaveImageWebsocket, but the resulting json format is wrong.
import comfy.utils from server import PromptServer, BinaryEventTypes
class SaveTextWebsocket: @classmethod def INPUT_TYPES(s): return {"required": {"text": ("STRING", ),} }
RETURN_TYPES = () FUNCTION = "save_text" OUTPUT_NODE = True CATEGORY = "api/text" def save_text(self, text): server = PromptServer.instance server.send_json(0, text, server.client_id) return {"ui": {"text": text}}
{'type': 'executed', 'data': {'node': 'save_text_websocket_node', 'display_node': 'save_text_websocket_node', 'output': {'text': ['t', 'h', 'e', 'r', 'e', ' ', 'i', 's', ' ', 'a', ' ', 'p', 'l', 'a', 'n', 't', ' ', 'i', 'n', ' ', 'a', ' ', 'p', 'o', 't', ' ', 'w', 'i', 't', 'h', ' ', 'a', ' ', 'f', 'i', 's', 'h', ' ', 'd', 'e', 's', 'i', 'g', 'n', ' ', 'o', 'n', ' ', 'i', 't', ',', ' ', 'f', 'e', 'a', 't', 'u', 'r', 'e', 'd', ' ', 'o', 'n', ' ', 'a', 'm', 'i', 'a', 'm', 'i', ',', ' ', 'c', 'u', 't', 'e', ' ', 's', 'i', 'n', 'g', 'l', 'e', ' ', 'a', 'n', 'i', 'm', 'a', 'l', ',', ' ', 'b', 'e', 'i', 'g', 'e', ' ', 'b', 'a', 'c', 'k', 'g', 'r', 'o', 'u', 'n', 'd', ',', ' ', 'i', 'v', 'y', ',', ' ', 'i', 'n', 's', 'p', 'i', 'r', 'e', 'd', ' ', 'b', 'y', ' ', 'J', 'e', 'm', 'i', 'm', 'a', ' ', 'B', 'l', 'a', 'c', 'k', 'b', 'u', 'r', 'n', ',', ' ', 'm', 'e', 'o', 'w', ',', ' ', 'h', 'i', 'g', 'h', '-', 'q', 'u', 'a', 'l', 'i', 't', 'y', ' ', 'r', 'e', 'n', 'd', 'e', 'r', ',', ' ', 'w', 'i', 't', 'h', ' ', 'a', ' ', 'w', 'h', 'i', 't', 'e', ' ', 'm', 'u', 'g', ',', ' ', 'a', 'q', 'u', 'a', 'r', 'i', 'u', 'm', ' ', 'l', 'i', 'f', 'e', ',', ' ', 'l', 'i', 'l', 'l', 'i', 'e', 's', ',', ' ', 'd', 'i', 'c', 'h', 'r', 'o', 'm', 'a', 't', 'i', 's', 'm', ',', ' ', 'a', 'p', 'p', ',', ' ', 'g', 'r', 'e', 'e', 'n', ':', ' ', '0', '.', '5', ',', ' ', 'c', 'o', 'o', 'k', 'y', ',', ' ', 'h', 'e', 'i', 'g', 'h', 't', ' ', '1', ' ', '7', ' ', '8']}, 'prompt_id': 'xxx'}}
No response
I just wanna get the text content of the custom node via API
the following way works
def save_text(self, text): server = PromptServer.instance server.send_sync("xx", text, server.client_id)
return {}
Your question
I implemented the following nodes in the same way as SaveImageWebsocket, but the resulting json format is wrong.
import comfy.utils from server import PromptServer, BinaryEventTypes
class SaveTextWebsocket: @classmethod def INPUT_TYPES(s): return {"required": {"text": ("STRING", ),} }
Logs
Other
No response