This extension adds nodes that allow you to easily serve your workflow (for example using a discord bot)
Welcome to the ComfyUI Serving Toolkit, a powerful tool for serving image generation workflows in Discord and other platforms (soon). This toolkit is designed to simplify the process of serving your ComfyUI workflow, making image generation bots easier than ever before. You can serve on discord, or on websockets.
If you need any help, Checkout the Discord!
Use ComfyUI Manager or put all the files inside custom_nodes and run:
..\..\..\python_embeded\python.exe -s -m pip install -r requirements.txt
Here a simple workflow that will get a !generate <prompt> and respond with an existing image, and !help will produce a help message
You can copy the workflow json: workflow.json
After setting up your workflow, In order for the serving to always be up, you need to allow auto queue, here is an image to help you do that:
DiscordServing
This node is an essencial part of the serving, queueing the prompt it will wait for a single message, process it and optionally return the image.
Note that in order for it to work for all messages you would have to mark Auto Queue
(details above in the running section)
Inputs:
Outputs:
WebsocketServing
This will connect to a websocket and wait for JSON of {_requestId, prompt, arguments} and will return a json of {_requestId, base64_img} You can see an example ws server over at examples/websocket.js to run it you would need to navigate to the examples folder and run these commands:
npm install
node websocket.js
Inputs:
Outputs:
CommandPickerServing This node allows you to define specific behaviour for specific commands - it will only execute outputs that are connected to it when that specific command is given. Note, the command in HTTP Serving is the path after /, and the command in websocket is "command_name" json property
Inputs:
CommandPickerServing
AlwaysExecute For when you don't care about commands, it will always return an output regardless of command given. this will execute for ALL commands, no matter if the commands are registered or not.
Inputs:
ServingInputText
Allows you to grab a text arguments from the request
Discord example:
When a user types: !generate 4k epic realism portrait --negative drawing you could set the argument=negative and then recieve the value of "drawing" inside the output text.
Inputs:
Outputs: text - the value of the argument
ServingInputNumber
similar to ServingInputText, this one is for numbers. it is important to set the minimum, maximum and step to the right values in order to avoid errors (for example when trying a width that does isn't divisable by 16) Inputs that are not in ServingInputText:
Serving Image/Video Output
Allows you to return an image/video back to the request Inputs:
TelegramServing
This node allows you to serve your workflow via Telegram. It listens for commands and processes them, enabling interaction with your ComfyUI workflow through a Telegram bot.
Inputs:
Outputs:
HTTPServing
This node enables serving your workflow via HTTP, allowing you to interact with your ComfyUI workflow through HTTP POST requests.
Inputs:
Outputs:
ServingMultiImageOutput
Allows you to return multiple images back to the request. This is useful for batch processing or when generating animations.
Inputs:
ServingInputImage
Allows you to input images from the serving platform (e.g., attachments in Discord, Telegram, or files sent via HTTP).
Inputs:
Outputs:
ServingInputImageAsLatent
Similar to ServingInputImage, but converts the input image directly into a latent representation for use in your workflow.
Inputs:
Outputs: