diff --git a/plugins/kid_photo_extractor/main.py b/plugins/kid_photo_extractor/main.py index d7f6f08..4e8fe58 100644 --- a/plugins/kid_photo_extractor/main.py +++ b/plugins/kid_photo_extractor/main.py @@ -10,6 +10,7 @@ import traceback from wcferry import Wcf +from db.connection import DBConnectionManager from plugin_common.plugin_interface import PluginStatus try: @@ -328,7 +329,7 @@ class KidPhotoExtractorPlugin(MessagePluginInterface): self.wcf = context.get("wcf") self.event_system = context.get("event_system") self.message_util = context.get("message_util") - self.db_manager = context.get("db_manager") + self.db_manager = DBConnectionManager.get_instance() # 初始化数据库 if self.db_manager: @@ -746,6 +747,9 @@ class KidPhotoExtractorPlugin(MessagePluginInterface): self.LOG.error(traceback.format_exc()) wcf.send_text(f"❌分析过程中出错: {str(e)}", target, sender) finally: + # 清理所有临时文件 + self._cleanup_temp_files(temp_files) + # 标记任务完成 self.analysis_tasks[group_key]["running"] = False