mirror of
https://github.com/RYDE-WORK/Langchain-Chatchat.git
synced 2026-02-07 23:43:30 +08:00
Add support for folder path as input
This commit is contained in:
parent
196904872c
commit
55071c79ef
@ -55,9 +55,14 @@ def init_knowledge_vector_store(filepath:str):
|
|||||||
print("路径不存在")
|
print("路径不存在")
|
||||||
return None
|
return None
|
||||||
elif os.path.isfile(filepath):
|
elif os.path.isfile(filepath):
|
||||||
loader = UnstructuredFileLoader(filepath, mode="elements")
|
file = os.path.split(filepath)[-1]
|
||||||
docs = loader.load()
|
try:
|
||||||
print(f"{os.path.split(filepath)[-1]} 已成功加载")
|
loader = UnstructuredFileLoader(filepath, mode="elements")
|
||||||
|
docs = loader.load()
|
||||||
|
print(f"{file} 已成功加载")
|
||||||
|
except:
|
||||||
|
print(f"{file} 未能成功加载")
|
||||||
|
return None
|
||||||
elif os.path.isdir(filepath):
|
elif os.path.isdir(filepath):
|
||||||
docs = []
|
docs = []
|
||||||
for file in os.listdir(filepath):
|
for file in os.listdir(filepath):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user