dsh-math-input: DeepSeek Harness Zero-Token Offline Math Input Plugin

The Composer in DeepSeek Harness (DSH) defaults to plain text input. When formulas are required for model reasoning, manual LaTeX input is usually needed, which is cumbersome and error-prone. dsh-math-input provides DSH with zero-token consumption offline math input capabilities, supporting handwriting recognition, screenshot OCR, and LaTeX editing. All inference is performed in the browser.

Plugin Overview

dsh-math-input is a DeepSeek Harness plugin that provides zero-token consumption offline math input capabilities. The plugin is maintained by xiaxi626, is licensed under MIT, and is a model reasoning tool.

Core Capabilities

The plugin mainly provides the following features:

  • Handwriting recognition: Based on the CoMER ONNX model, it supports input via mouse, touch, or stylus.
  • Screenshot OCR: Extracts LaTeX from images and supports pasting with Ctrl+V or uploading a file.
  • LaTeX editor: Provides a symbol palette to easily insert Greek letters and math templates.
  • Inline rendering: Entering \[ ... \] renders the formula.
  • Zero consumption and offline: All inference is performed in the browser, does not rely on remote APIs, and does not consume tokens.

Installation and Activation

Before installing, ensure the following environment requirements are met:

  • DeepSeek Harness version >= 0.1.1-rc.2
  • Node.js version >= 20.0.0
  • The browser supports SharedArrayBuffer and WebGPU (Chrome or Edge is recommended)

Run the following command to install:

dsh plugin --profile web add github:xiaxi626/dsh-math-input

After successful installation, restart the DSH Web process, and a + button will appear on the left side of the input line.

Typical Usage

Click the + button on the left side of the input line to open the menu, then select the corresponding feature:

  1. Handwritten input

    • Click “Handwritten input” and draw the formula on the canvas.
    • Pause for about 1.5 seconds (adjustable in settings) to trigger automatic recognition.
    • After the preview is generated, click “Confirm and Insert,” and the formula is added to the Composer in the form \[ ... \].
  2. Screenshot OCR

    • Click “Screenshot and Recognize.”
    • Press Ctrl+V to paste an image, or click “Upload File.”
    • The plugin automatically extracts LaTeX; insert it after confirmation.
  3. LaTeX editor

    • Click “LaTeX Syntax Editor,” and the panel expands.
    • Use the symbol palette (Greek letters, fractions, radicals, etc.) to insert code.
    • Preview it in real time on the right, then click “Insert” to write the formula.
  4. Inline rendering

    • Enter \[x^2 + y^2 = r^2\] in the Composer, and the system will automatically render it as a formula.

Notes and Limitations

  • Dependency environment: The first recognition will download a model of about 7.2 MB (cached in IndexedDB); subsequent loads use the cache.
  • Browser support: A modern browser that supports WebAssembly SIMD is required. If WebGPU is selected but not supported, the engine will automatically fall back to WASM.
  • Cache cleanup: The cache in IndexedDB is not cleared automatically; you must manually delete the math-handwrite-models database in browser developer tools.
  • Recognition accuracy: The CoMER model is optimized for handwritten formulas; printed formulas or complex layouts may not be recognized well.
  • Security: When relying on SharedArrayBuffer, the Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy headers must be set.

Summary

With this plugin, developers can quickly input high-quality mathematical formulas without consuming tokens, improving development and debugging efficiency. For more details, refer to the plugin catalog page or the GitHub repository.

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

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

Xiaoye