diff --git a/src/chat/brain_chat/brain_chat.py b/src/chat/brain_chat/brain_chat.py index e631f88a..5ba077ab 100644 --- a/src/chat/brain_chat/brain_chat.py +++ b/src/chat/brain_chat/brain_chat.py @@ -502,12 +502,6 @@ class BrainChatting: ) return {"action_type": "no_action", "success": True, "reply_text": "", "command": ""} - elif action_planner_info.action_type == "wait_time": - action_planner_info.action_data = action_planner_info.action_data or {} - logger.info(f"{self.log_prefix} 等待{action_planner_info.action_data['time']}秒后回复") - await asyncio.sleep(action_planner_info.action_data["time"]) - return {"action_type": "wait_time", "success": True, "reply_text": "", "command": ""} - elif action_planner_info.action_type == "reply": try: success, llm_response = await generator_api.generate_reply( diff --git a/src/chat/brain_chat/brain_planner.py b/src/chat/brain_chat/brain_planner.py index 67e0a873..971a7356 100644 --- a/src/chat/brain_chat/brain_planner.py +++ b/src/chat/brain_chat/brain_planner.py @@ -59,7 +59,7 @@ reply no_reply 动作描述: -保持沉默,等待对方发言 +等待,保持沉默,等待对方发言 {{ "action": "no_reply", }} @@ -332,7 +332,7 @@ class BrainPlanner: moderation_prompt=moderation_prompt_block, name_block=name_block, interest=interest, - plan_style=global_config.personality.plan_style, + plan_style=global_config.personality.private_plan_style, ) return prompt, message_id_list diff --git a/src/chat/frequency_control/utils.py b/src/chat/frequency_control/utils.py deleted file mode 100644 index 037e02a5..00000000 --- a/src/chat/frequency_control/utils.py +++ /dev/null @@ -1,37 +0,0 @@ -from typing import Optional -import hashlib - - -def parse_stream_config_to_chat_id(stream_config_str: str) -> Optional[str]: - """ - 解析流配置字符串并生成对应的 chat_id - - Args: - stream_config_str: 格式为 "platform:id:type" 的字符串 - - Returns: - str: 生成的 chat_id,如果解析失败则返回 None - """ - try: - parts = stream_config_str.split(":") - if len(parts) != 3: - return None - - platform = parts[0] - id_str = parts[1] - stream_type = parts[2] - - # 判断是否为群聊 - is_group = stream_type == "group" - - # 使用与 ChatStream.get_stream_id 相同的逻辑生成 chat_id - - if is_group: - components = [platform, str(id_str)] - else: - components = [platform, str(id_str), "private"] - key = "_".join(components) - return hashlib.md5(key.encode()).hexdigest() - - except (ValueError, IndexError): - return None diff --git a/src/chat/heart_flow/heartFC_chat.py b/src/chat/heart_flow/heartFC_chat.py index e1c74f5c..2ea8b519 100644 --- a/src/chat/heart_flow/heartFC_chat.py +++ b/src/chat/heart_flow/heartFC_chat.py @@ -18,6 +18,7 @@ from src.chat.planner_actions.action_manager import ActionManager from src.chat.heart_flow.hfc_utils import CycleDetail from src.chat.heart_flow.hfc_utils import send_typing, stop_typing from src.chat.express.expression_learner import expression_learner_manager +from src.chat.frequency_control.frequency_control import frequency_control_manager from src.person_info.person_info import Person from src.plugin_system.base.component_types import EventType, ActionInfo from src.plugin_system.core import events_manager @@ -202,7 +203,7 @@ 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: + 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: return True diff --git a/src/config/official_configs.py b/src/config/official_configs.py index 7f1a7127..b3cd8627 100644 --- a/src/config/official_configs.py +++ b/src/config/official_configs.py @@ -52,6 +52,9 @@ class PersonalityConfig(ConfigBase): visual_style: str = "" """图片提示词""" + + private_plan_style: str = "" + """私聊说话规则,行为风格""" @dataclass diff --git a/template/bot_config_template.toml b/template/bot_config_template.toml index 033c86b6..44e89a4a 100644 --- a/template/bot_config_template.toml +++ b/template/bot_config_template.toml @@ -1,5 +1,5 @@ [inner] -version = "6.13.0" +version = "6.14.0" #----以下是给开发人员阅读的,如果你只是部署了麦麦,不需要阅读---- #如果你想要修改配置文件,请递增version的值 @@ -39,6 +39,12 @@ plan_style = """请你根据聊天内容,用户的最新消息和以下标准选 # 麦麦识图规则,不建议修改 visual_style = "请用中文描述这张图片的内容。如果有文字,请把文字描述概括出来,请留意其主题,直观感受,输出为一段平文本,最多30字,请注意不要分点,就输出一段文本" + +# 麦麦私聊的说话规则,行为风格: +private_plan_style = """请你根据聊天内容,用户的最新消息和以下标准选择合适的动作: +1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 +2.如果相同的内容已经被执行,请不要重复执行""" + [expression] # 表达学习配置 learning_list = [ # 表达学习配置列表,支持按聊天流配置