fix cli if there is no other type of doc to make it robust
This commit is contained in:
@@ -356,13 +356,20 @@ Examples:
|
|||||||
".py",
|
".py",
|
||||||
".jl",
|
".jl",
|
||||||
]
|
]
|
||||||
other_docs = SimpleDirectoryReader(
|
# Try to load other file types, but don't fail if none are found
|
||||||
docs_dir,
|
try:
|
||||||
recursive=True,
|
other_docs = SimpleDirectoryReader(
|
||||||
encoding="utf-8",
|
docs_dir,
|
||||||
required_exts=code_extensions,
|
recursive=True,
|
||||||
).load_data(show_progress=True)
|
encoding="utf-8",
|
||||||
documents.extend(other_docs)
|
required_exts=code_extensions,
|
||||||
|
).load_data(show_progress=True)
|
||||||
|
documents.extend(other_docs)
|
||||||
|
except ValueError as e:
|
||||||
|
if "No files found" in str(e):
|
||||||
|
print("No additional files found for other supported types.")
|
||||||
|
else:
|
||||||
|
raise e
|
||||||
|
|
||||||
all_texts = []
|
all_texts = []
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user