调参仙人有福了,添加了willing_manager的自选功能

This commit is contained in:
SengokuCola
2025-03-14 21:34:52 +08:00
parent ccc6d9e48c
commit c0f9298517
11 changed files with 286 additions and 30 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
@@ -11,6 +10,13 @@ from .config import global_config
from .utils import get_embedding, get_recent_group_detailed_plain_text
from .chat_stream import chat_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):
@@ -163,7 +169,7 @@ class PromptBuilder:
prompt_ger += "你喜欢用文言文"
# 额外信息要求
extra_info = """但是记得回复平淡一些,简短一些,尤其注意在没明确提到时不要过多提及自身的背景, 不要直接回复别人发的表情包,记住不要输出多余内容(包括前后缀,冒号和引号,括号,表情等),只需要输出回复内容就好,不要输出其他任何内容"""
extra_info = """但是记得回复平淡一些,简短一些,尤其注意在没明确提到时不要过多提及自身的背景, 不要直接回复别人发的表情包,记住不要输出多余内容(包括前后缀,冒号和引号,括号,表情,@,等),只需要输出回复内容就好,不要输出其他任何内容"""
# 合并prompt
prompt = ""
@@ -239,7 +245,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):