From 14433589acf10764a87c35a976639fe6cf2f7e43 Mon Sep 17 00:00:00 2001 From: cat_shark <1716967236@qq.com> Date: Wed, 20 May 2026 22:51:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20categorisation=20=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E7=B1=BB=E5=9E=8B=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit HAR 文件分析发现新的任务类型 categorisation(分类题), 新增对应的答题策略函数并注册到 RESPONSE_BUILDERS 字典中。 优先使用服务器返回的 expectedResponse,回退时提交空映射。 Co-Authored-By: Claude Opus 4.7 --- ef_course_autopilot.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ef_course_autopilot.py b/ef_course_autopilot.py index 3097e47..0d98837 100755 --- a/ef_course_autopilot.py +++ b/ef_course_autopilot.py @@ -294,6 +294,22 @@ def build_response_flashcards(task: TaskInfo) -> dict: } +def build_response_categorisation(task: TaskInfo) -> dict: + """categorisation: 分类题 — 优先使用expectedResponse,否则提交空映射""" + expected = task.expected_response.get("contents", {}).get("categorisation", {}) + if expected: + return {"categorisation": expected} + + # 回退:从task.detail获取items,全部设为未分类 + cat = task.task_detail.get("categorisation", {}) + items = cat.get("items", []) + result = {} + for item in items: + iid = item.get("id", "") + result[iid] = {"id": iid, "userInput": ""} + return {"categorisation": result} + + # 任务类型 → 答题策略映射 RESPONSE_BUILDERS = { "media-with-time-markers": build_response_media_with_time_markers, @@ -305,6 +321,7 @@ RESPONSE_BUILDERS = { "speaking-practice": build_response_speaking_practice, "multiple-choice": build_response_multiple_choice, "text-highlights": build_response_text_highlights, + "categorisation": build_response_categorisation, }