@xiangyixie/dsh-superagent 0.16.6 → 0.16.8
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 +18 -0
- package/README.en.md +3 -3
- package/README.md +3 -3
- package/README.zh.md +3 -3
- package/lib/client.js +9 -91
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,24 @@ along with the next code release. A doc-only version leaves `lib/` and `bin/`
|
|
|
8
8
|
byte-identical to the version before it, and the pinned install line in the
|
|
9
9
|
README is updated to the version being released.
|
|
10
10
|
|
|
11
|
+
## 0.16.8 — 2026-11-17
|
|
12
|
+
|
|
13
|
+
### 变化
|
|
14
|
+
|
|
15
|
+
- **去掉输入区的「排队 / 插话」选择。** 用户不再需要决定投递方式:空闲时发送
|
|
16
|
+
正常开启一轮,回合进行中发送自动使用 `steer` 立即交给超级智能体,适合连续
|
|
17
|
+
快速发多条消息;对应 `mode` 状态、`Menu` 选择器和 chip 样式一并删除。
|
|
18
|
+
- 输入区只剩附件与发送/停止两个控件;附件按钮从「+」换成宿主回形针图标,
|
|
19
|
+
不再看起来像新建会话,提示文案保持「放进工作区」。
|
|
20
|
+
|
|
21
|
+
## 0.16.7 — 2026-11-17
|
|
22
|
+
|
|
23
|
+
### 变化
|
|
24
|
+
|
|
25
|
+
- **头栏只留边栏开合按钮。** 去掉「刷新」按钮和「已连接 / 流中断 / 连接中」
|
|
26
|
+
状态文字,清理对应的 `refresh` 动作、`conn` 状态与状态点样式;重连仍由
|
|
27
|
+
面板自动进行,初次加载失败时保留原有的错误页与「重试」。
|
|
28
|
+
|
|
11
29
|
## 0.16.6 — 2026-11-17
|
|
12
30
|
|
|
13
31
|
### 变化
|
package/README.en.md
CHANGED
|
@@ -36,12 +36,12 @@ Three steps. The desktop app and the CLI install the same plugin; each step says
|
|
|
36
36
|
|
|
37
37
|
### 1. Install
|
|
38
38
|
|
|
39
|
-
Desktop: **Plugins** → **Add plugin** → enter `@xiangyixie/dsh-superagent@0.16.
|
|
39
|
+
Desktop: **Plugins** → **Add plugin** → enter `@xiangyixie/dsh-superagent@0.16.8` → install.
|
|
40
40
|
|
|
41
41
|
CLI:
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
|
-
dsh plugin --profile web add @xiangyixie/dsh-superagent@0.16.
|
|
44
|
+
dsh plugin --profile web add @xiangyixie/dsh-superagent@0.16.8
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
**Restart DSH** afterwards — plugins are loaded once at host startup. You can also add the [plugin index](https://raw.githubusercontent.com/LittleChenLiya/dsh-superagent/main/plugin-index.json) on the **Discover** page for one-click installs; upgrades are always remove-then-add.
|
|
@@ -1666,7 +1666,7 @@ appears to "hang" until the ignored-abort child returns.
|
|
|
1666
1666
|
|
|
1667
1667
|
| What you see | What it means | What to do |
|
|
1668
1668
|
| --- | --- | --- |
|
|
1669
|
-
| `superagent_*` tools do not exist | The bundle row is not mounted, or the host refused to load the plugin. | Run `--dump-config` and check for the `@xiangyixie/dsh-superagent` block; reinstall with `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.16.
|
|
1669
|
+
| `superagent_*` tools do not exist | The bundle row is not mounted, or the host refused to load the plugin. | Run `--dump-config` and check for the `@xiangyixie/dsh-superagent` block; reinstall with `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.16.8` and read the host log for `[dsh-superagent]` lines. |
|
|
1670
1670
|
| `Cannot find module .../lib/control.js` (or `watch.js` / `report.js` / `wizard.js`), or `[dsh-superagent] dsh-superagent failed to load because a file it imports is missing: ...` in the host log | The copy in that profile is incomplete — an `add` that was interrupted leaves a partial extraction. From 0.14.3 the entry point names the missing file itself. The published package is not the cause: every version ships all thirty-four `lib/` files. | Delete the plugin's directory under the profile's `node_modules` (scoped `@xiangyixie/dsh-superagent`, or unscoped `dsh-superagent` from an older tarball install) and run the same `add` command again, with the version number. Do not copy files in by hand. |
|
|
1671
1671
|
| `[error] the model provider rejected the API key` | The key env var is missing in the process that started the host. | Export `DEEPSEEK_API_KEY` (the default route) or the variable your route names, then restart `dsh`. |
|
|
1672
1672
|
| `MISSING_CREDENTIAL ... no API key for provider route "..."` | The profile's route has no credential in the environment. | Set the env var named for that route and restart. The error line names the route, so use that, not this page. |
|
package/README.md
CHANGED
|
@@ -36,12 +36,12 @@ dsh-superagent 把这件事接过去:你说一句目标,它负责拆、负
|
|
|
36
36
|
|
|
37
37
|
### 1. 装
|
|
38
38
|
|
|
39
|
-
桌面端:侧边栏 **插件** → **Add plugin** → 输入 `@xiangyixie/dsh-superagent@0.16.
|
|
39
|
+
桌面端:侧边栏 **插件** → **Add plugin** → 输入 `@xiangyixie/dsh-superagent@0.16.8` → 安装。
|
|
40
40
|
|
|
41
41
|
命令行:
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
|
-
dsh plugin --profile web add @xiangyixie/dsh-superagent@0.16.
|
|
44
|
+
dsh plugin --profile web add @xiangyixie/dsh-superagent@0.16.8
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
装完**重启 DSH**(插件只在宿主启动时加载一次)。也可以从「发现」页添加[插件索引](https://raw.githubusercontent.com/LittleChenLiya/dsh-superagent/main/plugin-index.json)一键安装;升级一律先 `remove` 再 `add`。
|
|
@@ -1090,7 +1090,7 @@ SHA-256)。`--format html` 把同样的内容写成一个自包含
|
|
|
1090
1090
|
|
|
1091
1091
|
| 你看到的 | 含义 | 怎么办 |
|
|
1092
1092
|
| --- | --- | --- |
|
|
1093
|
-
| `superagent_*` 工具不存在 | bundle 行没挂上,或者宿主拒绝加载插件。 | 跑 `--dump-config` 查 `@xiangyixie/dsh-superagent` 块;用 `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.16.
|
|
1093
|
+
| `superagent_*` 工具不存在 | bundle 行没挂上,或者宿主拒绝加载插件。 | 跑 `--dump-config` 查 `@xiangyixie/dsh-superagent` 块;用 `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.16.8` 重装,并在宿主日志里找 `[dsh-superagent]` 行。 |
|
|
1094
1094
|
| `Cannot find module .../lib/control.js`(或 `watch.js` / `report.js` / `wizard.js`),或宿主日志里的 `[dsh-superagent] dsh-superagent failed to load because a file it imports is missing: ...` | 那个 profile 里的副本不完整——被中断的 `add` 会留下残缺的解包结果。0.14.3 起的入口会直接点名缺哪个文件。已发布的包不是原因:每个版本都带全部三十四个 `lib/` 文件。 | 删掉 profile 的 `node_modules` 下该插件的目录(带 scope 的 `@xiangyixie/dsh-superagent`,或旧 tarball 安装留下的无 scope 的 `dsh-superagent`),再用同一条 `add` 命令重装,并带上版本号。不要手工拷贝文件进去。 |
|
|
1095
1095
|
| `[error] the model provider rejected the API key` | 启动宿主的那个进程里缺 key 环境变量。 | 导出 `DEEPSEEK_API_KEY`(默认路由)或你那条路由声明的变量,然后重启 `dsh`。 |
|
|
1096
1096
|
| `MISSING_CREDENTIAL ... no API key for provider route "..."` | profile 的路由在环境里没有凭据。 | 设置该路由对应的环境变量并重启。错误行里写了路由名,以它为准,不要照本文。 |
|
package/README.zh.md
CHANGED
|
@@ -36,12 +36,12 @@ dsh-superagent 把这件事接过去:你说一句目标,它负责拆、负
|
|
|
36
36
|
|
|
37
37
|
### 1. 装
|
|
38
38
|
|
|
39
|
-
桌面端:侧边栏 **插件** → **Add plugin** → 输入 `@xiangyixie/dsh-superagent@0.16.
|
|
39
|
+
桌面端:侧边栏 **插件** → **Add plugin** → 输入 `@xiangyixie/dsh-superagent@0.16.8` → 安装。
|
|
40
40
|
|
|
41
41
|
命令行:
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
|
-
dsh plugin --profile web add @xiangyixie/dsh-superagent@0.16.
|
|
44
|
+
dsh plugin --profile web add @xiangyixie/dsh-superagent@0.16.8
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
装完**重启 DSH**(插件只在宿主启动时加载一次)。也可以从「发现」页添加[插件索引](https://raw.githubusercontent.com/LittleChenLiya/dsh-superagent/main/plugin-index.json)一键安装;升级一律先 `remove` 再 `add`。
|
|
@@ -1090,7 +1090,7 @@ SHA-256)。`--format html` 把同样的内容写成一个自包含
|
|
|
1090
1090
|
|
|
1091
1091
|
| 你看到的 | 含义 | 怎么办 |
|
|
1092
1092
|
| --- | --- | --- |
|
|
1093
|
-
| `superagent_*` 工具不存在 | bundle 行没挂上,或者宿主拒绝加载插件。 | 跑 `--dump-config` 查 `@xiangyixie/dsh-superagent` 块;用 `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.16.
|
|
1093
|
+
| `superagent_*` 工具不存在 | bundle 行没挂上,或者宿主拒绝加载插件。 | 跑 `--dump-config` 查 `@xiangyixie/dsh-superagent` 块;用 `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.16.8` 重装,并在宿主日志里找 `[dsh-superagent]` 行。 |
|
|
1094
1094
|
| `Cannot find module .../lib/control.js`(或 `watch.js` / `report.js` / `wizard.js`),或宿主日志里的 `[dsh-superagent] dsh-superagent failed to load because a file it imports is missing: ...` | 那个 profile 里的副本不完整——被中断的 `add` 会留下残缺的解包结果。0.14.3 起的入口会直接点名缺哪个文件。已发布的包不是原因:每个版本都带全部三十四个 `lib/` 文件。 | 删掉 profile 的 `node_modules` 下该插件的目录(带 scope 的 `@xiangyixie/dsh-superagent`,或旧 tarball 安装留下的无 scope 的 `dsh-superagent`),再用同一条 `add` 命令重装,并带上版本号。不要手工拷贝文件进去。 |
|
|
1095
1095
|
| `[error] the model provider rejected the API key` | 启动宿主的那个进程里缺 key 环境变量。 | 导出 `DEEPSEEK_API_KEY`(默认路由)或你那条路由声明的变量,然后重启 `dsh`。 |
|
|
1096
1096
|
| `MISSING_CREDENTIAL ... no API key for provider route "..."` | profile 的路由在环境里没有凭据。 | 设置该路由对应的环境变量并重启。错误行里写了路由名,以它为准,不要照本文。 |
|
package/lib/client.js
CHANGED
|
@@ -64,9 +64,8 @@ window.__ModuleLoader__.load({
|
|
|
64
64
|
const MarkdownText = pick('MarkdownText')
|
|
65
65
|
const UserMessageBubble = pick('UserMessageBubble')
|
|
66
66
|
const StateDot = pick('StateDot')
|
|
67
|
-
const Menu = pick('Menu')
|
|
68
67
|
const Tooltip = pick('Tooltip')
|
|
69
|
-
const MISSING_PRIMITIVES = ['Button', 'FishLogo', 'MarkdownText', 'UserMessageBubble', 'StateDot', '
|
|
68
|
+
const MISSING_PRIMITIVES = ['Button', 'FishLogo', 'MarkdownText', 'UserMessageBubble', 'StateDot', 'Tooltip']
|
|
70
69
|
.filter(name => !pick(name))
|
|
71
70
|
if (!ui) {
|
|
72
71
|
console.warn('[dsh-superagent] host primitives module is absent; assistant text renders as plain text')
|
|
@@ -76,14 +75,12 @@ window.__ModuleLoader__.load({
|
|
|
76
75
|
const ICONS = {
|
|
77
76
|
spark: ui?.IconSparkleRegular ?? ui?.IconSparkleMedium,
|
|
78
77
|
send: ui?.IconSendOutlineRegular ?? ui?.IconSendOutlineMedium,
|
|
79
|
-
|
|
80
|
-
refresh: ui?.IconRefreshOutlineRegular ?? ui?.IconRefreshOutlineMedium,
|
|
78
|
+
attach: ui?.IconPaperclipOutlineRegular ?? ui?.IconPaperclipOutlineMedium,
|
|
81
79
|
stop: ui?.IconStopFillRegular ?? ui?.IconStopFillMedium,
|
|
82
80
|
clock: ui?.IconClockOutlineRegular ?? ui?.IconClockOutlineMedium,
|
|
83
81
|
check: ui?.IconCheckOutlineRegular ?? ui?.IconCheckOutlineMedium,
|
|
84
82
|
close: ui?.IconCloseOutlineRegular ?? ui?.IconCloseOutlineMedium,
|
|
85
83
|
folder: ui?.IconFolderCloseRegular ?? ui?.IconFolderCloseMedium,
|
|
86
|
-
chevron: ui?.IconChevronDownOutlineRegular ?? ui?.IconChevronDownOutlineMedium,
|
|
87
84
|
panel: ui?.IconPanelLeftOutlineRegular ?? ui?.IconPanelLeftOutlineMedium,
|
|
88
85
|
}
|
|
89
86
|
// MarkdownText reads `labels.code` on every fenced block, so the host
|
|
@@ -100,11 +97,7 @@ window.__ModuleLoader__.load({
|
|
|
100
97
|
},
|
|
101
98
|
footnotes: '脚注',
|
|
102
99
|
}
|
|
103
|
-
/** Composer delivery
|
|
104
|
-
const MODES = [
|
|
105
|
-
{ id: 'queue', label: '排队' },
|
|
106
|
-
{ id: 'steer', label: '插话' },
|
|
107
|
-
]
|
|
100
|
+
/** Composer delivery behaviour: idle sends start a turn, running sends steer. */
|
|
108
101
|
const RAIL_KEY = 'dsh-superagent.rail-open'
|
|
109
102
|
function readRailOpen() {
|
|
110
103
|
try {
|
|
@@ -182,10 +175,6 @@ window.__ModuleLoader__.load({
|
|
|
182
175
|
.dsa-railtoggle{position:relative}
|
|
183
176
|
.dsa-railtoggle[aria-expanded=false] svg{transform:scaleX(-1)}
|
|
184
177
|
.dsa-badge{position:absolute;top:-2px;right:-2px;min-width:14px;height:14px;padding:0 3px;border-radius:7px;background:var(--dsw-alias-state-business-primary,#4d6bfe);color:#fff;font-size:9px;line-height:14px;font-weight:600;text-align:center;box-sizing:border-box}
|
|
185
|
-
.dsa-status{display:inline-flex;align-items:center;gap:6px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary,rgb(129,133,140))}
|
|
186
|
-
.dsa-dot{width:6px;height:6px;border-radius:50%;background:var(--dsw-alias-label-caption,rgb(129,133,140))}
|
|
187
|
-
.dsa-dot[data-state=live]{background:var(--dsw-alias-state-success-primary,#22c55e)}
|
|
188
|
-
.dsa-dot[data-state=warn]{background:var(--dsw-alias-state-warn-primary,#f59e0b)}
|
|
189
178
|
.dsa-body{position:relative;display:grid;grid-template-columns:minmax(0,1fr) 0;grid-template-rows:minmax(0,1fr);flex:1;min-height:0;overflow:hidden;transition:grid-template-columns var(--ds-transition-duration-slow,240ms) var(--ds-ease-in-out,ease)}
|
|
190
179
|
.dsa-body[data-rail=open]{grid-template-columns:minmax(0,1fr) 360px}
|
|
191
180
|
.dsa-main{grid-column:1;grid-row:1;position:relative;display:flex;flex-direction:column;min-width:0;min-height:0}
|
|
@@ -207,8 +196,6 @@ window.__ModuleLoader__.load({
|
|
|
207
196
|
.dsa-trailing{margin-left:auto;flex:none}
|
|
208
197
|
.dsa-add{display:grid;place-items:center;flex:none;width:28px;height:28px;border:0;border-radius:999px;background:var(--dsw-specific-selector,rgba(255,255,255,.08));color:var(--dsw-alias-label-primary,#f9fafb);cursor:pointer}
|
|
209
198
|
.dsa-add:hover{background:var(--dsw-alias-interactive-bg-hover-solid,rgba(255,255,255,.14))}
|
|
210
|
-
.dsa-chip{display:inline-flex;align-items:center;gap:4px;height:28px;padding:0 8px;border:0;border-radius:var(--dsw-radius-sm,8px);background-color:transparent;color:var(--dsw-alias-label-secondary,rgb(207,211,214));font-size:13px;line-height:20px;font-weight:500;white-space:nowrap;cursor:pointer;appearance:none}
|
|
211
|
-
.dsa-chip:hover,.dsa-chip[aria-expanded=true]{background-color:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.08))}
|
|
212
199
|
.dsa-send{display:grid;place-items:center;flex:none;width:34px;height:34px;border:0;border-radius:999px;background:var(--dsw-alias-button-info-fill,#3964fe);color:var(--dsw-alias-label-on-color,#fff);cursor:pointer;transform:translateY(-2px);transition:background-color 100ms ease}
|
|
213
200
|
.dsa-send:hover:not(:disabled){background:var(--dsw-alias-button-info-hover,#2f57e6)}
|
|
214
201
|
.dsa-send:disabled{opacity:.4;cursor:default}
|
|
@@ -327,8 +314,6 @@ window.__ModuleLoader__.load({
|
|
|
327
314
|
messages: [],
|
|
328
315
|
approvals: [],
|
|
329
316
|
runs: [],
|
|
330
|
-
conn: 'connecting',
|
|
331
|
-
mode: 'queue',
|
|
332
317
|
toast: null,
|
|
333
318
|
canceling: false,
|
|
334
319
|
approvalBusy: {},
|
|
@@ -496,7 +481,7 @@ window.__ModuleLoader__.load({
|
|
|
496
481
|
if (!frame || typeof frame !== 'object') return model
|
|
497
482
|
switch (frame.type) {
|
|
498
483
|
case 'hello':
|
|
499
|
-
return { ...model, sessionId: frame.sessionId ?? model.sessionId, capabilities: frame.capabilities ?? model.capabilities
|
|
484
|
+
return { ...model, sessionId: frame.sessionId ?? model.sessionId, capabilities: frame.capabilities ?? model.capabilities }
|
|
500
485
|
case 'session':
|
|
501
486
|
if (!frame.sessionId || frame.sessionId === model.sessionId) return model
|
|
502
487
|
return { ...model, sessionId: frame.sessionId, messages: [], approvals: [], approvalBusy: {}, currentId: null, typing: false, canceling: false }
|
|
@@ -532,25 +517,18 @@ window.__ModuleLoader__.load({
|
|
|
532
517
|
return { ...model, runs: Array.isArray(frame.runs) ? frame.runs : [] }
|
|
533
518
|
case 'canceling':
|
|
534
519
|
return { ...model, canceling: true }
|
|
535
|
-
case 'error':
|
|
536
|
-
return { ...model, conn: frame.code === 'follow-failed' || frame.code === 'state-failed' ? 'warn' : model.conn }
|
|
537
|
-
case 'closed':
|
|
538
|
-
return { ...model, conn: 'warn' }
|
|
539
520
|
default:
|
|
540
521
|
return model
|
|
541
522
|
}
|
|
542
523
|
}
|
|
543
524
|
|
|
544
525
|
function Header(props) {
|
|
545
|
-
const {
|
|
526
|
+
const { railOpen, runningCount, onToggleRail } = props
|
|
546
527
|
const toggleLabel = railOpen ? '收起任务栏(Ctrl+Shift+B)' : '展开任务栏(Ctrl+Shift+B)'
|
|
547
528
|
return h('header', { className: 'dsa-header' },
|
|
548
529
|
h('div', { className: 'dsa-crumbs' },
|
|
549
530
|
h('span', { className: 'dsa-crumb dsa-crumb-current' }, PANEL_LABEL)),
|
|
550
531
|
h('div', { className: 'dsa-head-actions' },
|
|
551
|
-
h('span', { className: 'dsa-status' },
|
|
552
|
-
h('span', { className: 'dsa-dot', 'data-state': model.conn }),
|
|
553
|
-
model.conn === 'live' ? '已连接' : model.conn === 'warn' ? '流中断' : '连接中'),
|
|
554
532
|
tipped(toggleLabel, h('button', {
|
|
555
533
|
type: 'button',
|
|
556
534
|
className: 'dsa-iconbtn dsa-railtoggle',
|
|
@@ -559,9 +537,7 @@ window.__ModuleLoader__.load({
|
|
|
559
537
|
onClick: onToggleRail,
|
|
560
538
|
},
|
|
561
539
|
h(Icon, { of: 'panel' }),
|
|
562
|
-
runningCount > 0 ? h('span', { className: 'dsa-badge' }, runningCount > 9 ? '9+' : String(runningCount)) : null))
|
|
563
|
-
tipped('刷新', h('button', { type: 'button', className: 'dsa-iconbtn', onClick: onRefresh },
|
|
564
|
-
h(Icon, { of: 'refresh' })))))
|
|
540
|
+
runningCount > 0 ? h('span', { className: 'dsa-badge' }, runningCount > 9 ? '9+' : String(runningCount)) : null))))
|
|
565
541
|
}
|
|
566
542
|
|
|
567
543
|
function UserMessage(props) {
|
|
@@ -668,50 +644,10 @@ window.__ModuleLoader__.load({
|
|
|
668
644
|
}))
|
|
669
645
|
}
|
|
670
646
|
|
|
671
|
-
/**
|
|
672
|
-
* Delivery-mode picker. The host Menu carries the theme, radius, row height,
|
|
673
|
-
* hover fill, check mark, shadow, keyboard handling, outside dismiss and
|
|
674
|
-
* focus return; without it the chip still never falls back to a native
|
|
675
|
-
* `<select>` (it just cycles on click).
|
|
676
|
-
*/
|
|
677
|
-
function Chooser(props) {
|
|
678
|
-
const label = MODES.find(entry => entry.id === props.mode)?.label ?? '排队'
|
|
679
|
-
if (!Menu) {
|
|
680
|
-
return h('button', {
|
|
681
|
-
type: 'button',
|
|
682
|
-
className: 'dsa-chip',
|
|
683
|
-
'aria-label': `发送方式:${label},点击切换`,
|
|
684
|
-
onClick: () => props.onMode(props.mode === 'queue' ? 'steer' : 'queue'),
|
|
685
|
-
}, h('span', null, label), h(Icon, { of: 'chevron', size: 12 }))
|
|
686
|
-
}
|
|
687
|
-
return h(Menu, {
|
|
688
|
-
open: props.open,
|
|
689
|
-
anchor: h('button', {
|
|
690
|
-
type: 'button',
|
|
691
|
-
className: 'dsa-chip',
|
|
692
|
-
'aria-haspopup': 'menu',
|
|
693
|
-
'aria-expanded': props.open ? 'true' : 'false',
|
|
694
|
-
'aria-label': `发送方式:${label}`,
|
|
695
|
-
onClick: () => props.onOpenChange(!props.open),
|
|
696
|
-
}, h('span', null, label), h(Icon, { of: 'chevron', size: 12 })),
|
|
697
|
-
items: MODES,
|
|
698
|
-
selectedId: props.mode,
|
|
699
|
-
side: 'top',
|
|
700
|
-
align: 'start',
|
|
701
|
-
portal: true,
|
|
702
|
-
onClose: () => props.onOpenChange(false),
|
|
703
|
-
onSelect: id => {
|
|
704
|
-
props.onOpenChange(false)
|
|
705
|
-
if (id !== props.mode) props.onMode(id)
|
|
706
|
-
},
|
|
707
|
-
})
|
|
708
|
-
}
|
|
709
|
-
|
|
710
647
|
function Composer(props) {
|
|
711
648
|
const { hero, disabled, onSend } = props
|
|
712
649
|
const [text, setText] = react.useState('')
|
|
713
650
|
const [busy, setBusy] = react.useState(false)
|
|
714
|
-
const [chooser, setChooser] = react.useState(false)
|
|
715
651
|
const areaRef = react.useRef(null)
|
|
716
652
|
const fileRef = react.useRef(null)
|
|
717
653
|
|
|
@@ -793,13 +729,7 @@ window.__ModuleLoader__.load({
|
|
|
793
729
|
disabled: busy,
|
|
794
730
|
'aria-label': '放进工作区',
|
|
795
731
|
onClick: () => fileRef.current?.click(),
|
|
796
|
-
}, h(Icon, { of: '
|
|
797
|
-
h(Chooser, {
|
|
798
|
-
mode: props.mode ?? 'queue',
|
|
799
|
-
open: chooser,
|
|
800
|
-
onOpenChange: setChooser,
|
|
801
|
-
onMode: props.onMode,
|
|
802
|
-
})),
|
|
732
|
+
}, h(Icon, { of: 'attach', size: 16 })), 'top')),
|
|
803
733
|
h('div', { className: 'dsa-trailing' },
|
|
804
734
|
props.running
|
|
805
735
|
? tipped('停止本轮', h('button', {
|
|
@@ -913,11 +843,9 @@ window.__ModuleLoader__.load({
|
|
|
913
843
|
const notify = text => dispatch({ type: 'toast', text })
|
|
914
844
|
return h('div', { className: 'dsa-root', 'data-rail': railOpen ? 'open' : 'closed' },
|
|
915
845
|
h(Header, {
|
|
916
|
-
model,
|
|
917
846
|
railOpen,
|
|
918
847
|
runningCount,
|
|
919
848
|
onToggleRail: toggleRail,
|
|
920
|
-
onRefresh: () => dispatch({ type: 'refresh' }),
|
|
921
849
|
}),
|
|
922
850
|
h(Toast, { toast: model.toast }),
|
|
923
851
|
h('div', { className: 'dsa-body', 'data-rail': railOpen ? 'open' : 'closed' },
|
|
@@ -925,13 +853,11 @@ window.__ModuleLoader__.load({
|
|
|
925
853
|
empty
|
|
926
854
|
? h(Hero, {
|
|
927
855
|
model,
|
|
928
|
-
mode: model.mode,
|
|
929
856
|
disabled: model.sending,
|
|
930
857
|
running: model.typing,
|
|
931
858
|
canceling: model.canceling,
|
|
932
859
|
onStop: () => dispatch({ type: 'cancel' }),
|
|
933
860
|
onSend: text => dispatch({ type: 'send', text }),
|
|
934
|
-
onMode: mode => dispatch({ type: 'mode', mode }),
|
|
935
861
|
onError: notify,
|
|
936
862
|
})
|
|
937
863
|
: h(Transcript, { model, scrollRef: model.scrollRef }),
|
|
@@ -942,13 +868,11 @@ window.__ModuleLoader__.load({
|
|
|
942
868
|
}),
|
|
943
869
|
empty ? null : h(Composer, {
|
|
944
870
|
model,
|
|
945
|
-
mode: model.mode,
|
|
946
871
|
disabled: model.sending || model.capabilities?.chat === false,
|
|
947
872
|
running: model.typing,
|
|
948
873
|
canceling: model.canceling,
|
|
949
874
|
onStop: () => dispatch({ type: 'cancel' }),
|
|
950
875
|
onSend: text => dispatch({ type: 'send', text }),
|
|
951
|
-
onMode: mode => dispatch({ type: 'mode', mode }),
|
|
952
876
|
onError: notify,
|
|
953
877
|
})),
|
|
954
878
|
h(Rail, { model })))
|
|
@@ -1010,8 +934,6 @@ window.__ModuleLoader__.load({
|
|
|
1010
934
|
}
|
|
1011
935
|
patch(current => applyFrame(current, frame))
|
|
1012
936
|
})
|
|
1013
|
-
source.onopen = () => patch(current => ({ ...current, conn: 'live' }))
|
|
1014
|
-
source.onerror = () => patch(current => ({ ...current, conn: 'warn' }))
|
|
1015
937
|
}
|
|
1016
938
|
open()
|
|
1017
939
|
return () => {
|
|
@@ -1045,10 +967,11 @@ window.__ModuleLoader__.load({
|
|
|
1045
967
|
typing: true,
|
|
1046
968
|
messages: [...current.messages, { id, role: 'user', text, at: Date.now(), pending: true }],
|
|
1047
969
|
}))
|
|
970
|
+
const mode = modelRef.current.typing ? 'steer' : 'queue'
|
|
1048
971
|
try {
|
|
1049
972
|
await call('/message', {
|
|
1050
973
|
method: 'POST',
|
|
1051
|
-
body: JSON.stringify({ text, mode
|
|
974
|
+
body: JSON.stringify({ text, mode, sessionId }),
|
|
1052
975
|
})
|
|
1053
976
|
} catch (error) {
|
|
1054
977
|
patch(current => ({
|
|
@@ -1086,15 +1009,10 @@ window.__ModuleLoader__.load({
|
|
|
1086
1009
|
throw error
|
|
1087
1010
|
}
|
|
1088
1011
|
},
|
|
1089
|
-
refresh: () => {
|
|
1090
|
-
patch(current => ({ ...current, phase: 'loading' }))
|
|
1091
|
-
setAttempt(value => value + 1)
|
|
1092
|
-
},
|
|
1093
1012
|
retry: () => {
|
|
1094
1013
|
patch(current => ({ ...current, phase: 'loading', reason: '' }))
|
|
1095
1014
|
setAttempt(value => value + 1)
|
|
1096
1015
|
},
|
|
1097
|
-
mode: action => patch(current => ({ ...current, mode: action.mode })),
|
|
1098
1016
|
toast: action => patch(current => ({ ...current, toast: { kind: 'err', text: String(action.text ?? '') } })),
|
|
1099
1017
|
}
|
|
1100
1018
|
|