Bundle
dsh-selection-comments
Selection-based comments for the DeepSeek Harness Web UI: select text in the chat, comment on each selection, then submit all comments as one message.
- Source
- surenkid
- License
- MIT
- Updated
- Updated 18 days ago
Readme
# dsh-selection-comments
DSH Web 的选区评论插件,提供类似 ChatGPT/Codex 网页端的评论体验:在聊天消息中选中一段文字,针对该选段写评论;可以继续选择其他内容追加评论;最后一次性把所有选段和评论组成一条普通用户消息提交给当前会话。
## 功能
- 在聊天消息文本上拖动选择,选区上方会出现“评论选中内容”按钮。
- 每个选段可以单独编辑或删除,尚未提交的评论会汇总到右下角的评论胶囊。
- 提交时自动合并为一条普通用户消息,模型看到的内容与手打消息一致。
- 已保存评论对应的消息行上会显示评论标记,点击标记可快速打开待提交面板。
## 安装
依赖 `dsh` 和 `pnpm`。`dsh plugin` 会在首次使用时自动初始化 `web` profile。
```bash
dsh plugin --profile web add github:surenkid/dsh-selection-based-comments
```
安装完成后重启 DSH Web:
```bash
dsh web --port 3080
```
然后刷新浏览器页面。插件不需要额外构建步骤,也没有安装脚本。
### 指定版本或分支
`dsh plugin` 会把参数转发给 pnpm,因此可以使用 pnpm 的 GitHub 依赖语法固定分支或 tag:
```bash
dsh plugin --profile web add github:surenkid/dsh-selection-based-comments#main
```
```bash
dsh plugin --profile web add github:surenkid/dsh-selection-based-comments#v0.1.0
```
### 更新与卸载
```bash
dsh plugin --profile web update dsh-selection-comments
dsh plugin --profile web remove dsh-selection-comments
```
### 本地开发安装
```bash
git clone https://github.com/surenkid/dsh-selection-based-comments.git
dsh plugin --profile web add link:/absolute/path/to/dsh-selection-based-comments
```
### 手动安装
如果不想使用 `dsh plugin`,也可以直接编辑 `~/.dsh/profiles/web/package.json`,在 `dependencies` 中加入 GitHub 依赖,并把插件加入 `dsh.profile.bundles`:
```json
{
"dependencies": {
"dsh-selection-comments": "github:surenkid/dsh-selection-based-comments"
},
"dsh": {
"profile": {
"bundles": [
"@deepseek-ai/dsh-base",
"@deepseek-ai/dsh-web-app",
"dsh-selection-comments"
]
}
}
}
```
然后在 profile 目录执行:
```bash
cd ~/.dsh/profiles/web
pnpm install
```
## 使用方式
1. 在聊天消息中按住鼠标选中文字,选区上方会出现“评论选中内容”按钮。
2. 点击按钮,在浮层中写下针对这段内容的评论,然后保存。可以继续选其他内容追加多条评论。
3. 已保存的评论不会占据聊天区域:右下角会显示一个小胶囊“评论 N”,鼠标悬停或点击即可展开编辑/删除面板;消息行上的评论标记点击后也会直接打开这个面板。
4. 在展开面板中点击“提交评论”,所有评论会合并成一条消息发送到当前会话;发送成功后待提交列表会清空。
## 设计说明
- 待提交评论只存在浏览器内存中(按 `sessionId` 分组)。提交是唯一的持久化步骤,发送路径就是普通 `session.prompt(..., 'queue')`,所以模型看到的是与手打一样的用户消息。
- 选区定位使用 DSH conversation 渲染出的 `[data-chat-anchor-key]` 消息行,不依赖任何 conversation 内部实现。
- 浮动按钮、评论编辑器和消息标记使用原生 DOM;评论列表注册在 `conversation.input.dock` slot。
## 已知限制
- 未提交评论在页面刷新后会丢失,后续可以改成持久化 sidecar。
- 评论标记只挂在所属消息行尾部,不在原文中做逐字符高亮;原文高亮需要 markdown source map,复杂度更高。
- 跨消息跨区块选择时,评论归属到选择起点的消息行。
Install
dsh plugin --profile web add github:surenkid/dsh-selection-based-comments
Profile: web
With the hub plugin installed, ask your agent to install it by name — it resolves the same plan shown here.
dsh plugin --profile web add github:stvlynn/dsh.fish#path:packages/dsh-plugin-hub
install dsh-selection-comments from the hub
- This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.