@xmanrui/dsh-im 5.4.0 → 5.6.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/PROACTIVE_DELIVERY.en.md +15 -0
- package/PROACTIVE_DELIVERY.md +15 -0
- package/README.en.md +46 -5
- package/README.md +46 -5
- package/lib/client.js +2579 -664
- package/lib/index.js +406 -339
- package/package.json +4 -4
- package/plugin-src/client/channel-card-meta.js +6 -2
- package/plugin-src/client/channels/dingtalk/index.js +12 -9
- package/plugin-src/client/channels/feishu/group-settings.js +5 -5
- package/plugin-src/client/channels/feishu/index.js +33 -25
- package/plugin-src/client/channels/qq/index.js +5 -5
- package/plugin-src/client/channels/shared/token-api.js +25 -7
- package/plugin-src/client/channels/shared/token-channel.js +18 -11
- package/plugin-src/client/channels/telegram/styles.js +4 -0
- package/plugin-src/client/channels/telegram/thinking-traces.js +138 -5
- package/plugin-src/client/channels/wecom/index.js +5 -5
- package/plugin-src/client/channels/wecom-app/index.js +3 -3
- package/plugin-src/client/channels/weixin/index.js +2 -2
- package/plugin-src/client/channels/whatsapp/index.js +6 -6
- package/plugin-src/client/credential-binding.js +3 -2
- package/plugin-src/client/delivery-settings.js +4 -4
- package/plugin-src/client/ds-bot-settings.js +3 -3
- package/plugin-src/client/global-settings.js +5 -2
- package/plugin-src/client/i18n-ru.js +1637 -0
- package/plugin-src/client/i18n.js +281 -124
- package/plugin-src/client/index.js +8 -1
- package/plugin-src/host/channels/shared/production.mjs +5 -0
- package/plugin-src/host/channels/shared/rpc.mjs +21 -0
- package/plugin-src/host/channels/shared/send-limit-rpc.mjs +13 -0
- package/plugin-src/host/channels/shared/thinking-cadence-rpc.mjs +16 -0
- package/plugin-src/host/channels/telegram/production.mjs +7 -0
- package/plugin-src/host/delivery-adapter.mjs +41 -33
- package/plugin-src/host/delivery-service.mjs +42 -0
- package/plugin-src/host/ds-bot-client.mjs +31 -18
- package/plugin-src/host/ds-bot-question-sync.mjs +78 -0
- package/plugin-src/host/index.mjs +3 -0
- package/plugin-src/host/modern-harness-api.mjs +53 -8
- package/plugin-src/host/session-sync-coordinator.mjs +5 -5
- package/scripts/verify-package.mjs +18 -6
- package/src/channels/dingtalk/dingtalk-bridge.mjs +1 -0
- package/src/channels/feishu/bridge.mjs +107 -7
- package/src/channels/feishu/feishu-cards.mjs +1 -45
- package/src/channels/feishu/feishu-runtime.mjs +10 -0
- package/src/channels/feishu/multi-bot-controller.mjs +12 -0
- package/src/channels/feishu/slash-command-panel.mjs +2 -5
- package/src/channels/qq/qq-bridge.mjs +1 -0
- package/src/channels/shared/AGENTS.md +19 -0
- package/src/channels/shared/bot-workspace-store.mjs +1 -1
- package/src/channels/shared/clear-command.mjs +2 -1
- package/src/channels/shared/command-catalog.mjs +8 -5
- package/src/channels/shared/compact-command.mjs +2 -1
- package/src/channels/shared/conversation-queue.mjs +49 -0
- package/src/channels/shared/deferred-delivery-coordinator.mjs +2 -1
- package/src/channels/shared/delivery-failure-log.mjs +111 -0
- package/src/channels/shared/diagnostic-details.mjs +1 -0
- package/src/channels/shared/harness-client.mjs +16 -9
- package/src/channels/shared/history-command.mjs +2 -1
- package/src/channels/shared/i18n-en/shared-a.mjs +2 -2
- package/src/channels/shared/i18n-en/shared-b.mjs +7 -2
- package/src/channels/shared/i18n-en/shared-c.mjs +6 -2
- package/src/channels/shared/i18n-en/telegram.mjs +6 -0
- package/src/channels/shared/i18n-ru/diagnostics.mjs +104 -0
- package/src/channels/shared/i18n-ru/dingtalk.mjs +96 -0
- package/src/channels/shared/i18n-ru/discord.mjs +10 -0
- package/src/channels/shared/i18n-ru/email.mjs +23 -0
- package/src/channels/shared/i18n-ru/feishu.mjs +374 -0
- package/src/channels/shared/i18n-ru/image-input.mjs +25 -0
- package/src/channels/shared/i18n-ru/matrix.mjs +73 -0
- package/src/channels/shared/i18n-ru/office.mjs +27 -0
- package/src/channels/shared/i18n-ru/permission.mjs +45 -0
- package/src/channels/shared/i18n-ru/qq.mjs +88 -0
- package/src/channels/shared/i18n-ru/shared-a.mjs +236 -0
- package/src/channels/shared/i18n-ru/shared-b.mjs +262 -0
- package/src/channels/shared/i18n-ru/shared-c.mjs +176 -0
- package/src/channels/shared/i18n-ru/slack.mjs +22 -0
- package/src/channels/shared/i18n-ru/telegram.mjs +30 -0
- package/src/channels/shared/i18n-ru/wecom-app.mjs +43 -0
- package/src/channels/shared/i18n-ru/wecom.mjs +79 -0
- package/src/channels/shared/i18n-ru/weixin.mjs +275 -0
- package/src/channels/shared/i18n-ru/whatsapp.mjs +18 -0
- package/src/channels/shared/i18n-ru.mjs +48 -0
- package/src/channels/shared/i18n.mjs +47 -12
- package/src/channels/shared/inbound-access.mjs +1 -1
- package/src/channels/shared/interface-language.mjs +3 -3
- package/src/channels/shared/message-failure.mjs +8 -4
- package/src/channels/shared/model-command.mjs +2 -1
- package/src/channels/shared/permission-command.mjs +2 -1
- package/src/channels/shared/send-limit.mjs +38 -0
- package/src/channels/shared/session-error.mjs +11 -0
- package/src/channels/shared/status-reaction.mjs +2 -0
- package/src/channels/shared/text-harness-bridge.mjs +205 -3
- package/src/channels/shared/thinking-cadence.mjs +36 -0
- package/src/channels/shared/workspace-command.mjs +43 -17
- package/src/channels/shared/workspace-labels.mjs +65 -0
- package/src/channels/shared/workspace-session.mjs +24 -4
- package/src/channels/telegram/config-store.mjs +34 -1
- package/src/channels/telegram/telegram-api.mjs +240 -32
- package/src/channels/telegram/telegram-bridge.mjs +62 -1
- package/src/channels/telegram/telegram-controller.mjs +29 -0
- package/src/channels/telegram/telegram-runtime.mjs +592 -179
- package/src/channels/telegram/voice.mjs +250 -0
- package/src/channels/wecom/wecom-bridge.mjs +1 -0
- package/src/channels/wecom-app/wecom-app-bridge.mjs +1 -0
- package/src/channels/weixin/weixin-bridge.mjs +1 -0
|
@@ -1,13 +1,112 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* 会话行为设置块:思考过程留痕、帧编号、帧节奏与消息发送上限(Telegram 专属)。
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* 开启留痕后,机器人把 agent 的推理与工具调用作为独立的 💭/🔧 消息实时发出来,
|
|
5
|
+
* 最终答案单独成条;关闭留痕后使用常规占位符进度,完成时删除占位符并发送答案。
|
|
6
|
+
* 一轮里可能产生几十帧,所以另外两个设置决定这串消息的样子:编号让顺序可见,
|
|
7
|
+
* 节奏把突发合并成最新一帧,而不是排一队过期的消息。
|
|
6
8
|
*/
|
|
9
|
+
import { normalizeThinkingIntervalSeconds } from '../../../../src/channels/shared/thinking-cadence.mjs';
|
|
10
|
+
import { DEFAULT_SEND_LIMIT_PER_MINUTE } from '../../../../src/channels/shared/send-limit.mjs';
|
|
7
11
|
import { h } from '../../i18n.js';
|
|
12
|
+
import * as React from 'react';
|
|
8
13
|
|
|
9
|
-
|
|
14
|
+
/** 0 表示不限制;其余是常见的步长,最大一分钟。 */
|
|
15
|
+
export const THINKING_INTERVAL_OPTIONS = Object.freeze([
|
|
16
|
+
0, 1, 2, 3, 5, 7, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60,
|
|
17
|
+
]);
|
|
18
|
+
|
|
19
|
+
/** 配置里可能存着列表外的值(旧配置或手工编辑),补一个选项而不是静默改成 0。 */
|
|
20
|
+
function intervalValues(saved) {
|
|
21
|
+
if (THINKING_INTERVAL_OPTIONS.includes(saved)) return THINKING_INTERVAL_OPTIONS;
|
|
22
|
+
return [...THINKING_INTERVAL_OPTIONS, saved].sort((left, right) => left - right);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function SendLimitField({ account, busy, saving, onCommit }) {
|
|
26
|
+
const saved = Number.isInteger(account.sendLimitPerMinute)
|
|
27
|
+
? account.sendLimitPerMinute
|
|
28
|
+
: DEFAULT_SEND_LIMIT_PER_MINUTE;
|
|
29
|
+
const [value, setValue] = React.useState(String(saved));
|
|
30
|
+
// A save from another tab, or a reconnect, rewrites the stored value.
|
|
31
|
+
React.useEffect(() => { setValue(String(saved)); }, [saved]);
|
|
32
|
+
const commit = () => {
|
|
33
|
+
const numeric = Number(value.trim());
|
|
34
|
+
if (!value.trim() || !Number.isFinite(numeric) || Math.round(numeric) === saved) {
|
|
35
|
+
setValue(String(saved));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
onCommit?.(Math.round(numeric));
|
|
39
|
+
};
|
|
40
|
+
return h('label', { className: 'dim-accountSettingsRow' },
|
|
41
|
+
h('span', { className: 'dim-accountSettingsText' },
|
|
42
|
+
h('span', { className: 'dim-accountSettingsLabel' }, '消息发送上限'),
|
|
43
|
+
h('span', { className: 'dim-accountSettingsHelp' },
|
|
44
|
+
'每个聊天每分钟的消息数;机器人会等待而不是丢弃')),
|
|
45
|
+
h('input', {
|
|
46
|
+
type: 'number',
|
|
47
|
+
min: 1,
|
|
48
|
+
max: 30,
|
|
49
|
+
step: 1,
|
|
50
|
+
className: 'dim-accountSettingsNumber',
|
|
51
|
+
value,
|
|
52
|
+
disabled: Boolean(busy) || saving,
|
|
53
|
+
onChange: (event) => { setValue(event.target.value); },
|
|
54
|
+
onBlur: commit,
|
|
55
|
+
onKeyDown: (event) => {
|
|
56
|
+
if (event.key !== 'Enter') return;
|
|
57
|
+
event.preventDefault();
|
|
58
|
+
commit();
|
|
59
|
+
},
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function ThinkingTracesSettings({
|
|
64
|
+
account, busy, onSave, rpcCall, endpoints, onChanged,
|
|
65
|
+
}) {
|
|
10
66
|
const checked = account.thinkingTraces !== false;
|
|
67
|
+
const storedNumbering = account.thinkingNumbering === true;
|
|
68
|
+
const storedInterval = normalizeThinkingIntervalSeconds(account.thinkingIntervalSeconds);
|
|
69
|
+
// 两个新控件共用一个 RPC,所以各自提交时都要带上对方的当前值。
|
|
70
|
+
const [draft, setDraft] = React.useState({
|
|
71
|
+
thinkingNumbering: storedNumbering,
|
|
72
|
+
thinkingIntervalSeconds: storedInterval,
|
|
73
|
+
});
|
|
74
|
+
// 另一个标签页保存过、或重连之后,服务端存的值才是准的。
|
|
75
|
+
React.useEffect(() => {
|
|
76
|
+
setDraft({ thinkingNumbering: storedNumbering, thinkingIntervalSeconds: storedInterval });
|
|
77
|
+
}, [storedNumbering, storedInterval]);
|
|
78
|
+
const [saving, setSaving] = React.useState(false);
|
|
79
|
+
const endpoint = endpoints?.setThinkingCadence;
|
|
80
|
+
const commit = async (patch) => {
|
|
81
|
+
if (typeof rpcCall !== 'function' || !endpoint) return;
|
|
82
|
+
const next = { ...draft, ...patch };
|
|
83
|
+
setDraft(next);
|
|
84
|
+
setSaving(true);
|
|
85
|
+
try {
|
|
86
|
+
const response = await rpcCall(endpoint, { botId: account.botId, ...next });
|
|
87
|
+
if (response && response.ok === false) throw new Error(response.error?.message ?? '请求失败');
|
|
88
|
+
await onChanged?.({ silent: true });
|
|
89
|
+
} catch {
|
|
90
|
+
// 服务端存的值仍然作准:界面回到它,免得显示一个没保存的节奏。
|
|
91
|
+
setDraft({ thinkingNumbering: storedNumbering, thinkingIntervalSeconds: storedInterval });
|
|
92
|
+
} finally {
|
|
93
|
+
setSaving(false);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
const sendLimitEndpoint = endpoints?.setSendLimit;
|
|
97
|
+
const commitSendLimit = async (sendLimitPerMinute) => {
|
|
98
|
+
if (typeof rpcCall !== 'function' || !sendLimitEndpoint) return;
|
|
99
|
+
setSaving(true);
|
|
100
|
+
try {
|
|
101
|
+
const response = await rpcCall(sendLimitEndpoint, { botId: account.botId, sendLimitPerMinute });
|
|
102
|
+
if (response && response.ok === false) throw new Error(response.error?.message ?? '请求失败');
|
|
103
|
+
await onChanged?.({ silent: true });
|
|
104
|
+
} catch {
|
|
105
|
+
// The stored value stays authoritative; the next reload shows it again.
|
|
106
|
+
} finally {
|
|
107
|
+
setSaving(false);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
11
110
|
return h('div', { className: 'dim-accountSettings' },
|
|
12
111
|
h('h4', { className: 'dim-accountSettingsTitle' }, '会话行为'),
|
|
13
112
|
h('label', { className: 'dim-accountSettingsRow' },
|
|
@@ -21,5 +120,39 @@ export function ThinkingTracesSettings({ account, busy, onSave }) {
|
|
|
21
120
|
checked,
|
|
22
121
|
disabled: Boolean(busy),
|
|
23
122
|
onChange: (event) => { onSave?.({ thinkingTraces: event.target.checked }); },
|
|
24
|
-
}))
|
|
123
|
+
})),
|
|
124
|
+
h('label', { className: 'dim-accountSettingsRow' },
|
|
125
|
+
h('span', { className: 'dim-accountSettingsText' },
|
|
126
|
+
h('span', { className: 'dim-accountSettingsLabel' }, '编号思考帧'),
|
|
127
|
+
h('span', { className: 'dim-accountSettingsHelp' },
|
|
128
|
+
'在每帧前加上本轮序号;被节奏跳过的帧也计数,所以编号会跳号(需先打开思考过程留痕)')),
|
|
129
|
+
h('input', {
|
|
130
|
+
type: 'checkbox',
|
|
131
|
+
className: 'dim-accountSettingsSwitch',
|
|
132
|
+
checked: draft.thinkingNumbering,
|
|
133
|
+
disabled: Boolean(busy) || saving,
|
|
134
|
+
onChange: (event) => { void commit({ thinkingNumbering: event.target.checked }); },
|
|
135
|
+
})),
|
|
136
|
+
h('label', { className: 'dim-accountSettingsRow' },
|
|
137
|
+
h('span', { className: 'dim-accountSettingsText' },
|
|
138
|
+
h('span', { className: 'dim-accountSettingsLabel' }, '最多每隔多久发送一帧(秒)'),
|
|
139
|
+
h('span', { className: 'dim-accountSettingsHelp' },
|
|
140
|
+
'突发时只发送窗口里最新的一帧,过期的帧丢弃,不排队也不重发')),
|
|
141
|
+
h('select', {
|
|
142
|
+
className: 'dim-accountSettingsSelect',
|
|
143
|
+
value: String(draft.thinkingIntervalSeconds),
|
|
144
|
+
disabled: Boolean(busy) || saving,
|
|
145
|
+
onChange: (event) => {
|
|
146
|
+
void commit({ thinkingIntervalSeconds: Number(event.target.value) });
|
|
147
|
+
},
|
|
148
|
+
}, intervalValues(draft.thinkingIntervalSeconds).map((value) => h('option', {
|
|
149
|
+
key: value,
|
|
150
|
+
value: String(value),
|
|
151
|
+
}, value === 0 ? '不限制(0)' : String(value))))),
|
|
152
|
+
h(SendLimitField, {
|
|
153
|
+
account,
|
|
154
|
+
busy: Boolean(busy),
|
|
155
|
+
saving,
|
|
156
|
+
onCommit: commitSendLimit,
|
|
157
|
+
}));
|
|
25
158
|
}
|
|
@@ -5,7 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import { WecomLogoGlyph } from '../../channel-logos.js';
|
|
6
6
|
import { CredentialActionIcon, CredentialBindingPanel, QrActionIcon } from '../../credential-binding.js';
|
|
7
7
|
import { AccountSettingsToggle, CollapsibleAccountSection } from '../shared/collapsible-account.js';
|
|
8
|
-
import { h } from '../../i18n.js';
|
|
8
|
+
import { channelName, h, localizeTemplate } from '../../i18n.js';
|
|
9
9
|
import { WorkspaceEditor } from '../../workspace-editor.js';
|
|
10
10
|
import { ContextEnhancementEditor } from '../../context-enhancement.js';
|
|
11
11
|
import {
|
|
@@ -82,14 +82,14 @@ function Heading({ totals, adding, busy, onAdd, onCredential, credentialOpen, ad
|
|
|
82
82
|
}, h(CredentialActionIcon), credentialOpen ? '收起凭据' : '手动接入')),
|
|
83
83
|
totals.configured > 0
|
|
84
84
|
? h('div', { className: 'ddt-badge dim-onlineBadge' },
|
|
85
|
-
h('span', null,
|
|
85
|
+
h('span', null, localizeTemplate('{connected} / {configured} 在线', { connected: totals.connected, configured: totals.configured })))
|
|
86
86
|
: null));
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
function LoadingView() {
|
|
90
90
|
return h('div', { className: 'ddt-card ddt-loading dim-surfaceCard dim-loadingView', 'aria-busy': 'true' },
|
|
91
91
|
h('div', { className: 'ddt-spinner dim-spinner' }),
|
|
92
|
-
h('span', null, '
|
|
92
|
+
h('span', null, localizeTemplate('正在读取 {channel} 机器人状态…', { channel: channelName('企业微信') })));
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
function EmptyView({ busy, onStart }) {
|
|
@@ -160,7 +160,7 @@ function ProvisionView({ provision, busy, onRetry, onClose }) {
|
|
|
160
160
|
|
|
161
161
|
function RemoveConfirmation({ account, busy, onConfirm, onCancel }) {
|
|
162
162
|
return h('div', { className: 'ddt-confirm dim-confirm', role: 'alertdialog' },
|
|
163
|
-
h('strong', null,
|
|
163
|
+
h('strong', null, localizeTemplate('从 DeepSeek Harness 移除“{name}”?', { name: account.bot.name })),
|
|
164
164
|
h('p', null, '这会停止消息连接,并删除本机保存的应用凭据、机器人配置及会话映射。企业微信平台中的机器人不会被自动删除。'),
|
|
165
165
|
h('div', { className: 'ddt-actions dim-viewActions' },
|
|
166
166
|
h(Button, { onClick: onCancel, disabled: busy }, '保留机器人'),
|
|
@@ -615,7 +615,7 @@ export function WecomSettingsTab({ rpcCall }) {
|
|
|
615
615
|
h('div', { className: 'ddt-visuallyHidden', role: 'status', 'aria-live': 'polite' }, notice),
|
|
616
616
|
model.phase === 'loading' ? h(LoadingView)
|
|
617
617
|
: model.phase === 'error'
|
|
618
|
-
? h('div', { className: 'ddt-card dim-surfaceCard' }, h('div', { className: 'ddt-inlineError dim-inlineError' }, h('h3', null, '
|
|
618
|
+
? h('div', { className: 'ddt-card dim-surfaceCard' }, h('div', { className: 'ddt-inlineError dim-inlineError' }, h('h3', null, localizeTemplate('无法读取 {channel} 机器人状态', { channel: channelName('企业微信') })), h(ConnectionError, { error: model.error }), h(Button, { onClick: () => void loadStatus() }, '重新读取')))
|
|
619
619
|
: h(React.Fragment, null,
|
|
620
620
|
credentialView,
|
|
621
621
|
provisionView,
|
|
@@ -4,7 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
|
|
5
5
|
import { WecomLogoGlyph } from '../../channel-logos.js';
|
|
6
6
|
import { AccountSettingsToggle, CollapsibleAccountSection } from '../shared/collapsible-account.js';
|
|
7
|
-
import { h } from '../../i18n.js';
|
|
7
|
+
import { h, localizeTemplate } from '../../i18n.js';
|
|
8
8
|
import { WorkspaceEditor } from '../../workspace-editor.js';
|
|
9
9
|
import { ContextEnhancementEditor } from '../../context-enhancement.js';
|
|
10
10
|
import {
|
|
@@ -68,7 +68,7 @@ function Heading({ totals, adding, busy, onAdd, addButtonRef }) {
|
|
|
68
68
|
}, adding ? '收起表单' : '添加企业微信应用')),
|
|
69
69
|
totals.configured > 0
|
|
70
70
|
? h('div', { className: 'ddt-badge dim-onlineBadge' },
|
|
71
|
-
h('span', null,
|
|
71
|
+
h('span', null, localizeTemplate('{connected} / {configured} 在线', { connected: totals.connected, configured: totals.configured })))
|
|
72
72
|
: null));
|
|
73
73
|
}
|
|
74
74
|
|
|
@@ -232,7 +232,7 @@ function AppSettingsEditor({ bot, busy, onSave }) {
|
|
|
232
232
|
|
|
233
233
|
function RemoveConfirmation({ account, busy, onConfirm, onCancel }) {
|
|
234
234
|
return h('div', { className: 'ddt-confirm dim-confirm', role: 'alertdialog' },
|
|
235
|
-
h('strong', null,
|
|
235
|
+
h('strong', null, localizeTemplate('从 DeepSeek Harness 移除“{name}”?', { name: account.bot.name })),
|
|
236
236
|
h('p', null, '这会删除本机保存的应用凭据、回调配置及会话映射。企业微信后台的应用不会被删除。'),
|
|
237
237
|
h('div', { className: 'ddt-actions dim-viewActions' },
|
|
238
238
|
h(Button, { onClick: onCancel, disabled: busy }, '保留应用'),
|
|
@@ -5,7 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import { WeixinLogoGlyph } from '../../channel-logos.js';
|
|
6
6
|
import { QrActionIcon } from '../../credential-binding.js';
|
|
7
7
|
import { AccountSettingsToggle, CollapsibleAccountSection } from '../shared/collapsible-account.js';
|
|
8
|
-
import { h } from '../../i18n.js';
|
|
8
|
+
import { h, localizeTemplate } from '../../i18n.js';
|
|
9
9
|
import {
|
|
10
10
|
WEIXIN_ENDPOINTS,
|
|
11
11
|
managementRequestError,
|
|
@@ -63,7 +63,7 @@ function Heading({ totals, adding, busy, onAdd, addButtonRef }) {
|
|
|
63
63
|
}, h(QrActionIcon), adding ? '正在接入' : '扫码接入机器人'),
|
|
64
64
|
totals.configured > 0
|
|
65
65
|
? h('div', { className: 'dxw-badge dim-onlineBadge' },
|
|
66
|
-
h('span', null,
|
|
66
|
+
h('span', null, localizeTemplate('{connected} / {configured} 在线', { connected: totals.connected, configured: totals.configured })))
|
|
67
67
|
: null,
|
|
68
68
|
),
|
|
69
69
|
);
|
|
@@ -5,7 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import { WhatsappLogoGlyph } from '../../channel-logos.js';
|
|
6
6
|
import { QrActionIcon } from '../../credential-binding.js';
|
|
7
7
|
import { AccountSettingsToggle, CollapsibleAccountSection } from '../shared/collapsible-account.js';
|
|
8
|
-
import { h } from '../../i18n.js';
|
|
8
|
+
import { channelName, h, localizeTemplate } from '../../i18n.js';
|
|
9
9
|
import { WorkspaceEditor } from '../../workspace-editor.js';
|
|
10
10
|
import { ContextEnhancementEditor } from '../../context-enhancement.js';
|
|
11
11
|
import {
|
|
@@ -87,7 +87,7 @@ function Heading({ totals, busy, onAdd, addButtonRef }) {
|
|
|
87
87
|
}, h(QrActionIcon), busy ? '正在接入' : '扫码接入机器人')),
|
|
88
88
|
totals.configured > 0
|
|
89
89
|
? h('div', { className: 'ddt-badge dim-onlineBadge' },
|
|
90
|
-
h('span', null,
|
|
90
|
+
h('span', null, localizeTemplate('{connected} / {configured} 在线', { connected: totals.connected, configured: totals.configured })))
|
|
91
91
|
: null));
|
|
92
92
|
}
|
|
93
93
|
|
|
@@ -95,7 +95,7 @@ function LoadingView() {
|
|
|
95
95
|
return h('div', {
|
|
96
96
|
className: 'ddt-card ddt-loading dim-surfaceCard dim-loadingView',
|
|
97
97
|
'aria-busy': 'true',
|
|
98
|
-
}, h('div', { className: 'ddt-spinner dim-spinner' }), '正在读取
|
|
98
|
+
}, h('div', { className: 'ddt-spinner dim-spinner' }), localizeTemplate('正在读取 {channel} 机器人状态…', { channel: channelName('WhatsApp') }));
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
export function EmptyView({ busy, onStart }) {
|
|
@@ -104,7 +104,7 @@ export function EmptyView({ busy, onStart }) {
|
|
|
104
104
|
h('div', { className: 'dim-emptyCopy' },
|
|
105
105
|
h('div', { className: 'ddt-stateLabel dim-stateLabel' },
|
|
106
106
|
h('span', { className: 'ddt-dot dim-stateDot' }),
|
|
107
|
-
h('span', null, '尚未接入
|
|
107
|
+
h('span', null, localizeTemplate('尚未接入 {channel} 机器人', { channel: channelName('WhatsApp') }))),
|
|
108
108
|
h('h3', null, '扫码绑定 WhatsApp 机器人'),
|
|
109
109
|
h('p', null, '使用手机 WhatsApp 扫描二维码即可接入。'),
|
|
110
110
|
h('div', { className: 'ddt-actions dim-viewActions' },
|
|
@@ -178,7 +178,7 @@ export function ProvisionView({ provision, busy, onRetry, onClose }) {
|
|
|
178
178
|
|
|
179
179
|
function RemoveConfirmation({ account, busy, onConfirm, onCancel }) {
|
|
180
180
|
return h('div', { className: 'ddt-confirm dim-confirm', role: 'alertdialog' },
|
|
181
|
-
h('strong', null,
|
|
181
|
+
h('strong', null, localizeTemplate('从 DeepSeek Harness 移除“{name}”?', { name: account.bot.name })),
|
|
182
182
|
h('p', null, '这会停止消息连接,并删除本机保存的 WhatsApp 关联设备和会话映射。'),
|
|
183
183
|
h('div', { className: 'ddt-actions dim-viewActions' },
|
|
184
184
|
h(Button, { onClick: onCancel, disabled: busy }, '保留机器人'),
|
|
@@ -583,7 +583,7 @@ export function WhatsappSettingsTab({ rpcCall }) {
|
|
|
583
583
|
: model.phase === 'error'
|
|
584
584
|
? h('div', { className: 'ddt-card dim-surfaceCard' },
|
|
585
585
|
h('div', { className: 'ddt-inlineError dim-inlineError' },
|
|
586
|
-
h('h3', null, '无法读取
|
|
586
|
+
h('h3', null, localizeTemplate('无法读取 {channel} 机器人状态', { channel: channelName('WhatsApp') })),
|
|
587
587
|
h(ConnectionError, { error: model.error }),
|
|
588
588
|
h(Button, { onClick: () => void loadStatus() }, '重新读取')))
|
|
589
589
|
: h(React.Fragment, null,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { h } from './i18n.js';
|
|
2
|
+
import { channelName, h, localizeTemplate } from './i18n.js';
|
|
3
3
|
|
|
4
4
|
function ActionIcon({ children }) {
|
|
5
5
|
return h('svg', {
|
|
@@ -66,7 +66,8 @@ export function CredentialBindingPanel({
|
|
|
66
66
|
className: 'ddt-card dim-surfaceCard dim-credentialPanel',
|
|
67
67
|
'aria-labelledby': headingId,
|
|
68
68
|
},
|
|
69
|
-
h('h3', { id: headingId, className: 'dim-credentialTitle' },
|
|
69
|
+
h('h3', { id: headingId, className: 'dim-credentialTitle' },
|
|
70
|
+
localizeTemplate('手动接入{channel}机器人', { channel: channelName(channel) })),
|
|
70
71
|
children,
|
|
71
72
|
h('form', {
|
|
72
73
|
className: `dim-credentialForm${hasIdentity ? '' : ' dim-credentialFormSingle'}`,
|
|
@@ -8,7 +8,7 @@ import { FeishuGroupSettingsPage } from './channels/feishu/group-settings.js';
|
|
|
8
8
|
import { FeishuVoiceSettingsPage } from './channels/feishu/voice-settings.js';
|
|
9
9
|
import { FeishuSlashPanelSettingsPage } from './channels/feishu/slash-panel-settings.js';
|
|
10
10
|
import { TelegramGroupTriggersSettings } from './channels/telegram/group-triggers-settings.js';
|
|
11
|
-
import { h,
|
|
11
|
+
import { h, imLocale, localizeTemplate, localizeText } from './i18n.js';
|
|
12
12
|
|
|
13
13
|
export const DELIVERY_RPC_CHANNEL = '/dsh-im-delivery';
|
|
14
14
|
|
|
@@ -30,7 +30,7 @@ export const DELIVERY_ENDPOINTS = Object.freeze({
|
|
|
30
30
|
export const BOT_SETTINGS_TABS = Object.freeze([
|
|
31
31
|
Object.freeze({ id: 'general', label: '通用' }),
|
|
32
32
|
Object.freeze({ id: 'delivery', label: '投递设置' }),
|
|
33
|
-
Object.freeze({ id: 'ds-bot', label: '绑定
|
|
33
|
+
Object.freeze({ id: 'ds-bot', label: '绑定 DS Bot' }),
|
|
34
34
|
Object.freeze({ id: 'access', label: '访问设置' }),
|
|
35
35
|
]);
|
|
36
36
|
|
|
@@ -779,7 +779,7 @@ export function DeliveryTargetSettingsPage({
|
|
|
779
779
|
|
|
780
780
|
return h('section', {
|
|
781
781
|
className: 'dim-deliveryPage',
|
|
782
|
-
'aria-label':
|
|
782
|
+
'aria-label': localizeTemplate('{name}机器人设置', { name: account.botName || definition.label }),
|
|
783
783
|
},
|
|
784
784
|
h('header', { className: 'dim-deliveryHeader' },
|
|
785
785
|
h(DeliveryButton, { className: 'dim-deliveryBack', onClick: onBack }, '← 返回机器人列表')),
|
|
@@ -833,7 +833,7 @@ export function DeliveryTargetSettingsPage({
|
|
|
833
833
|
account.botName || '机器人设置'),
|
|
834
834
|
h('a', {
|
|
835
835
|
className: 'dim-deliveryDocsLink',
|
|
836
|
-
href:
|
|
836
|
+
href: imLocale() === 'zh' ? DELIVERY_DOCS_URL.zh : DELIVERY_DOCS_URL.en,
|
|
837
837
|
target: '_blank',
|
|
838
838
|
rel: 'noopener noreferrer',
|
|
839
839
|
'aria-label': '打开主动投递使用文档',
|
|
@@ -7,7 +7,7 @@ export const DS_BOT_MESSAGES = Object.freeze({
|
|
|
7
7
|
disabled: 'DS Bot 尚未启用,请在 DSH 插件管理中启用后刷新。',
|
|
8
8
|
unavailable: '暂时无法读取 DS Bot,请检查插件是否正常运行后重试。',
|
|
9
9
|
readonly: 'DS Bot 当前由其他 Host 管理,请在运行它的 Host 中绑定。',
|
|
10
|
-
remote: '绑定
|
|
10
|
+
remote: '绑定 DS Bot 仅支持当前 Host 的会话,请先检查机器人的 Harness 连接设置。',
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
export function dsBotErrorMessage(error) {
|
|
@@ -149,9 +149,9 @@ export function DsBotSettingsPage({ botId, rpcCall }) {
|
|
|
149
149
|
setFeedbackTone('error'); setFeedback(dsBotErrorMessage(error));
|
|
150
150
|
} finally { requests.current.busy = false; setBusy(false); }
|
|
151
151
|
};
|
|
152
|
-
return h('section', { className: 'dim-deliveryTargets dim-dsBotSettings', 'aria-label': '绑定
|
|
152
|
+
return h('section', { className: 'dim-deliveryTargets dim-dsBotSettings', 'aria-label': '绑定 DS Bot' },
|
|
153
153
|
h('div', { className: 'dim-deliverySectionHeading' },
|
|
154
|
-
h('div', null, h('h3', null, '绑定
|
|
154
|
+
h('div', null, h('h3', null, '绑定 DS Bot'), h('p', null, '选择 DS Bot 和私聊对象,直接使用 Bot 的会话。')),
|
|
155
155
|
h('button', { className: 'dim-deliveryButton', type: 'button', disabled: busy || loading, onClick: () => void refresh() }, '刷新')),
|
|
156
156
|
!status ? h('p', { className: 'dim-dsBotNotice', role: 'status' }, '正在检测 DS Bot…')
|
|
157
157
|
: status.state !== 'ready' ? h('p', { className: 'dim-dsBotNotice', role: 'status' }, DS_BOT_MESSAGES[status.state] ?? DS_BOT_MESSAGES.unavailable)
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
INBOUND_TTL_MAX_HOURS,
|
|
8
8
|
normalizeInboundTtlHours,
|
|
9
9
|
} from '../../src/channels/shared/inbound-ttl.mjs';
|
|
10
|
-
import { h } from './i18n.js';
|
|
10
|
+
import { h, localizeTemplate } from './i18n.js';
|
|
11
11
|
import { DEFAULT_IMAGE_INPUT_SETTINGS, normalizeImageInputSettings } from '../../src/channels/shared/image-input-policy.mjs';
|
|
12
12
|
|
|
13
13
|
export const GLOBAL_SETTINGS_RPC_CHANNEL = '/dsh-im-settings';
|
|
@@ -277,7 +277,10 @@ function AttachmentSettingsPanel({ rpcCall }) {
|
|
|
277
277
|
const inlineStatus = phase === 'loading'
|
|
278
278
|
? { role: 'status', message: '正在读取通用设置…' }
|
|
279
279
|
: ttlError
|
|
280
|
-
? {
|
|
280
|
+
? {
|
|
281
|
+
role: 'alert',
|
|
282
|
+
message: localizeTemplate('请输入 -1、0 或 1~{max} 之间的整数。', { max: INBOUND_TTL_MAX_HOURS }),
|
|
283
|
+
}
|
|
281
284
|
: saveError
|
|
282
285
|
? { role: 'alert', message: saveError }
|
|
283
286
|
: phase === 'error' && loadError
|