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

This commit is contained in:
github-actions[bot]
2025-05-28 14:42:38 +00:00
parent cd41dcb4cb
commit 8f03be10be
6 changed files with 21 additions and 21 deletions

View File

@@ -406,9 +406,7 @@ class HeartFChatting:
try: try:
# 使用 await task 来获取结果或触发异常 # 使用 await task 来获取结果或触发异常
result_list = await task result_list = await task
logger.info( logger.info(f"{self.log_prefix} 处理器 {processor_name} 已完成!")
f"{self.log_prefix} 处理器 {processor_name} 已完成!"
)
if result_list is not None: if result_list is not None:
all_plan_info.extend(result_list) all_plan_info.extend(result_list)
else: else:

View File

@@ -41,7 +41,6 @@ class NormalChat:
self.willing_amplifier = 1 self.willing_amplifier = 1
self.start_time = time.time() self.start_time = time.time()
# Other sync initializations # Other sync initializations
self.gpt = NormalChatGenerator() self.gpt = NormalChatGenerator()
self.mood_manager = mood_manager self.mood_manager = mood_manager
@@ -58,8 +57,6 @@ class NormalChat:
self._disabled = False # 增加停用标志 self._disabled = False # 增加停用标志
async def initialize(self): async def initialize(self):
"""异步初始化,获取聊天类型和目标信息。""" """异步初始化,获取聊天类型和目标信息。"""
if self._initialized: if self._initialized:
@@ -217,7 +214,6 @@ class NormalChat:
else: else:
self.adjust_reply_frequency(duration=(time.time() - self.start_time) / 60) self.adjust_reply_frequency(duration=(time.time() - self.start_time) / 60)
await self.normal_response( await self.normal_response(
message=message, message=message,
is_mentioned=is_mentioned, is_mentioned=is_mentioned,
@@ -498,7 +494,9 @@ class NormalChat:
total_message_count = stats["total_message_count"] total_message_count = stats["total_message_count"]
if total_message_count == 0: if total_message_count == 0:
return return
logger.debug(f"[{self.stream_name}]({self.willing_amplifier}) 最近{duration}分钟 回复数量: {bot_reply_count},消息总数: {total_message_count}") logger.debug(
f"[{self.stream_name}]({self.willing_amplifier}) 最近{duration}分钟 回复数量: {bot_reply_count},消息总数: {total_message_count}"
)
# 计算回复频率 # 计算回复频率
_reply_frequency = bot_reply_count / total_message_count _reply_frequency = bot_reply_count / total_message_count
@@ -509,12 +507,16 @@ class NormalChat:
if differ > 0.1: if differ > 0.1:
mapped = 1 + (differ - 0.1) * 4 / 0.9 mapped = 1 + (differ - 0.1) * 4 / 0.9
mapped = max(1, min(5, mapped)) mapped = max(1, min(5, mapped))
logger.info(f"[{self.stream_name}] 回复频率低于{global_config.normal_chat.talk_frequency}增加回复概率differ={differ:.3f},映射值={mapped:.2f}") logger.info(
f"[{self.stream_name}] 回复频率低于{global_config.normal_chat.talk_frequency}增加回复概率differ={differ:.3f},映射值={mapped:.2f}"
)
self.willing_amplifier += mapped * 0.1 # 你可以根据实际需要调整系数 self.willing_amplifier += mapped * 0.1 # 你可以根据实际需要调整系数
elif differ < -0.1: elif differ < -0.1:
mapped = 1 - (differ + 0.1) * 4 / 0.9 mapped = 1 - (differ + 0.1) * 4 / 0.9
mapped = max(1, min(5, mapped)) mapped = max(1, min(5, mapped))
logger.info(f"[{self.stream_name}] 回复频率高于{global_config.normal_chat.talk_frequency}减少回复概率differ={differ:.3f},映射值={mapped:.2f}") logger.info(
f"[{self.stream_name}] 回复频率高于{global_config.normal_chat.talk_frequency}减少回复概率differ={differ:.3f},映射值={mapped:.2f}"
)
self.willing_amplifier -= mapped * 0.1 self.willing_amplifier -= mapped * 0.1
if self.willing_amplifier > 5: if self.willing_amplifier > 5:

View File

@@ -326,7 +326,6 @@ FOCUS_CHAT_STYLE_CONFIG = {
} }
REMOTE_STYLE_CONFIG = { REMOTE_STYLE_CONFIG = {
"advanced": { "advanced": {
"console_format": ( "console_format": (
@@ -992,6 +991,7 @@ NORMAL_CHAT_STYLE_CONFIG = NORMAL_CHAT_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT e
FOCUS_CHAT_STYLE_CONFIG = FOCUS_CHAT_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else FOCUS_CHAT_STYLE_CONFIG["advanced"] FOCUS_CHAT_STYLE_CONFIG = FOCUS_CHAT_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else FOCUS_CHAT_STYLE_CONFIG["advanced"]
EXPRESS_STYLE_CONFIG = EXPRESS_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else EXPRESS_STYLE_CONFIG["advanced"] EXPRESS_STYLE_CONFIG = EXPRESS_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else EXPRESS_STYLE_CONFIG["advanced"]
def is_registered_module(record: dict) -> bool: def is_registered_module(record: dict) -> bool:
"""检查是否为已注册的模块""" """检查是否为已注册的模块"""
return record["extra"].get("module") in _handler_registry return record["extra"].get("module") in _handler_registry