From be53fc837ef73090c1456aec260efbe58c08e85c Mon Sep 17 00:00:00 2001 From: Wenjie Zhang Date: Sat, 10 May 2025 00:17:38 +0800 Subject: [PATCH] fix add chunks bug --- server/routers/data_router.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/server/routers/data_router.py b/server/routers/data_router.py index b7ad34fa..c310db9c 100644 --- a/server/routers/data_router.py +++ b/server/routers/data_router.py @@ -78,11 +78,7 @@ async def create_document_by_file(db_id: str = Body(...), files: List[str] = Bod async def add_by_chunks(db_id: str = Body(...), file_chunks: dict = Body(...), current_user: User = Depends(get_admin_user)): # logger.debug(f"Add chunks in {db_id}: {len(file_chunks)} chunks") try: - loop = asyncio.get_event_loop() - await loop.run_in_executor( - executor, # 使用与chat_router相同的线程池 - lambda: knowledge_base.add_chunks(db_id, file_chunks) - ) + await knowledge_base.add_chunks(db_id, file_chunks) return {"message": "分块添加完成", "status": "success"} except Exception as e: logger.error(f"添加分块失败: {e}, {traceback.format_exc()}")