diff --git a/src/components/cards/NotificationChannelCard.vue b/src/components/cards/NotificationChannelCard.vue
index 8e50fe1d..59c23631 100644
--- a/src/components/cards/NotificationChannelCard.vue
+++ b/src/components/cards/NotificationChannelCard.vue
@@ -67,10 +67,39 @@ const notificationTypes = [
{ value: '其它', title: t('notificationSwitch.other') },
]
+function ensureWechatConfigDefaults(notification: NotificationConf) {
+ if (notification.type !== 'wechat') {
+ return
+ }
+ if (!notification.config) {
+ notification.config = {}
+ }
+ if (!notification.config.WECHAT_MODE) {
+ notification.config.WECHAT_MODE = 'app'
+ }
+ if (!notification.config.WECHAT_BOT_WS_URL) {
+ notification.config.WECHAT_BOT_WS_URL = 'wss://openws.work.weixin.qq.com'
+ }
+}
+
+const isWechatBotMode = computed({
+ get: () => notificationInfo.value.config?.WECHAT_MODE === 'bot',
+ set: value => {
+ if (!notificationInfo.value.config) {
+ notificationInfo.value.config = {}
+ }
+ notificationInfo.value.config.WECHAT_MODE = value ? 'bot' : 'app'
+ if (value && !notificationInfo.value.config.WECHAT_BOT_WS_URL) {
+ notificationInfo.value.config.WECHAT_BOT_WS_URL = 'wss://openws.work.weixin.qq.com'
+ }
+ },
+})
+
// 打开详情弹窗
function openNotificationInfoDialog() {
// 替换成深复制,避免修改时影响原数据
notificationInfo.value = cloneDeep(props.notification)
+ ensureWechatConfigDefaults(notificationInfo.value)
notificationInfoDialog.value = true
}
@@ -86,6 +115,7 @@ function saveNotificationInfo() {
$toast.error(t('notification.channel') + `【${notificationInfo.value.name}】` + t('common.exists'))
return
}
+ ensureWechatConfigDefaults(notificationInfo.value)
notificationInfoDialog.value = false
emit('change', notificationInfo.value, props.notification.name)
emit('done')
@@ -190,69 +220,129 @@ function onClose() {
/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/locales/en-US.ts b/src/locales/en-US.ts
index 4bff1d2e..bed4dfe3 100644
--- a/src/locales/en-US.ts
+++ b/src/locales/en-US.ts
@@ -435,6 +435,8 @@ export default {
config: 'Configuration',
wechat: {
name: 'WeChat Work',
+ useBotMode: 'Use AI Bot',
+ useBotModeHint: 'Enable WebSocket bot mode with fixed dmPolicy=open and groupPolicy=disabled',
corpId: 'Corp ID',
corpIdHint: 'Corp ID in WeChat Work backend enterprise information',
corpIdRequired: 'Corp ID cannot be empty',
@@ -451,6 +453,15 @@ export default {
tokenHint: 'Token in WeChat Work self-built app -> API message receiving configuration',
encodingAesKey: 'EncodingAESKey',
encodingAesKeyHint: 'EncodingAESKey in WeChat Work self-built app -> API message receiving configuration',
+ botId: 'Bot ID',
+ botIdHint: 'Bot ID of the WeChat Work AI bot',
+ botSecret: 'Bot Secret',
+ botSecretHint: 'WebSocket secret of the WeChat Work AI bot',
+ botChatId: 'Default Target',
+ botChatIdHint: 'Use user userid; for proactive group messages use group:chatid. Leave empty to notify known interacted users',
+ botChatIdPlaceholder: 'userid or group:chatid',
+ botWsUrl: 'WebSocket URL',
+ botWsUrlHint: 'WebSocket endpoint for the WeChat Work AI bot, usually the default value',
admins: 'Admin Whitelist',
adminsHint: 'User IDs that can use admin menu and commands, separated by commas',
adminsPlaceholder: 'User IDs list, separated by commas',
diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts
index 5e8768e1..225c8fb1 100644
--- a/src/locales/zh-CN.ts
+++ b/src/locales/zh-CN.ts
@@ -433,6 +433,8 @@ export default {
config: '配置',
wechat: {
name: '企业微信',
+ useBotMode: '使用智能机器人',
+ useBotModeHint: '开启后使用智能机器人长连接,固定 dmPolicy=open、groupPolicy=disabled',
corpId: '企业ID',
corpIdHint: '企业微信后台企业信息中的企业ID',
corpIdRequired: '企业ID不能为空',
@@ -448,6 +450,15 @@ export default {
tokenHint: '微信企业自建应用->API接收消息配置中的Token',
encodingAesKey: 'EncodingAESKey',
encodingAesKeyHint: '微信企业自建应用->API接收消息配置中的EncodingAESKey',
+ botId: '机器人 BotID',
+ botIdHint: '企业微信智能机器人的 BotID',
+ botSecret: '机器人 Secret',
+ botSecretHint: '企业微信智能机器人长连接专用 Secret',
+ botChatId: '默认通知目标',
+ botChatIdHint: '可填写用户 userid;如需主动发群消息可填写 group:群聊chatid,不填则默认发给已互动用户',
+ botChatIdPlaceholder: 'userid 或 group:chatid',
+ botWsUrl: '长连接地址',
+ botWsUrlHint: '企业微信智能机器人 WebSocket 地址,通常使用默认值',
admins: '管理员白名单',
adminsHint: '可使用管理菜单及命令的用户ID列表,多个ID使用,分隔',
adminsPlaceholder: '用户ID列表,多个ID使用,分隔',
diff --git a/src/locales/zh-TW.ts b/src/locales/zh-TW.ts
index 7deffa77..127b4c95 100644
--- a/src/locales/zh-TW.ts
+++ b/src/locales/zh-TW.ts
@@ -433,6 +433,8 @@ export default {
config: '配置',
wechat: {
name: '企業微信',
+ useBotMode: '使用智能機器人',
+ useBotModeHint: '開啟後使用智能機器人長連線,固定 dmPolicy=open、groupPolicy=disabled',
corpId: '企業ID',
corpIdHint: '企業微信後台企業信息中的企業ID',
corpIdRequired: '企業ID不能為空',
@@ -448,6 +450,15 @@ export default {
tokenHint: '微信企業自建應用->API接收消息配置中的Token',
encodingAesKey: 'EncodingAESKey',
encodingAesKeyHint: '微信企業自建應用->API接收消息配置中的EncodingAESKey',
+ botId: '機器人 BotID',
+ botIdHint: '企業微信智能機器人的 BotID',
+ botSecret: '機器人 Secret',
+ botSecretHint: '企業微信智能機器人長連線專用 Secret',
+ botChatId: '預設通知目標',
+ botChatIdHint: '可填寫使用者 userid;如需主動發群消息可填寫 group:群聊chatid,不填則預設發給已互動使用者',
+ botChatIdPlaceholder: 'userid 或 group:chatid',
+ botWsUrl: '長連線地址',
+ botWsUrlHint: '企業微信智能機器人 WebSocket 位址,通常使用預設值',
admins: '管理員白名單',
adminsHint: '可使用管理菜單及命令的用戶ID列表,多個ID使用,分隔',
adminsPlaceholder: '用戶ID列表,多個ID使用,分隔',