🤖 自动格式化代码 [skip ci]

This commit is contained in:
github-actions[bot]
2025-07-07 18:04:52 +00:00
parent f17f5cf46c
commit d49a6b840e
4 changed files with 19 additions and 24 deletions

View File

@@ -123,9 +123,7 @@ class HeartFCMessageReceiver:
picid_pattern = r"\[picid:([^\]]+)\]" picid_pattern = r"\[picid:([^\]]+)\]"
processed_plain_text = re.sub(picid_pattern, "[图片]", message.processed_plain_text) processed_plain_text = re.sub(picid_pattern, "[图片]", message.processed_plain_text)
logger.info( logger.info(f"[{mes_name}]{userinfo.user_nickname}:{processed_plain_text}")
f"[{mes_name}]{userinfo.user_nickname}:{processed_plain_text}"
)
logger.debug(f"[{mes_name}][当前时段回复频率: {current_talk_frequency}]") logger.debug(f"[{mes_name}][当前时段回复频率: {current_talk_frequency}]")

View File

@@ -596,7 +596,9 @@ class NormalChat:
timeout_source = "".join(timeout_details) timeout_source = "".join(timeout_details)
logger.warning(f"[{self.stream_name}] {timeout_source} 任务超时 ({global_config.chat.thinking_timeout}秒),正在取消相关任务...") logger.warning(
f"[{self.stream_name}] {timeout_source} 任务超时 ({global_config.chat.thinking_timeout}秒),正在取消相关任务..."
)
# print(f"111{self.timeout_count}") # print(f"111{self.timeout_count}")
self.timeout_count += 1 self.timeout_count += 1
if self.timeout_count > 5: if self.timeout_count > 5:

View File

@@ -1,12 +1,10 @@
from src.common.logger import get_logger from src.common.logger import get_logger
import math
from src.person_info.person_info import PersonInfoManager, get_person_info_manager from src.person_info.person_info import PersonInfoManager, get_person_info_manager
import time import time
import random import random
from src.llm_models.utils_model import LLMRequest from src.llm_models.utils_model import LLMRequest
from src.config.config import global_config from src.config.config import global_config
from src.chat.utils.chat_message_builder import build_readable_messages from src.chat.utils.chat_message_builder import build_readable_messages
from src.manager.mood_manager import mood_manager
import json import json
from json_repair import repair_json from json_repair import repair_json
from datetime import datetime from datetime import datetime
@@ -26,7 +24,6 @@ class RelationshipManager:
request_type="relationship", # 用于动作规划 request_type="relationship", # 用于动作规划
) )
@staticmethod @staticmethod
async def is_known_some_one(platform, user_id): async def is_known_some_one(platform, user_id):
"""判断是否认识某人""" """判断是否认识某人"""
@@ -113,7 +110,6 @@ class RelationshipManager:
return relation_prompt return relation_prompt
async def update_person_impression(self, person_id, timestamp, bot_engaged_messages=None): async def update_person_impression(self, person_id, timestamp, bot_engaged_messages=None):
"""更新用户印象 """更新用户印象
@@ -340,7 +336,6 @@ class RelationshipManager:
# 获取现有forgotten_points # 获取现有forgotten_points
person_info_manager = get_person_info_manager() person_info_manager = get_person_info_manager()
person_name = await person_info_manager.get_value(person_id, "person_name") person_name = await person_info_manager.get_value(person_id, "person_name")
nickname = await person_info_manager.get_value(person_id, "nickname") nickname = await person_info_manager.get_value(person_id, "nickname")
know_times = await person_info_manager.get_value(person_id, "know_times") or 0 know_times = await person_info_manager.get_value(person_id, "know_times") or 0
@@ -364,12 +359,10 @@ class RelationshipManager:
max_short_impression_length = 50 max_short_impression_length = 50
# 根据好感度,调整印象和简短印象的最大长度 # 根据好感度,调整印象和简短印象的最大长度
attitude_multiplier = (abs(100-attitude) / 100) + 1 attitude_multiplier = (abs(100 - attitude) / 100) + 1
max_impression_length = max_impression_length * attitude_multiplier max_impression_length = max_impression_length * attitude_multiplier
max_short_impression_length = max_short_impression_length * attitude_multiplier max_short_impression_length = max_short_impression_length * attitude_multiplier
forgotten_points = await person_info_manager.get_value(person_id, "forgotten_points") or [] forgotten_points = await person_info_manager.get_value(person_id, "forgotten_points") or []
if isinstance(forgotten_points, str): if isinstance(forgotten_points, str):
try: try:
@@ -542,7 +535,6 @@ class RelationshipManager:
return current_points return current_points
def calculate_time_weight(self, point_time: str, current_time: str) -> float: def calculate_time_weight(self, point_time: str, current_time: str) -> float:
"""计算基于时间的权重系数""" """计算基于时间的权重系数"""
try: try:

View File

@@ -103,7 +103,6 @@ class NoReplyAction(BaseAction):
logger.info(f"{self.log_prefix} 选择不回复(第{count}次),开始摸鱼,原因: {reason}") logger.info(f"{self.log_prefix} 选择不回复(第{count}次),开始摸鱼,原因: {reason}")
# 进入等待状态 # 进入等待状态
while True: while True:
current_time = time.time() current_time = time.time()
@@ -387,7 +386,9 @@ class NoReplyAction(BaseAction):
f"{self.log_prefix} 发言过多(超过{over_count}条)随机决定跳过此次LLM判断(概率{skip_probability * 100:.0f}%)" f"{self.log_prefix} 发言过多(超过{over_count}条)随机决定跳过此次LLM判断(概率{skip_probability * 100:.0f}%)"
) )
logger.info(f"{self.log_prefix} 过去10分钟发言{bot_message_count}条,超过阈值{talk_frequency_threshold},添加疲惫提示") logger.info(
f"{self.log_prefix} 过去10分钟发言{bot_message_count}条,超过阈值{talk_frequency_threshold},添加疲惫提示"
)
return frequency_block, should_skip_judge return frequency_block, should_skip_judge
else: else:
# 回复次数少时的正向提示 # 回复次数少时的正向提示
@@ -398,7 +399,9 @@ class NoReplyAction(BaseAction):
elif under_count >= talk_frequency_threshold * 0.5: elif under_count >= talk_frequency_threshold * 0.5:
frequency_block = "你感觉状态不错。\n" frequency_block = "你感觉状态不错。\n"
logger.info(f"{self.log_prefix} 过去10分钟发言{bot_message_count}条,未超过阈值{talk_frequency_threshold},添加正向提示") logger.info(
f"{self.log_prefix} 过去10分钟发言{bot_message_count}条,未超过阈值{talk_frequency_threshold},添加正向提示"
)
return frequency_block, False return frequency_block, False
except Exception as e: except Exception as e: