fix:修复好感prompt没启用
This commit is contained in:
@@ -29,7 +29,7 @@ def init_prompt():
|
||||
现在请你根据现有的信息,总结你和群里的人的关系
|
||||
1. 当聊天记录中提到你时,请输出你和这个人之间的关系
|
||||
2. 当聊天记录中提到其他人时,请输出你和这个人之间的关系
|
||||
3. 如果没有特别需要提及的关系,请输出“没有特别在意的人”
|
||||
3. 如果没有特别需要提及的关系,就不用输出这个人
|
||||
|
||||
输出内容平淡一些,说中文。
|
||||
请注意不要输出多余内容(包括前后缀,括号(),表情包,at或 @等 )。只输出关系内容,记得明确说明这是你的关系。
|
||||
@@ -93,18 +93,6 @@ class RelationshipProcessor(BaseProcessor):
|
||||
tuple: (current_mind, past_mind, prompt) 当前想法、过去的想法列表和使用的prompt
|
||||
"""
|
||||
|
||||
for observation in observations:
|
||||
if isinstance(observation, ChattingObservation):
|
||||
is_group_chat = observation.is_group_chat
|
||||
chat_target_info = observation.chat_target_info
|
||||
chat_target_name = "对方" # 私聊默认名称
|
||||
person_list = observation.person_list
|
||||
|
||||
relation_prompt = ""
|
||||
for person in person_list:
|
||||
if len(person) >= 3 and person[0] and person[1]:
|
||||
relation_prompt += await relationship_manager.build_relationship_info(person, is_id=True)
|
||||
|
||||
if observations is None:
|
||||
observations = []
|
||||
for observation in observations:
|
||||
@@ -131,9 +119,11 @@ class RelationshipProcessor(BaseProcessor):
|
||||
relation_prompt_init = "你对群聊里的人的印象是:\n"
|
||||
else:
|
||||
relation_prompt_init = "你对对方的印象是:\n"
|
||||
|
||||
|
||||
relation_prompt = ""
|
||||
for person in person_list:
|
||||
relation_prompt += await relationship_manager.build_relationship_info(person, is_id=True)
|
||||
relation_prompt += f"{await relationship_manager.build_relationship_info(person, is_id=True)}\n"
|
||||
|
||||
if relation_prompt:
|
||||
relation_prompt = relation_prompt_init + relation_prompt
|
||||
else:
|
||||
@@ -162,7 +152,7 @@ class RelationshipProcessor(BaseProcessor):
|
||||
if content == "None":
|
||||
content = ""
|
||||
# 记录初步思考结果
|
||||
logger.debug(f"{self.log_prefix} 关系识别prompt: \n{prompt}\n")
|
||||
logger.info(f"{self.log_prefix} 关系识别prompt: \n{prompt}\n")
|
||||
logger.info(f"{self.log_prefix} 关系识别: {content}")
|
||||
|
||||
return content
|
||||
|
||||
@@ -104,12 +104,6 @@ class SelfProcessor(BaseProcessor):
|
||||
chat_target_name = "对方" # 私聊默认名称
|
||||
person_list = observation.person_list
|
||||
|
||||
|
||||
relation_prompt = ""
|
||||
for person in person_list:
|
||||
if len(person) >= 3 and person[0] and person[1]:
|
||||
relation_prompt += await relationship_manager.build_relationship_info(person, is_id=True)
|
||||
|
||||
if observations is None:
|
||||
observations = []
|
||||
for observation in observations:
|
||||
|
||||
@@ -128,15 +128,6 @@ class ToolProcessor(BaseProcessor):
|
||||
for running_memory in running_memorys:
|
||||
memory_str += f"{running_memory['topic']}: {running_memory['content']}\n"
|
||||
|
||||
# 构建关系信息
|
||||
relation_prompt = "【关系信息】\n"
|
||||
for person in person_list:
|
||||
relation_prompt += await relationship_manager.build_relationship_info(person, is_id=True)
|
||||
|
||||
# 获取个性信息
|
||||
|
||||
# prompt_personality = individuality.get_prompt(x_person=2, level=2)
|
||||
|
||||
# 获取时间信息
|
||||
time_now = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ from src.config.config import global_config
|
||||
from src.chat.focus_chat.info.info_base import InfoBase
|
||||
from src.chat.focus_chat.info.obs_info import ObsInfo
|
||||
from src.chat.focus_chat.info.cycle_info import CycleInfo
|
||||
from src.chat.focus_chat.info.mind_info import MindInfo
|
||||
from src.chat.focus_chat.info.action_info import ActionInfo
|
||||
from src.chat.focus_chat.info.structured_info import StructuredInfo
|
||||
from src.chat.focus_chat.info.self_info import SelfInfo
|
||||
@@ -129,8 +128,6 @@ class ActionPlanner(BasePlanner):
|
||||
observed_messages_str = info.get_talking_message_str_truncate()
|
||||
chat_type = info.get_chat_type()
|
||||
is_group_chat = chat_type == "group"
|
||||
elif isinstance(info, MindInfo):
|
||||
current_mind = info.get_current_mind()
|
||||
elif isinstance(info, CycleInfo):
|
||||
cycle_info = info.get_observe_info()
|
||||
elif isinstance(info, SelfInfo):
|
||||
@@ -171,7 +168,6 @@ class ActionPlanner(BasePlanner):
|
||||
is_group_chat=is_group_chat, # <-- Pass HFC state
|
||||
chat_target_info=None,
|
||||
observed_messages_str=observed_messages_str, # <-- Pass local variable
|
||||
current_mind=current_mind, # <-- Pass argument
|
||||
structured_info=structured_info, # <-- Pass SubMind info
|
||||
current_available_actions=current_available_actions, # <-- Pass determined actions
|
||||
cycle_info=cycle_info, # <-- Pass cycle info
|
||||
@@ -284,7 +280,6 @@ class ActionPlanner(BasePlanner):
|
||||
is_group_chat: bool, # Now passed as argument
|
||||
chat_target_info: Optional[dict], # Now passed as argument
|
||||
observed_messages_str: str,
|
||||
current_mind: Optional[str],
|
||||
structured_info: Optional[str],
|
||||
current_available_actions: Dict[str, ActionInfo],
|
||||
cycle_info: Optional[str],
|
||||
|
||||
@@ -278,8 +278,9 @@ class ChattingObservation(Observation):
|
||||
show_actions=True,
|
||||
)
|
||||
# print(f"构建中:self.talking_message_str_truncate: {self.talking_message_str_truncate}")
|
||||
|
||||
|
||||
self.person_list = await get_person_id_list(self.talking_message)
|
||||
|
||||
# print(f"构建中:self.person_list: {self.person_list}")
|
||||
|
||||
logger.trace(
|
||||
|
||||
@@ -114,8 +114,7 @@ class PromptBuilder:
|
||||
|
||||
relation_prompt = ""
|
||||
for person in who_chat_in_group:
|
||||
if len(person) >= 3 and person[0] and person[1]:
|
||||
relation_prompt += await relationship_manager.build_relationship_info(person)
|
||||
relation_prompt += await relationship_manager.build_relationship_info(person)
|
||||
|
||||
mood_prompt = mood_manager.get_mood_prompt()
|
||||
|
||||
|
||||
@@ -673,9 +673,8 @@ async def get_person_id_list(messages: List[Dict[str, Any]]) -> List[str]:
|
||||
person_ids_set = set() # 使用集合来自动去重
|
||||
|
||||
for msg in messages:
|
||||
user_info = msg.get("user_info", {})
|
||||
platform = user_info.get("platform")
|
||||
user_id = user_info.get("user_id")
|
||||
platform = msg.get("user_platform")
|
||||
user_id = msg.get("user_id")
|
||||
|
||||
# 检查必要信息是否存在 且 不是机器人自己
|
||||
if not all([platform, user_id]) or user_id == global_config.bot.qq_account:
|
||||
|
||||
Reference in New Issue
Block a user