chore: auto-commit (61 archivos)
- docs/capabilities/INDEX.md - docs/capabilities/comfyui.md - python/functions/browser/comfyui_export_workflow_ui.md - python/functions/browser/comfyui_export_workflow_ui.py - python/functions/browser/comfyui_load_workflow_ui.md - python/functions/browser/comfyui_load_workflow_ui.py - python/functions/browser/comfyui_queue_prompt_ui.md - python/functions/browser/comfyui_queue_prompt_ui.py - python/functions/browser/comfyui_refresh_nodes_ui.md - python/functions/browser/comfyui_refresh_nodes_ui.py - ... Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
---
|
||||
name: comfyui_submit_workflow
|
||||
kind: function
|
||||
lang: py
|
||||
domain: ml
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "def comfyui_submit_workflow(workflow: dict, server: str = \"127.0.0.1:8188\", client_id: str | None = None, timeout: float = 30.0) -> dict"
|
||||
description: "Envia un workflow (API format) a ComfyUI via POST /prompt. Devuelve la respuesta con prompt_id y number (posicion en cola). Si ComfyUI rechaza el workflow (HTTP 400) propaga el cuerpo con los detalles de validacion por nodo. Impura: HTTP POST, solo stdlib (urllib, json, uuid)."
|
||||
tags: [comfyui, ml, image-generation, stable-diffusion, http, queue]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
params:
|
||||
- name: workflow
|
||||
desc: "dict en API format (resultado de comfyui_build_txt2img_workflow u otro builder). Claves = node_ids, valores con class_type + inputs."
|
||||
- name: server
|
||||
desc: "host:port del servidor ComfyUI sin esquema (default '127.0.0.1:8188')."
|
||||
- name: client_id
|
||||
desc: "Identificador de cliente para correlar eventos. None genera un uuid4; el id usado se devuelve en la respuesta."
|
||||
- name: timeout
|
||||
desc: "Timeout de la peticion HTTP en segundos."
|
||||
output: "dict de respuesta de ComfyUI con prompt_id (str, para comfyui_wait_result), number (int, posicion en cola), node_errors (dict) y la clave anadida client_id (str usado en la peticion)."
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "python/functions/ml/comfyui_submit_workflow.py"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```python
|
||||
import sys, os
|
||||
sys.path.insert(0, os.path.join(os.environ["HOME"], "fn_registry", "python", "functions"))
|
||||
from ml.comfyui_build_txt2img_workflow import comfyui_build_txt2img_workflow
|
||||
from ml.comfyui_submit_workflow import comfyui_submit_workflow
|
||||
|
||||
wf = comfyui_build_txt2img_workflow(
|
||||
ckpt_name="v1-5-pruned-emaonly-fp16.safetensors",
|
||||
positive="a red apple on a wooden table, sharp focus",
|
||||
negative="blurry, low quality",
|
||||
)
|
||||
resp = comfyui_submit_workflow(wf)
|
||||
prompt_id = resp["prompt_id"] # pasalo a comfyui_wait_result
|
||||
print(prompt_id, resp.get("number"))
|
||||
```
|
||||
|
||||
O lanzable directo (build + submit) con: `./fn run comfyui_submit_workflow`.
|
||||
|
||||
## Cuando usarla
|
||||
|
||||
Tras construir un workflow con `comfyui_build_txt2img_workflow`, para encolarlo
|
||||
en el servidor y obtener el `prompt_id`. Es el segundo paso del round-trip
|
||||
build -> submit -> wait. Reutiliza el `client_id` que devuelve si vas a
|
||||
correlar varios prompts del mismo cliente.
|
||||
|
||||
## Gotchas
|
||||
|
||||
- ComfyUI encola y devuelve de inmediato; NO espera a que termine la
|
||||
generacion. Para recuperar el resultado usa `comfyui_wait_result` con el
|
||||
prompt_id.
|
||||
- Si el workflow es invalido (checkpoint inexistente, conexion mal tipada,
|
||||
input fuera de rango) ComfyUI responde HTTP 400 y esta funcion lanza
|
||||
RuntimeError con el cuerpo de validacion del nodo afectado. Leelo: el detalle
|
||||
dice que nodo y que input fallo.
|
||||
- Encolar tiene efecto secundario: arranca trabajo de GPU en el servidor. No es
|
||||
idempotente — cada llamada encola un prompt nuevo.
|
||||
Reference in New Issue
Block a user