@surfishs/dsh-prompt-enhance 0.0.2 → 0.0.4
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/README.en.md +13 -4
- package/README.md +13 -4
- package/docs/images/panel.png +0 -0
- package/lib/client.js +672 -445
- package/lib/index.js +11 -4
- package/lib/index.js.map +2 -2
- package/package.json +1 -1
- package/src/client/ActionIcons.tsx +61 -0
- package/src/client/EnhanceButton.tsx +24 -56
- package/src/client/ResultDock.tsx +261 -0
- package/src/client/ResultPanel.tsx +149 -177
- package/src/client/SparkleFishIcon.tsx +41 -0
- package/src/client/SparkleIcon.tsx +33 -0
- package/src/client/UndoBar.tsx +4 -0
- package/src/client/index.tsx +16 -0
- package/src/client/locales.ts +18 -4
- package/src/client/styles.ts +75 -48
- package/src/client/ui-state.ts +7 -2
- package/src/context.ts +1 -1
- package/src/enhancer.ts +11 -2
- package/src/prompts.ts +1 -1
- package/src/shared/protocol.ts +2 -0
package/README.en.md
CHANGED
|
@@ -8,13 +8,18 @@
|
|
|
8
8
|
|
|
9
9
|
[简体中文](./README.md) | English
|
|
10
10
|
|
|
11
|
+

