release: 1.0.0

This commit is contained in:
wangjinding committed 2026-11-23 09:49:57 +08:00
commit 2ab101cfea
7 files changed
+1018

No files matched your search

+71
View File
@@ -0,0 +1,71 @@
# @wangjinding/dsh-comfyui
把局域网里的 **ComfyUI** 接进 DeepSeek Harness:设置页填地址、一键测试,之后 agent 就能用它的显卡出图、跑任意工作流。
## 安装
```bash
cd ~/.dsh/profiles/<profile>
pnpm add @wangjinding/dsh-comfyui
```
然后在 `package.json` 的 `dsh.profile.bundles` 里加上 `@wangjinding/dsh-comfyui`,重启 DSH。
## 配置
**设置 → ComfyUI**:填服务地址(如 `http://<主机>:8188`)→「保存并连接」。
地址也可写进 profile 的 `cordis.patch.yml`:
```yaml
- id: comfyui
config:
baseUrl: http://<你的 ComfyUI 主机>:8188
```
设置在 `~/.dsh/storages/dsh-comfyui/config.json`(600),**不写进 profile 配置**,也不进发布包。
## 工具
| 工具 | 作用 |
|---|---|
| `comfy_generate_image` | 内置 Z-Image Turbo 文生图(1024²/8 步约 20–25 秒) |
| `comfy_run_workflow` | 跑任意 **API 格式** 工作流,产物自动下载到本地 |
| `comfy_upload` | 上传本地文件到 ComfyUI 的 `input/`,供图生视频等使用 |
| `comfy_status` | 版本 / GPU 显存 / 队列 / 内置模型(不消耗算力) |
## API 格式 vs UI 格式(重要)
ComfyUI 的 `POST /prompt` 只接受 **API 格式**:
```json
{ "节点id": { "class_type": "KSampler", "inputs": { ... } } }
```
ComfyUI 界面保存的工作流是 **UI 格式**(`nodes` / `links` / `widgets_values`),直接提交会报校验失败。
在界面里右键 →「**导出 (API)**」得到的 JSON 才是能跑的。
## 内置工作流
`comfy_generate_image` 用的是 Z-Image Turbo 的 API 图:
```
CLIPLoader(qwen_3_4b, type=lumina2) ─┐
UNETLoader(z_image_turbo_bf16) ─┼→ ModelSamplingAuraFlow(shift=3) → KSampler(8步, cfg=1,
VAELoader(ae.safetensors) ─┘ res_multistep, simple)
CLIPTextEncode(prompt) → ConditioningZeroOut → 作为负向条件(cfg=1 时这样做)
→ VAEDecode → SaveImage
```
两个容易踩的点:
1. **文本编码器类型是 `lumina2`**,不是 `qwen_image`。
2. **负向条件用 `ConditioningZeroOut`** 把正向清零,而不是再写一个 `CLIPTextEncode`。
## 安全提示
ComfyUI 默认没有认证,通常监听 `0.0.0.0` —— 同一局域网内任何设备都能连上并占用显卡。建议只在可信内网使用,或在前置反向代理上加认证。
## 许可
MIT