feat: 格式化

This commit is contained in:
李如威 2025-07-09 00:57:24 +08:00
parent 3640290ce1
commit 9b9265b46a
1 changed files with 3 additions and 3 deletions

View File

@ -33,7 +33,7 @@ class AsyncRAGService:
答案""", 答案""",
) )
self.logger.info("RAG服务初始化完成") self.logger.info("RAG服务初始化完成")
async def add_document_async(self, content: str, filename: str) -> str: async def add_document_async(self, content: str, filename: str) -> str:
@ -58,7 +58,7 @@ class AsyncRAGService:
try: try:
self.logger.info(f"开始处理问答: {question[:50]}...") self.logger.info(f"开始处理问答: {question[:50]}...")
# 异步检索相关文档 # 异步检索相关文档
search_results = await self.vector_store.search_async(question, top_k) search_results = await self.vector_store.search_async(question, top_k)
self.logger.debug(f"检索到 {len(search_results)} 个相关文档") self.logger.debug(f"检索到 {len(search_results)} 个相关文档")
@ -95,7 +95,7 @@ class AsyncRAGService:
"sources": sources, "sources": sources,
"processing_time": duration, "processing_time": duration,
} }
except Exception as e: except Exception as e:
duration = time.time() - start_time duration = time.time() - start_time
self.logger.error(f"问答处理失败: {str(e)}, 耗时: {duration:.2f}s") self.logger.error(f"问答处理失败: {str(e)}, 耗时: {duration:.2f}s")