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,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 = []