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, }