1847123733/dsh-prompt-optimize
DeepSeek Harness (DSH) Web 插件:提供 提示词优化、用户提问锚点,以及右下角的 DeepSeek API 悬浮用量卡片。
catalog 简介 / catalog descriptioncatalog description:DSH Web plugin: web ui
编辑导读Editor's Brief
## 核心特性
- Prompt 优化会读取当前草稿,在按钮上显示加载状态,使用默认 provider 和 model 生成改写结果,在按钮上方的气泡中预览结果,仅在选择 Apply 后写入输入框。
- 用户问题锚点会按对话顺序收集用户消息和已接受的追问,在右侧显示带问题数量的锚点面板,悬停或键盘聚焦时显示完整文本,并平滑滚动到所选用户消息。
- 悬浮的 DeepSeek API 用量胶囊显示在右下角,悬停或点击后展开,展示已配置的 key 名称、脱敏标识符、今天、昨天和最近七天的消耗,并单独显示账户余额。
- 用量数据复用 DSH 模型设置中存储的 DEEPSEEK_API_KEY,每 60 秒自动刷新或手动刷新,并且完整 API key 和平台 token 仅在 DSH host 端解析,不会返回给浏览器。
## 使用场景
- 在 DSH Web 聊天会话中发送前优化 prompt。
- 通过锚点面板定位此前的用户问题,在长对话中快速导航。
- 在使用 Web 界面时监控 DeepSeek API 余额和 key 级消耗。
## 技术细节
- 该插件通过 dsh plugin add 从 GitHub、本地路径或 npm 安装到 DSH web profile,并在安装或移除后需要重启 web profile。
- 运行时依赖包括 host 的 llm 和 webServer 服务、client slots 的 input-area 集成,以及 DSH 设置中可用的 LLM。
- Prompt 优化行为可通过 cordis.patch.yml 或 profile patch 设置修改 provider、model、最大输入字符数、最大输出 tokens 和 temperature。
- 账户余额从公开的 DeepSeek 用户余额 endpoint 获取,而单 key 成本使用通过 sensitive_id 和 tracking_id 匹配的平台用量 endpoint。
## 注意事项
- 单 key 用量展示依赖 DeepSeek 平台内部接口,当登录状态过期、WAF 拦截访问或接口变化时可能失效。
- 环境变量或 DSH credential provider 可以覆盖内置默认的 DEEPSEEK_PLATFORM_TOKEN,token 值可包含或省略 Bearer 前缀。
- 用量金额按 GMT+8 自然日计算,平台数据可能延迟约五分钟。
## Core Features
- Prompt optimization reads the current draft, shows a loading state on the button, generates a rewrite with the default provider and model, previews the result in a bubble above the button, and writes to the input box only after Apply is selected.
- User question anchors collect user messages and accepted follow-up questions in conversation order, display an anchor panel on the right with a question count, reveal full text on hover or keyboard focus, and scroll smoothly to the selected user message.
- The floating DeepSeek API usage capsule appears in the lower-right corner, expands on hover or click, and shows the configured key name, masked identifier, spending for today, yesterday, and the last seven days, with account balance displayed separately.
- Usage data reuses the DEEPSEEK_API_KEY stored in DSH model settings, refreshes automatically every 60 seconds or manually, and keeps full API keys and platform tokens parsed only on the DSH host side rather than returning them to the browser.
## Use Cases
- Optimizing a prompt before sending it in a DSH web chat session.
- Navigating long conversations by locating prior user questions through the anchor panel.
- Monitoring DeepSeek API balance and key-level spending while using the web interface.
## Technical Details
- The plugin is installed into the DSH web profile with dsh plugin add from GitHub, a local path, or npm, and requires restarting the web profile after installation or removal.
- Runtime dependencies include the host llm and webServer services, the client slots input-area integration, and an available LLM configured in DSH settings.
- Prompt optimization behavior can be changed through cordis.patch.yml or profile patch settings for provider, model, maximum input characters, maximum output tokens, and temperature.
- Account balance is fetched from the public DeepSeek user balance endpoint, while per-key cost uses a platform usage endpoint matched by sensitive_id and tracking_id.
## Notes
- The per-key usage display depends on an internal DeepSeek platform interface that may stop working when login state expires, a WAF blocks access, or the interface changes.
- Environment variables or the DSH credential provider can override the bundled default DEEPSEEK_PLATFORM_TOKEN, and the token value may include or omit the Bearer prefix.
- Usage amounts are calculated by GMT+8 calendar days, and platform data may be delayed by about five minutes.
安装Install
dsh plugin --profile web add dsh-prompt-optimize
把 1847123733/dsh-prompt-optimize 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
dsh-prompt-optimize
DeepSeek Harness (DSH) Web 插件:提供 提示词优化、用户提问锚点,以及右下角的 DeepSeek API 悬浮用量卡片。
- 读取当前草稿
- 点击后图标 loading(不弹全屏窗)
- 默认用
deepseek-official/deepseek-v4-flash改写 - 完成后在按钮上方 气泡预览
- 点 应用 才写入输入框
用户提问锚点
- 自动按对话顺序收集用户提问及已接纳的追加提问(不混入助手回答)
- 问答页右侧显示轻量锚点,顶部标注提问数量
- 鼠标悬浮或键盘聚焦时显示完整提问内容
- 点击后平滑滚动到对应的用户消息
- 窄屏下自动移到输入区上方并改为横向排列
DeepSeek API 悬浮用量
- 复用 DSH 在“设置 → 模型”中保存的
DEEPSEEK_API_KEY,无需重复配置 - 页面右下角显示轻量悬浮胶囊,悬浮或点击后展开卡片
- 显示当前配置 Key 的名称、脱敏标识,以及今天、昨天、最近 7 天消费金额
- 账号余额单独展示,不再与单个 Key 的消费混淆
- 每 60 秒自动刷新,也支持手动刷新
- 完整 API Key 和平台 Token 仅在 DSH 宿主端解析,不会返回浏览器
- 余额来自公开接口
GET https://api.deepseek.com/user/balance - 单 Key 消费来自平台内部接口
GET https://platform.deepseek.com/api/v0/usage/by_api_key/cost,按返回的sensitive_id匹配当前 Key 的tracking_id
配置单 Key 用量
平台用量接口使用 DeepSeek 开放平台的登录态,不接受普通 sk-... API Key。插件源码内
包含一个默认平台 Token;如需替换,可通过 DSH 凭据提供器或环境变量覆盖:
DEEPSEEK_PLATFORM_TOKEN=<Usage 页面请求中 Authorization 的 Bearer 值>
DEEPSEEK_PLATFORM_TOKEN可填写纯 Token,也可包含Bearer前缀,无需配置 Cookie。- 环境变量的值优先于源码默认值。
- 这是 DeepSeek 未公开承诺稳定性的站内接口;登录态过期、WAF 拦截或接口变更时,卡片会继续显示账号余额,并提示当前 Key 用量不可用。
- 金额按 GMT+8 自然日统计;平台数据可能延迟约 5 分钟。
安装
需要已安装 DSH / npx @deepseek-ai/dsh,且 pnpm 在 PATH 中。
从 GitHub(推荐发布后)
dsh plugin --profile web add "github:184712373/dsh-prompt-optimize"
从本地路径(开发 / 未推送时)
# 在仓库父目录执行,路径按实际修改
dsh plugin --profile web add "file:./dsh-prompt-optimize"
# 或
dsh plugin --profile web add "link:C:/Users/you/path/dsh-prompt-optimize"
从 npm(可选,npm publish 之后)
dsh plugin --profile web add dsh-prompt-optimize
安装或更新后 重启 Web profile:
dsh --profile web
# 或
npx @deepseek-ai/dsh web
设置 → 插件 中应能看到本包。任意会话输入框右侧出现 星星图标。
卸载
dsh plugin --profile web remove dsh-prompt-optimize
然后重启 DSH。
配置
cordis.patch.yml / profile patch 中可改:
- insert:
- id: prompt-optimize
name: dsh-prompt-optimize
config:
provider: deepseek-official
model: deepseek-v4-flash
maxInputChars: 24000
maxOutputTokens: 1024
temperature: 0.3
若默认 provider 未配置,Host 会回退到当前第一个可用 provider,并在气泡 meta 中标注「已回退」。
依赖
- Host:
llm、webServer(DSH Web profile 已有) - Client:
slots(输入区 Slot) - 需在设置中配置可用的 LLM(建议 DeepSeek API Key)
发布到 GitHub dsh-plugin Topic
- 新建 Public 仓库,推送本目录全部文件
- 把
package.json里的YOUR_GITHUB_USERNAME换成真实用户名 - 仓库 About → Topics 添加
dsh-plugin(可选:deepseek-harness、dsh) - README 安装命令改为真实
github:user/dsh-prompt-optimize - (可选)
npm publish
无需官方审核;社区目录会从 topics/dsh-plugin 聚合。
与动态插件源码的关系
工作区若仍保留 prompt-optimize-plugin/(cordis_define 用的 host.js/client.js),那是 会话内动态插件 原型,进程重启即失效。
本目录是正式 bundle:dsh plugin add 进 profile,重启仍可用。
License
MIT
amruthpillai/reactive-resume
tt-a1i/archify
zhu1090093659/dsh-web-ui
strukto-ai/mirage
liustack/modlens
omdsh-dev/DSH-better-sidebar
ccch1mneyyy/dsh-TUI