From 01f7c6bc2bd2dbd6703e957713e278bedd7efccc Mon Sep 17 00:00:00 2001 From: jxxghp Date: Sat, 1 Mar 2025 18:55:16 +0800 Subject: [PATCH] fix --- app/actions/__init__.py | 6 +++--- app/actions/add_download.py | 6 +++--- app/actions/add_subscribe.py | 6 +++--- app/actions/fetch_downloads.py | 6 +++--- app/actions/fetch_medias.py | 6 +++--- app/actions/fetch_rss.py | 6 +++--- app/actions/fetch_torrents.py | 6 +++--- app/actions/filter_medias.py | 6 +++--- app/actions/filter_torrents.py | 6 +++--- app/actions/scan_file.py | 6 +++--- app/actions/scrape_file.py | 6 +++--- app/actions/send_event.py | 6 +++--- app/actions/send_message.py | 12 ++++++------ app/actions/transfer_file.py | 6 +++--- app/chain/workflow.py | 4 ++-- app/schemas/workflow.py | 4 ++-- 16 files changed, 49 insertions(+), 49 deletions(-) diff --git a/app/actions/__init__.py b/app/actions/__init__.py index 6b1c41fd..ac46d4cf 100644 --- a/app/actions/__init__.py +++ b/app/actions/__init__.py @@ -21,19 +21,19 @@ class BaseAction(ABC): @classmethod @property @abstractmethod - def name(cls) -> str: + def name(cls) -> str: # noqa pass @classmethod @property @abstractmethod - def description(cls) -> str: + def description(cls) -> str: # noqa pass @classmethod @property @abstractmethod - def data(cls) -> dict: + def data(cls) -> dict: # noqa pass @property diff --git a/app/actions/add_download.py b/app/actions/add_download.py index b5486d28..334a7a64 100644 --- a/app/actions/add_download.py +++ b/app/actions/add_download.py @@ -36,17 +36,17 @@ class AddDownloadAction(BaseAction): @classmethod @property - def name(cls) -> str: + def name(cls) -> str: # noqa return "添加下载" @classmethod @property - def description(cls) -> str: + def description(cls) -> str: # noqa return "根据资源列表添加下载任务" @classmethod @property - def data(cls) -> dict: + def data(cls) -> dict: # noqa return AddDownloadParams().dict() @property diff --git a/app/actions/add_subscribe.py b/app/actions/add_subscribe.py index 779b8d23..97a92616 100644 --- a/app/actions/add_subscribe.py +++ b/app/actions/add_subscribe.py @@ -29,17 +29,17 @@ class AddSubscribeAction(BaseAction): @classmethod @property - def name(cls) -> str: + def name(cls) -> str: # noqa return "添加订阅" @classmethod @property - def description(cls) -> str: + def description(cls) -> str: # noqa return "根据媒体列表添加订阅" @classmethod @property - def data(cls) -> dict: + def data(cls) -> dict: # noqa return AddSubscribeParams().dict() @property diff --git a/app/actions/fetch_downloads.py b/app/actions/fetch_downloads.py index a0c18bb7..eefe3502 100644 --- a/app/actions/fetch_downloads.py +++ b/app/actions/fetch_downloads.py @@ -24,17 +24,17 @@ class FetchDownloadsAction(BaseAction): @classmethod @property - def name(cls) -> str: + def name(cls) -> str: # noqa return "获取下载任务" @classmethod @property - def description(cls) -> str: + def description(cls) -> str: # noqa return "获取下载队列中的任务状态" @classmethod @property - def data(cls) -> dict: + def data(cls) -> dict: # noqa return FetchDownloadsParams().dict() @property diff --git a/app/actions/fetch_medias.py b/app/actions/fetch_medias.py index 03910837..3f1372d6 100644 --- a/app/actions/fetch_medias.py +++ b/app/actions/fetch_medias.py @@ -100,17 +100,17 @@ class FetchMediasAction(BaseAction): @classmethod @property - def name(cls) -> str: + def name(cls) -> str: # noqa return "获取媒体数据" @classmethod @property - def description(cls) -> str: + def description(cls) -> str: # noqa return "获取榜单等媒体数据列表" @classmethod @property - def data(cls) -> dict: + def data(cls) -> dict: # noqa return FetchMediasParams().dict() @property diff --git a/app/actions/fetch_rss.py b/app/actions/fetch_rss.py index 1c3fd5d3..efe0184a 100644 --- a/app/actions/fetch_rss.py +++ b/app/actions/fetch_rss.py @@ -38,17 +38,17 @@ class FetchRssAction(BaseAction): @classmethod @property - def name(cls) -> str: + def name(cls) -> str: # noqa return "获取RSS资源" @classmethod @property - def description(cls) -> str: + def description(cls) -> str: # noqa return "订阅RSS地址获取资源" @classmethod @property - def data(cls) -> dict: + def data(cls) -> dict: # noqa return FetchRssParams().dict() @property diff --git a/app/actions/fetch_torrents.py b/app/actions/fetch_torrents.py index eee5a191..a825b6da 100644 --- a/app/actions/fetch_torrents.py +++ b/app/actions/fetch_torrents.py @@ -36,17 +36,17 @@ class FetchTorrentsAction(BaseAction): @classmethod @property - def name(cls) -> str: + def name(cls) -> str: # noqa return "搜索站点资源" @classmethod @property - def description(cls) -> str: + def description(cls) -> str: # noqa return "搜索站点种子资源列表" @classmethod @property - def data(cls) -> dict: + def data(cls) -> dict: # noqa return FetchTorrentsParams().dict() @property diff --git a/app/actions/filter_medias.py b/app/actions/filter_medias.py index a1e3b5fe..588d34ad 100644 --- a/app/actions/filter_medias.py +++ b/app/actions/filter_medias.py @@ -26,17 +26,17 @@ class FilterMediasAction(BaseAction): @classmethod @property - def name(cls) -> str: + def name(cls) -> str: # noqa return "过滤媒体数据" @classmethod @property - def description(cls) -> str: + def description(cls) -> str: # noqa return "对媒体数据列表进行过滤" @classmethod @property - def data(cls) -> dict: + def data(cls) -> dict: # noqa return FilterMediasParams().dict() @property diff --git a/app/actions/filter_torrents.py b/app/actions/filter_torrents.py index 912df8f0..e1158e3b 100644 --- a/app/actions/filter_torrents.py +++ b/app/actions/filter_torrents.py @@ -35,17 +35,17 @@ class FilterTorrentsAction(BaseAction): @classmethod @property - def name(cls) -> str: + def name(cls) -> str: # noqa return "过滤资源" @classmethod @property - def description(cls) -> str: + def description(cls) -> str: # noqa return "对资源列表数据进行过滤" @classmethod @property - def data(cls) -> dict: + def data(cls) -> dict: # noqa return FilterTorrentsParams().dict() @property diff --git a/app/actions/scan_file.py b/app/actions/scan_file.py index 224b2ce6..843de4ef 100644 --- a/app/actions/scan_file.py +++ b/app/actions/scan_file.py @@ -33,17 +33,17 @@ class ScanFileAction(BaseAction): @classmethod @property - def name(cls) -> str: + def name(cls) -> str: # noqa return "扫描目录" @classmethod @property - def description(cls) -> str: + def description(cls) -> str: # noqa return "扫描目录文件到队列" @classmethod @property - def data(cls) -> dict: + def data(cls) -> dict: # noqa return ScanFileParams().dict() @property diff --git a/app/actions/scrape_file.py b/app/actions/scrape_file.py index a0123ff8..148fabb2 100644 --- a/app/actions/scrape_file.py +++ b/app/actions/scrape_file.py @@ -31,17 +31,17 @@ class ScrapeFileAction(BaseAction): @classmethod @property - def name(cls) -> str: + def name(cls) -> str: # noqa return "刮削文件" @classmethod @property - def description(cls) -> str: + def description(cls) -> str: # noqa return "刮削媒体信息和图片" @classmethod @property - def data(cls) -> dict: + def data(cls) -> dict: # noqa return ScrapeFileParams().dict() @property diff --git a/app/actions/send_event.py b/app/actions/send_event.py index 0b8ceecd..2f4966a6 100644 --- a/app/actions/send_event.py +++ b/app/actions/send_event.py @@ -18,17 +18,17 @@ class SendEventAction(BaseAction): @classmethod @property - def name(cls) -> str: + def name(cls) -> str: # noqa return "发送事件" @classmethod @property - def description(cls) -> str: + def description(cls) -> str: # noqa return "发送任务执行事件" @classmethod @property - def data(cls) -> dict: + def data(cls) -> dict: # noqa return SendEventParams().dict() @property diff --git a/app/actions/send_message.py b/app/actions/send_message.py index 16a960fb..f181514d 100644 --- a/app/actions/send_message.py +++ b/app/actions/send_message.py @@ -25,17 +25,17 @@ class SendMessageAction(BaseAction): @classmethod @property - def name(cls) -> str: + def name(cls) -> str: # noqa return "发送消息" @classmethod @property - def description(cls) -> str: + def description(cls) -> str: # noqa return "发送任务执行消息" @classmethod @property - def data(cls) -> dict: + def data(cls) -> dict: # noqa return SendMessageParams().dict() @property @@ -47,10 +47,10 @@ class SendMessageAction(BaseAction): 发送messages中的消息 """ params = SendMessageParams(**params) - msg_text = f"当前进度:{context.progress}%" + msg_text = f"当前进度:{context.__progress__}%" index = 1 - if context.execute_history: - for history in context.execute_history: + if context.__execute_history__: + for history in context.__execute_history__: if not history.message: continue msg_text += f"\n{index}. {history.action}:{history.message}" diff --git a/app/actions/transfer_file.py b/app/actions/transfer_file.py index 0e0b0b2b..e8e67ea9 100644 --- a/app/actions/transfer_file.py +++ b/app/actions/transfer_file.py @@ -37,17 +37,17 @@ class TransferFileAction(BaseAction): @classmethod @property - def name(cls) -> str: + def name(cls) -> str: # noqa return "整理文件" @classmethod @property - def description(cls) -> str: + def description(cls) -> str: # noqa return "整理队列中的文件" @classmethod @property - def data(cls) -> dict: + def data(cls) -> dict: # noqa return TransferFileParams().dict() @property diff --git a/app/chain/workflow.py b/app/chain/workflow.py index d237eae9..5e24b0db 100644 --- a/app/chain/workflow.py +++ b/app/chain/workflow.py @@ -135,10 +135,10 @@ class WorkflowExecutor: try: self.finished_actions += 1 # 更新当前进度 - self.context.progress = round(self.finished_actions / self.total_actions) * 100 + self.context.__progress__ = round(self.finished_actions / self.total_actions) * 100 # 补充执行历史 - self.context.execute_history.append( + self.context.__execute_history__.append( ActionExecution( action=action.name, result=state, diff --git a/app/schemas/workflow.py b/app/schemas/workflow.py index 4934c1cb..63c8f78d 100644 --- a/app/schemas/workflow.py +++ b/app/schemas/workflow.py @@ -70,8 +70,8 @@ class ActionContext(BaseModel): downloads: Optional[List[DownloadTask]] = Field([], description="下载任务列表") sites: Optional[List[Site]] = Field([], description="站点列表") subscribes: Optional[List[Subscribe]] = Field([], description="订阅列表") - execute_history: Optional[List[ActionExecution]] = Field([], description="执行历史") - progress: Optional[int] = Field(0, description="执行进度(%)") + __execute_history__: Optional[List[ActionExecution]] = Field([], description="执行历史") + __progress__: Optional[int] = Field(0, description="执行进度(%)") class ActionFlow(BaseModel):