Merge branch 'main-fix' into relationship

This commit is contained in:
meng_xi_pan
2025-03-14 23:47:33 +08:00
19 changed files with 1549 additions and 31 deletions

View File

@@ -1,7 +1,6 @@
import random
import time
from typing import Optional
from loguru import logger
from ...common.database import db
from ..memory_system.memory import hippocampus, memory_graph
@@ -12,6 +11,13 @@ from .utils import get_embedding, get_recent_group_detailed_plain_text, get_rece
from .chat_stream import chat_manager
from .relationship_manager import relationship_manager
from ..utils.logger_config import LogClassification, LogModule
log_module = LogModule()
logger = log_module.setup_logger(LogClassification.PBUILDER)
logger.info("初始化Prompt系统")
class PromptBuilder:
def __init__(self):
@@ -188,7 +194,11 @@ class PromptBuilder:
prompt_ger += "你喜欢用文言文"
# 额外信息要求
<<<<<<< HEAD
extra_info = f'''但是记得你的回复态度和你的立场,切记你回复的人是{sender_name},不要输出你的思考过程,只需要输出最终的回复,务必简短一些,尤其注意在没明确提到时不要过多提及自身的背景, 不要直接回复别人发的表情包,记住不要输出多余内容(包括前后缀,冒号和引号,括号,表情等),只需要输出回复内容就好,不要输出其他任何内容'''
=======
extra_info = """但是记得回复平淡一些,简短一些,尤其注意在没明确提到时不要过多提及自身的背景, 不要直接回复别人发的表情包,记住不要输出多余内容(包括前后缀,冒号和引号,括号,表情,@,等),只需要输出回复内容就好,不要输出其他任何内容"""
>>>>>>> main-fix
# 合并prompt
prompt = ""
@@ -265,7 +275,7 @@ class PromptBuilder:
return prompt_for_check, memory
def _build_initiative_prompt(self, selected_node, prompt_regular, memory):
prompt_for_initiative = f"{prompt_regular}你现在想在群里发言,回忆了一下,想到一个话题,是{selected_node['concept']},关于这个话题的记忆有\n{memory}\n,请在把握群里的聊天内容的基础上,综合群内的氛围,以日常且口语化的口吻,简短且随意一点进行发言,不要说的太有条理,可以有个性。记住不要输出多余内容(包括前后缀,冒号和引号,括号,表情等)"
prompt_for_initiative = f"{prompt_regular}你现在想在群里发言,回忆了一下,想到一个话题,是{selected_node['concept']},关于这个话题的记忆有\n{memory}\n,请在把握群里的聊天内容的基础上,综合群内的氛围,以日常且口语化的口吻,简短且随意一点进行发言,不要说的太有条理,可以有个性。记住不要输出多余内容(包括前后缀,冒号和引号,括号,表情,@等)"
return prompt_for_initiative
async def get_prompt_info(self, message: str, threshold: float):