-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] API support in Workflow JSON #2275
Comments
@philmaas Thanks for collecting those issues. I believe they are mainly referring to the exported API JSON, whereas I'd like to add this data directly to the exported workflow json and image metadata. That way the workflow will always contain all of the information you'd need to call the API. I think it makes sense to keep the API endpoints as simple as possible, and encourage users to work with the workflow files and then transform the data to the required API format. I'm working on a Typescript / JS library to make it easier to parse the workflow files for external applications, if anyone is interested. But right now it requires you to pass in the |
Currently, any external tooling will have a hard time converting workflow JSON files to the API format. The main reason is that widgets_values is an array and mapping values from that array to widget names requires loading node types from the object_info endpoint as well. However, object_info depends on the plugins installed and thus may miss some of the nodes in the workflow. This change adds widget_names to the JSON, allowing direct conversion of workflow files to API format without prior knowledge of all node types. This could also help with compatibility in the future. Resolves comfyanonymous#2275
For external integrations, it is currently impossible to generate an API call solely from a workflow
json
file. This is because the input names for widgets are not stored in the file, only the values are:You need to call the
object_info
endpoint and parse the available nodes to determine what the values should be. The above code eventually becomes the following when sending to the API:I propose that the input widget names are added to the exported JSON files to help build API calls. There would be several ways to do this, but the easiest for backwards compatibility would be to add a
widgets_names
array.Even better if it were changed to an object:
That way the widget inputs don't have to rely on the index value anymore.
@comfyanonymous Let me know if this is something you're interested in supporting. Happy to submit a PR if you approve.
The text was updated successfully, but these errors were encountered: