增加写作类题目的处理逻辑

This commit is contained in:
2026-05-21 15:41:36 +08:00
parent eedf48d6df
commit 4afa7c51f8
+23
View File
@@ -310,6 +310,28 @@ def build_response_categorisation(task: TaskInfo) -> dict:
return {"categorisation": result} 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 = { RESPONSE_BUILDERS = {
"media-with-time-markers": build_response_media_with_time_markers, "media-with-time-markers": build_response_media_with_time_markers,
@@ -322,6 +344,7 @@ RESPONSE_BUILDERS = {
"multiple-choice": build_response_multiple_choice, "multiple-choice": build_response_multiple_choice,
"text-highlights": build_response_text_highlights, "text-highlights": build_response_text_highlights,
"categorisation": build_response_categorisation, "categorisation": build_response_categorisation,
"writing-challenge": build_response_writing_challenge,
} }