Preface¶
The plugin architecture of DeepSeek Harness (DSH) allows developers to extend its capabilities. dsh-imgdraw is a plugin that provides text-to-image generation for DSH and is maintained by ninjasln. It addresses the need to directly call large models to generate images within the DSH environment, and provides a model tool interface, a browser interactive popup, and persistent image storage and access routes.
Core Capabilities¶
The plugin mainly includes the following capabilities:
- Model Tool: Registers the
draw_imagetool, supporting control of the prompt, count, size, backend, and tag through parameters. - Browser Interaction: Provides a “🎨 Generate Image” button to the left of the input box. Clicking it opens an interactive popup. You can select the size (1:1, 16:9, etc.), count (1-4 images), and backend, and the popup displays quota in real time.
- Asynchronous Generation and Preview: Supports asynchronous image generation, with results displayed in a 4-cell grid. Each image supports download, being marked for retention (never cleaned up), or deletion.
- Image Routes: Provides the
/imgdrawroute, allowing generated image files to be accessed via direct links. - Persistent History: Generation records are saved in
~/.dsh/imgdraw/index.jsonand persist across restarts. - Multi-Backend Support: By default, supports DashScope’s
wan2.7-image(free quota), with SiliconFlow’sQwen-Imageas an optional backend.
Installation and Enablement¶
For the npm-published version, you can install it using the following command:
dsh plugin add dsh-imgdraw
After installation, the plugin is automatically loaded with the profile. It is an official bundle, so restarting the process will not lose its state.
Configuration Items¶
The plugin can be configured via cordis.patch.yml or a profile overlay. The main configuration items are as follows:
| Field | Default Value | Description |
|---|---|---|
outDir |
~/.dsh/imgdraw |
Image output directory |
keysPath |
~/.dsh/image-api-keys.json |
Path to the API keys configuration file |
routePrefix |
/imgdraw |
Image route prefix |
rpcPath |
/imgdraw-rpc |
Browser RPC interaction route |
keepLatest |
24 |
Number of latest files retained after each cleanup (files marked for retention are not subject to this limit) |
maxCount |
4 |
Maximum number of images generated at a time |
defaultBackend |
dashscope |
Default backend: dashscope or siliconflow |
dashscopeModel |
wan2.7-image |
Model used by DashScope |
siliconflowModel |
Qwen/Qwen-Image |
Model used by SiliconFlow |
historyCap |
50 |
Maximum number of history records |
Usage¶
1. Browser-Side Operation¶
- Find and click the “🎨 Generate Image” button to the left of the chat input box.
- In the popup, enter a prompt, and select the size, count, and backend.
- After submission, the system generates images asynchronously, and results are displayed in a 4-cell grid.
- For each image, perform download, mark for retention, or deletion.
2. Model Tool Invocation¶
The AI can directly call the draw_image tool in a conversation. Parameters include:
* prompt: prompt
* count: number to generate
* size: image size
* backend: backend selection
* tag: tag (used for file naming)
3. Direct Link Access¶
Generated images can be accessed via a direct link:
http://127.0.0.1:3080/imgdraw/<文件名>
Notes¶
- Official Bundle: This plugin is an official bundle, not a dynamic plugin. Restarting the DSH process does not cause data loss.
- Asynchronous Mechanism: Browser
fetchhas a 30-second timeout limit, so the generation process must be performed asynchronously. Thedraw_imagetool supports synchronous waiting, but its timeout is set to 180 seconds. - RPC Communication: Communication between the Client and Host uses the same-origin
/imgdraw-rpcHTTP route, rather than DSH’s native harness.handle. - Quota Logic: The plugin uses local counting for quota management and does not provide an API billing query interface. Once the free quota is exhausted, you need to switch backends or manually verify.