This commit is contained in:
hzywhite 2025-09-02 06:21:08 +08:00
parent 36c81039b1
commit 745aa085db
2 changed files with 18 additions and 15 deletions

View file

@ -1250,7 +1250,10 @@ async def pipeline_enqueue_file(
try:
await rag.apipeline_enqueue_documents(
content, file_paths=file_path.name, track_id=track_id, scheme_name=scheme_name
content,
file_paths=file_path.name,
track_id=track_id,
scheme_name=scheme_name,
)
logger.info(
@ -1334,7 +1337,9 @@ async def pipeline_enqueue_file(
logger.error(f"Error deleting file {file_path}: {str(e)}")
async def pipeline_index_file(rag: LightRAG, file_path: Path, track_id: str = None, scheme_name: str = None):
async def pipeline_index_file(
rag: LightRAG, file_path: Path, track_id: str = None, scheme_name: str = None
):
"""Index a file with track_id
Args:
@ -1376,7 +1381,9 @@ async def pipeline_index_files(
# Process files sequentially with track_id
for file_path in sorted_file_paths:
success, _ = await pipeline_enqueue_file(rag, file_path, track_id, scheme_name)
success, _ = await pipeline_enqueue_file(
rag, file_path, track_id, scheme_name
)
if success:
enqueued = True
@ -1421,13 +1428,11 @@ async def pipeline_index_files_raganything(
# Process files sequentially with track_id
for file_path in sorted_file_paths:
success = (
await rag_anything.process_document_complete_lightrag_api(
file_path=str(file_path),
output_dir="./output",
parse_method="auto",
scheme_name=scheme_name,
)
success = await rag_anything.process_document_complete_lightrag_api(
file_path=str(file_path),
output_dir="./output",
parse_method="auto",
scheme_name=scheme_name,
)
if success:
pass

View file

@ -1,6 +1,5 @@
from __future__ import annotations
from re import A
import traceback
import asyncio
import configparser
@ -930,9 +929,7 @@ class LightRAG:
return track_id
def move_file_to_enqueue(self, file_path):
try:
enqueued_dir = file_path.parent / "__enqueued__"
enqueued_dir.mkdir(exist_ok=True)
@ -955,8 +952,9 @@ class LightRAG:
)
# Don't affect the main function's success status
def get_unique_filename_in_enqueued(self, target_dir: Path, original_name: str) -> str:
def get_unique_filename_in_enqueued(
self, target_dir: Path, original_name: str
) -> str:
from pathlib import Path
import time