- 点选金框滑动 + 检视区 150ms 交叉淡变;↑↓/J/K 即时切换、空格播放、 Delete 删除、] 检视区、浮层让位;新记录入场/完成金光/失败抖动,减动效只余短淡变 - 单条删除 5 秒撤销(Toast 金色动作钮),窗口过后才提交 DELETE,离页 flush; 任务页同队列同步;工作流删除保留旧记录并标识「工作流已删除」 - 红/琥珀界线:失败红 + 中文结论展开;done 但文件取不到 → 琥珀「文件缺失」 + 用相同参数重做/移除记录 - 参数页提交自动切结果页;工作流选择器 ↑↓ 真高亮 + Enter 使用(ShellPop arrowRoving 开关) - 记录流 80 条分页(220 条专项:50 次轮询 490ms);任务页 §3.5 芯片+搜索+ 行内进度条+ghost 重试;i18n 七语种 +17 键 Co-authored-by: multica-agent <github@multica.ai>
76 lines
2.5 KiB
Python
76 lines
2.5 KiB
Python
"""Seed the isolated backend: one fake-ComfyUI endpoint + two workflows."""
|
|
import json
|
|
import sys
|
|
import urllib.request
|
|
|
|
BASE = "http://127.0.0.1:8247"
|
|
|
|
|
|
def call(method, path, payload=None):
|
|
data = json.dumps(payload).encode() if payload is not None else None
|
|
req = urllib.request.Request(
|
|
BASE + path, data=data, method=method, headers={"Content-Type": "application/json"}
|
|
)
|
|
with urllib.request.urlopen(req) as r:
|
|
body = r.read()
|
|
return json.loads(body) if body else {}
|
|
|
|
|
|
IMAGE_WF = {
|
|
"1": {
|
|
"class_type": "CLIPTextEncode",
|
|
"inputs": {"text": "默认提示词"},
|
|
"_meta": {"title": "(Input:prompt) 正向提示词"},
|
|
},
|
|
"2": {
|
|
"class_type": "PrimitiveInt",
|
|
"inputs": {"value": 42},
|
|
"_meta": {"title": "(Input:seed) 种子"},
|
|
},
|
|
"9": {
|
|
"class_type": "SaveImage",
|
|
"inputs": {"images": "x"},
|
|
"_meta": {"title": "(Output:image) 图片输出"},
|
|
},
|
|
}
|
|
VIDEO_WF = {
|
|
"1": {
|
|
"class_type": "CLIPTextEncode",
|
|
"inputs": {"text": "镜头缓慢推近"},
|
|
"_meta": {"title": "(Input:prompt) 正向提示词"},
|
|
},
|
|
"2": {
|
|
"class_type": "PrimitiveFloat",
|
|
"inputs": {"value": 6},
|
|
"_meta": {"title": "(Input:duration) 时长"},
|
|
},
|
|
"9": {
|
|
"class_type": "VHS_VideoCombine",
|
|
"inputs": {},
|
|
"_meta": {"title": "(Output:video) 视频输出"},
|
|
},
|
|
}
|
|
|
|
if __name__ == "__main__":
|
|
# Idempotent: drop same-named workflows and the old fake endpoint first.
|
|
for w in call("GET", "/api/workflows"):
|
|
if w["name"] in ("文生图·回归", "文生视频·回归"):
|
|
call("DELETE", f"/api/workflows/{w['id']}")
|
|
for e in call("GET", "/api/comfyui/endpoints")["endpoints"]:
|
|
if e["base_url"] == "http://127.0.0.1:18188":
|
|
call("DELETE", f"/api/comfyui/endpoints/{e['id']}")
|
|
r = call(
|
|
"POST",
|
|
"/api/comfyui/endpoints",
|
|
{"name": "假 ComfyUI", "base_url": "http://127.0.0.1:18188", "auth_type": "none"},
|
|
)
|
|
eps = [e for e in r["endpoints"] if e["base_url"] == "http://127.0.0.1:18188"]
|
|
call("POST", f"/api/comfyui/endpoints/{eps[0]['id']}/activate")
|
|
img_id = call(
|
|
"POST", "/api/workflows", {"name": "文生图·回归", "kind": "image", "workflow_json": IMAGE_WF}
|
|
)["id"]
|
|
vid_id = call(
|
|
"POST", "/api/workflows", {"name": "文生视频·回归", "kind": "video", "workflow_json": VIDEO_WF}
|
|
)["id"]
|
|
print(json.dumps({"image_wf": img_id, "video_wf": vid_id, "endpoint": eps[0]["id"]}))
|