Introduction

In DSH Web client usage scenarios, interrupting the currently generating turn typically requires clicking the “Stop Running” button on the interface. Ctrl+C is the most commonly used keyboard shortcut, but the browser’s default behavior is usually to copy text or be intercepted by the input method. This plugin aims to intercept Ctrl+C events so that, while DSH is in a generating state, the event behaves as an interrupt command, with the same effect as clicking the Stop button.

Plugin Overview

  • Name: maybemar/dsh-ctrl-c
  • Purpose: DSH Web client plugin
  • Maintainer: Maybemar
  • License: MIT

Core Features

  1. Interrupt the current turn: Press Ctrl+C during generation without selected text to immediately interrupt the current turn and display a confirmation prompt.
  2. Preserve normal copying: When text is selected on the page (page text or input box selection), pressing Ctrl+C performs normal copying and does not interrupt generation.
  3. Automatic queue resumption: After a successful interruption, if there were queued messages before the interruption, the system automatically re-enqueues the messages according to FIFO (First In, First Out) rules and wakes up the driver, enabling automatic resumption.
  4. No interference with other operations: It does not intercept key combinations such as Ctrl+Shift+C, Ctrl+Alt+C, or Ctrl+Cmd+C, nor operations during Chinese input method sequences.

Installation and Enablement

Install it using the official plugin command:

dsh plugin --profile web add github:Maybemar/dsh-ctrl-c

After installation, restart the dsh web process and refresh the page. If only the bundle content is modified, refreshing the page is sufficient for the changes to take effect.

Typical Usage

  • Interrupt generation: While content is being generated, press Ctrl+C (with no selected text) to immediately interrupt the current turn.
  • Copy text: Select text anywhere on the page and press Ctrl+C to perform normal copying.
  • Control automatic resumption: Run the following command in the browser console to disable the automatic resumption feature:
    localStorage["dsh.ctrlC.autoResume"] = "off"

Notes

  • Scope: This plugin only interrupts the currently opened session.
  • Plugin changes: Changes to the plugin collection require restarting dsh web.