dsh-ujn-image: Text-to-Image and Image-to-Image Generation via UJN Tokens in DSH

Introduction

DeepSeek Harness (DSH) comes with a built-in read_image tool, but it can only read existing images—it cannot directly “draw an image” in a conversation or modify a scene based on a reference image. The University of Jinan’s LLM public service platform 济大词元 (llm.ujn.edu.cn) provides an OpenAI-compatible interface that includes image generation capabilities such as Qwen-Image. While the API can be called independently, it is not automatically integrated with DSH’s tool registration, base64 persistence, persistent attachments, or credential storage mechanisms.

The following introduces the community plugin dsh-ujn-image (maintainer: Jia-HuaWu): enter your API Key once in the DSH settings page, and use natural language in your conversation to trigger text-to-image or image-to-image generation. The generated results are saved as PNGs and returned as persistent image attachments, so they can be used later in the same conversation.

What Is This

dsh-ujn-image belongs to the “Model Inference” category in the DSH community plugin directory (directory page: skillhub.cn/plugins/Jia-HuaWu/dsh-ujn-image). It fills three gaps:

Gap How the Plugin Addresses It
DSH has no built-in “image generation” tool Registers ujn_generate_image, ujn_edit_image
The platform returns base64, but conversations need persistent attachments Decode → save to disk → ctx.attachments.saveImage() → return an ImageBlock
API Keys should not be stored in plaintext config Uses DSH’s official credentials domain, entered via the settings page, and plaintext is not returned in responses

In short: it lets DSH call your campus platform to draw images, and feeds those images into the conversation attachment pipeline.

Core Features

Text-to-Image

Simply describe the scene in your conversation, for example:

Draw an orange cat wearing a space helmet, floating in space, in a detailed realistic style

Main tool parameters (excerpted from the README):

Parameter Required Description
prompt Yes Image description; can be written directly in Chinese
size No square / landscape / portrait / wide / tall
enhance No Whether to first expand the prompt using Qwen-Image-PE-T2I (adds ~15 seconds; falls back to the original prompt if it fails)
steps No Sampling steps, default 40
fileName No Custom filename (files with the same name are not overwritten; a sequence number is appended automatically)

Image Editing / Image-to-Image

When you need to preserve the appearance of a character or object, attach 1–4 reference images and clearly state “keep … unchanged.” Pure text-to-image cannot know what the character in the reference image looks like.

Example:

Let her play on the computer            [attach a character image]

This corresponds to the platform’s /v1/images/edits endpoint (multipart). The images parameter can take a path to a read-only copy (without extension) in DSH’s attachment directory; the plugin identifies the file format via file magic bytes.

For editing scenarios, the README recommends leaving enhance off by default: PE-I2I takes about 70 seconds in actual testing, and sometimes fails to rewrite Chinese prompts; if your instructions are clear, you usually don’t need to enable it.

Settings Page

After installing and restarting DSH, you can do the following in Settings → 济大词元 Text-to-Image:

  1. Enter your API Key (after saving, only “Configured” is displayed)
  2. Test Connection: lists platform models to confirm the key and image generation models are available
  3. Try Run: preview generation without opening a conversation; entering a reference image path automatically switches to editing mode
  4. Adjust the API endpoint, image generation model, default canvas size, sampling steps, save directory, etc.

If you have already configured a key for the same platform under “Settings → Models”, the plugin reuses the UJN_API_KEY credential name by default.

Installation and Activation

The installation methods given in the README are as follows (local path examples need to be changed to the plugin directory on your machine):

# Desktop (DeepSeek Harness desktop application)
dsh plugin --profile desktop add link:E:/DeepseekHarness/dsh-ujn-image

# Web version (dsh web)
dsh plugin --profile web add link:E:/DeepseekHarness/dsh-ujn-image

# Or install from git
dsh plugin --profile desktop add git+https://github.com/Jia-HuaWu/dsh-ujn-image

After installation, restart DSH: host-side tool registration and browser-side settings page assembly are completed at startup. The README badge indicates that it targets the DSH 0.2.0-rc.2 ecosystem; the plugin version in package.json is 1.0.0, and the license is MIT.

Uninstall example:

dsh plugin --profile desktop remove dsh-ujn-image

Uninstalling does not delete already-generated images, nor does it clear the credentials file.

Getting an API Key

  1. Open https://llm.ujn.edu.cn and log in with unified identity authentication (students use their student ID)
  2. Go to “Keys / Tokens” and create a key
  3. Copy the string starting with ujn- (it is shown only once; save it immediately)
  4. Paste it into the plugin’s settings page

The README notes: image generation and chat model quotas are independent, so generating images does not consume your daily conversation quota.

Typical Usage

Text-to-image only: describe the scene in Chinese within the conversation; specify size, steps, or enable enhance in the tool parameters if needed.

Put a character into a new scene: first attach a character reference image, then send an instruction like “Let this character sit in front of a computer desk playing PC games… keep the hairstyle, hair accessories, and clothing exactly the same,” and ujn_edit_image will call the editing endpoint.

Test without a conversation: use the “Try Run” feature on the settings page to verify text-to-image generation or editing with reference images independently.

Letting the Model “See” Generated Images (Optional)

The plugin saves images as persistent attachments, but DSH’s llm-pi-ai adapter—when the model does not declare input—may by default only accept text. Images are then replaced with placeholder descriptions, so the model cannot read the pixels. The README suggests adding defaultInput: [text, image] for the ujn route in the profile’s cordis.patch.yml, and notes that you should verify through testing that the platform model actually supports image input before making this change. Without this step, images are still generated and displayed in the interface, but the model may be unable to follow up or make modifications based on the visual content.

Suitable Scenarios and Notes

Who it’s for: users who are already using (or can access) the University of Jinan’s LLM platform (济大词元) and want to perform text-to-image or image-to-image generation directly within DSH conversations/agent workflows.

How it runs: like other DSH plugins, the code executes under the permissions of the current dsh process; before installing, please review the GitHub repository source code and the MIT license, and confirm where your key and generated images are stored on disk (default directories per the README: ujn-images/, settings stored in $DSH_HOME/dsh-ujn-image/settings.json).

Security notes (README summary): the key is stored in $DSH_HOME/.credentials.yaml; the settings page endpoint that writes the key only accepts local loopback requests. Reverse proxy or LAN access can declare trusted hosts via DSH_UJN_IMAGE_TRUSTED_HOSTS.

Known limitations: depends on the availability and quota of the campus platform; image-to-image generation depends on the quality of reference images and prompts; this third-party plugin does not use @deepseek-ai/dsh-tools’s defineTool, but hand-writes tool definitions equivalent to the registry (the README explains why).

Conclusion

dsh-ujn-image integrates 济大词元’s Qwen-Image text-to-image and image-to-image capabilities into DSH’s tool and attachment pipeline, and provides a settings page, connection testing, and a try-run feature. Community directory: https://www.skillhub.cn/plugins/Jia-HuaWu/dsh-ujn-image; source code and full documentation: https://github.com/Jia-HuaWu/dsh-ujn-image.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye