weimingyu9312/DSHSwitch ↗★ 0

dsh-switch

在输入框上方添加可自定义的快捷斜杠命令按钮 适合需要一键插入常用斜杠命令以提升输入效率的快捷操作用户。

套件
dsh-switch
相容性
待驗證
版本
1.7.1
最近更新
2026年9月15日

同名套件的其他儲存庫

安裝

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:weimingyu9312/DSHSwitch

Usage

Configuring buttons

  1. Open the DSH Web GUI → Settings → Switch Buttons
  2. Click "+ Add button"
  3. Each card has two fields:
    • Label: button text (e.g. "Plan Off")
    • Slash command: the command to insert (e.g. /plan off)
  4. Toggle the switch to enable/disable; click × to delete

Default configuration

{
  "buttons": [
    { "id": "plan", "label": "Plan", "command": "/plan", "mode": "insert", "enabled": true },
    { "id": "plan-off", "label": "Plan Off", "command": "/plan off", "mode": "insert", "enabled": true }
  ]
}

Defaults apply only while the Host config has no buttons key yet; once you change anything, the stored value wins. To restore defaults, delete the dsh-switch: section from settings.yaml, clear the browser's localStorage, and restart.

Configuration fields

FieldTypeDescription
idstringUnique button identifier
labelstringButton display text
commandstringSlash command to insert
modestringFixed insert; legacy values (toggle/persistent/missing) are migrated automatically on read
enabledbooleanWhether the button is enabled

Verification

  1. Switch buttons appear to the left of the composer
  2. Click Plan: with an empty input → /plan appears at the start; with existing content (e.g. research pricing) → it becomes /plan research pricing; Enter sends normally
  3. The settings panel footer shows the slash-command reference list

When a command doesn't land in the input box

Ask the plugin itself what it sees, from the browser console (F12):

__dshSwitch.state()                // scopeBound / buttons / faces / draft / editorFound / editorPhase
__dshSwitch.log()                  // last 40 insertions: kind(setDraft|dom|no-editor|skip:stale-snapshot|…)/text/before/after
__dshSwitch.insert("/plan")        // run one insertion manually, check whether the draft gets the command

Common symptoms: faces: [] = the host slot did not deliver inputActions (older host version); insertion falls back to the DOM channel with reduced reliability. editorFound: false = the composer DOM changed and neither channel can write. Enable verbose logging with localStorage.setItem("dsh-switch-debug","1").

Default configuration

{
  "buttons": [
    { "id": "plan", "label": "Plan", "command": "/plan", "mode": "insert", "enabled": true },
    { "id": "plan-off", "label": "Plan Off", "command": "/plan off", "mode": "insert", "enabled": true }
  ]
}

Defaults apply only while the Host config has no buttons key yet; once you change anything, the stored value wins. To restore defaults, delete the dsh-switch: section from settings.yaml, clear the browser's localStorage, and restart.

Configuration fields

FieldTypeDescription
idstringUnique button identifier
labelstringButton display text
commandstringSlash command to insert
modestringFixed insert; legacy values (toggle/persistent/missing) are migrated automatically on read
enabledbooleanWhether the button is enabled