Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

logger = logging.getLogger(__name__)

BATCH_DELETE_SIZE = 100
BATCH_DELETE_SIZE = 500


def _delete_chunks_by_rag_file_id_batched(client, collection_name: str, rag_file_id: str) -> int:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ async def _store_single_batch(
documents, doc_ids = chunks_to_documents(batch_chunks, ids=ids)

try:
vectorstore.add_documents(documents=documents, ids=doc_ids)
# 使用异步方法避免阻塞事件循环
await vectorstore.aadd_documents(documents=documents, ids=doc_ids)
logger.info("批次 %d-%d 存储成功", batch_start + 1, batch_end)
except Exception as e:
logger.error(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ async def _process_single_graph_file(
await self._mark_failed(db, file_repo, str(rag_file.id), "文件不存在")
return

documents = load_documents(file_path)
documents = await asyncio.to_thread(load_documents, file_path)
if not documents:
await self._mark_failed(db, file_repo, str(rag_file.id), "文件解析失败,未生成文档")
return
Expand Down
Loading