mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 07:27:15 +08:00
feat(message): 实现自定义消息模板功能
- 新增 MessageTemplateHelper 类用于渲染消息模板 - 在 ChainBase 中集成消息模板渲染功能 - 修改 DownloadChain、SubscribeChain 和 TransferChain 以使用新消息模板 - 新增 TemplateHelper 类用于处理模板格式 - 在 SystemConfigKey 中添加 NotificationTemplates 配置项 - 更新 Notification 模型以支持 ctype 字段
This commit is contained in:
@@ -2,7 +2,7 @@ from typing import Optional, Union
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from app.schemas.types import NotificationType, MessageChannel
|
||||
from app.schemas.types import ContentType, NotificationType, MessageChannel
|
||||
|
||||
|
||||
class CommingMessage(BaseModel):
|
||||
@@ -45,6 +45,8 @@ class Notification(BaseModel):
|
||||
source: Optional[str] = None
|
||||
# 消息类型
|
||||
mtype: Optional[NotificationType] = None
|
||||
# 内容类型
|
||||
ctype: Optional[ContentType] = None
|
||||
# 标题
|
||||
title: Optional[str] = None
|
||||
# 文本内容
|
||||
|
||||
@@ -151,6 +151,8 @@ class SystemConfigKey(Enum):
|
||||
FollowSubscribers = "FollowSubscribers"
|
||||
# 通知发送时间
|
||||
NotificationSendTime = "NotificationSendTime"
|
||||
# 通知消息格式模板
|
||||
NotificationTemplates = "NotificationTemplates"
|
||||
|
||||
|
||||
# 处理进度Key字典
|
||||
@@ -189,6 +191,21 @@ class NotificationType(Enum):
|
||||
Other = "其它"
|
||||
|
||||
|
||||
class ContentType(str, Enum):
|
||||
"""
|
||||
消息内容类型
|
||||
操作状态的通知消息类型标识
|
||||
"""
|
||||
# 订阅添加成功
|
||||
SubscribeAdded: str = "subscribeAdded"
|
||||
# 订阅完成
|
||||
SubscribeComplete: str = "subscribeComplete"
|
||||
# 入库成功
|
||||
OrganizeSuccess: str = "organizeSuccess"
|
||||
# 下载开始(添加下载任务成功)
|
||||
DownloadAdded: str = "downloadAdded"
|
||||
|
||||
|
||||
# 消息渠道
|
||||
class MessageChannel(Enum):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user