优化多可选答案时的处理逻辑
This commit is contained in:
@@ -162,7 +162,14 @@ def build_response_gapfill(task: TaskInfo) -> dict:
|
|||||||
"""gapfill: 填空题 — 优先使用expectedResponse中的正确答案"""
|
"""gapfill: 填空题 — 优先使用expectedResponse中的正确答案"""
|
||||||
expected = task.expected_response.get("contents", {}).get("gapfill", {})
|
expected = task.expected_response.get("contents", {}).get("gapfill", {})
|
||||||
if expected:
|
if expected:
|
||||||
return {"gapfill": expected}
|
result = {}
|
||||||
|
for gid, gdata in expected.items():
|
||||||
|
user_input = gdata.get("userInput", "")
|
||||||
|
# 处理 "friendlier | more friendly" 多答案格式,取第一个
|
||||||
|
if " | " in user_input:
|
||||||
|
user_input = user_input.split(" | ")[0].strip()
|
||||||
|
result[gid] = {"id": gid, "userInput": user_input}
|
||||||
|
return {"gapfill": result}
|
||||||
|
|
||||||
# 回退:从task.detail获取gap列表, 填入空字符串
|
# 回退:从task.detail获取gap列表, 填入空字符串
|
||||||
gf = task.task_detail.get("gapfill", {})
|
gf = task.task_detail.get("gapfill", {})
|
||||||
|
|||||||
Reference in New Issue
Block a user