dsh-prompt-snippets 1.3.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +67 -0
- package/README.md +9 -6
- package/client.js +3292 -2897
- package/index.js +141 -29
- package/package.json +11 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
本文件记录 `dsh-prompt-snippets` 每个发布版本的用户可见变更。格式遵循 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),版本号遵循 [Semantic Versioning](https://semver.org/lang/zh-CN/)。
|
|
4
|
+
|
|
5
|
+
## [1.4.0] - 2026-11-06
|
|
6
|
+
|
|
7
|
+
### 新增
|
|
8
|
+
|
|
9
|
+
- **AI 优化流式透传**:点击 ✨ 优化后,对比视图会实时显示模型逐段生成的内容,不再全程静止、最后一次性蹦出。底层从一次性的 RPC 调用改为走 `/api/prompt-snippets/optimize-stream` 流式接口(NDJSON),生成进度即时可见。
|
|
10
|
+
- **AI 优化提速(maxTokens 自适应)**:优化请求的 `maxTokens` 从固定 2000 改为按输入长度自适应(短输入 600 / 中等 900 / 长输入 1200 封顶),减少模型扩写冗长输出的倾向,明显加快生成。
|
|
11
|
+
|
|
12
|
+
### 修复
|
|
13
|
+
|
|
14
|
+
- **片段库按钮位置**:按钮从输入框卡片下方的独立一行(`conversation.composer.dock`)改挂到输入框工具条(`conversation.input.right`,与权限控件、模型选择器同排),修复 Claude 样式等主题下按钮消失或孤行的问题(#5、#6)。
|
|
15
|
+
- **窄窗口按钮撑高**:工具条按钮加 `flex: none` + 文字不折行,窄窗口下不再被压缩折行撑高。
|
|
16
|
+
- **收藏置顶复选框字号**:显式声明字号,不再继承会话字体放大一号(#2)。
|
|
17
|
+
|
|
18
|
+
### 工程化
|
|
19
|
+
|
|
20
|
+
- **i18n 接入平台 locale 服务**:client 端全部硬编码文案接入 DSH 官方 locale(`ctx.locale.register/bind/subscribe`),随平台语言切换。
|
|
21
|
+
- **ESLint 门禁**:新增 ESLint 8 配置与 `npm run lint`,并在 CI 中强制执行。
|
|
22
|
+
- **CI Windows 矩阵**:GitHub Actions 增加 `windows-latest` runner,覆盖目标用户主平台。
|
|
23
|
+
- **README 徽章与措辞**:补充 npm version / downloads / License 徽章,同步按钮位置描述。
|
|
24
|
+
|
|
25
|
+
## [1.3.1] - 2026-11-04
|
|
26
|
+
|
|
27
|
+
### 修复
|
|
28
|
+
|
|
29
|
+
- Gemini review 8 处问题修复。
|
|
30
|
+
- 命令面板快捷键、滚动跟随、插入并发送等细节修正。
|
|
31
|
+
|
|
32
|
+
## [1.3.0] - 2026-11-03
|
|
33
|
+
|
|
34
|
+
### 新增
|
|
35
|
+
|
|
36
|
+
- 标签 / 收藏 / 最近使用。
|
|
37
|
+
- 版本历史(每片段保留最近 20 版)。
|
|
38
|
+
- 命令面板(Ctrl+Shift+K)。
|
|
39
|
+
- 动态变量(date / time / datetime)。
|
|
40
|
+
- 内置模板包冷启动。
|
|
41
|
+
- README 功能示意图。
|
|
42
|
+
|
|
43
|
+
## [1.2.0] - 2026-11-03
|
|
44
|
+
|
|
45
|
+
### 新增
|
|
46
|
+
|
|
47
|
+
- AI 优化闭环(三态对比视图:原文 / 优化后 / 覆盖或插入)。
|
|
48
|
+
- 搜索增强。
|
|
49
|
+
- 导入导出。
|
|
50
|
+
- 数据可靠性补丁。
|
|
51
|
+
- 窗口缩放。
|
|
52
|
+
|
|
53
|
+
## [1.1.0] - 2026-11-02
|
|
54
|
+
|
|
55
|
+
### 新增
|
|
56
|
+
|
|
57
|
+
- 数据可靠性(原子写 / .bak 轮换 / 损坏自愈 / 旧版本迁移)。
|
|
58
|
+
- 面板内编辑。
|
|
59
|
+
- 占位符表单(必填 / 默认值 / 枚举下拉)。
|
|
60
|
+
- 主题适配(浅色 / 深色)。
|
|
61
|
+
|
|
62
|
+
## [1.0.0] - 2026-10-27
|
|
63
|
+
|
|
64
|
+
### 新增
|
|
65
|
+
|
|
66
|
+
- `/snippet` 命令(保存 / 列出 / 查看 / 删除 / 恢复 / 改名)。
|
|
67
|
+
- 侧栏一键插入。
|
package/README.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# 提示词片段库(Prompt Snippets)
|
|
2
2
|
|
|
3
3
|
[](https://github.com/dadazhangn/dsh-prompt-snippets/actions/workflows/ci.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/dsh-prompt-snippets)
|
|
5
|
+
[](https://www.npmjs.com/package/dsh-prompt-snippets)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
7
|
|
|
5
8
|
<p align="center">
|
|
6
9
|
<img src="docs/feature-map.svg" alt="Prompt Snippets 占位符三态填充流程" width="800">
|
|
@@ -20,7 +23,7 @@ dsh plugin --profile web add dsh-prompt-snippets
|
|
|
20
23
|
```
|
|
21
24
|
|
|
22
25
|
`web` 换成你实际使用的 profile 名即可(本机 profile 在 `~/.dsh/profiles/<名字>`)。
|
|
23
|
-
装完重启 DSH
|
|
26
|
+
装完重启 DSH,刷新页面,输入框工具条那一行会出现「📋 片段库」按钮(与模型选择器、权限控件同排,位于发送按钮之前)。
|
|
24
27
|
|
|
25
28
|
也可以从 GitHub 装(版本由仓库 HEAD 决定,不跟随 npm 发布):
|
|
26
29
|
|
|
@@ -55,7 +58,7 @@ and reload the page.
|
|
|
55
58
|
- **列出 / 查看 / 删除 / 恢复 / 改名**:`/snippet list`、`/snippet show <名称>`、
|
|
56
59
|
`/snippet rm <名称>`、`/snippet undo <名称>`、`/snippet mv <旧名> <新名>`。
|
|
57
60
|
重名时不会瞎删,会列出候选让你用 `#id前缀` 精确指定。
|
|
58
|
-
-
|
|
61
|
+
- **一键插入**:输入框工具条上的「📋 片段库」按钮展开面板,按分类浏览,点击片段即插入当前
|
|
59
62
|
草稿。插入失败(草稿在面板打开期间被改动、或输入框正在提交)会在面板内说明原因。
|
|
60
63
|
- **面板内编辑 / 新建**:点 ✏️ 在原行下方展开编辑器,改名称、分类、正文,并直接维护
|
|
61
64
|
变量(必填勾选 + 默认值);面板底部「+ 新建」同样在面板内完成创建,全程不用敲命令。
|
|
@@ -108,7 +111,7 @@ and reload the page.
|
|
|
108
111
|
面板里点 🕘 展开该片段的历史,可回看历次正文;`/snippet show` 也会显示 revision 号。
|
|
109
112
|
- **命令面板(全局快捷唤起)**:任意时刻按 `Ctrl+Shift+K`(或 `Ctrl+Shift+P`)弹出片段搜索
|
|
110
113
|
浮层,输入关键字即时过滤(名称/分类/标签/正文),`↑` `↓` 选择、`Enter` 插入、`Esc` 关闭;
|
|
111
|
-
|
|
114
|
+
收藏片段自动置顶,无需先点开片段库面板。选中后按 `Ctrl+Enter`(Mac `Cmd+Enter`)则是
|
|
112
115
|
**插入并立即发送**;带必填占位符的片段仍需先填表单,无法直接发送。`↑` `↓` 切换选中项时
|
|
113
116
|
列表自动滚动跟随,始终把选中项保持在可视区内。
|
|
114
117
|
|
|
@@ -130,7 +133,7 @@ and reload the page.
|
|
|
130
133
|
/snippet import 我的片段.json
|
|
131
134
|
```
|
|
132
135
|
|
|
133
|
-
|
|
136
|
+
然后在任意会话里,点击输入框工具条上的「📋 片段库」→ 点击片段名 → 内容插入草稿。
|
|
134
137
|
要改内容或改分类,不必再敲命令:面板里点 ✏️ 直接改,改完点「保存」。
|
|
135
138
|
|
|
136
139
|
## 数据
|
|
@@ -184,11 +187,11 @@ and reload the page.
|
|
|
184
187
|
## 结构
|
|
185
188
|
|
|
186
189
|
bundle 结构:host 半(`index.js`,命令 + RPC + JSON 存储)、client 半(`client.js`,
|
|
187
|
-
|
|
190
|
+
输入框工具条面板 UI)。
|
|
188
191
|
|
|
189
192
|
```
|
|
190
193
|
index.js host 半:/snippet 命令 + /prompt-snippets RPC + JSON 持久化
|
|
191
|
-
client.js client 半:conversation.
|
|
194
|
+
client.js client 半:conversation.input.right 面板
|
|
192
195
|
package.json bundle 声明(dsh.bundle.patch + dsh.client + engines.dsh)
|
|
193
196
|
cordis.patch.yml 插入 host 半的 loader patch
|
|
194
197
|
locale/{en,zh}.json 市场显示名与描述
|