fix cli if there is no other type of doc to make it robust

This commit is contained in:
yichuan520030910320
2025-08-07 18:46:05 -07:00
parent c96d653072
commit 710e83b1fd

View File

@@ -356,6 +356,8 @@ Examples:
".py", ".py",
".jl", ".jl",
] ]
# Try to load other file types, but don't fail if none are found
try:
other_docs = SimpleDirectoryReader( other_docs = SimpleDirectoryReader(
docs_dir, docs_dir,
recursive=True, recursive=True,
@@ -363,6 +365,11 @@ Examples:
required_exts=code_extensions, required_exts=code_extensions,
).load_data(show_progress=True) ).load_data(show_progress=True)
documents.extend(other_docs) 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 = []