From 4afa7c51f8deca32af0e51ba9a6a54f552711570 Mon Sep 17 00:00:00 2001 From: cat_shark <1716967236@qq.com> Date: Thu, 21 May 2026 15:41:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=86=99=E4=BD=9C=E7=B1=BB?= =?UTF-8?q?=E9=A2=98=E7=9B=AE=E7=9A=84=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ef_course_autopilot.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/ef_course_autopilot.py b/ef_course_autopilot.py index 816596c..b0903d4 100755 --- a/ef_course_autopilot.py +++ b/ef_course_autopilot.py @@ -310,6 +310,28 @@ def build_response_categorisation(task: TaskInfo) -> dict: return {"categorisation": result} +def build_response_writing_challenge(task: TaskInfo) -> dict: + """writing-challenge: 写作挑战 — 优先使用expectedResponse,否则提交占位文本""" + expected = task.expected_response.get("contents", {}).get("writingChallenge", {}) + if expected: + return {"writingChallenge": expected} + + # 回退:提交一段较长占位文本(确保满足最低字数要求) + return { + "writingChallenge": { + "userInput": ( + "I think this is a good topic. There are many things to consider " + "when writing about this subject. First of all, it is important to " + "understand the main ideas and think carefully about the best way to " + "express your thoughts. In my opinion, practice is the key to success " + "and everyone should try their best to improve their skills every day. " + "This is why I believe that learning English is very useful for " + "communication with people from different countries and cultures." + ), + } + } + + # 任务类型 → 答题策略映射 RESPONSE_BUILDERS = { "media-with-time-markers": build_response_media_with_time_markers, @@ -322,6 +344,7 @@ RESPONSE_BUILDERS = { "multiple-choice": build_response_multiple_choice, "text-highlights": build_response_text_highlights, "categorisation": build_response_categorisation, + "writing-challenge": build_response_writing_challenge, }