Update pages/3_Add_Questions.py
Browse files- pages/3_Add_Questions.py +11 -0
pages/3_Add_Questions.py
CHANGED
@@ -53,6 +53,17 @@ if st.button("Save Question"):
|
|
53 |
with open(question_dir / "metadata.json", "w", encoding="utf-8") as f:
|
54 |
json.dump(metadata, f, indent=4)
|
55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
st.success(f"✅ Question saved successfully! (ID: {question_id})")
|
57 |
commit_and_push_changes()
|
58 |
st.info("refresh in-order to see the applied changes")
|
|
|
53 |
with open(question_dir / "metadata.json", "w", encoding="utf-8") as f:
|
54 |
json.dump(metadata, f, indent=4)
|
55 |
|
56 |
+
new_entry = {
|
57 |
+
"folder": question_id,
|
58 |
+
"question": question_text,
|
59 |
+
"answer": answer_text,
|
60 |
+
"code": formatted_code,
|
61 |
+
"metadata": metadata
|
62 |
+
}
|
63 |
+
|
64 |
+
with open ("output.jsonl", "w+", encoding="utf-8") as f:
|
65 |
+
f.write(json.dumps(new_entry, ensure_ascii=False) + "\n")
|
66 |
+
|
67 |
st.success(f"✅ Question saved successfully! (ID: {question_id})")
|
68 |
commit_and_push_changes()
|
69 |
st.info("refresh in-order to see the applied changes")
|