From 8d8b9197b614b595bbba1ecf95c189ea1389780c Mon Sep 17 00:00:00 2001 From: Lan Hui <1348141770@qq.com> Date: Sun, 26 Mar 2023 09:59:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=8B=E5=8A=A8=E8=BE=93=E5=85=A5=E7=9A=84?= =?UTF-8?q?=E6=96=87=E5=AD=97=E6=9C=80=E9=AB=98=E9=9A=BE=E5=BA=A6=E7=AD=89?= =?UTF-8?q?=E7=BA=A7=E6=98=AF4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin_service.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/admin_service.py b/app/admin_service.py index 8632b43..30d622f 100644 --- a/app/admin_service.py +++ b/app/admin_service.py @@ -88,13 +88,13 @@ def article(): content = data.get("content", "") source = data.get("source", "") question = data.get("question", "") - level = data.get("level", "5") + level = data.get("level", "4") if content: try: # check level - if level not in [str(x + 1) for x in range(5)]: + if level not in ['1', '2', '3', '4']: raise ValueError except ValueError: - return "Level must be between 1 and 5" + return "Level must be between 1 and 4." add_article(content, source, level, question) _update_context() title = content.split('\n')[0]