Preface¶
In DeepSeek Harness (DSH), connecting an Agent to text-to-image is a common practice, usually done by hand-writing scripts to call ComfyUI or relying on online APIs. The former requires handling process startup, queuing, timeouts, and failure retries every time; the latter outsources data and latency to the remote. If the goal is for the Agent to “see the image directly in the conversation,” and you want the local Stable Diffusion 1.5 calls to be predictable, you need a plugin attached to DSH that turns health checks, startup, queuing, polling, and attachment return into a single chain. dsh-image-gen (maintainer OrdinaryTu, category: Model Inference) provides the generate_image tool for this purpose, generating images locally via ComfyUI, writing them to disk, and entering the conversation attachments.
What is this¶
dsh-image-gen is a DSH plugin that exposes generate_image to the Agent, using local ComfyUI (SD 1.5) for text-to-image, with results displayed directly in the conversation. The design focus is not “occasionally being able to draw once,” but having deterministic behavior for every call: health check before calling, auto-start if not running (wait max 90s), serial request queuing, polling and timeout, and a seed swap retry on failure, bringing back the ComfyUI reason on failure. Plugin version 0.1.0, MIT license, requires DSH >=0.2.2-rc.1 <0.3.0-0.
Core Features¶
The following lists the capabilities already documented in the README.
- Tool
generate_image: Parameters areprompt, negative?, width?, height?, steps?, cfg?, seed?;promptmust be in English, describing the subject, environment, lighting, and style. - ComfyUI Lifecycle: Health checks; auto-start if not running, max wait 90s; plugin waits ~15-30s for the first cold start.
- Generation Pipeline: POST
/promptfollowed by polling/history, 240s timeout; generation requests are queued serially to avoid GPU memory contention; auto seed swap retry on failure. - Result Delivery: Image is written locally and handed to
attachmentsfor direct display in the conversation; default output directory$DSH_HOME/image-gen/outputs, ComfyUI logs$DSH_HOME/image-gen/comfy.log. - Local HTTP Interface (Loopback only):
GET /dsh-image/healthto check ComfyUI status;GET /dsh-image/gen-<timestamp>-<seed>.pngto get the image; also exposesPOST /dsh-image/generatefor other local callers. - Reusable Engine: Exports
./engine, allowing local QQ bridges, etc., toimportgenerateImagefromengine.mjs, sharing the same ComfyUI logic with the plugin.
Current implementation only supports SD 1.5; complex composition, text, and fingers are still weak points. The maintainer’s verification environment in the README includes ComfyUI 0.37, checkpoint v1-5-pruned-emaonly-fp16.safetensors, etc.; other machines need to align models and paths themselves.
Installation and Enablement¶
The plugin runs with the current DSH process permissions. Before installing, you should review the source code and MIT license on the GitHub repository.
Execute the official installation command under the desktop profile:
dsh plugin --profile desktop add github:OrdinaryTu/dsh-image-gen
You can also install from the GitHub source from the DSH plugins directory page. After installation, generate_image is immediately available; the README states that ComfyUI does not need to be restarted for this.
Depends on local ComfyUI; paths and endpoints can be overridden via environment variables:
| Variable | Default |
|---|---|
DSH_COMFY_ROOT |
D:\ComfyUI\ComfyUI_windows_portable |
DSH_COMFY_URL |
http://127.0.0.1:8188 |
DSH_COMFY_CKPT |
v1-5-pruned-emaonly-fp16.safetensors |
Linux or other systems should change DSH_COMFY_ROOT etc. to the actual local paths.
Typical Usage¶
Agent Calling the Tool¶
In the conversation, just let the Agent call generate_image. Parameter constraints (from README):
width/height: 256-768, default 512; SD 1.5 is most stable at 512×512.steps: 5-40, default 20.cfg: 1-15, default 7.seed: optional; if not passed, it is random.
Reusing in Other Local Code¶
Local bridges can reuse engine.mjs:
const { generateImage } = await import('../image-plugin/engine.mjs')
const result = await generateImage({ prompt: 'a cat waiting in the rain, illustration' })
The README also uses “QQ Xiaoyu” as an example: write [[image:English prompt]] in the reply, and the bridge uses local ComfyUI to generate the image and send it back. Paths need to be adjusted according to the actual location of the plugin in your repository.
Health Check and Image Retrieval¶
Locally, you can request:
GET /dsh-image/health— ComfyUI health statusGET /dsh-image/gen-<timestamp>-<seed>.png— Retrieve the generated image
The routes above are only open to the local loopback.
Suitable Scenarios and Notes¶
Suitable for: Agents already developed in the DSH desktop environment, wanting local SD 1.5, controllable latency, and images directly entering the conversation; or needing to share the same ComfyUI wrapper with local services like the QQ bridge.
Notes:
- Only SD 1.5; SDXL/Flux requires changing the workflow (README mentions
buildWorkflow) or connecting to an API fallback. - Under 8GB VRAM, 512×512, 20 steps takes roughly a few to ten seconds; 768 is slower.
- Plugin logic is in
index.js(tool, health check/startup, queue, generation and image routing); it is advisable to quickly review the source code before installing. - The DSH ecosystem follows “everything is a plugin”; the community directory skillhub.cn is a separate site with no official affiliation with DeepSeek or HF.
Conclusion¶
dsh-image-gen integrates ComfyUI text-to-image into DSH’s generate_image and local HTTP interfaces, using health checks, auto-start, serial queues, timeouts, and a single seed retry to make the Agent’s image generation behavior repeatable and failures explainable. For installation or issues, see the plugin directory page and GitHub:
- Directory page: https://www.skillhub.cn/plugins/OrdinaryTu/dsh-image-gen
- Repository: https://github.com/OrdinaryTu/dsh-image-gen