From 895e7397c2bba57373ecdff365bb9330a349b0c0 Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Fri, 7 Feb 2025 20:00:30 +0800 Subject: [PATCH] =?UTF-8?q?remove:=20=E7=A7=BB=E9=99=A4=E4=BA=86=20put=5Fh?= =?UTF-8?q?istory=5Fto=5Fprompt=E3=80=82=E5=BD=93=E4=B8=BB=E5=8A=A8?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E6=97=B6=EF=BC=8C=E5=B0=86=E7=BE=A4=E8=81=8A?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=B0=86=E8=87=AA=E5=8A=A8=E6=94=BE=E5=85=A5?= =?UTF-8?q?prompt=EF=BC=8C=E5=BD=93=E6=9C=AA=E4=B8=BB=E5=8A=A8=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E4=BD=86=E6=98=AF=E5=BC=80=E5=90=AF=E7=BE=A4=E8=81=8A?= =?UTF-8?q?=E5=A2=9E=E5=BC=BA=E6=97=B6=EF=BC=8C=E7=BE=A4=E8=81=8A=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E5=B0=86=E6=94=BE=E5=85=A5system=20prompt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astrbot/core/config/default.py | 9 +-------- packages/astrbot/long_term_memory.py | 6 +++--- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/astrbot/core/config/default.py b/astrbot/core/config/default.py index a6933a767..4087a498a 100644 --- a/astrbot/core/config/default.py +++ b/astrbot/core/config/default.py @@ -64,8 +64,7 @@ DEFAULT_CONFIG = { "method": "possibility_reply", "possibility_reply": 0.1, "prompt": "", - }, - "put_history_to_prompt": True, + } }, "content_safety": { "internal_keywords": {"enable": True, "extra_keywords": []}, @@ -763,12 +762,6 @@ CONFIG_METADATA_2 = { "hint": "提示词。当提示词为空时,如果触发回复,则向 LLM 请求的是触发的消息的内容;否则是提示词。此项可以和定时回复(暂未实现)配合使用。", }, }, - }, - "put_history_to_prompt": { - "description": "将群聊历史记录作为 prompt", - "type": "bool", - "obvious_hint": True, - "hint": "需要先启用 group_icl_enable。此功能会将群聊历史记录放到 prompt 再请求。如果关闭,则是放在 system_prompt。如果开启了主动回复,建议启用,模型能够更好地完成回复任务。", } }, }, diff --git a/packages/astrbot/long_term_memory.py b/packages/astrbot/long_term_memory.py index a55df03ef..f1ec8b252 100644 --- a/packages/astrbot/long_term_memory.py +++ b/packages/astrbot/long_term_memory.py @@ -33,7 +33,7 @@ class LongTermMemory: self.ar_possibility = self.active_reply["possibility_reply"] self.ar_prompt = self.active_reply.get("prompt", "") - self.put_history_to_prompt = self.config["put_history_to_prompt"] + # self.put_history_to_prompt = self.config["put_history_to_prompt"] async def remove_session(self, event: AstrMessageEvent) -> int: cnt = 0 @@ -110,11 +110,11 @@ class LongTermMemory: chats_str = '\n---\n'.join(self.session_chats[event.unified_msg_origin]) - if self.put_history_to_prompt: + if self.enable_active_reply: prompt = req.prompt req.prompt = f"You are now in a chatroom. The chat history is as follows:\n{chats_str}" req.prompt += f"\nNow, a new message is coming: `{prompt}`. Please react to it. Only output your response and do not output any other information." - req.contexts = [] # 清空上下文,当使用了群聊增强,所有聊天记录都在一个prompt中。 + req.contexts = [] # 清空上下文,当使用了主动回复,所有聊天记录都在一个prompt中。 else: req.system_prompt += "You are now in a chatroom. The chat history is as follows: \n" req.system_prompt += chats_str