diff --git a/changelogs/changelog.md b/changelogs/changelog.md index bef8ab146..ce411dd16 100644 --- a/changelogs/changelog.md +++ b/changelogs/changelog.md @@ -1,6 +1,6 @@ # Changelog -## [0.8.1] - 2025-6-27 +## [0.8.1] - 2025-7-5 功能更新: @@ -21,9 +21,6 @@ - 修复表达器无法读取原始文本 - 修复normal planner没有超时退出问题 - - - ## [0.8.0] - 2025-6-27 MaiBot 0.8.0 现已推出! diff --git a/src/chat/heart_flow/observation/chatting_observation.py b/src/chat/heart_flow/observation/chatting_observation.py index 1a41ede1f..d96d62649 100644 --- a/src/chat/heart_flow/observation/chatting_observation.py +++ b/src/chat/heart_flow/observation/chatting_observation.py @@ -16,7 +16,7 @@ logger = get_logger("observation") # 定义提示模板 Prompt( - """这是qq群聊的聊天记录,请总结以下聊天记录的主题: + """这是{chat_type_description},请总结以下聊天记录的主题: {chat_logs} 请概括这段聊天记录的主题和主要内容 主题:简短的概括,包括时间,人物和事件,不要超过20个字 @@ -28,22 +28,7 @@ Prompt( "content": "内容,可以是对聊天记录的概括,也可以是聊天记录的详细内容" }} """, - "chat_summary_group_prompt", # Template for group chat -) - -Prompt( - """这是你和{chat_target}的私聊记录,请总结以下聊天记录的主题: -{chat_logs} -请用一句话概括,包括事件,时间,和主要信息,不要分点。 -主题:简短的介绍,不要超过10个字 -内容:包括人物、事件和主要信息,不要分点。 - -请用json格式返回,格式如下: -{{ - "theme": "主题", - "content": "内容" -}}""", - "chat_summary_private_prompt", # Template for private chat + "chat_summary_prompt", ) @@ -132,11 +117,10 @@ class ChattingObservation(Observation): ) # 根据聊天类型选择提示模板 + prompt_template_name = "chat_summary_prompt" if self.is_group_chat: - prompt_template_name = "chat_summary_group_prompt" - prompt = await global_prompt_manager.format_prompt(prompt_template_name, chat_logs=oldest_messages_str) + chat_type_description = "qq群聊的聊天记录" else: - prompt_template_name = "chat_summary_private_prompt" chat_target_name = "对方" if self.chat_target_info: chat_target_name = ( @@ -144,11 +128,14 @@ class ChattingObservation(Observation): or self.chat_target_info.get("user_nickname") or chat_target_name ) - prompt = await global_prompt_manager.format_prompt( - prompt_template_name, - chat_target=chat_target_name, - chat_logs=oldest_messages_str, - ) + chat_type_description = f"你和{chat_target_name}的私聊记录" + + prompt = await global_prompt_manager.format_prompt( + prompt_template_name, + chat_type_description=chat_type_description, + chat_logs=oldest_messages_str, + ) + self.compressor_prompt = prompt diff --git a/src/config/config.py b/src/config/config.py index 9beeed6ba..33561c48f 100644 --- a/src/config/config.py +++ b/src/config/config.py @@ -50,7 +50,7 @@ TEMPLATE_DIR = os.path.join(PROJECT_ROOT, "template") # 考虑到,实际上配置文件中的mai_version是不会自动更新的,所以采用硬编码 # 对该字段的更新,请严格参照语义化版本规范:https://semver.org/lang/zh-CN/ -MMC_VERSION = "0.8.1-snapshot.1" +MMC_VERSION = "0.8.1" def update_config(): diff --git a/src/plugins/built_in/core_actions/plugin.py b/src/plugins/built_in/core_actions/plugin.py index cb469ae87..217405c0e 100644 --- a/src/plugins/built_in/core_actions/plugin.py +++ b/src/plugins/built_in/core_actions/plugin.py @@ -206,127 +206,3 @@ class CoreActionsPlugin(BasePlugin): # components.append((DeepReplyAction.get_action_info(), DeepReplyAction)) return components - - -# class DeepReplyAction(BaseAction): -# """回复动作 - 参与聊天回复""" - -# # 激活设置 -# focus_activation_type = ActionActivationType.ALWAYS -# normal_activation_type = ActionActivationType.NEVER -# mode_enable = ChatMode.FOCUS -# parallel_action = False - -# # 动作基本信息 -# action_name = "deep_reply" -# action_description = "参与聊天回复,关注某个话题,对聊天内容进行深度思考,给出回复" - -# # 动作参数定义 -# action_parameters = { -# "topic": "想要思考的话题" -# } - -# # 动作使用场景 -# action_require = ["有些问题需要深度思考", "某个问题可能涉及多个方面", "某个问题涉及专业领域或者需要专业知识","这个问题讨论的很激烈,需要深度思考"] - -# # 关联类型 -# associated_types = ["text"] - -# async def execute(self) -> Tuple[bool, str]: -# """执行回复动作""" -# logger.info(f"{self.log_prefix} 决定深度思考") - -# try: -# # 获取聊天观察 -# chatting_observation = self._get_chatting_observation() -# if not chatting_observation: -# return False, "未找到聊天观察" - -# talking_message_str = chatting_observation.talking_message_str - -# # 处理回复目标 -# chat_stream = self.api.get_service("chat_stream") -# anchor_message = await create_empty_anchor_message(chat_stream.platform, chat_stream.group_info, chat_stream) - - -# llm_model = self.api.get_available_models().replyer_1 - -# prompt = f""" -# {talking_message_str} - -# 在上面的聊天中,你对{self.action_data.get("topic", "")}感兴趣,形成深刻观点,请你思考,总结成一份学术论文,APA标准格式 -# """ - -# success, response, reasoning, model_name = await self.api.generate_with_model(prompt, llm_model) - -# print(prompt) -# print(f"DeepReplyAction: {response}") - -# # prompt = f""" -# # {talking_message_str} - -# # 在上面的聊天中,你对{self.action_data.get("topic", "")}感兴趣,请你思考 -# # """ - -# extra_info_block = self.action_data.get("extra_info_block", "") -# extra_info_block += response -# # extra_info_block += f"\n--------------------------------\n注意,这是最重要的内容!!!!!你现在可以用比较长的篇幅来表达你的观点,不要只回复一个字或者几个字\n由于你进入了深度思考模式,所以下方聊天记录的回复要求不再适用,请你自由的表达,不论字数长短限制\n\n--------------------------------\n注意,你现在可以用比较长的篇幅来表达你的观点,不要只回复一个字或者几个字\n由于你进入了深度思考模式,所以下方聊天记录的回复要求不再适用,请你自由的表达,不论字数长短限制\n" -# # extra_info_block += f"\n--------------------------------\n注意,优先关注这句!!!!你现在可以用比较长的篇幅来表达你的观点,不要只回复一个字或者几个字\n由于你进入了深度思考模式,所以下方聊天记录的回复要求不再适用,请你自由的表达,不论字数长短限制\n\n--------------------------------\n注意,你现在可以用比较长的篇幅来表达你的观点,不要只回复一个字或者几个字\n由于你进入了深度思考模式,所以其他的回复要求不再适用,请你自由的表达,不论字数长短限制\n" -# self.action_data["extra_info_block"] = extra_info_block - - -# # 获取回复器服务 -# # replyer = self.api.get_service("replyer") -# # if not replyer: -# # logger.error(f"{self.log_prefix} 未找到回复器服务") -# # return False, "回复器服务不可用" - -# # await self.send_message_by_expressor(extra_info_block) -# await self.send_text(extra_info_block) -# # 执行回复 -# # success, reply_set = await replyer.deal_reply( -# # cycle_timers=self.cycle_timers, -# # action_data=self.action_data, -# # anchor_message=anchor_message, -# # reasoning=self.reasoning, -# # thinking_id=self.thinking_id, -# # ) - -# # 构建回复文本 -# reply_text = "self._build_reply_text(reply_set)" - -# # 存储动作记录 -# await self.api.store_action_info( -# action_build_into_prompt=False, -# action_prompt_display=reply_text, -# action_done=True, -# thinking_id=self.thinking_id, -# action_data=self.action_data, -# ) - -# # 重置NoReplyAction的连续计数器 -# NoReplyAction.reset_consecutive_count() - -# return success, reply_text - -# except Exception as e: -# logger.error(f"{self.log_prefix} 回复动作执行失败: {e}") -# return False, f"回复失败: {str(e)}" - -# def _get_chatting_observation(self) -> Optional[ChattingObservation]: -# """获取聊天观察对象""" -# observations = self.api.get_service("observations") or [] -# for obs in observations: -# if isinstance(obs, ChattingObservation): -# return obs -# return None - - -# def _build_reply_text(self, reply_set) -> str: -# """构建回复文本""" -# reply_text = "" -# if reply_set: -# for reply in reply_set: -# data = reply[1] -# reply_text += data -# return reply_text