Introduction¶
When using screenshots in conversations within DSH Desktop, the common practice is: first use OCR to copy text, then paste it into the input box. If the underlying model itself does not support image input, attachments often cannot participate in reasoning directly. Although vision models can receive the original image, when mixing multiple providers, one must determine whether to use direct transmission or text conversion.
dsh-desktop-tool-ocr is released by community maintainer huanglihome1996-rgb and categorized under model inference. The plugin adds an auto-vision--<original provider> entry at the public LLM adapter layer, automatically branching based on DSH’s model capability declarations: if image capability exists, the original image is transmitted directly; otherwise, it goes through a pluggable recognition backend, projecting the text to the original model’s response. The process can be summarized as: Screenshot → Paste to chat box → Send → Response.
What is this¶
This plugin is an extension for DSH Desktop; it does not modify the DSH installation package and does not disguise non-vision models as vision models. Recognition occurs during the request projection phase, while the original image attachments are retained in the chat history.
The current version is 0.2.0 under the MIT license. Development and host verification target DSH 0.2.2-rc.1; compatibility with other DSH versions is not guaranteed. It requires Node.js >= 22.19. Image attachments rely on the local file-based attachment service (attachments.imageHostPath()). The Windows desktop has been tested; other platforms have not been tested on actual hardware.
The workflow is as follows:
Image attachment → Automatic recognition backend
├─ Underlying model declares image capability → Original image direct transmission
└─ Underlying model lacks image capability → Recognition backend → Text/Description → Original model response
Built-in recognition backend types include: nbocr, custom local command, and the OpenAI-compatible openai visual interface. The nbocr engine is not included in the npm package and requires separate installation; the plugin will not download or execute remote installation scripts.
Core Features¶
Automatic Branching and Enhanced Entry¶
The plugin relies on DSH’s model capability declarations to select direct transmission or OCR, rather than guessing based on the model name. It does not support automatic remote retry after an interface rejection; errors in capability declarations must be corrected in the original provider configuration.
Starting from v0.2.0, support for verifying the image capability of official models is included: scanning the original provider’s model list and combining public documentation or optional official /models metadata to determine supported / unsupported / unknown. The report is saved by default at $DSH_HOME/desktop-tool-ocr-capabilities.json (or ~/.dsh/ if DSH_HOME is not set). Official proof that a model can view images does not automatically mean a third-party gateway with the same ID can transmit images; the gateway side needs to configure trust and alias mapping themselves.
Pluggable Backend¶
The recognition backend is specified via an independent JSON configuration file, which is re-read when recognition is needed. Changing the backend does not require restarting the plugin process. The in-process recognition result cache holds up to cacheSize items (default 64; set to 0 to disable).
- Local nbocr: Connects to Newbee OCR CLI.
- command: Calls a local trusted command via argv, supporting stdout or file output, with an optional
jsonTextPathto extract text from JSON. - openai: Enabled only when explicitly set to
allowRemote: true; images are sent to the configured/chat/completionsendpoint, potentially incurring costs; the default remains local nbocr.
At the entry level, forceRecognition: true can be set to force even models declared with visual capability to go through the backend (default is false).
Third-party Backend Extension¶
Custom engines can be registered via registerBackend in dsh-desktop-tool-ocr/backends. Registration must be completed before the first use of that type, and it must resolve to the same package instance as the main plugin.
Installation and Enabling¶
Install from Release Package¶
Download the .tgz file from GitHub Releases and install it in DSH Desktop’s extension management; the release package comes with a SHA-256 checksum file.
Install via “Discovery” Index¶
Enable the experimental “Custom Plugin Index”, and fill in the following in “Discovery → Add Index Source”:
https://raw.githubusercontent.com/huanglihome1996-rgb/dsh-desktop-tool-ocr/main/market/index.json
The index is pinned to the Git commit of the release version. The first installation still requires configuring a local OCR engine or another recognition backend.
Install from Source Package¶
Before the npm registry release is completed, you can execute the following in the source directory:
npm pack
Install the generated .tgz file in DSH extension management, or via the CLI that supports desktop profiles:
dsh plugin --profile desktop add C:/path/dsh-desktop-tool-ocr-0.1.0.tgz
If the desktop version prompts that the profile is managed exclusively by Electron, please use the desktop extension management; do not start a separate server to install the plugin.
The package declares dsh.bundle.patch, which mounts the desktop-auto-ocr entry in the bundle. Override configuration in the profile’s cordis.patch.yml, for example:
- id: desktop-auto-ocr
config:
backendConfigFile: 'C:/path/recognition.json'
# Optional: Enhance only specific providers; default is to enhance all original providers
providers: [hth]
cacheSize: 64
If the loader requires a name, you can also specify name: dsh-desktop-tool-ocr. Do not mount the old temporary script and this plugin simultaneously (same entry ID).
After restarting or reloading, select hth · Auto Recognize / Local OCR (or another enhanced provider) in the input box; the model remains the original model. Old sessions will not switch automatically; you can set the default provider for new sessions to auto-vision--hth, etc.
Typical Usage¶
Default nbocr Configuration¶
Example recognition.json:
{
"type": "nbocr",
"command": "C:/path/to/nbocr.exe",
"model": "v6-tiny",
"language": "chinese",
"timeoutMs": 120000
}
Custom Local Command¶
{
"type": "command",
"command": "C:/tools/other-ocr.exe",
"args": ["--image", "{input}", "--output", "{output}"],
"output": "file",
"jsonTextPath": "result.text"
}
{input} / {output} will be replaced with the absolute paths of temporary files; it uses the argv array and does not go through a shell. Custom commands have local execution permissions and should only use trusted programs.
OpenAI-compatible Visual Interface¶
{
"type": "openai",
"allowRemote": true,
"baseURL": "https://your-provider.example/v1",
"model": "your-vision-model",
"apiKeyEnv": "OCR_VISION_API_KEY",
"timeoutMs": 120000,
"maxTokens": 2048
}
The key is read from DSH credentials or an environment variable with the same name; do not write it in JSON or the repository. After adding a new environment variable, the host may need to restart to read it.
Capability Verification (Optional)¶
In the config of desktop-auto-ocr, you can configure capabilityCheck (e.g., enabled, autoCorrect, ttlMs). Manual overrides remain effective when verification is disabled. It cannot be guaranteed that any new model will automatically look up or correct gateway aliases.
Applicable Scenarios and Notes¶
Who is this for? Developers who mainly work on the DSH 0.2.2-rc.1 desktop, need screenshots to go directly into conversations, and use both vision and non-vision models simultaneously. Those who wish to use local OCR as a fallback or switch online vision APIs on demand will find the independent recognition.json convenient for operations and maintenance (O&M).
Runtime and Security: The plugin runs with the permissions of the current DSH process; you should read the source code and the MIT license before installation. Recognition results are marked as untrusted image data and prompts within images should not be executed. OCR is not equivalent to layout or semantic understanding, so financial amounts, dates, etc., should be manually verified. After switching to allowRemote: true, historical images may also be sent out in subsequent non-vision requests; you must first confirm that the session data allows outbound traffic. Local command and custom backends bear the responsibility for credentials, timeouts, and data authorization.
Limitations: It does not support inferring capabilities based on the model name; errors will not silently degrade to a guessed response. Issues such as enterprise policies, remote image rejection, and corrupted attachments will still result in errors.
Links¶
- Community directory page: dsh-desktop-tool-ocr
- Source code and documentation: GitHub — huanglihome1996-rgb/dsh-desktop-tool-ocr
The community plugin index is provided by the maintainer and does not represent an official endorsement by DeepSeek. The DSH ecosystem advocates “everything is a plugin,” and the directory site has no affiliation with the official entity. After completing the installation and recognition.json configuration as per the README, you can reproduce the “paste image and ask” desktop workflow under the enhanced entry.