Introduction

When writing prompts, configurations, or long texts in the DSH Web interface, typing is not the only way. If you want spoken content to appear directly in the input box without relying on external speech interfaces, you can integrate a local ASR. dsh-funasr-voice is designed for this scenario: the browser collects the microphone, the host side launches a local FunASR + SenseVoiceSmall for recognition, and then fills the text into the DSH input box.

What is this

dsh-funasr-voice is a local offline speech input plugin for DSH Web, maintained by fenglin-ai, under the MIT license. It splits voice input into two parts: the browser side handles microphone collection and button status display, while the host side is responsible for semi-automatically launching the local FunASR + SenseVoiceSmall recognition service and filling the recognition results into the input box.

Core Capabilities

The following capabilities revolve around “less window switching and real-time text output while speaking”:

  • Click to start, then click to stop; toggle between continuous dictation modes. VAD automatically segments sentences, outputting text as you speak.
  • Real-time display of recording duration next to the button while recording.
  • Recognized text is automatically filled into the draft; optionally, it can be sent automatically after recognition.
  • SenseVoice event/emotion emojis at the beginning or end of sentences are automatically stripped.
  • One-click installation via the settings page: automatically creates venv, installs funasr + torch, and downloads the SenseVoiceSmall model.
  • Supports automatic detection of Python and models, or manual path entry.
  • ASR runs on the local CPU; SenseVoice RTF is approx 0.07, about 10x real-time.
  • Supports GUI or YAML configuration for python, model, enabled, basePath, port, language, useItn, and autoSend.

Installation and Enablement

First, install the plugin. According to the official command, hand the plugin directory or repository address to the DSH plugin manager:

dsh plugin --profile <your-profile> add <this-plugin-directory-or-repo-url>

After installation, restart DSH, then enter:

DSH Settings → General → Voice Input

Click “Install”; the plugin will automatically create venv, install funasr + torch, and download the SenseVoiceSmall model. After completion, click the microphone icon on the right side of the input box to start dictation. The first time, it will request microphone permission; just allow it.

Manually Prepare FunASR Environment

If you already have a FunASR environment or want to control the installation location yourself, you can first prepare a standalone venv and model directory, then fill in the python and model back into the plugin configuration. The following uses macOS as an example:

# 1. Create standalone venv
python3 -m venv ~/Documents/ASR/funasr/.venv
source ~/Documents/ASR/funasr/.venv/bin/activate

# 2. Install FunASR
pip install --upgrade pip
pip install funasr

# 3. Prepare model directory
mkdir -p ~/Documents/ASR/funasr/models
cd ~/Documents/ASR/funasr/models

Model downloads can be done using ModelScope or HuggingFace:

# ModelScope
python -c "from modelscope import snapshot_download; snapshot_download('iic/SenseVoiceSmall', local_dir='SenseVoiceSmall')"

# HuggingFace
pip install huggingface_hub
python -c "from huggingface_hub import snapshot_download; snapshot_download('FunAudioLLM/SenseVoiceSmall', local_dir='SenseVoiceSmall')"

After preparation, you need to record two paths:

python: ~/Documents/ASR/funasr/.venv/bin/python
model: ~/Documents/ASR/funasr/models/SenseVoiceSmall

Fill these two paths into the plugin’s python and model configurations. You can also use “Auto-detect Python and Model” in the settings.

Configuration

python and model are required fields: they are the python interpreter for the FunASR venv and the SenseVoiceSmall model directory, respectively. The plugin source code does not come with personal paths by default, usually defaulting to python: python3 and model being empty.

It is recommended to use the GUI for configuration: go to DSH Settings → General → Voice Input, and after clicking “Install”, it will automatically write the available paths. The configuration is persisted to:

~/.dsh/dsh-funasr-voice.json

This file takes precedence over YAML configuration.

You can also override it in your profile’s cordis.patch.yml:

# ~/.dsh/profiles/<your-profile>/cordis.patch.yml
- id: dsh-funasr-voice
  config:
    python: /your/FunASR/.venv/bin/python
    model: /your/SenseVoiceSmall/model-directory

Configurable fields are as follows:

Field Default Description
enabled true Master switch
basePath /funasr-voice HTTP route prefix (usually don’t change)
python python3 Python interpreter for FunASR venv (Required)
model Empty SenseVoiceSmall model directory (Required)
port 18765 Local ASR service port
language auto auto / zh / en / ja / ko / yue
useItn true Inverse Text Normalization
autoSend false Send automatically after recognition

Runtime Environment

Before using the plugin, it is recommended to confirm that the local machine meets the following requirements:

  • DSH Desktop 2.0.2, this is the development/test version of this plugin.
  • Node ≥ 20.
  • Python venv + FunASR 1.4.x + torch.
  • SenseVoiceSmall model loaded locally offline.

The first recognition requires about 2-3 seconds to load the model; afterwards, the service runs persistently and is reused.

macOS Known Issues

macOS users please note: DSH Desktop 2.0.2 has a microphone permission bug where it gets a silent stream, manifesting as “recording but not recognizing, no response in the input box”. Before using, you must patch DSH Desktop first; the “Known Bugs and Fixes” section in the repository README provides instructions on how to handle this.

Applicable Scenarios and Notes

This plugin is suitable for the following scenarios:

  • Use voice instead of keyboard input in DSH Web input boxes.
  • Want ASR to run on the local CPU.
  • Need to fill recognized text directly into the draft, with the option to auto-send.
  • Already have or are willing to manually prepare a FunASR + SenseVoiceSmall local environment.

Note: The plugin runs with the permissions of the current dsh process. It is recommended to check the source code and MIT license before installation; the installation process downloads models, so please reserve disk space. If used for production, it is recommended to explicitly fill in python and model in your profile to avoid relying on automatic detection results.

Links

  • GitHub: https://github.com/fenglin-ai/dsh-funasr-voice
  • Community Directory Page (Plugin Clue): https://www.skillhub.cn/plugins/fenglin-ai/dsh-funasr-voice