fix:修复表达方式空构建问题

This commit is contained in:
SengokuCola
2025-05-28 23:23:01 +08:00
parent 0087601fb3
commit 2951feadb5
4 changed files with 82 additions and 56 deletions

View File

@@ -204,7 +204,8 @@ class ExpressionLearner:
random_msg: Optional[List[Dict[str, Any]]] = get_raw_msg_by_timestamp_random(
current_time - 3600 * 24, current_time, limit=num
)
if not random_msg:
# print(random_msg)
if not random_msg or random_msg == []:
return None
# 转化成str
chat_id: str = random_msg[0]["chat_id"]
@@ -216,7 +217,7 @@ class ExpressionLearner:
chat_str=random_msg_str,
)
# logger.info(f"学习{type_str}的prompt: {prompt}")
logger.info(f"学习{type_str}的prompt: {prompt}")
try:
response, _ = await self.express_learn_model.generate_response_async(prompt)