mirror of https://github.com/Mai-with-u/MaiBot.git
better:优化记忆生成
parent
a3009e0128
commit
f44857d856
|
|
@ -49,6 +49,8 @@ reply
|
|||
动作描述:
|
||||
1.你可以选择呼叫了你的名字,但是你没有做出回应的消息进行回复
|
||||
2.你可以自然的顺着正在进行的聊天内容进行回复或自然的提出一个问题
|
||||
3.不要回复你自己发送的消息
|
||||
4.不要单独对表情包进行回复
|
||||
{{
|
||||
"action": "reply",
|
||||
"target_message_id":"想要回复的消息id",
|
||||
|
|
@ -77,6 +79,7 @@ no_reply_until_call
|
|||
{actions_before_now_block}
|
||||
|
||||
请选择**可选的**且符合使用条件的action,并说明触发action的消息id(消息id格式:m+数字)
|
||||
不要回复你自己发送的消息
|
||||
先输出你的选择思考理由,再输出你选择的action,理由是一段平文本,不要分点,精简。
|
||||
**动作选择要求**
|
||||
请你根据聊天内容,用户的最新消息和以下标准选择合适的动作:
|
||||
|
|
@ -469,8 +472,8 @@ class ActionPlanner:
|
|||
# 调用LLM
|
||||
llm_content, (reasoning_content, _, _) = await self.planner_llm.generate_response_async(prompt=prompt)
|
||||
|
||||
logger.info(f"{self.log_prefix}规划器原始提示词: {prompt}")
|
||||
logger.info(f"{self.log_prefix}规划器原始响应: {llm_content}")
|
||||
# logger.info(f"{self.log_prefix}规划器原始提示词: {prompt}")
|
||||
# logger.info(f"{self.log_prefix}规划器原始响应: {llm_content}")
|
||||
|
||||
if global_config.debug.show_prompt:
|
||||
logger.info(f"{self.log_prefix}规划器原始提示词: {prompt}")
|
||||
|
|
|
|||
|
|
@ -405,9 +405,14 @@ class DefaultReplyer:
|
|||
if picid_matches:
|
||||
pic_descriptions = []
|
||||
for picid_match in picid_matches:
|
||||
pic_id = picid_match[6:-1] # 提取picid:xxx中的xxx部分
|
||||
pic_id = picid_match[7:-1] # 提取picid:xxx中的xxx部分(从第7个字符开始)
|
||||
description = translate_pid_to_description(pic_id)
|
||||
pic_descriptions.append(f"[图片:{description}]")
|
||||
logger.info(f"图片ID: {pic_id}, 描述: {description}")
|
||||
# 如果description已经是[图片]格式,直接使用;否则包装为[图片:描述]格式
|
||||
if description == "[图片]":
|
||||
pic_descriptions.append(description)
|
||||
else:
|
||||
pic_descriptions.append(f"[图片:{description}]")
|
||||
pic_part = "".join(pic_descriptions)
|
||||
|
||||
return has_only_pics, has_text, pic_part, text_without_picids
|
||||
|
|
|
|||
|
|
@ -409,9 +409,14 @@ class PrivateReplyer:
|
|||
if picid_matches:
|
||||
pic_descriptions = []
|
||||
for picid_match in picid_matches:
|
||||
pic_id = picid_match[6:-1] # 提取picid:xxx中的xxx部分
|
||||
pic_id = picid_match[7:-1] # 提取picid:xxx中的xxx部分(从第7个字符开始)
|
||||
description = translate_pid_to_description(pic_id)
|
||||
pic_descriptions.append(f"[图片:{description}]")
|
||||
logger.debug(f"图片ID: {pic_id}, 描述: {description}")
|
||||
# 如果description已经是[图片]格式,直接使用;否则包装为[图片:描述]格式
|
||||
if description == "[图片]":
|
||||
pic_descriptions.append(description)
|
||||
else:
|
||||
pic_descriptions.append(f"[图片:{description}]")
|
||||
pic_part = "".join(pic_descriptions)
|
||||
|
||||
return has_only_pics, has_text, pic_part, text_without_picids
|
||||
|
|
|
|||
|
|
@ -141,11 +141,26 @@ class MemoryChest:
|
|||
聊天记录中可能包含有效信息,也可能信息密度很低,请你根据聊天记录中的信息,修改<part1>中的内容与<part2>中的内容
|
||||
--------------------------------
|
||||
请将上面的新聊天记录内的有用的信息进行整合到现有的记忆中
|
||||
对[图片]的处理:
|
||||
1.除非与文本有关,不要将[图片]的内容整合到记忆中
|
||||
2.如果图片与某个概念相关,将图片中的关键内容也整合到记忆中,不要写入图片原文,例如:
|
||||
|
||||
聊天记录(与图片有关):
|
||||
用户说:[图片1:这是一个黄色的龙形状玩偶,被一只手拿着。]
|
||||
用户说:这个玩偶看起来很可爱,是我新买的奶龙
|
||||
总结的记忆内容:
|
||||
黄色的龙形状玩偶 是 奶龙
|
||||
|
||||
聊天记录(概念与图片无关):
|
||||
用户说:[图片1:这是一个台电脑,屏幕上显示了某种游戏。]
|
||||
用户说:使命召唤今天发售了新一代,有没有人玩
|
||||
总结的记忆内容:
|
||||
使命召唤新一代 是 最新发售的游戏
|
||||
|
||||
请主要关注概念和知识或者时效性较强的信息!!,而不是聊天的琐事
|
||||
1.不要关注诸如某个用户做了什么,说了什么,不要关注某个用户的行为,而是关注其中的概念性信息
|
||||
2.概念要求精确,不啰嗦,像科普读物或教育课本那样
|
||||
3.如果有图片,请只关注图片和文本结合的知识和概念性内容
|
||||
4.记忆为一段纯文本,逻辑清晰,指出概念的含义,并说明关系
|
||||
3.记忆为一段纯文本,逻辑清晰,指出概念的含义,并说明关系
|
||||
|
||||
记忆内容的格式,你必须仿照下面的格式,但不一定全部使用:
|
||||
{format_section}
|
||||
|
|
|
|||
|
|
@ -500,8 +500,8 @@ def filter_mai_messages(messages: List[DatabaseMessages]) -> List[DatabaseMessag
|
|||
def translate_pid_to_description(pid: str) -> str:
|
||||
image = Images.get_or_none(Images.image_id == pid)
|
||||
description = ""
|
||||
if image and image.description:
|
||||
description = image.description
|
||||
if image and image.description and image.description.strip():
|
||||
description = image.description.strip()
|
||||
else:
|
||||
description = "[图片]"
|
||||
return description
|
||||
|
|
|
|||
Loading…
Reference in New Issue