Merge pull request #1759 from antonvice/bugfix/handle-none-filepath
Fix: Handle NoneType error when processing documents without a file path
This commit is contained in:
commit
feb30d8987
1 changed files with 9 additions and 3 deletions
|
|
@ -900,9 +900,15 @@ class LightRAG:
|
|||
# Get first document's file path and total count for job name
|
||||
first_doc_id, first_doc = next(iter(to_process_docs.items()))
|
||||
first_doc_path = first_doc.file_path
|
||||
path_prefix = first_doc_path[:20] + (
|
||||
"..." if len(first_doc_path) > 20 else ""
|
||||
)
|
||||
|
||||
# Handle cases where first_doc_path is None
|
||||
if first_doc_path:
|
||||
path_prefix = first_doc_path[:20] + (
|
||||
"..." if len(first_doc_path) > 20 else ""
|
||||
)
|
||||
else:
|
||||
path_prefix = "unknown_source"
|
||||
|
||||
total_files = len(to_process_docs)
|
||||
job_name = f"{path_prefix}[{total_files} files]"
|
||||
pipeline_status["job_name"] = job_name
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue