From be2a1fb1bb7991740ca0a8b85954388f630aabfb Mon Sep 17 00:00:00 2001 From: cat_shark <1716967236@qq.com> Date: Thu, 21 May 2026 16:56:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E9=87=8D=E5=A4=8D=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ef_course_autopilot.py | 56 +++--------------------------------------- ef_course_loop.py | 5 ++-- 2 files changed, 6 insertions(+), 55 deletions(-) diff --git a/ef_course_autopilot.py b/ef_course_autopilot.py index 4bf9029..49d26ff 100755 --- a/ef_course_autopilot.py +++ b/ef_course_autopilot.py @@ -885,56 +885,6 @@ class EFCourseAutopilot: return False - def _save_diagnostic_report(self): - """当检测到重复课程时,保存诊断报告供开发者分析""" - import datetime - - report = { - "timestamp": datetime.datetime.now().isoformat(), - "course_id": self.ctx.course_id, - "node_id": self.ctx.node_id, - "unit_id": self.ctx.unit_id, - "level_id": self.ctx.level_id, - "lesson_id": self.lesson.lesson_id, - "session_id": self.lesson.session_id, - "activities": [], - "results": [], - } - - for act in self.activities: - act_info = { - "activity_id": act.activity_id, - "tasks": [ - { - "task_id": t.task_id, - "task_type": t.task_type, - "task_detail": t.task_detail, - "expected_response": t.expected_response, - } - for t in act.tasks - ], - } - report["activities"].append(act_info) - - for r in self.results: - report["results"].append({ - "task_id": r.task_id, - "task_type": r.task_type, - "success": r.success, - "skipped": r.skipped, - "error": r.error, - "new_version": r.new_version, - }) - - safe_cid = self.ctx.course_id[:8] if self.ctx.course_id else "unknown" - safe_nid = self.ctx.node_id[:8] if self.ctx.node_id else "unknown" - filename = f"diagnostic_{safe_cid}_{safe_nid}_{int(time.time())}.json" - - with open(filename, "w") as f: - json.dump(report, f, ensure_ascii=False, indent=2) - - self._log(f"\n 诊断报告已保存至: {filename}") - self._log(f" 请将此文件提供给开发者以优化对新课程的支持") # -------------------------------------------------------- # 主流程 @@ -980,9 +930,9 @@ class EFCourseAutopilot: if lesson_key in self._processed_lessons: self.repeat_detected = True self._log("\n⚠️ 检测到重复课程!该课程已处理过但未能晋级。") - self._log(" 请手动登录平台检查课程状态,或联系开发者分析。") - self._save_diagnostic_report() - self._log(f" 诊断文件已保存,请提供给开发者") + self._log(" 请手动完成此课程,处理方式二选一:") + self._log(" ① 打开F12录制HAR,从课程列表到学习完成的全流程,将har文件发给开发者优化") + self._log(" ② 直接手动学习完成,完成后本程序将继续处理后续课程") return False # 步骤②: 注册课程会话 diff --git a/ef_course_loop.py b/ef_course_loop.py index 41ae2f4..05f0bbc 100755 --- a/ef_course_loop.py +++ b/ef_course_loop.py @@ -103,8 +103,9 @@ token.txt 说明: success = autopilot.run() if autopilot.repeat_detected: print("\n⚠️ 检测到重复课程,自动循环终止。") - print(" 请手动登录平台检查课程状态,或联系开发者优化。") - print(f" 诊断文件已保存至当前目录。") + print(" 请手动完成此课程,处理方式二选一:") + print(" ① 打开F12录制HAR,从课程列表到学习完成的全流程,将har文件发给开发者优化") + print(" ② 直接手动学习完成,完成后重新运行本程序继续后续课程") total_fail += 1 break if success: