Introduction¶
The plugin ecosystem of DeepSeek Harness (DSH) aims to extend functionality through plugins. Generating images in conversation usually requires a complex backend setup or an API key. dsh-imggen, maintained by Stellight, is a static dual-face plugin that provides text-to-image output capability to DSH. This plugin uses the same profile bundle mechanism as dsh-deepseek-balance, which means configurations written into the bundle persist across restarts and do not require approval each time.
Core Features¶
dsh-imggen provides a complete toolchain for rendering and generating images in conversation.
generate_imagemodel tool: generates images from text prompts and renders them directly in the conversation tool card.- Backend support:
- Uses Pollinations by default (free, no API key required).
- Supports OpenAI (DALL·E 3), requiring configuration of
OPENAI_API_KEYorDSH_OPENAI_API_KEY.
- Tool card features:
- Download button: supports one-click download of generated images. If the browser cross-origin fetch fails, it automatically falls back to opening in a new tab.
- History gallery: click the
🖼 历史button to open a floating gallery, displaying images and prompts in a grid, with support for deleting or clearing them. History records are stored in browser localStorage and retained across restarts.
- API selector tab: provides a segmented control on the right side of the input tool row, supporting switching between
🎨 Pollinationsand✨ OpenAI. After selection, the prompt is injected via thesystemPromptvariable, and the host side calls the corresponding backend based on the selected option.
Installation and Enablement¶
Installing this plugin requires placing the package into the profile’s node_modules and configuring the bundle in package.json.
- Use the plugin command:
dsh plugin --profile web add <本包路径>
- Manual installation:
Copy the package to the profile’snode_modulesdirectory, for example:
~/.dsh/profiles/web/node_modules/dsh-imggen/ - Configure the profile:
Edit the profile’spackage.jsonand add the dependency and bundles configuration:
{
"dependencies": { "dsh-imggen": "1.0.0" },
"dsh": { "profile": { "bundles": ["...", "dsh-imggen"] } }
}
- Restart Harness:
Rundsh webto restart; the tool card, gallery, and tab will take effect automatically.
Typical Usage¶
- Default generation: call
generate_imagedirectly in the conversation. The Pollinations backend is used by default, so images can be generated without additional configuration. - Switch backend: select OpenAI in the selector tab on the right side of the input box, and ensure the corresponding key is configured in environment variables or the DSH credentials store.
- Manage history: click the
🖼 历史button on the tool card to view the list of generated images. The list is saved in browser localStorage and is not lost when the browser is refreshed or restarted.
Architecture and Security¶
- Architecture: adopts a dual-face architecture with no build steps.
dsh/index.js(Host): registers thegenerate_imagetool,systemPromptvariable/section, and the same-origin route/dsh-imggen/pref. OpenAI calls and Pollinations validation use Node’s nativefetch.dsh/client.js(Client): a handwritten lazy-CJS bundle, responsible for the tool card, history gallery overlay, and image-generation API tab.
- Security: the repository code contains no API keys. The OpenAI key is used only within the local process for official API calls and is resolved by the
credentialsservice in the order ofOPENAI_API_KEYorDSH_OPENAI_API_KEYenvironment variables.
Conclusion¶
dsh-imggen simplifies the image generation process in DSH and uses the static bundle mechanism to ensure configuration stability. The project code is open source and can be viewed on GitHub.