From 6dd6f7c7b53604fb8eee2aa27509619752bf3133 Mon Sep 17 00:00:00 2001 From: Ashing Zheng Date: Sat, 1 Apr 2023 13:18:28 +0800 Subject: [PATCH] chore(cli_demo): strip the query input for `stop` or `clear` command Remove the query space to determine whether it is a stop command or a clear command --- cli_demo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli_demo.py b/cli_demo.py index 1c3ff2b..da80fff 100644 --- a/cli_demo.py +++ b/cli_demo.py @@ -31,9 +31,9 @@ def main(): print("欢迎使用 ChatGLM-6B 模型,输入内容即可进行对话,clear 清空对话历史,stop 终止程序") while True: query = input("\n用户:") - if query == "stop": + if query.strip() == "stop": break - if query == "clear": + if query.strip() == "clear": history = [] os.system(clear_command) print("欢迎使用 ChatGLM-6B 模型,输入内容即可进行对话,clear 清空对话历史,stop 终止程序")