This commit is contained in:
墨梓柒
2025-09-28 00:02:18 +08:00
parent 5cc1e56904
commit e9a5488b62
32 changed files with 215 additions and 222 deletions

View File

@@ -206,7 +206,11 @@ class HeartFChatting:
# *控制频率用
if mentioned_message:
await self._observe(recent_messages_list=recent_messages_list, force_reply_message=mentioned_message)
elif random.random() < global_config.chat.talk_value * frequency_control_manager.get_or_create_frequency_control(self.stream_id).get_talk_frequency_adjust():
elif (
random.random()
< global_config.chat.talk_value
* frequency_control_manager.get_or_create_frequency_control(self.stream_id).get_talk_frequency_adjust()
):
await self._observe(recent_messages_list=recent_messages_list)
else:
# 没有提到继续保持沉默等待5秒防止频繁触发
@@ -276,9 +280,8 @@ class HeartFChatting:
recent_messages_list = []
reply_text = "" # 初始化reply_text变量避免UnboundLocalError
start_time = time.time()
if s4u_config.enable_s4u:
await send_typing()
@@ -350,7 +353,7 @@ class HeartFChatting:
available_actions=available_actions,
)
)
logger.info(
f"{self.log_prefix} 决定执行{len(action_to_use_info)}个动作: {' '.join([a.action_type for a in action_to_use_info])}"
)
@@ -412,7 +415,7 @@ class HeartFChatting:
},
}
reply_text = action_reply_text
self.end_cycle(loop_info, cycle_timers)
self.print_cycle_info(cycle_timers)
@@ -423,11 +426,6 @@ class HeartFChatting:
else:
await asyncio.sleep(0.1)
"""S4U内容暂时保留"""
if s4u_config.enable_s4u:
await stop_typing()

View File

@@ -1,10 +1,8 @@
import asyncio
import re
import traceback
from typing import Tuple, TYPE_CHECKING
from src.config.config import global_config
from src.chat.message_receive.message import MessageRecv
from src.chat.message_receive.storage import MessageStorage
from src.chat.heart_flow.heartflow import heartflow
@@ -74,7 +72,7 @@ class HeartFCMessageReceiver:
await self.storage.store_message(message, chat)
heartflow_chat: HeartFChatting = await heartflow.get_or_create_heartflow_chat(chat.stream_id) # type: ignore
_heartflow_chat: HeartFChatting = await heartflow.get_or_create_heartflow_chat(chat.stream_id) # type: ignore
# 3. 日志记录
mes_name = chat.group_info.group_name if chat.group_info else "私聊"
@@ -102,7 +100,7 @@ class HeartFCMessageReceiver:
replace_bot_name=True,
)
# if not processed_plain_text:
# print(message)
# print(message)
logger.info(f"[{mes_name}]{userinfo.user_nickname}:{processed_plain_text}") # type: ignore