feat: ComfyUI 改走 10.60.74.221,测试页上传图超阈值自动降采样

将 worker 默认 ComfyUI 地址改为远端 10.60.74.221:8188;前端测试页在像素超过 1536000 时等比缩小到 786432 以内。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
xsl
2026-07-17 02:23:35 +08:00
co-authored by Cursor
parent c1bb9614c7
commit 659c037270
17 changed files with 104 additions and 23 deletions
+3 -3
View File
@@ -598,7 +598,7 @@ _REPAINT_WORKFLOW = os.path.join(os.path.dirname(os.path.dirname(__file__)), "ha
def _call_comfyui(image_bgr, mask_bool, prompt=None):
"""本机 ComfyUI 的 Flux-2 inpaint 工作流(hair_repaint.json),返回与输入同分辨率的 BGR。
"""远端 ComfyUI 的 Flux-2 inpaint 工作流(hair_repaint.json),返回与输入同分辨率的 BGR。
与 swapHair 的区别:ComfyUI 把「原图 VAE 编码作 reference latent + ColorMatch」双重保色,
天生不易染色;提示词自由可调(中文)。mask 经 RGBA alpha 通道传入(透明=重绘区)。
@@ -606,10 +606,10 @@ def _call_comfyui(image_bgr, mask_bool, prompt=None):
"""
import io
from hairline.mask import compose_comfy_rgba
from hairline.comfyui import run as comfyui_run, ping
from hairline.comfyui import COMFYUI_URL, run as comfyui_run, ping
if not ping():
raise SwapError("ComfyUI 不可达(http://127.0.0.1:8188),redraw Flux-2 路跳过")
raise SwapError(f"ComfyUI 不可达({COMFYUI_URL}),redraw Flux-2 路跳过")
mask_u8 = (mask_bool.astype(np.uint8)) * 255
rgba_img = compose_comfy_rgba(image_bgr, mask_u8) # alpha=255-mask:透明=重绘区
buf = io.BytesIO()