@ai-wendao/ant 0.4.8 → 0.4.9
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/client.js +45 -32
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -435,7 +435,8 @@ window.__ModuleLoader__.load({
|
|
|
435
435
|
border: '0', borderBottom: activeTab === tab ? '2px solid var(--dsw-alias-state-business-primary)' : '2px solid transparent',
|
|
436
436
|
backgroundColor: 'transparent',
|
|
437
437
|
} }, tab === 'updates' && updateNeedsAttention ? `${label} · ${updateSummary.state === 'available' ? '有新版' : '需处理'}` : label)))),
|
|
438
|
-
h('div', { id: 'ant-settings-content', role: 'tabpanel', 'aria-labelledby': `ant-settings-tab-${activeTab}
|
|
438
|
+
h('div', { id: 'ant-settings-content', role: 'tabpanel', 'aria-labelledby': `ant-settings-tab-${activeTab}`,
|
|
439
|
+
style: { display: 'grid', gap: activeTab === 'connection' ? 12 : 0 } },
|
|
439
440
|
teamServicePanel,
|
|
440
441
|
h(ModelSyncFooter, { remote, serviceUrl, bindingReady: binding.state === 'ready', activeTab,
|
|
441
442
|
onServiceUrlChange: setServiceUrl, onConnectionChange,
|
|
@@ -657,7 +658,7 @@ window.__ModuleLoader__.load({
|
|
|
657
658
|
const result = await readLocalJsonResponse(response)
|
|
658
659
|
if (!response.ok) throw new Error(result.message || '无法获取身份绑定码。')
|
|
659
660
|
setBindingCode(result.code)
|
|
660
|
-
setMessage('
|
|
661
|
+
setMessage('')
|
|
661
662
|
} catch (error) { setMessage(error.message) }
|
|
662
663
|
finally { setBusy(false) }
|
|
663
664
|
}
|
|
@@ -949,7 +950,8 @@ window.__ModuleLoader__.load({
|
|
|
949
950
|
h('p', { role: 'status', style: mutedTextStyle }, '私聊与群聊可同时开启;每项能力一次只授权给一个私聊或一个群。普通对话不会自动获得读取电脑、调用工具或访问其他群的权限。'),
|
|
950
951
|
loadFailures.length ? h('p', { role: 'status', style: mutedTextStyle },
|
|
951
952
|
`部分协作信息暂时无法读取:${loadFailures.map((path) => loadNames[path]).join('、')}。已读取的信息仍显示,请稍后刷新状态。`) : null,
|
|
952
|
-
h('
|
|
953
|
+
h('div', { style: { display: 'flex', flexWrap: 'wrap', alignItems: 'flex-start', justifyContent: 'space-between', gap: 8 } },
|
|
954
|
+
h('span', { role: 'status', style: { ...mutedTextStyle, flex: '1 1 260px', minWidth: 0 } }, loading ? '正在读取机器人与任务状态…'
|
|
953
955
|
: botLoadError ? '暂时无法读取机器人状态。请刷新后再试。'
|
|
954
956
|
: connectedBots.length === 0 ? '尚未发现已连接的机器人。请先在 DSH-IM 中连接飞书机器人。'
|
|
955
957
|
: selectedBot && !botConnected ? `“${selectedBot.name}”当前离线;请先在 DSH-IM 恢复连接。`
|
|
@@ -965,6 +967,10 @@ window.__ModuleLoader__.load({
|
|
|
965
967
|
: !dmChatEnabled ? `“${selectedBot.name}”已启用协作;私聊已关闭,群聊仍按各自设置工作。`
|
|
966
968
|
: selectedTaskCount === 0 ? `“${selectedBot.name}”已启用协作;下一步开放一项能力。你也可以先私聊自测普通聊天。`
|
|
967
969
|
: `“${selectedBot.name}”已启用协作 · ${selectedTaskCount} 项能力已开放。可以私聊自测。`),
|
|
970
|
+
h('button', { type: 'button', disabled: loading || busy,
|
|
971
|
+
onClick: () => void load().catch((error) => setMessage(error.message)),
|
|
972
|
+
style: { ...secondaryButtonStyle, whiteSpace: 'nowrap' } },
|
|
973
|
+
loading ? '正在刷新…' : '刷新状态')),
|
|
968
974
|
bots.length ? h('label', null, '我的机器人', h('select', { id: 'ant-bot-selector', value: botId,
|
|
969
975
|
onChange: (event) => { setBotId(event.target.value); setGroupId(''); setChatGroupId(''); setBindingCode('');
|
|
970
976
|
setTrustedOrigin(enrolled.find((bot) => bot.bot_id === event.target.value)?.gitea_origin || '') }, style: inputStyle },
|
|
@@ -991,13 +997,29 @@ window.__ModuleLoader__.load({
|
|
|
991
997
|
h('button', { type: 'button', disabled: busy || !trustedOrigin.trim() || (!selectedEnrollmentBound && !botConnected),
|
|
992
998
|
onClick: () => void (selectedEnrollmentBound ? saveTrustedOrigin() : enrollBot()), style: secondaryButtonStyle },
|
|
993
999
|
selectedEnrollmentBound ? '保存可信地址' : botConnected ? '绑定机器人并保存地址' : '先连接机器人'))) : null,
|
|
1000
|
+
selectedBot && selectedEnrollmentBound ? h('div', { role: 'region', 'aria-label': '群任务所有者身份验证',
|
|
1001
|
+
style: { display: 'grid', gap: 8, padding: 10, border: '1px solid var(--dsw-alias-border-l2)', borderRadius: 8,
|
|
1002
|
+
backgroundColor: 'var(--dsw-alias-bg-layer-1)' } },
|
|
1003
|
+
h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', gap: 8 } },
|
|
1004
|
+
h('strong', null, '群任务所有者身份'),
|
|
1005
|
+
h('span', { role: 'status', style: { ...mutedTextStyle, color: selectedEnrollment.owner_bound
|
|
1006
|
+
? 'var(--dsw-alias-state-success-primary)' : 'var(--dsw-alias-state-warning-primary, var(--dsw-alias-label-secondary))' } },
|
|
1007
|
+
selectedEnrollment.owner_bound ? '已绑定' : '尚未绑定')),
|
|
1008
|
+
h('p', { style: mutedTextStyle }, '绑定只针对当前机器人,所有群共用。只有允许群成员请求已开放能力时才需要;普通群聊无需绑定。绑定后,群任务仍需你在目标群按机器人提示确认。'),
|
|
1009
|
+
h('div', { style: { display: 'flex', alignItems: 'center', gap: 8, flexWrap: 'wrap' } },
|
|
1010
|
+
h('button', { type: 'button', disabled: busy || !botConnected || enrollmentLoadError,
|
|
1011
|
+
onClick: () => void issueBindingCode(), style: secondaryButtonStyle },
|
|
1012
|
+
selectedEnrollment.owner_bound ? '重新获取绑定码' : '获取绑定码'),
|
|
1013
|
+
bindingCode ? h('span', { role: 'status', style: mutedTextStyle },
|
|
1014
|
+
`请你本人私聊“${selectedBot.name}”发送“绑定身份 ${bindingCode}”。绑定码 5 分钟有效。`) : null)) : null,
|
|
994
1015
|
setupStepper,
|
|
995
1016
|
chatScopePanel,
|
|
996
1017
|
selectedEnrollmentBound && botConnected ? h('p', { style: mutedTextStyle },
|
|
997
1018
|
dmChatEnabled
|
|
998
1019
|
? `自测:私聊“${selectedBot.name}”发送“你能做什么”;发起任务后可问“刚才的任务怎么样了”。群聊请先在目标群 @机器人,再开放能力时选择该群。`
|
|
999
1020
|
: '私聊当前已关闭;如要恢复,请在上方开启。群聊请先在目标群 @机器人,再开放能力时选择该群。') : null,
|
|
1000
|
-
selectedEnrollmentBound && botConnected ? h('div', {
|
|
1021
|
+
selectedEnrollmentBound && botConnected ? h('div', { role: 'region', 'aria-label': '群聊白名单',
|
|
1022
|
+
style: { display: 'grid', gap: 8 } },
|
|
1001
1023
|
h('strong', null, '群聊白名单'),
|
|
1002
1024
|
h('span', { role: 'status', style: mutedTextStyle }, groupChatLoadFailed
|
|
1003
1025
|
? '群聊列表与当前权限暂时无法读取,请刷新后再更改;仍可填写群 ID。'
|
|
@@ -1020,28 +1042,16 @@ window.__ModuleLoader__.load({
|
|
|
1020
1042
|
onChange: (event) => setChatGroupId(event.target.value.trim()),
|
|
1021
1043
|
placeholder: '输入群 ID', style: inputStyle })),
|
|
1022
1044
|
selectedChatGroup?.chat_enabled && selectedGroupHasTasks ? h('span', { style: mutedTextStyle },
|
|
1023
|
-
'本群还有开放能力;关闭普通聊天前请先停止这些能力。') : null,
|
|
1024
|
-
h('div', { style: { display: 'flex', gap: 8, alignItems: 'center', flexWrap: 'wrap', paddingTop: 4,
|
|
1025
|
-
borderTop: '1px solid var(--dsw-alias-border-l2)' } },
|
|
1026
|
-
h('span', { style: mutedTextStyle }, '群内所有者身份'),
|
|
1027
|
-
h('span', { style: { ...mutedTextStyle, color: selectedEnrollment.owner_bound
|
|
1028
|
-
? 'var(--dsw-alias-state-success-primary)' : 'var(--dsw-alias-state-warning-primary, var(--dsw-alias-label-secondary))' } },
|
|
1029
|
-
selectedEnrollment.owner_bound ? '已绑定' : '尚未绑定'),
|
|
1030
|
-
h('button', { type: 'button', disabled: busy || !chatGroupId.trim(),
|
|
1031
|
-
onClick: () => void issueBindingCode(), style: secondaryButtonStyle },
|
|
1032
|
-
selectedEnrollment.owner_bound ? '重新获取绑定码' : '获取绑定码')),
|
|
1033
|
-
h('span', { style: mutedTextStyle }, '仅当允许群成员发起受限能力时需要;验证后由机器人所有者在群内确认。'),
|
|
1034
|
-
bindingCode ? h('p', { role: 'status', style: mutedTextStyle },
|
|
1035
|
-
`请你本人私聊机器人发送“绑定身份 ${bindingCode}”,再回到群里 @机器人完成确认。`) : null) : null,
|
|
1036
|
-
h('div', { style: { display: 'flex', gap: 8, flexWrap: 'wrap' } },
|
|
1037
|
-
h('button', { type: 'button', onClick: () => { setCreateOpen(true); onSelectTab('capability') },
|
|
1038
|
-
style: primaryButtonStyle }, '开放新能力'),
|
|
1039
|
-
h('button', { type: 'button', onClick: () => { preparePrExample(); onSelectTab('capability') }, style: secondaryButtonStyle }, '使用 PR 差异审查示例'),
|
|
1040
|
-
h('button', { type: 'button', onClick: () => void load().catch((error) => setMessage(error.message)),
|
|
1041
|
-
style: secondaryButtonStyle }, '刷新状态'))),
|
|
1045
|
+
'本群还有开放能力;关闭普通聊天前请先停止这些能力。') : null) : null),
|
|
1042
1046
|
h('div', { id: 'ant-capability-list', role: 'region', 'aria-label': '已开放能力列表', tabIndex: -1,
|
|
1043
1047
|
style: { display: activeTab === 'capability' ? 'grid' : 'none', gap: 12 } },
|
|
1044
|
-
h('
|
|
1048
|
+
h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start', gap: 10, flexWrap: 'wrap' } },
|
|
1049
|
+
h('h4', { style: sectionTitleStyle }, `我开放的能力 · ${authorizationLoadError ? '暂未读取' : activeCards.length}`),
|
|
1050
|
+
h('div', { role: 'toolbar', 'aria-label': '能力授权操作', style: { display: 'flex', gap: 8, flexWrap: 'wrap' } },
|
|
1051
|
+
h('button', { type: 'button', onClick: () => { setCreateOpen(true); onSelectTab('capability') },
|
|
1052
|
+
style: primaryButtonStyle }, '开放新能力'),
|
|
1053
|
+
h('button', { type: 'button', onClick: () => { preparePrExample(); onSelectTab('capability') },
|
|
1054
|
+
style: secondaryButtonStyle }, '使用 PR 差异审查示例'))),
|
|
1045
1055
|
h('p', { style: mutedTextStyle }, '当前一项能力只能绑定一个范围:私聊,或某一个群。若要给其他群或私聊开放相同任务,目前需分别建立能力卡;它们的请求人和有效期独立。'),
|
|
1046
1056
|
...activeCards.map((card) => {
|
|
1047
1057
|
const expiresAt = Number(card.expires_at) * 1000
|
|
@@ -1257,18 +1267,21 @@ window.__ModuleLoader__.load({
|
|
|
1257
1267
|
h('button', { type: 'button', onClick: () => void load().catch((error) => setMessage(error.message)), style: secondaryButtonStyle }, '刷新')),
|
|
1258
1268
|
loadFailures.includes('local-settings') ? h('p', { role: 'status', style: mutedTextStyle },
|
|
1259
1269
|
'本机处理设置暂未读取;请刷新后重试。')
|
|
1260
|
-
: h('form', { onSubmit: saveLocalProcessingSettings, style: { display: 'flex', gap:
|
|
1261
|
-
h('label',
|
|
1270
|
+
: h('form', { onSubmit: saveLocalProcessingSettings, style: { display: 'flex', gap: 12, flexWrap: 'wrap', alignItems: 'end' } },
|
|
1271
|
+
h('label', { style: { display: 'grid', gap: 5, flex: '0 1 280px', maxWidth: '100%' } }, '这台电脑最多同时处理',
|
|
1262
1272
|
h('select', { value: localConcurrency == null ? '' : String(localConcurrency),
|
|
1263
|
-
onChange: (event) => setLocalConcurrency(event.target.value), style: inputStyle },
|
|
1273
|
+
onChange: (event) => setLocalConcurrency(event.target.value), style: { ...inputStyle, width: '100%' } },
|
|
1264
1274
|
h('option', { value: '' }, '跟随团队默认'),
|
|
1265
1275
|
...Array.from({ length: 8 }, (_, index) => h('option', { key: index + 1, value: index + 1 }, `${index + 1} 项任务`)))),
|
|
1266
|
-
h('label',
|
|
1267
|
-
|
|
1276
|
+
h('label', { style: { display: 'grid', gap: 5, flex: '0 1 200px', maxWidth: '100%' } },
|
|
1277
|
+
'这台电脑 PR 仓库缓存上限(GiB)',
|
|
1278
|
+
h('input', { 'aria-label': '这台电脑 PR 仓库缓存上限(GiB)', type: 'number', min: 1, max: 100, step: 1, required: true,
|
|
1268
1279
|
value: repositoryCacheLimitGib,
|
|
1269
|
-
onChange: (event) => setRepositoryCacheLimitGib(event.target.value),
|
|
1270
|
-
|
|
1271
|
-
h('button', { disabled: busy, style: secondaryButtonStyle }, '保存本机处理设置')
|
|
1280
|
+
onChange: (event) => setRepositoryCacheLimitGib(event.target.value),
|
|
1281
|
+
style: { ...inputStyle, width: 128, maxWidth: '100%', boxSizing: 'border-box' } })),
|
|
1282
|
+
h('button', { disabled: busy, style: secondaryButtonStyle }, '保存本机处理设置'),
|
|
1283
|
+
h('p', { style: { ...mutedTextStyle, flex: '1 1 100%', margin: 0 } },
|
|
1284
|
+
'默认 10 GiB,范围 1–100 GiB,按长期仓库文件逻辑大小计算(不含临时工作区和文件系统分配开销)。日常不会淘汰仍启用能力的缓存;停用或到期能力会在刷新时回收。单次拉取若实际越界,为恢复预算会清理这项能力的仓库缓存(旧 PR 可重新下载)。')),
|
|
1272
1285
|
h('p', { style: mutedTextStyle }, `本机检测到的执行方:${executors.map((item) => `${item.title}${item.available ? '(可用)' : `(${item.reason || '未启用或未找到'})`}`).join('、') || '暂未读取到'}。只有能力配置下拉框中列出的执行方能接收委托。`))))
|
|
1273
1286
|
}
|
|
1274
1287
|
|