|
|
12
|
+
|
|
11
13
|
---
|
|
12
14
|
|
|
13
15
|
## Features
|
|
14
16
|
|
|
15
|
-
- **One-click enhance**: the
|
|
16
|
-
- **
|
|
17
|
-
- **
|
|
17
|
+
- **One-click enhance**: the enhance button in the composer toolbar (DeepSeek fish mark with a sparkle); the shortcut is off by default and can be set in the settings. The original draft is preserved, and a failure never touches it.
|
|
18
|
+
- **Docked result card**: the result appears above the composer without covering the conversation, with model, timing and token usage. Apply, copy, regenerate or undo; sending the draft closes it automatically, Escape closes it too.
|
|
19
|
+
- **Apply and undo**: after applying, the card stays open with a Replaced chip and an undo action; once closed, the undo bar remains above the composer.
|
|
20
|
+
- **Regenerate**: re-runs the current composer text; after applying, it can regenerate the enhanced draft as well.
|
|
21
|
+
- **Empty-draft dimming**: with no text (or attachments only), the icon dims and neither clicks nor the shortcut start a request.
|
|
22
|
+
- **Truncation warning**: when the output hits the token cap, the partial result is kept and marked as possibly incomplete.
|
|
18
23
|
- **`/enhance <text>`**: rewrite any text from the slash menu; the result never enters model history.
|
|
19
24
|
- **Model routing**: pinned settings pair → current session model → harness default, in that order.
|
|
20
25
|
- **Context aware**: uses recent conversation to resolve references; can be turned off.
|
|
@@ -61,7 +66,7 @@ dsh plugin --profile <profile> remove @surfishs/dsh-prompt-enhance
|
|
|
61
66
|
|
|
62
67
|
## Usage
|
|
63
68
|
|
|
64
|
-
Leave a draft in the composer, then click
|
|
69
|
+
Leave a draft in the composer, then click the enhance button in the toolbar (or your configured shortcut). An empty or attachment-only draft dims the button and cannot be clicked; over-length or reference-chip drafts are rejected locally. The result appears in a card docked above the composer: apply, copy, regenerate or close it; after applying, the card stays open with a Replaced chip and an undo action; sending the draft closes it automatically, and Escape closes it too. A result that hit the token cap is marked as possibly incomplete.
|
|
65
70
|
|
|
66
71
|
`/enhance <text>` rewrites any text from the slash menu; the result is copyable and never enters model history.
|
|
67
72
|
|
|
@@ -88,6 +93,8 @@ Edit in **Settings → dsh-prompt-enhance** (or Plugins → `dsh-prompt-enhance`
|
|
|
88
93
|
| `maxConcurrent` | `2` | Concurrent enhancement limit; a new request past the limit is told to retry later |
|
|
89
94
|
| `rateLimitPerMinute` | `10` | Successful enhancements per minute (sliding window); past the limit the request is told to retry later |
|
|
90
95
|
|
|
96
|
+
An empty or attachment-only draft dims the button and starts no request; raise `maxOutputTokens` when a result is truncated.
|
|
97
|
+
|
|
91
98
|
## Security
|
|
92
99
|
|
|
93
100
|
The enhance route is served by your own local dsh host and accepts loopback addresses with a local `Host` / `Origin` only. With `contextAware` on, recent conversation history is sent with the draft to the configured model provider — do not send context from sensitive sessions.
|
|
@@ -95,6 +102,8 @@ The enhance route is served by your own local dsh host and accepts loopback addr
|
|
|
95
102
|
## Troubleshooting
|
|
96
103
|
|
|
97
104
|
- No button: make sure `enabled` is `true` and `dsh web` was restarted after installing.
|
|
105
|
+
- The button is dimmed: the composer is empty or has attachments only; type some text to restore it.
|
|
106
|
+
- Incomplete result: check the truncation warning and raise `maxOutputTokens`.
|
|
98
107
|
- "No model resolved for the enhancement": set `provider` / `model` as a pair, or send a message in the current session first.
|
|
99
108
|
- Authentication failed: check the provider's API key in the harness.
|
|
100
109
|
|
package/README.md
CHANGED
|
@@ -8,13 +8,18 @@
|
|
|
8
8
|
|
|
9
9
|
简体中文 | [English](./README.en.md)
|
|
10
10
|
|
|
11
|
+

|
|
12
|
+
|
|
11
13
|
---
|
|
12
14
|
|
|
13
15
|
## 功能
|
|
14
16
|
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
17
|
+
- **一键增强**:输入框工具栏的增强按钮(DeepSeek 鱼形标识 + 星芒);快捷键默认关闭,可在设置中指定。原文保留,失败不改草稿。
|
|
18
|
+
- **停靠结果卡**:结果显示在输入框上方,不遮挡对话;附模型、耗时与 token 用量,可回填、复制、重新生成或撤销;发送消息时自动收起,`Esc` 关闭。
|
|
19
|
+
- **回填与撤销**:回填后结果卡保持打开并显示「已替换」,可直接撤销;关闭后输入框上方仍保留撤销条。
|
|
20
|
+
- **重新生成**:按当前输入框内容重新请求;回填后也可对增强稿再生成。
|
|
21
|
+
- **空输入灰态**:没有文字或只有附件时图标变浅,点击和快捷键都不发起请求。
|
|
22
|
+
- **截断提示**:输出达到 Token 上限时保留已生成内容,并提示结果可能不完整。
|
|
18
23
|
- **`/enhance <文本>`**:从斜杠面板改写任意文本,结果不进入模型历史。
|
|
19
24
|
- **模型路由**:设置成对覆盖 → 当前会话模型 → 全局默认模型,逐级回退。
|
|
20
25
|
- **上下文感知**:参考当前会话近况消解指代;可关闭。
|
|
@@ -61,7 +66,7 @@ dsh plugin --profile <profile> remove @surfishs/dsh-prompt-enhance
|
|
|
61
66
|
|
|
62
67
|
## 使用
|
|
63
68
|
|
|
64
|
-
|
|
69
|
+
在输入框留下草稿,点输入框工具栏的增强按钮(或你设置的快捷键)。输入为空或只有附件时按钮灰掉、不可点;超长或含引用块会被本地拒绝。结果出现在输入框上方的停靠卡里:可回填、复制、重新生成或关闭;回填后卡片保持打开并显示「已替换」,可直接撤销;发送消息时自动收起,`Esc` 关闭。输出达到 Token 上限时会提示结果可能不完整。
|
|
65
70
|
|
|
66
71
|
`/enhance <文本>` 从斜杠面板改写任意文本,结果可复制,不进入模型历史。
|
|
67
72
|
|
|
@@ -88,6 +93,8 @@ dsh plugin --profile <profile> remove @surfishs/dsh-prompt-enhance
|
|
|
88
93
|
| `maxConcurrent` | `2` | 同时进行的增强上限;达到上限时新请求会提示稍后再试 |
|
|
89
94
|
| `rateLimitPerMinute` | `10` | 每分钟增强次数上限(滑动窗口);超限时提示稍后再试 |
|
|
90
95
|
|
|
96
|
+
输入为空或只有附件时按钮灰掉,不发起请求;结果被截断时调高 `maxOutputTokens`。
|
|
97
|
+
|
|
91
98
|
## 安全
|
|
92
99
|
|
|
93
100
|
增强路由只由本机 dsh 宿主提供,仅接受回环地址与本地 `Host` / `Origin`。`contextAware` 开启时,会话历史会随草稿发给当前配置的模型服务商——不要把敏感会话的上下文外发。
|
|
@@ -95,6 +102,8 @@ dsh plugin --profile <profile> remove @surfishs/dsh-prompt-enhance
|
|
|
95
102
|
## 故障排查
|
|
96
103
|
|
|
97
104
|
- 按钮不出现:确认 `enabled` 为 `true`,且安装后重启了 `dsh web`。
|
|
105
|
+
- 按钮是灰的:输入框为空或只有附件;输入文字后恢复。
|
|
106
|
+
- 结果不完整:查看截断提示,并调高 `maxOutputTokens`。
|
|
98
107
|
- 「尚未确定增强用的模型」:成对填写 `provider` / `model`,或先在当前会话发一条消息。
|
|
99
108
|
- 鉴权失败:检查对应 provider 在 harness 中的 API Key。
|
|
100
109
|
|
|
Binary file
|