1
0
Fork 0

refactor: refactor the way to check article level

Bug502-YuGaoXiang
吴宇涵 2023-05-06 17:42:04 +08:00
parent f64d06fbbf
commit 01ecc83768
1 changed files with 1 additions and 4 deletions

View File

@ -91,10 +91,7 @@ def article():
question = data.get("question", "") question = data.get("question", "")
level = data.get("level", "4") level = data.get("level", "4")
if content: if content:
try: # check level if level not in ['1', '2', '3', '4']:
if level not in ['1', '2', '3', '4']:
raise ValueError
except ValueError:
return "Level must be between 1 and 4." return "Level must be between 1 and 4."
add_article(content, source, level, question) add_article(content, source, level, question)
_update_context() _update_context()