Enhance LLM question import preview with detailed payload information and improved answer display
This commit is contained in:
@@ -1,21 +1,19 @@
|
||||
{% for item in items %}
|
||||
<div class="card mb-2">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Question {{ item.index }}</h5>
|
||||
{% with payload=payloads|slice:item.index|first %}
|
||||
{% if payload %}
|
||||
<p><strong>Stem:</strong> {{ payload.stem|default:''|safe }}</p>
|
||||
<p><strong>Answers:</strong>
|
||||
<ul>
|
||||
<li>A: {{ payload.a_answer|default:''|safe }}</li>
|
||||
<li>B: {{ payload.b_answer|default:''|safe }}</li>
|
||||
<li>C: {{ payload.c_answer|default:''|safe }}</li>
|
||||
<li>D: {{ payload.d_answer|default:''|safe }}</li>
|
||||
<li>E: {{ payload.e_answer|default:''|safe }}</li>
|
||||
</ul>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
<h5 class="card-title">Question {{ item.index|add:1 }}</h5>
|
||||
{% if item.payload %}
|
||||
<p><strong>Stem:</strong> {{ item.payload.stem|default:''|safe }}</p>
|
||||
<p><strong>Answers:</strong>
|
||||
<ul>
|
||||
<li>A: {{ item.payload.a_answer|default:''|safe }}</li>
|
||||
<li>B: {{ item.payload.b_answer|default:''|safe }}</li>
|
||||
<li>C: {{ item.payload.c_answer|default:''|safe }}</li>
|
||||
<li>D: {{ item.payload.d_answer|default:''|safe }}</li>
|
||||
<li>E: {{ item.payload.e_answer|default:''|safe }}</li>
|
||||
</ul>
|
||||
</p>
|
||||
{% endif %}
|
||||
<p><strong>Missing M2M:</strong>
|
||||
{% if item.missing_m2m %}
|
||||
<ul>
|
||||
|
||||
+1
-1
@@ -635,7 +635,7 @@ def import_llm_questions(request):
|
||||
aggregated_actually_created = defaultdict(list)
|
||||
|
||||
for idx, payload in enumerate(candidates):
|
||||
item_report = {"index": idx, "status": None, "errors": [], "missing_m2m": [], "resolved_m2m": {}}
|
||||
item_report = {"index": idx, "status": None, "errors": [], "missing_m2m": [], "resolved_m2m": {}, "payload": payload}
|
||||
for err in validator.iter_errors(payload):
|
||||
item_report["errors"].append(err.message)
|
||||
if item_report["errors"]:
|
||||
|
||||
Reference in New Issue
Block a user