[Feature Request] API support in Workflow JSON
- Dominant language
- Python
- Stars
- 133k
- Forks
- 15.7k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 155
Description
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:
```json
"inputs": [
{
"name": "clip",
"type": "CLIP",
"link": 3
}
],
"widgets_values": [
"beautiful scenery nature glass bottle landscape, , purple galaxy bottle,"
]
```
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:
```json
"6": {
"inputs": {
"text": "beautiful scenery nature glass bottle landscape, , purple galaxy bottle,",
"clip": [
"4",
1
]
},
"class_type": "CLIPTextEncode"
},
```
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.
```json
"widgets_names": ["text"],
"widgets_values": [
"beautiful scenery nature glass bottle landscape, , purple galaxy bottle,"
]
```
Even better if it were changed to an object:
```json
"widgets": {
"text": "beautiful scenery nature glass bottle landscape, , purple galaxy bottle,"
}
```
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.
Contributor guide
Assessment
This issue has not been assessed yet.