Update app.py
Browse files
app.py
CHANGED
@@ -51,12 +51,12 @@ def generate_quiz_page():
|
|
51 |
if request.content_type == 'application/json':
|
52 |
data = request.get_json()
|
53 |
context = data.get("context")
|
54 |
-
if context is None:
|
55 |
-
return jsonify({"error": "Missing 'context' parameter"}), 400
|
56 |
else:
|
57 |
context = request.form.get("context")
|
58 |
-
if context is None:
|
59 |
-
return jsonify({"error": "Missing 'context' parameter"}), 400
|
60 |
|
61 |
response = generate_quiz(context)
|
62 |
|
|
|
51 |
if request.content_type == 'application/json':
|
52 |
data = request.get_json()
|
53 |
context = data.get("context")
|
54 |
+
if context is None or context.strip() == "":
|
55 |
+
return jsonify({"error": "Missing or empty 'context' parameter"}), 400
|
56 |
else:
|
57 |
context = request.form.get("context")
|
58 |
+
if context is None or context.strip() == "":
|
59 |
+
return jsonify({"error": "Missing or empty 'context' parameter"}), 400
|
60 |
|
61 |
response = generate_quiz(context)
|
62 |
|