dsh-switch
在输入框上方添加可自定义的快捷斜杠命令按钮 适合需要一键插入常用斜杠命令以提升输入效率的快捷操作用户。
同名包的其他仓库
安装
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:weimingyu9312/DSHSwitch说明文档
阅读完整 README ↗Usage
Configuring buttons
- Open the DSH Web GUI → Settings → Switch Buttons
- Click "+ Add button"
- Each card has two fields:
- Label: button text (e.g. "Plan Off")
- Slash command: the command to insert (e.g.
/plan off)
- 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
| Field | Type | Description |
|---|---|---|
id | string | Unique button identifier |
label | string | Button display text |
command | string | Slash command to insert |
mode | string | Fixed insert; legacy values (toggle/persistent/missing) are migrated automatically on read |
enabled | boolean | Whether the button is enabled |
Verification
- Switch buttons appear to the left of the composer
- Click Plan: with an empty input →
/planappears at the start; with existing content (e.g.research pricing) → it becomes/plan research pricing; Enter sends normally - 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
| Field | Type | Description |
|---|---|---|
id | string | Unique button identifier |
label | string | Button display text |
command | string | Slash command to insert |
mode | string | Fixed insert; legacy values (toggle/persistent/missing) are migrated automatically on read |
enabled | boolean | Whether the button is enabled |