Spaces:
Sleeping
Sleeping
Tuchuanhuhuhu
commited on
Commit
·
fe0c8bd
1
Parent(s):
dc61f72
改进生成 embedding 时的稳定性
Browse files- modules/index_func.py +4 -1
modules/index_func.py
CHANGED
@@ -83,7 +83,10 @@ def get_documents(file_src):
|
|
83 |
logging.error(f"Error loading file: {filename}")
|
84 |
traceback.print_exc()
|
85 |
|
86 |
-
|
|
|
|
|
|
|
87 |
documents.extend(texts)
|
88 |
logging.debug("Documents loaded.")
|
89 |
return documents
|
|
|
83 |
logging.error(f"Error loading file: {filename}")
|
84 |
traceback.print_exc()
|
85 |
|
86 |
+
try:
|
87 |
+
texts = text_splitter.split_documents(texts)
|
88 |
+
except AttributeError:
|
89 |
+
texts = text_splitter.split_documents([texts])
|
90 |
documents.extend(texts)
|
91 |
logging.debug("Documents loaded.")
|
92 |
return documents
|