save code
This commit is contained in:
@@ -109,6 +109,21 @@ def run(rgba_png_bytes: bytes, timeout: float = COMFY_TIMEOUT, prompt: str = Non
|
||||
if prompt is not None:
|
||||
wf[_PROMPT_NODE]["inputs"]["text"] = prompt
|
||||
|
||||
# 诊断:落盘实际提交的工作流 + 输入图,便于和手动 ComfyUI 跑的对比
|
||||
try:
|
||||
import os as _os
|
||||
_diag = _os.path.join(_os.path.dirname(_os.path.dirname(_os.path.abspath(__file__))),
|
||||
"log", "comfyui_last_submit")
|
||||
_os.makedirs(_diag, exist_ok=True)
|
||||
with open(_os.path.join(_diag, "workflow.json"), "w", encoding="utf-8") as _f:
|
||||
json.dump(wf, _f, ensure_ascii=False, indent=2)
|
||||
with open(_os.path.join(_diag, "input.png"), "wb") as _f:
|
||||
_f.write(rgba_png_bytes)
|
||||
with open(_os.path.join(_diag, "prompt.txt"), "w", encoding="utf-8") as _f:
|
||||
_f.write(prompt if prompt is not None else "(None=用工作流内置默认)")
|
||||
except Exception: # noqa: BLE001
|
||||
pass
|
||||
|
||||
# 3. 提交
|
||||
r = cli.post("/prompt", json={"prompt": wf, "client_id": client_id})
|
||||
r.raise_for_status()
|
||||
|
||||
Reference in New Issue
Block a user