Introduction

Below the status bar in dsh web, there is a line of statistics, and the cache hit rate is one of them. By default, this value is not displayed to two decimal places, making it insufficient for observing subtle changes between adjacent rounds.

To modify such displays, directly editing the code in the dsh installation directory is one approach, but the changes become entangled with the upstream environment, making maintenance difficult. DSH’s philosophy is “everything is a plugin,” and small interface tweaks like this are perfectly suited for plugin solutions. Below is an introduction to such a plugin: dsh-cache-hit-precision, authored by luern0313.

Plugin Introduction

dsh-cache-hit-precision targets the dsh web platform (dsh.client.platform in package.json is web), current version 1.0.0, open source under the MIT license. In a single sentence, it does this: forces the cache hit rate displayed below the status bar to show two decimal places.

Specifically:

  • The only change is the stats.cacheHit item: recalculating the precise percentage from the tokenUsage projection, and outputting it with two decimal places.
  • Stats items such as rounds, steps, duration, TTFT, tokens, etc., are displayed as usual and remain unchanged.
  • Interface text automatically follows the current language, supporting Chinese / English.
  • Non-intrusive: does not modify the dsh installation directory or any upstream packages.

How It Works

The plugin uses dsh’s slot shadow mechanism to wrap the original StatsLine component, replacing only the localization parameter for stats.cacheHit: recalculating the precise cache hit percentage from the tokenUsage projection and outputting it with two decimal places.

Other data items are not processed and directly inherit the display logic of the original component. Therefore, the statistics row looks identical to the original, with only the hit rate item having additional decimal places.

Installation and Usage

The plugin targets the web platform, and installation commands all include --profile web. Choose any one of the following three methods; after installation, you must restart dsh web for it to take effect.

  1. Install from GitHub:
dsh plugin --profile web add github:luern0313/DSH-Cache-Hit-Precision
  1. Install locally. First clone the repository, then add from the local path:
git clone https://github.com/luern0313/DSH-Cache-Hit-Precision.git
dsh plugin --profile web add ./DSH-Cache-Hit-Precision
  1. Manual installation when not using pnpm. First create a directory and symlink the repository into it:
mkdir -p ~/.dsh/profiles/web/node_modules
ln -sfn /path/to/DSH-Cache-Hit-Precision ~/.dsh/profiles/web/node_modules/dsh-cache-hit-precision

Replace /path/to/DSH-Cache-Hit-Precision with the actual repository path. Then append to the end of ~/.dsh/profiles/web/cordis.patch.yml:

- insert:
    - id: cache-hit-precision
      name: dsh-cache-hit-precision

Note the distinction between the two names: the GitHub repository name is DSH-Cache-Hit-Precision, and the package name is dsh-cache-hit-precision. When installing manually, the symlink target name must use the latter.

After installation, restart:

dsh web

Applicable Scenarios and Notes

The target audience is clear: users who need to precisely read the cache hit rate in dsh web and are concerned with changes in decimal places. If you do not typically look at this value, the benefit of installing it is limited.

Before installing, there are a few points to confirm:

  1. The plugin will run with the permissions of the current dsh process. Before installing any third-party plugin, it is recommended to read the source code in the GitHub repository and confirm the license (this project is MIT) before deciding whether to install.

  2. The plugin declares the platform as web, and installation commands all use --profile web.

  3. After installation, you must restart dsh web for it to take effect.

Summary

dsh-cache-hit-precision solves only one problem: precisely displaying the cache hit rate below the status bar to two decimal places, while keeping other displays as they are and not modifying any dsh installation files. The installation cost is simply one command plus a restart.

  • Community Plugin Directory: https://www.skillhub.cn/plugins/luern0313/DSH-Cache-Hit-Precision
  • GitHub Repository: https://github.com/luern0313/DSH-Cache-Hit-Precision