feat:记忆系统再优化,现在及时构建,并且不会重复构建
This commit is contained in:
@@ -294,6 +294,9 @@ class DefaultReplyer:
|
||||
async def build_relation_info(self, sender: str, target: str):
|
||||
if not global_config.relationship.enable_relationship:
|
||||
return ""
|
||||
|
||||
if sender == global_config.bot.nickname:
|
||||
return ""
|
||||
|
||||
# 获取用户ID
|
||||
person = Person(person_name = sender)
|
||||
@@ -757,13 +760,19 @@ class DefaultReplyer:
|
||||
# 处理结果
|
||||
timing_logs = []
|
||||
results_dict = {}
|
||||
|
||||
almost_zero_str = ""
|
||||
for name, result, duration in task_results:
|
||||
results_dict[name] = result
|
||||
chinese_name = task_name_mapping.get(name, name)
|
||||
if duration < 0.01:
|
||||
almost_zero_str += f"{chinese_name},"
|
||||
continue
|
||||
|
||||
timing_logs.append(f"{chinese_name}: {duration:.1f}s")
|
||||
if duration > 8:
|
||||
logger.warning(f"回复生成前信息获取耗时过长: {chinese_name} 耗时: {duration:.1f}s,请使用更快的模型")
|
||||
logger.info(f"在回复前的步骤耗时: {'; '.join(timing_logs)}")
|
||||
logger.info(f"回复准备: {'; '.join(timing_logs)}; {almost_zero_str} <0.01s")
|
||||
|
||||
expression_habits_block, selected_expressions = results_dict["expression_habits"]
|
||||
relation_info = results_dict["relation_info"]
|
||||
|
||||
Reference in New Issue
Block a user