Eliminate first-inpaint timeout: preseed SAM/GroundingDINO + 600s default

Two changes to address the timeout-and-retry loop the user hit on the
first edit_image call:

  1. comfyui-init-models.sh now fetches the three weights inpaint
     needs into /models/sams and /models/grounding-dino:
       - sam_hq_vit_h.pth                (~2.5 GB)
       - groundingdino_swint_ogc.pth     (~700 MB)
       - GroundingDINO_SwinT_OGC.cfg.py  (~1 KB)
     Without preseeding these auto-download on first inpaint, which
     takes minutes and times out the tool call. The mkdir line gets
     the new subdirs added too.

  2. Tool TIMEOUT_SECONDS valve default bumped 240s → 600s as
     defense-in-depth — even with weights preseeded, BERT-base
     auto-downloads via transformers on first GroundingDINO load
     (~30s) and a slow KSampler on a contended GPU can push past
     4 minutes occasionally. Steady-state runs still finish in under
     a minute; the valve only matters for first-call latency.

After comfyui-model-init re-runs (`docker compose up -d
comfyui-model-init`), first inpaint should be near-instant.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
57_WolveandClaude Opus 4.7 committed 2026-04-19 15:39:23 -05:00
1 parent e77666ea0f
commit 0fa8040251
2 files changed
+27 -4

No files matched your search

@@ -1,7 +1,7 @@
"""
title: Smart Image Generator & Editor (ComfyUI)
author: ai-stack
version: 0.7.3
version: 0.7.4
description: Generate or edit images via ComfyUI with automatic SDXL
checkpoint routing. Two methods — generate_image (txt2img) and
edit_image (img2img on the user's most recently attached image). The
@@ -684,8 +684,15 @@ class Tools:
description="ComfyUI server URL reachable from the open-webui container.",
)
TIMEOUT_SECONDS: int = Field(
default=240,
description="Maximum wait for a single generation to complete.",
default=600,
description=(
"Maximum wait for a single generation to complete. "
"Default 10 minutes — long enough to absorb a first-time "
"inpaint where SAM-HQ + GroundingDINO + BERT auto-download "
"(~3 GB). Steady-state runs finish in well under a minute; "
"if your KSampler routinely takes longer than that, lower "
"the per-style steps in STYLES."
),
)
def __init__(self):