fix:修复qa

This commit is contained in:
SengokuCola
2025-07-15 22:35:38 +08:00
parent a150aa7b2b
commit 9927322bf9
2 changed files with 5 additions and 5 deletions

View File

@@ -31,12 +31,12 @@ class QAManager:
request_type="lpmm.qa"
)
def process_query(self, question: str) -> Tuple[List[Tuple[str, float, float]], Optional[Dict[str, float]]]:
async def process_query(self, question: str) -> Tuple[List[Tuple[str, float, float]], Optional[Dict[str, float]]]:
"""处理查询"""
# 生成问题的Embedding
part_start_time = time.perf_counter()
question_embedding = get_embedding(question)
question_embedding = await get_embedding(question)
if question_embedding is None:
logger.error("生成问题Embedding失败")
return None
@@ -103,10 +103,10 @@ class QAManager:
else:
return None
def get_knowledge(self, question: str) -> str:
async def get_knowledge(self, question: str) -> str:
"""获取知识"""
# 处理查询
processed_result = self.process_query(question)
processed_result = await self.process_query(question)
if processed_result is not None:
query_res = processed_result[0]
knowledge = [

View File

@@ -43,7 +43,7 @@ class SearchKnowledgeFromLPMMTool(BaseTool):
# 调用知识库搜索
knowledge_info = qa_manager.get_knowledge(query)
knowledge_info = await qa_manager.get_knowledge(query)
logger.debug(f"知识库查询结果: {knowledge_info}")