修改response结构

This commit is contained in:
zhaojinghao 2022-12-08 15:29:01 +08:00
parent eedd13fbea
commit 7d080b817d
1 changed files with 3 additions and 3 deletions

6
run.py
View File

@ -112,7 +112,7 @@ def run_chat():
resp_info = dict() resp_info = dict()
if request.method == "POST": if request.method == "POST":
dialog_history = request.form.get("dialog_history") dialog_history = request.form.get("dialog_history")
dialog_history = dialog_history.split('') dialog_history = dialog_history.rstrip('').split('')
logger.info(f"将对文本'{dialog_history}'进行对话") logger.info(f"将对文本'{dialog_history}'进行对话")
if len(dialog_history) > 0: if len(dialog_history) > 0:
rest = chatbot.response(dialog_history) rest = chatbot.response(dialog_history)
@ -182,7 +182,7 @@ def run_reading():
if request.method == "POST": if request.method == "POST":
question = request.form.get("question") question = request.form.get("question")
passages = request.form.get("passages") passages = request.form.get("passages")
passages = [x + '' for x in passages.split('')] passages = [x.strip() + '' for x in passages.split('')]
if question is None or question.strip() == "": if question is None or question.strip() == "":
resp_info["msg"] = "Question is None, please check!" resp_info["msg"] = "Question is None, please check!"
resp_info["code"] = 406 resp_info["code"] = 406
@ -200,4 +200,4 @@ def run_reading():
if __name__ == '__main__': if __name__ == '__main__':
app.run(host='0.0.0.0', port=8903, debug=True) app.run(host='0.0.0.0', port=8903, debug=False)