Back to home

MDAwMg

dsh-user-prompt

A DeepSeek Harness (DSH) plugin: edit custom system prompt segments in the Web settings UI, assembled together with the default prompt. Multi-segment, custom order, drag-to-reorder.

Stars
0
Language
JavaScript
Created
Aug 16, 2026
Updated
Aug 16, 2026

Introduction

dsh-user-prompt

A DeepSeek Harness (DSH) plugin for writing your own system prompt segments in the Web settings UI. Each segment is appended to the default system prompt as a separate section; the default prompt itself is never modified. Supports multiple segments, custom order values, titles, drag-to-reorder and collapsible editors.

一个 DeepSeek Harness 插件,让你在 Web 设置界面里写自己的「自定义系统提示词」。写好的每段会作为独立段落,和 DSH 的默认系统提示词拼在一起发给模型,默认内容一点不动。

结构

文件角色
lib/index.js宿主半侧:注册 user-prompt settings 命名空间;把每段设置值作为 {{user_prompt_text_N}} 提示词变量,贡献为 user:prompt 系统提示词段(默认 order 50,位于 persona 之后、工具引导之前)
lib/client.js浏览器半侧:在设置页注册「自定义提示词」分区(settings.section slot),文本域绑定 user-prompt 命名空间
package.jsondsh.client 清单声明浏览器注入依赖

工作原理

  • 用户文本走提示词变量({{user_prompt_text_N}})注入,不走内联段落文本,所以文本里写 {{...}} 不会被当成提示词变量解析(renderPrompt 对替换值不再扫描)。
  • 设置一改(scope.watch),插件先卸掉旧段落再注册新段落,之后的模型请求立刻用上新内容。
  • 关掉「启用」或清空文本,就不注册段落,系统提示词回到默认。

界面功能

设置页里每段提示词有独立的启用开关、顺序号和可折叠的文本编辑区,想加几段加几段。

单击段标题(或按 Enter/Space)会变成输入框,可以给段落起个自定义标题;Enter 或失焦提交,Esc 取消。标题留空就显示「提示词段 N」。标题只在界面上看,不会进系统提示词。

顺序号旁边有个 ⓘ,悬停(或键盘聚焦)会弹出各顺序区间的用途:-100 以下身份区(勿用)、-100 身份、-98 Web 表面层、0 人格、50 用户自定义(默认)、100–199 工具引导。

每段的展开/收起状态存在浏览器 localStorage 里,关掉设置页再打开,布局还在(首次默认展开第一段)。

段首的 ⠿ 把手(启用开关左边)按住拖动可以调显示顺序,跟注入用的 order 数值互不影响;拖到目标行时会亮起高亮指示线。

安装

  1. 把本包复制到 profile 的 node_modules:

    Copy-Item -Recurse .\dsh-user-prompt $env:USERPROFILE\.dsh\profiles\node_modules\dsh-user-prompt
    
  2. $env:USERPROFILE\.dsh\profiles\web\cordis.patch.yml 追加一行加载条目:

    - insert:
        - id: user-prompt
          name: 'dsh-user-prompt'
    
  3. $env:USERPROFILE\.dsh\profiles\node_modules\@deepseek-ai\dsh-host-apiproxy\lib\index.jsWEB_SETTINGS_NAMESPACES 数组中加入 "user-prompt"(settings 命名空间暴露给浏览器是 api-proxy 的白名单决定,第三方插件无法自行声明;这是本部署唯一需要动发布包的一处)。

  4. 重启 Host(web profile 禁用了热更新,patch 与代码改动需重启生效)。重启后:

    • 设置 → 「自定义提示词」页面即可编辑;
    • 每次模型请求的系统提示词都会包含该段落(可在会话日志 session.jsonl.zstdrequest/header.system 字段验证)。

卸载

移除 cordis.patch.yml 的 insert、从 apiproxy 白名单去掉 "user-prompt"、删除 profiles\node_modules\dsh-user-prompt 目录,重启。

语法校验(无构建链)

node --check lib\index.js
node --check lib\client.js

已知限制

  • 需要改 dsh-host-apiproxy 包源码(白名单加一行);DSH 升级重装后这个补丁要重新打。
  • 设置 RPC 只走 loopback:远程浏览器能看不能写。
  • 文本里尽量别用 {{...}} 形式的花括号组(变量注入本身安全,只是避免歧义)。