Adding speech recognition functionality to an agent in a DSH environment typically requires handling different audio input formats (links, Base64, file paths) and managing external API keys. The xby-asr-zh plugin addresses these specific needs by providing Chinese speech recognition capabilities.

Plugin Positioning

This is a Chinese speech recognition plugin categorized under “Model Inference” and maintained by xby-skill. It allows DSH processes to invoke speech recognition services directly, without requiring developers to build their own recognition backend.

Core Capabilities

The plugin provides the following core capabilities:

  1. set_xby_apikey: Sets an API key in the chat. This operation is automatically persisted and remains valid after restarting the DSH process.
  2. asr_paraformer_int8: Chinese speech recognition. When invoking this command, an audio file link (URL) must be provided.
  3. asr_paraformer_int8_for_data_base64: Chinese speech recognition. When invoking this command, the Base64-encoded audio file must be provided.
  4. asr_paraformer_int8_for_data_file: Chinese speech recognition. When invoking this command, the file path of the audio file must be provided.

Installation

It is recommended to install directly from GitHub. Installation from a local directory or a Patch file is also supported.

Use the following command to add the plugin to the specified profile:

dsh plugin --profile web add github:xby_skill/xby-asr-zh

Option 2: Install from a Local Directory (Development Mode)

This is only for local development and debugging. An absolute path to the local directory is required:

dsh plugin --profile web add /absolute/path/to/xby-asr-zh

Option 3: Develop and Debug with cordis.patch.yml

Use a Patch file for debugging:

dsh web --profile web --patch /absolute/path/to/dsh-ocr-plugin/cordis.patch.yml

Prerequisites

Before using this plugin, register on the Xiaobenyang official website and obtain an API key. Before invoking the speech recognition feature, you must set that key using the set_xby_apikey command.

Usage Examples

After installation, use the corresponding commands in DSH conversations or scripts.

Set the API Key

Enter the following in the chat:

set_xby_apikey <你的API密钥>

Invoke the Recognition Service

Depending on the audio source, choose the corresponding command format:

  • Audio file link:
    asr_paraformer_int8 https://example.com/audio.mp3
  • Base64 encoding:
    asr_paraformer_int8_for_data_base64 <音频数据的Base64字符串>
  • File path:
    asr_paraformer_int8_for_data_file /path/to/local/audio.wav

Notes

  • The plugin runs with the permissions of the current DSH process. It is recommended to check the source code and license before installation.
  • The plugin supports direct installation from GitHub or installation from a local directory.
  • Developers can use the cordis.patch.yml file for development and debugging.

References