Skip to content

Commit 1e60e83

Browse files
committed
feat: 新增智能体(Agent)消息类型,优化通知开关加载逻辑自动合并新增类型
1 parent 9c893ab commit 1e60e83

8 files changed

Lines changed: 25 additions & 2 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "moviepilot",
3-
"version": "2.9.23",
3+
"version": "2.9.24",
44
"private": true,
55
"type": "module",
66
"bin": "dist/service.js",

src/api/constants.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,10 @@ export const notificationSwitchOptions = [
282282
title: i18n.global.t('notificationSwitch.plugin'),
283283
value: '插件',
284284
},
285+
{
286+
title: i18n.global.t('notificationSwitch.agent'),
287+
value: '智能体',
288+
},
285289
{
286290
title: i18n.global.t('notificationSwitch.other'),
287291
value: '其它',

src/components/cards/NotificationChannelCard.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ const notificationTypes = [
6464
{ value: '媒体服务器', title: t('notificationSwitch.mediaServer') },
6565
{ value: '手动处理', title: t('notificationSwitch.manual') },
6666
{ value: '插件', title: t('notificationSwitch.plugin') },
67+
{ value: '智能体', title: t('notificationSwitch.agent') },
6768
{ value: '其它', title: t('notificationSwitch.other') },
6869
]
6970

src/locales/en-US.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ export default {
9090
mediaServer: 'Media Server',
9191
manual: 'Manual',
9292
plugin: 'Plugin',
93+
agent: 'Agent',
9394
other: 'Other',
9495
},
9596
actionStep: {

src/locales/zh-CN.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ export default {
9090
mediaServer: '媒体服务器',
9191
manual: '手动处理',
9292
plugin: '插件',
93+
agent: '智能体',
9394
other: '其它',
9495
},
9596
actionStep: {

src/locales/zh-TW.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ export default {
9090
mediaServer: '媒體伺服器',
9191
manual: '手動處理',
9292
plugin: '插件',
93+
agent: '智能體',
9394
other: '其它',
9495
},
9596
actionStep: {

src/views/setting/AccountSettingNotification.vue

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ const notificationSwitchs = ref<NotificationSwitchConf[]>([
9191
type: '插件',
9292
action: 'admin',
9393
},
94+
{
95+
type: '智能体',
96+
action: 'admin',
97+
},
9498
{
9599
type: '其它',
96100
action: 'admin',
@@ -214,7 +218,17 @@ function changNotificationSetting(notification: NotificationConf, name: string)
214218
async function loadNotificationSwitchs() {
215219
try {
216220
const result: { [key: string]: any } = await api.get('system/setting/NotificationSwitchs')
217-
if (result.data?.value && result.data?.value.length > 0) notificationSwitchs.value = result.data?.value
221+
if (result.data?.value && result.data?.value.length > 0) {
222+
const savedSwitchs: NotificationSwitchConf[] = result.data.value
223+
// 合并默认值中存在但后端数据中缺失的类型(如新增的类型)
224+
const defaults = notificationSwitchs.value
225+
for (const def of defaults) {
226+
if (!savedSwitchs.find(item => item.type === def.type)) {
227+
savedSwitchs.push(def)
228+
}
229+
}
230+
notificationSwitchs.value = savedSwitchs
231+
}
218232
} catch (error) {
219233
console.log(error)
220234
}

src/views/setup/NotificationSettingsStep.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const notificationTypes = [
1515
{ value: '媒体服务器', title: t('notificationSwitch.mediaServer') },
1616
{ value: '手动处理', title: t('notificationSwitch.manual') },
1717
{ value: '插件', title: t('notificationSwitch.plugin') },
18+
{ value: '智能体', title: t('notificationSwitch.agent') },
1819
{ value: '其它', title: t('notificationSwitch.other') },
1920
]
2021
</script>

0 commit comments

Comments
 (0)