imClumsyPanda 2 жил өмнө
parent
commit
8c469fda31

+ 1 - 1
chains/local_doc_qa.py

@@ -80,7 +80,7 @@ class LocalDocQA:
         vector_store = FAISS.from_documents(docs, self.embeddings)
         vs_path = f"""./vector_store/{os.path.splitext(file)[0]}_FAISS_{datetime.datetime.now().strftime("%Y%m%d_%H%M%S")}"""
         vector_store.save_local(vs_path)
-        return vs_path
+        return vs_path if len(docs)>0 else None
 
     def get_knowledge_based_answer(self,
                                    query,