The DSH Web interface provides the basic capability for API balance monitoring. The original widget has complete functionality but a fixed appearance. fiven577 modified it based on the original, replacing the desktop pet image with the character “Sankou” (三口), and added voice interaction, state machine logic (angry/stuffed), and transparent animation. It is suitable for developers who need a personalized desktop pet for balance monitoring.

Feature Overview

Based on the core capabilities of the original version, this plugin adds the following features:

  • Persistent auto-start: It automatically appears in the bottom-right corner when the DSH Web interface opens.
  • Balance monitoring: Supports 60s automatic refresh and manual refresh by clicking. Balance changes include a rolling number animation; supports two “used today” modes: “Little Whale Bookkeeping” and “Realtime Tokens”.
  • Interaction and operations: Supports dragging and edge snapping, pressing Q-bounce effect, and hamburger menu (adjust size/volume/bubble on-off).
  • Peak/off-peak copy: Supports three copy skins: “Default / 梁文峰谷 / !?强强?!”, and includes peak/off-peak pricing functionality.
  • Random lines and animated images: The desktop pet displays random line speech bubbles and shows the rua.gif animated image.
  • New in the Sankou skin version:
    • Custom appearance: The desktop pet body is replaced from a whale with a transparent standing portrait of the character “Sankou” (the image in assets/DSniang1.png can be replaced).
    • Voice interaction: Click to play sound effects; sound effects play synchronously when consumption prompts appear.
    • Angry state: If clicked ≥6 times within 2 seconds, the image switches to the angry state and plays voice.
    • Balance alert (stuffed): Supports fixed thresholds or custom amounts (0.1–1000). After cumulative consumption reaches the threshold, the image switches to the stuffed state and a speech bubble prompt appears.
    • Eating transparent animation: Each round of consumption prompt plays an eating animation with Alpha; if loading fails, it falls back to sound only.
    • State coordination: Angry and stuffed states are mutually exclusive, the eating animation can be interrupted, and menu state desynchronization and pixel occlusion issues have been fixed.

Installation and Enablement

Before installation, make sure DEEPSEEK_API_KEY is configured (required to fetch the balance), and DSH Desktop / dsh CLI / pnpm are installed.

  1. Run the following command to install the plugin:
dsh plugin --profile web add github:fiven577/dsh-whale-widget-sankou
  1. After installation is complete, fully exit and restart DSH Desktop, then refresh the page. The desktop pet will appear in the bottom-right corner.

  2. Verify the installation:

curl http://127.0.0.1:3080/dsh-whale/balance.json
curl http://127.0.0.1:3080/dsh-whale/image.png

Usage

  • View balance and today’s usage: Click the desktop pet to view.
  • Switch peak/off-peak lines: Click the speech bubble that pops up from the desktop pet. About 45% probabilities random lines such as “The current time period is” may appear.
  • Trigger angry state: Rapidly click the desktop pet more than 6 times within 2 seconds. The image will switch to the angry state and play voice.
  • Set stuffed alert: Click the desktop pet to open the hamburger menu, go to the “Balance Alert” option, and select a preset threshold or manually enter an amount from 0.1 to 1000.
  • Change sound effects: In the “Sound Effects” option of the hamburger menu, select “Voice · Click (Um?)”, “Little Yellow Duck”, or “Sound Effect 1”.

Notes

  • The plugin code is released under the MIT license, but custom assets (appearance images, voice, and animations) are original works by the author. When redistributing assets, keep the description and credit the source.
  • If animation loading fails, it silently falls back to playing sound effects only.
  • To restore the original whale appearance, simply replace it with the original assets/DSniang1.png.
  • The plugin runs with the permissions of the current DSH process. Please ensure the source code and license comply with usage norms.