dsh-prompt-manager
Manifest validDSH (DeepSeek Harness) Prompt Manager: Organize prompts by tag groups and write them into the input box with one click; also use a large language model to optimize what you're currently writing in the input box. A DSH bundle: tag-grouped prompt library + AI prompt optimizer for the composer.
dsh-prompt-manager
给 DeepSeek Harness(DSH) 输入框加两件事:提示词库(一键把收藏的提示词写进输入框)和提示词优化(用大模型把输入框里正在写的东西改写得更清晰可执行,满意就一键替换)。
一个 bundle,Host 半边 + Client 半边,纯 JavaScript、无构建步骤、无依赖(Host 只用 node: 内置模块)。
功能
提示词库(工具栏「提示词」按钮)
- 一键写入:点列表条目 → 通过 composer 的
inputActions写入草稿区(不碰编辑器 DOM)。 - 两种写入方式(面板底部切换,跟随保存):
插入(光标处写入,输入框为空即整段写入)/替换(覆盖输入框全部内容)。 - 标签分组:一条提示词可以带多个标签(表单里用逗号分隔,如
小满, 报告);面板顶部一条标签栏列出所有标签和各自条数,点一下只看这个话题下的条目——同一话题写十几条也不乱。没填标签的归到「未分组」。 - 键盘操作:搜索框里
↑ / ↓移动高亮,Enter直接把该条写进输入框(手不离键盘)。 - 管理:新建 / 编辑(标签随编辑改)/ 另存副本(同话题复制一条改几处)/ 删除(二次确认,再点一次确认)/「清空输入框」。
- 搜索:按名称、正文和标签一起过滤,与当前选中的标签叠加生效。
- 持久化:本机
localStorage(键dsh.prompt-manager.v1),收藏标记一并保存。首次安装预置 4 条。
提示词优化(工具栏「优化」按钮)
- 取当前输入框内容 → 交给配置好的大模型改写 → 面板里给出原文 / 优化后对照。
- 默认先预览,点「替换输入框」才写入;也可在设置里打开「优化后直接替换输入框」,成功即替换(面板里仍可「撤销替换」回去)。
- 「再优化一次」「测试连接」;接口地址 / 模型 / Key / 自动替换都在面板的「设置」里改,不用改配置文件。
- 改写用一条固定的中文元提示词(见 index.js 的
SYSTEM_PROMPT),规则:只改写不回答任务、不编造事实、原样保留代码/路径/命令/报错、缺信息写成「先向我要」而不是向用户索要、长度以够用为限(原文短就不膨胀)。
架构
Host 半边负责出网调用与凭据,Client 半边只做 UI —— 浏览器侧因此不需要 CORS,API Key 也不进浏览器:
| 路由(仅本机回环可访问) | 作用 |
|---|---|
GET /api/prompt-manager/config | 读设置;永不返回 Key,只返回是否可用及来源 |
POST /api/prompt-manager/config | 存设置(接口地址 / 模型 / 凭据名 / Key / 自动替换 / 温度) |
POST /api/prompt-manager/optimize | 用配置的服务商改写一段文本 |
- 设置文件:
$DSH_HOME/prompt-manager.json(默认~/.dsh/prompt-manager.json),每次请求重新读取,改配置不用重启。 - Key 解析顺序:设置里的字面 Key → 环境变量
keyRef→~/.dsh/.credentials.yaml里同名的凭据。所以复用 DSH 里已经配好的凭据(例如ZHIPU_API_KEY)不必再复制一份密钥。 - Client 半边注册进
conversation.input.left(输入框左下工具栏),两个条目:prompt-manager(提示词库)与prompt-optimizer(优化)。
安装
前提:DSH 0.2.0-rc.x(ctx.slots、composer 的 inputActions、ctx.webServer)。
git clone <本仓库> dsh-prompt-manager
然后在 DSH 里用内置插件管理器安装(把 target 换成本机 clone 的绝对路径):
plugin_manager install_bundle target = /abs/path/to/dsh-prompt-manager
plugin_manager remove_bundle target = @local/dsh-prompt-manager
- profile 会以链接方式挂载本目录,改源码即改插件本体。
- Client 半边(
client.js)热更新;Host 半边(index.js)需要重启一次 DSH(宿主模块只在新进程启动时加载)。重启前点「优化」会看到「插件的宿主半边要重启一次 DSH 才会生效」的提示。 - 手工挂载同样可以:把
cordis.patch.yml里的那一行合并进 profile 的cordis.patch.yml。
配置服务商
任何 OpenAI 兼容的 /chat/completions 端点都能用。面板「设置」里有几个预设:
| 预设 | 接口 | 凭据名 |
|---|---|---|
智谱 glm-4.5-flash | https://open.bigmodel.cn/api/paas/v4 | ZHIPU_API_KEY |
智谱 glm-5.3-flash | 同上 | 同上 |
阿里云百炼 qwen-flash | https://dashscope.aliyuncs.com/compatible-mode/v1 | DASHSCOPE_API_KEY |
Google gemini-2.5-flash | https://generativelanguage.googleapis.com/v1beta/openai | GEMINI_API_KEY |
模型 id 以服务商控制台为准,可直接在设置里改。
实测对照(Windows 桌面版 DSH 0.2.0-rc.2,同一句原文「我那个脚本跑不起来,报错 ModuleNotFoundError,帮我看看怎么回事」):
- 智谱
glm-4.5-flash(免费):约 8 s →我的脚本运行时出现 ModuleNotFoundError 错误,请帮我分析原因并提供解决方案。 - 智谱
glm-5.3-flash:约 10 s →我的脚本运行失败,报错 ModuleNotFoundError。请帮我定位原因并修复。脚本代码和报错全文我还没有提供,需要的话先向我要 <脚本代码> 和 <报错全文>,再开始排查。
需要走代理的服务商(Google / OpenRouter / Groq 等):给 DSH 进程设 HTTPS_PROXY 与 NODE_USE_ENV_PROXY=1 再启动。
开发
node --check client.js && node --check index.js
# 不碰运行中的 DSH,用假 ctx + 真 HTTP 服务器跑通三条路由(含真实模型调用)
node dev/host-harness.mjs '帮我看看这个报错,顺便优化一下'
PM_MODEL=glm-5.3-flash node dev/host-harness.mjs '换模型对比'
# 列某个 OpenAI 兼容中转/服务商能用的模型 id
node dev/list-relay-models.mjs <凭据名> https://your-endpoint/v1
# UI 半边的无浏览器自测:假 hooks 跑一遍面板/页签/星标/表单,不需要 React
node dev/render-check.mjs
dev/host-harness.mjs 会读写 $DSH_HOME/prompt-manager.json;想隔离测试就把 DSH_HOME 指到一个临时目录。
结构
| 文件 | 作用 |
|---|---|
package.json | bundle 清单:dsh.bundle.patch + dsh.client(platform: web, immediately)、icon、exports["./client"] |
cordis.patch.yml | 唯一一条 Host 行(id: prompt-manager) |
index.js | Host 半边:三条回环 JSON 路由 + 元提示词(只用 node: 内置模块,因为插件是链接进 profile 的,裸包名解析不到) |
client.js | Client 半边:两个工具栏条目与各自的面板 |
dev/ | 自测脚本(不随 profile 加载):render-check.mjs 用假 hooks 跑无头渲染断言 |
locale/{zh,en}.json | 插件卡片标题与描述 |
icon.svg | 插件图标 |
已知边界
- 词库、「自动替换」等设置是浏览器本机数据;换机器、清浏览器数据会丢。
- 优化是改写,不是执行:不会替你跑任务,也不回答任务本身。
- 输入框里若是
@文件引用芯片,优化后按剪贴板文本(@path)写成纯文本,芯片结构不再保留。 - 只有浏览器侧 UI 与三条本机路由,没有面向模型的工具(tool)。
- 包名
@local/...是按 DSH 本地 bundle 的惯例取的(工作区目录安装)。要发 npm 需要换个 scope 并重新安装。
License
MIT,见 LICENSE。
English (brief)
A DSH (DeepSeek Harness) bundle that adds two controls to the composer tool row:
- Prompt library (
提示词): a click-to-insert list of saved prompts organised by tags — one chip per topic, several prompts under each, an "Ungrouped" bucket for the rest. Create/edit/delete, "save as copy", search across names, text and tags, and ↑↓/Enter keyboard selection — persisted in the page'slocalStorage. - Prompt optimizer (
优化): rewrites whatever is in the composer through any OpenAI-compatible/chat/completionsendpoint and, after your confirmation (or automatically), replaces the draft. Host-side routes keep the API key out of the browser; the key is read from the plugin config, an environment variable, or~/.dsh/.credentials.yaml.
Install with the built-in plugin manager (install_bundle pointing at the cloned directory). The client half hot-reloads; the host half loads on the next DSH start. MIT licensed.
Comments
Loading…
Similar plugins
by master1Sun
DSH(DeepSeek Harness)Web 插件:在 composer 工具栏注入一个「提示词库」按钮,管理可复用的 prompt 片段,点击即可插入当前输入框。支持自动学习:输入复杂 prompt 文案时,插件会自动识别并保存到提示词库。
★ 16
↓ 538/wk
MIT
TypeScript
Oct 20, 2026
dsh plugin --profile web add @sunjuntao/dsh-prompt-libraryby yi-yezhiqiu
DeepSeek Harness 提示词市场插件:对话框内一键浏览、搜索、收藏提示词,选中即写入输入框。零后端、免构建、数据只存本机。 | A prompt marketplace for DSH: browse, search and insert prompts straight into the composer.
★ 111
↓ 269/wk
MIT
JavaScript
Oct 11, 2026
dsh plugin --profile web add dsh-prompt-marketby JoukoPuro
一个 DeepSeek Harness(DSH)插件: 在 Web 输入框的工具行中添加一个 ✨ 图标按钮。点击后选择打磨风格,已接入的大模型 会把你草稿中的提示词改写得更专业、更易被 AI 理解 。A DeepSeek Harness plugin: icon-only composer button that rewrites your prompt via the connected LLM
★ 8
↓ 121/wk
MIT
JavaScript
Oct 17, 2026
dsh plugin --profile web add dsh-prompt-polishby kee0012
DSH 提示词优化插件:输入框工具栏一键 ✨ 优化(直接写回可还原),风格/上下文/还原等设置收纳进 ▾ 弹出层。
★ 2
↓ 356/wk
MIT
JavaScript
Oct 13, 2026
dsh plugin --profile web add dsh-prompt-optimizerby naitoupi
DeepSeek Harness (DSH) plugin: ? optimize the composer draft with the current model. Installable bundle (dsh.bundle + dsh.client); Settings tab: on/off switch, generation params, editable system promp
★ 0
MIT
JavaScript
Sep 21, 2026
dsh plugin --profile web add prompt-optimizer-pluginby xiong356
为 DeepSeek Harness (DSH) 打造的输入框草稿优化插件:点一下 ✦,用当前默认模型把提示词草稿改得更完整、更有效,原地替换、绝不自动发送。
★ 1
MIT
JavaScript
Nov 6, 2026
dsh plugin --profile web add dsh-draft-optimizer