When developing DeepSeek Harness (DSH)-based agents, external OCR capabilities often need to be integrated. This plugin integrates SimpleTex’s “Formula Recognition” and “General OCR” into the DSH Web GUI. It registers a model tool named simpletex_recognize and provides complete input interaction components.

Plugin Introduction

Installation and Activation

Installing the plugin requires internet access. After installation, the Web service must be restarted.

dsh plugin --profile web add https://github.com/Huoer9527/dsh-simpletex-ocr.git
dsh web

Core Features

The plugin primarily addresses the insufficient image recognition capabilities in the DSH ecosystem. It provides the following capabilities:

  1. Tool Registration: Registers the simpletex_recognize model tool in the DSH Web GUI.
  2. Three-Component Interaction: Supports drag-and-drop/paste image input in the input box, in-chat thumbnails, and a GUI configuration card.
  3. Three Modes:
    • formula: Returns LaTeX-formatted results with confidence.
    • text: Returns Markdown-formatted results.
    • auto (default): Automatically determines whether to recognize content as a formula or text based on the question parameter.
  4. Security Validation: Validates image type and size before upload.
  5. Secure Storage: The repository contains no API keys. The API Key is only written to the credential service.

Configuring API Key

Before use, you need to apply for a SimpleTex API Key (referred to as Token on the official website, in a format starting with AT).

  1. Open the SimpleTex official website to register and log in.
  2. Apply for an API Token (starting with AT) in the account/console.
  3. Copy the Token.

Configure it in the DSH Web GUI:

Open Settings → Plugin Configuration → SimpleTex OCR, paste the Token into the password field, and save. The plugin writes the Key to the credential service SIMPLETEX_TOKEN and does not store it in plaintext in the settings file.

Tool Usage

The tool name is simpletex_recognize. Invocation parameters are as follows:

Parameter Type Required Description
image string Yes Local image path, URL, or attachment reference
task string No formula / text / auto; default is auto
question string No Used to determine recognition type in auto mode

Examples:

// 识别公式
simpletex_recognize({ image: '公式.png', task: 'formula' })

// 默认自动识别
simpletex_recognize({ image: '截图.png' })

// 指定识别任务
simpletex_recognize({ image: '公式.png', task: 'auto', question: '把公式转成 LaTeX' })

Return Format:
* formula mode: Returns { engine, task: 'formula', text: LaTeX, conf: confidence }
* text mode: Returns { engine, task: 'text', text: Markdown }

Ecosystem and Notes

  • Updates Take Effect: After modifying settings.yaml or configuring the API Key, you must restart dsh web for changes to take effect.
  • Permissions and Security: The plugin runs with the permissions of the current DSH process. It is recommended to review the source code and license before installation.
  • Directory Index: This plugin is listed in the community directory https://www.skillhub.cn/plugins/Huoer9527/dsh-simpletex-ocr.