Explorar o código

Update cli_demo.py

加了一个判断用户输入本地知识路径是否为空的判断,避免误触回车
keenzhu %!s(int64=2) %!d(string=hai) anos
pai
achega
26393f488b
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      cli_demo.py

+ 3 - 0
cli_demo.py

@@ -18,6 +18,9 @@ if __name__ == "__main__":
     vs_path = None
     vs_path = None
     while not vs_path:
     while not vs_path:
         filepath = input("Input your local knowledge file path 请输入本地知识文件路径:")
         filepath = input("Input your local knowledge file path 请输入本地知识文件路径:")
+        #判断filepath是否为空,如果为空的话,重新让用户输入,防止用户误触回车
+        if not filepath:
+            continue
         vs_path, _ = local_doc_qa.init_knowledge_vector_store(filepath)
         vs_path, _ = local_doc_qa.init_knowledge_vector_store(filepath)
     history = []
     history = []
     while True:
     while True: