dsh-plugin-choice-refresh 0.1.6 → 0.1.7
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 +5 -0
- package/README.en.md +11 -1
- package/README.md +11 -1
- package/docs/banner.svg +25 -0
- package/lib/client.js +34 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.en.md
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="docs/banner.svg" alt="dsh-plugin-choice-refresh banner" width="100%">
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
5
|
# dsh-plugin-choice-refresh
|
|
4
6
|
|
|
5
7
|

|
|
8
|
+

|
|
6
9
|

|
|
10
|
+

|
|
7
11
|

|
|
8
12
|
|
|
13
|
+
[中文](./README.md) | **English**
|
|
14
|
+
|
|
9
15
|
**The only choice-enhancement plugin in the dsh plugin market**: it adds two buttons to the choice cards of `ask_user_question` / `ask_user_choice` —
|
|
10
16
|
not happy with any of the options? One click has the model come back with a completely different batch. Too few options? One click has the model add more.
|
|
11
17
|
|
|
@@ -76,6 +82,9 @@ When the model asks a question as usual via `ask_user_question` / `ask_user_choi
|
|
|
76
82
|
> The injected message stays short (one or two lines) and remains in the session as a user message so the model can understand the instruction;
|
|
77
83
|
> the UI displays it verbatim.
|
|
78
84
|
|
|
85
|
+
> If regenerating the instruction fails after the question is cancelled (e.g. the session is busy), the UI shows an explicit
|
|
86
|
+
> "please resend manually" hint (bilingual zh / en) instead of silently hanging — just rephrase and send again.
|
|
87
|
+
|
|
79
88
|
> Note: the refresh / top-up is done by the model, which re-invokes the question tool after reading the instruction — this is a "soft" enhancement, and the model may occasionally adjust the question itself. If you are still not satisfied with the result, click the button again or simply type what you want.
|
|
80
89
|
|
|
81
90
|
## Self-check
|
|
@@ -104,6 +113,7 @@ This plugin is part of **Pasumao's dsh plugin ecosystem**; the other published p
|
|
|
104
113
|
| [dsh-plugin-table-zoom](https://www.npmjs.com/package/dsh-plugin-table-zoom) | [GitHub repo](https://github.com/Pasumao/dsh-plugin-table-zoom) | Floating-window viewer for long chat tables + one-click Markdown copy |
|
|
105
114
|
| [dsh-plugin-windows-guard](https://www.npmjs.com/package/dsh-plugin-windows-guard) | [GitHub repo](https://github.com/Pasumao/dsh-plugin-windows-guard) | Windows environment guard: rule skills + mojibake detection / dangerous-write blocking / encoding diagnostics & repair |
|
|
106
115
|
| [dsh-plugin-workbench](https://www.npmjs.com/package/dsh-plugin-workbench) | [GitHub repo](https://github.com/Pasumao/dsh-plugin-workbench) | VS Code-style file explorer + editable preview |
|
|
116
|
+
| [dsh-plugin-context-trim](https://www.npmjs.com/package/dsh-plugin-context-trim) | [GitHub repo](https://github.com/Pasumao/dsh-plugin-context-trim) | Per-session injection gate: trim skills / tools / prompt sections per session |
|
|
107
117
|
|
|
108
118
|
> For the rest of the series, see [Pasumao · dsh plugins](https://github.com/Pasumao); if you find them useful, a ⭐ on GitHub is always appreciated.
|
|
109
119
|
|
package/README.md
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="docs/banner.svg" alt="dsh-plugin-choice-refresh banner" width="100%">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
1
5
|
# dsh-plugin-choice-refresh
|
|
2
6
|
|
|
3
7
|

|
|
8
|
+

|
|
4
9
|

|
|
10
|
+

|
|
5
11
|

|
|
6
12
|
|
|
7
13
|
[**中文**](./README.md) | [English](./README.en.md)
|
|
@@ -80,6 +86,9 @@ npm install # 或 pnpm install
|
|
|
80
86
|
> 注入消息保持简短(一两行),作为用户消息留在会话里供模型理解指令;
|
|
81
87
|
> 界面会原样显示这条消息。
|
|
82
88
|
|
|
89
|
+
> 若取消问题后重新生成指令注入失败(如会话正忙),界面上会明确提示
|
|
90
|
+
> 「请手动重新发送」(zh / en 双语),不会再无声卡住——看到提示后重新描述需求发送即可。
|
|
91
|
+
|
|
83
92
|
> 说明:刷新/补充由模型理解指令后重新调用提问工具完成,属于「软」增强——
|
|
84
93
|
> 模型偶尔可能调整问题本身。若对结果仍不满意,可再点一次或直接打字说明。
|
|
85
94
|
|
|
@@ -112,6 +121,7 @@ npm run smoke # selfcheck + smoke-client
|
|
|
112
121
|
| [dsh-plugin-table-zoom](https://www.npmjs.com/package/dsh-plugin-table-zoom) | [GitHub 仓库](https://github.com/Pasumao/dsh-plugin-table-zoom) | 聊天长表格浮窗查看 + 一键复制 Markdown |
|
|
113
122
|
| [dsh-plugin-windows-guard](https://www.npmjs.com/package/dsh-plugin-windows-guard) | [GitHub 仓库](https://github.com/Pasumao/dsh-plugin-windows-guard) | Windows 环境防坑:守则技能 + 乱码检测 / 危险写拦截 / 编码诊断修复 |
|
|
114
123
|
| [dsh-plugin-workbench](https://www.npmjs.com/package/dsh-plugin-workbench) | [GitHub 仓库](https://github.com/Pasumao/dsh-plugin-workbench) | VS Code 风格文件浏览器 + 可编辑预览 |
|
|
124
|
+
| [dsh-plugin-context-trim](https://www.npmjs.com/package/dsh-plugin-context-trim) | [GitHub 仓库](https://github.com/Pasumao/dsh-plugin-context-trim) | 会话注入门控:skill / tool / 提示词段落按会话裁剪 |
|
|
115
125
|
|
|
116
126
|
> 本系列其余插件见 [Pasumao · dsh 插件](https://github.com/Pasumao);觉得好用欢迎到 GitHub 点 ⭐。
|
|
117
127
|
|
|
@@ -120,6 +130,6 @@ npm run smoke # selfcheck + smoke-client
|
|
|
120
130
|
代码与文档由 AI 辅助生成(DeepSeek Harness),均经人工审查与实机验证
|
|
121
131
|
(`npm run smoke`:selfcheck + 假客户端冒烟)。
|
|
122
132
|
|
|
123
|
-
##
|
|
133
|
+
## License
|
|
124
134
|
|
|
125
135
|
[MIT](./LICENSE)
|
package/docs/banner.svg
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="260" viewBox="0 0 1200 260" role="img" aria-label="dsh-plugin-choice-refresh banner">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">
|
|
4
|
+
<stop offset="0" stop-color="#0a1830"/>
|
|
5
|
+
<stop offset="1" stop-color="#102a4c"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
<radialGradient id="glow" cx="0.85" cy="0.1" r="0.9">
|
|
8
|
+
<stop offset="0" stop-color="#A78BFA" stop-opacity="0.22"/>
|
|
9
|
+
<stop offset="1" stop-color="#A78BFA" stop-opacity="0"/>
|
|
10
|
+
</radialGradient>
|
|
11
|
+
<linearGradient id="whale" x1="0" y1="0" x2="0" y2="1">
|
|
12
|
+
<stop offset="0" stop-color="#ffffff"/>
|
|
13
|
+
<stop offset="1" stop-color="#cfe3ff"/>
|
|
14
|
+
</linearGradient>
|
|
15
|
+
</defs>
|
|
16
|
+
<rect width="1200" height="260" rx="18" fill="url(#bg)"/>
|
|
17
|
+
<rect width="1200" height="260" rx="18" fill="url(#glow)"/>
|
|
18
|
+
<rect x="0" y="0" width="1200" height="6" rx="3" fill="#A78BFA" opacity="0.85"/>
|
|
19
|
+
<g transform="translate(64,80) scale(2.0)">
|
|
20
|
+
<path d="M48.8354 10.0479C48.3232 9.79199 48.1025 10.2798 47.8032 10.5278C47.7007 10.6079 47.6143 10.7119 47.5273 10.8076C46.7793 11.624 45.9048 12.1597 44.7622 12.0957C43.0923 12 41.666 12.5356 40.4058 13.8398C40.1377 12.2319 39.2476 11.272 37.8926 10.6558C37.1836 10.3359 36.4668 10.0156 35.9702 9.31982C35.6235 8.82373 35.5293 8.27197 35.356 7.72754C35.2456 7.3999 35.1353 7.06396 34.7651 7.00781C34.3633 6.94385 34.2056 7.2876 34.0479 7.57568C33.418 8.75195 33.1733 10.0479 33.1973 11.3599C33.2524 14.312 34.4736 16.6641 36.8999 18.3359C37.1758 18.5278 37.2466 18.7197 37.1597 19C36.9946 19.5757 36.7974 20.1357 36.624 20.7119C36.5137 21.0801 36.3486 21.1597 35.9624 21C34.6309 20.4321 33.481 19.5918 32.4644 18.5757C30.7393 16.8721 29.1792 14.9917 27.2334 13.52C26.7764 13.1758 26.3193 12.856 25.8467 12.5518C23.8618 10.584 26.1069 8.96777 26.627 8.77588C27.1704 8.57568 26.8159 7.8877 25.0591 7.896C23.3022 7.90381 21.6953 8.50391 19.647 9.30371C19.3477 9.42383 19.0322 9.51172 18.7095 9.58398C16.8501 9.22363 14.9199 9.14355 12.9033 9.37598C9.10596 9.80762 6.07275 11.6396 3.84326 14.7681C1.16455 18.5278 0.53418 22.7998 1.30664 27.2559C2.11768 31.9521 4.46582 35.8398 8.07373 38.8799C11.8159 42.0322 16.1255 43.5762 21.041 43.2803C24.0269 43.104 27.3516 42.6963 31.1016 39.4561C32.0469 39.936 33.0396 40.1279 34.686 40.272C35.9546 40.3921 37.1758 40.208 38.1211 40.0078C39.6021 39.688 39.4995 38.2881 38.9639 38.0322C34.623 35.9678 35.5762 36.8081 34.71 36.1279C36.9155 33.4639 40.2402 30.6958 41.54 21.728C41.6426 21.0161 41.5557 20.5679 41.54 19.9917C41.5322 19.6396 41.6108 19.5039 42.0049 19.4639C43.0923 19.3359 44.1479 19.0317 45.1167 18.4878C47.9292 16.9199 49.064 14.3438 49.3315 11.2559C49.3711 10.7837 49.3237 10.2959 48.8354 10.0479ZM24.3262 37.8398C20.1196 34.4639 18.0791 33.3521 17.2358 33.3999C16.4482 33.4482 16.5898 34.3682 16.7632 34.9678C16.9443 35.5601 17.1812 35.9683 17.5117 36.4878C17.7402 36.832 17.8979 37.3442 17.2832 37.728C15.9282 38.584 13.5728 37.4399 13.4624 37.3838C10.7207 35.7358 8.42822 33.5601 6.81348 30.584C5.25342 27.7197 4.34766 24.6479 4.19775 21.3677C4.1582 20.5757 4.38672 20.2959 5.15869 20.1519C6.17529 19.96 7.22314 19.9199 8.23926 20.0718C12.5327 20.7119 16.1885 22.6719 19.2529 25.7759C21.002 27.5439 22.3252 29.6558 23.6885 31.7202C25.1377 33.9121 26.6978 36 28.6831 37.7119C29.3843 38.312 29.9434 38.7681 30.479 39.104C28.8643 39.2881 26.1699 39.3281 24.3262 37.8398ZM26.3433 24.6001C26.3433 24.248 26.6191 23.9678 26.9658 23.9678C27.0444 23.9678 27.1152 23.9839 27.1782 24.0078C27.2651 24.04 27.3438 24.0879 27.4067 24.1602C27.5171 24.272 27.5801 24.4321 27.5801 24.6001C27.5801 24.9521 27.3042 25.2319 26.9575 25.2319C26.6108 25.2319 26.3433 24.9521 26.3433 24.6001ZM32.6064 27.8799C32.2046 28.0479 31.8027 28.1919 31.4165 28.208C30.8179 28.2397 30.1641 27.9922 29.8096 27.688C29.2583 27.2158 28.8643 26.9521 28.6987 26.1279C28.6279 25.7759 28.6675 25.2319 28.7305 24.9199C28.8721 24.248 28.7144 23.8159 28.2495 23.4238C27.8716 23.104 27.3911 23.0161 26.8633 23.0161C26.666 23.0161 26.4849 22.9277 26.3511 22.856C26.1304 22.7441 25.9492 22.4639 26.1226 22.1201C26.1777 22.0078 26.4458 21.7358 26.5088 21.688C27.2256 21.272 28.0527 21.4077 28.8169 21.7197C29.5259 22.0161 30.0615 22.5601 30.834 23.3281C31.6216 24.2559 31.7632 24.5117 32.2124 25.208C32.5669 25.752 32.8901 26.312 33.1104 26.9521C33.2446 27.3521 33.0713 27.6802 32.6064 27.8799Z" fill="url(#whale)"/>
|
|
21
|
+
</g>
|
|
22
|
+
<text x="212" y="86" font-family="'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif" font-size="17" font-weight="600" letter-spacing="5" fill="#A78BFA">DEEPSEEK HARNESS · DSH PLUGIN</text>
|
|
23
|
+
<text x="212" y="152" font-family="ui-monospace,'Cascadia Code',Consolas,monospace" font-size="46" font-weight="700" fill="#f4f8ff">dsh-plugin-choice-refresh</text>
|
|
24
|
+
<text x="212" y="204" font-family="'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif" font-size="22" fill="#9fb3c8">选项不满意?一键重新生成 · 选项太少?一键补充</text>
|
|
25
|
+
</svg>
|
package/lib/client.js
CHANGED
|
@@ -198,7 +198,7 @@ window.__ModuleLoader__.load({
|
|
|
198
198
|
// ------------------------------------------------------------------
|
|
199
199
|
// 子组件:图片卡片 / 文字选项 / 放大查看
|
|
200
200
|
// ------------------------------------------------------------------
|
|
201
|
-
|
|
201
|
+
// 放大图标改为 jsx('svg') 常量元素(不再用 dangerouslySetInnerHTML 注入字符串)。
|
|
202
202
|
|
|
203
203
|
function recommendedBadge(display, t) {
|
|
204
204
|
return display.recommended ? jsx('span', { className: 'dsr-badge', children: t('option.recommended') }) : null;
|
|
@@ -256,7 +256,24 @@ window.__ModuleLoader__.load({
|
|
|
256
256
|
loading: 'lazy',
|
|
257
257
|
onError: function () { setFailed(true); }
|
|
258
258
|
}),
|
|
259
|
-
jsx('span', {
|
|
259
|
+
jsx('span', {
|
|
260
|
+
className: 'dsr-zoomHint',
|
|
261
|
+
'aria-hidden': 'true',
|
|
262
|
+
children: jsx('svg', {
|
|
263
|
+
viewBox: '0 0 24 24',
|
|
264
|
+
width: '13',
|
|
265
|
+
height: '13',
|
|
266
|
+
fill: 'none',
|
|
267
|
+
stroke: 'currentColor',
|
|
268
|
+
strokeWidth: '2',
|
|
269
|
+
strokeLinecap: 'round',
|
|
270
|
+
children: [
|
|
271
|
+
jsx('circle', { cx: '11', cy: '11', r: '7' }, 'c'),
|
|
272
|
+
jsx('line', { x1: '21', y1: '21', x2: '16.5', y2: '16.5' }, 'h1'),
|
|
273
|
+
jsx('line', { x1: '8', y1: '11', x2: '14', y2: '11' }, 'h2')
|
|
274
|
+
]
|
|
275
|
+
})
|
|
276
|
+
}),
|
|
260
277
|
selected && jsx('span', { className: 'dsr-check', 'aria-hidden': 'true', children: '\u2713' })
|
|
261
278
|
]
|
|
262
279
|
}),
|
|
@@ -431,13 +448,22 @@ window.__ModuleLoader__.load({
|
|
|
431
448
|
var requestRegenerate = function (kind) {
|
|
432
449
|
setBusy(kind);
|
|
433
450
|
setError(null);
|
|
451
|
+
var cancelled = false;
|
|
434
452
|
pending.cancel()
|
|
435
453
|
.then(function () {
|
|
454
|
+
cancelled = true;
|
|
436
455
|
return steerSession(buildSteerText(kind, questions, index));
|
|
437
456
|
})
|
|
438
457
|
.catch(function (cause) {
|
|
439
458
|
setBusy(null);
|
|
440
|
-
|
|
459
|
+
var detail = cause instanceof Error ? cause.message : String(cause);
|
|
460
|
+
if (cancelled) {
|
|
461
|
+
// cancel 已成功:当前问题已解除,只是 steer 注入失败——
|
|
462
|
+
// 明确告知用户当前状态并请其手动重新发送。
|
|
463
|
+
setError({ key: 'error.steerFailed', text: detail });
|
|
464
|
+
} else {
|
|
465
|
+
setError({ text: detail });
|
|
466
|
+
}
|
|
441
467
|
});
|
|
442
468
|
};
|
|
443
469
|
|
|
@@ -667,7 +693,9 @@ window.__ModuleLoader__.load({
|
|
|
667
693
|
jsx('div', {
|
|
668
694
|
className: 'dsr-feedback',
|
|
669
695
|
role: 'status',
|
|
670
|
-
children: error === null
|
|
696
|
+
children: error === null
|
|
697
|
+
? null
|
|
698
|
+
: ('key' in error ? t(error.key) + (error.text ? ':' + error.text : '') : error.text)
|
|
671
699
|
})
|
|
672
700
|
]
|
|
673
701
|
}),
|
|
@@ -784,6 +812,7 @@ window.__ModuleLoader__.load({
|
|
|
784
812
|
var zh = {
|
|
785
813
|
'error.incomplete': '请先完成这道问题。',
|
|
786
814
|
'error.unanswered': '请选择一个选项或填写自定义答案。',
|
|
815
|
+
'error.steerFailed': '当前问题已取消,但重新生成的指令注入失败(详情见后),请手动重新发送。',
|
|
787
816
|
'nav.prev': '上一题',
|
|
788
817
|
'nav.next': '下一题',
|
|
789
818
|
'nav.cancel': '放弃整组问题',
|
|
@@ -804,6 +833,7 @@ window.__ModuleLoader__.load({
|
|
|
804
833
|
var en = {
|
|
805
834
|
'error.incomplete': 'Please complete this question first.',
|
|
806
835
|
'error.unanswered': 'Please select an option or enter a custom answer.',
|
|
836
|
+
'error.steerFailed': 'The question was cancelled, but the regenerate prompt failed to send (see detail). Please resend manually.',
|
|
807
837
|
'nav.prev': 'Previous question',
|
|
808
838
|
'nav.next': 'Next question',
|
|
809
839
|
'nav.cancel': 'Dismiss all questions',
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-choice-refresh",
|
|
3
3
|
"description": "DSH 选择增强插件(生态唯一):给 ask_user_question / ask_user_choice 的选择卡加「重新生成选项 / 更多选项」两个按钮——选项都不满意一键换一批(换角度/维度,5~8 个),选项太少一键补充到 6~10 个。纯前端交互实现,不改核心包、不新增工具,原生文字卡与图片选择卡通吃。",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.7",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"exports": {
|