druff
This commit is contained in:
@@ -15,7 +15,6 @@ from src.chat.heart_flow.observation.hfcloop_observation import HFCloopObservati
|
||||
from typing import Dict
|
||||
from src.chat.focus_chat.info.info_base import InfoBase
|
||||
from src.chat.focus_chat.info.self_info import SelfInfo
|
||||
from src.chat.utils.utils import get_recent_group_speaker
|
||||
|
||||
logger = get_logger("processor")
|
||||
|
||||
@@ -102,7 +101,6 @@ class SelfProcessor(BaseProcessor):
|
||||
tuple: (current_mind, past_mind, prompt) 当前想法、过去的想法列表和使用的prompt
|
||||
"""
|
||||
|
||||
|
||||
for observation in observations:
|
||||
if isinstance(observation, ChattingObservation):
|
||||
is_group_chat = observation.is_group_chat
|
||||
@@ -116,12 +114,10 @@ class SelfProcessor(BaseProcessor):
|
||||
for running_memory in running_memorys:
|
||||
memory_str += f"{running_memory['topic']}: {running_memory['content']}\n"
|
||||
|
||||
|
||||
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)
|
||||
|
||||
relation_prompt += await relationship_manager.build_relationship_info(person, is_id=True)
|
||||
|
||||
if observations is None:
|
||||
observations = []
|
||||
@@ -162,7 +158,6 @@ class SelfProcessor(BaseProcessor):
|
||||
else:
|
||||
relation_prompt = relation_prompt_init + "没有特别在意的人\n"
|
||||
|
||||
|
||||
prompt = (await global_prompt_manager.get_prompt_async("indentify_prompt")).format(
|
||||
name_block=name_block,
|
||||
prompt_personality=personality_block,
|
||||
|
||||
@@ -133,7 +133,6 @@ class ActionPlanner:
|
||||
action_available_block += f"\n你在聊天中可以使用{action_name},这个动作的描述是{action_description}\n"
|
||||
action_available_block += "注意,除了上述动作选项之外,你在群聊里不能做其他任何事情,这是你能力的边界\n"
|
||||
|
||||
|
||||
# 继续处理其他信息
|
||||
for info in all_plan_info:
|
||||
if isinstance(info, ObsInfo):
|
||||
@@ -156,7 +155,9 @@ class ActionPlanner:
|
||||
current_available_actions = self.action_manager.get_using_actions()
|
||||
|
||||
# 如果没有可用动作或只有no_reply动作,直接返回no_reply
|
||||
if not current_available_actions or (len(current_available_actions) == 1 and "no_reply" in current_available_actions):
|
||||
if not current_available_actions or (
|
||||
len(current_available_actions) == 1 and "no_reply" in current_available_actions
|
||||
):
|
||||
action = "no_reply"
|
||||
reasoning = "没有可用的动作" if not current_available_actions else "只有no_reply动作可用,跳过规划"
|
||||
logger.info(f"{self.log_prefix}{reasoning}")
|
||||
@@ -326,7 +327,6 @@ class ActionPlanner:
|
||||
else:
|
||||
extra_info_block = ""
|
||||
|
||||
|
||||
moderation_prompt_block = "请不要输出违法违规内容,不要输出色情,暴力,政治相关内容,如有敏感内容,请规避。"
|
||||
|
||||
planner_prompt_template = await global_prompt_manager.get_prompt_async("planner_prompt")
|
||||
|
||||
@@ -17,14 +17,14 @@ logger = get_logger("prompt")
|
||||
|
||||
|
||||
def init_prompt():
|
||||
# Prompt(
|
||||
# """
|
||||
# 你有以下信息可供参考:
|
||||
# {structured_info}
|
||||
# 以上的消息是你获取到的消息,或许可以帮助你更好地回复。
|
||||
# """,
|
||||
# "info_from_tools",
|
||||
# )
|
||||
# Prompt(
|
||||
# """
|
||||
# 你有以下信息可供参考:
|
||||
# {structured_info}
|
||||
# 以上的消息是你获取到的消息,或许可以帮助你更好地回复。
|
||||
# """,
|
||||
# "info_from_tools",
|
||||
# )
|
||||
|
||||
Prompt("你正在qq群里聊天,下面是群里在聊的内容:", "chat_target_group1")
|
||||
Prompt("你正在和{sender_name}聊天,这是你们之前聊的内容:", "chat_target_private1")
|
||||
@@ -94,10 +94,8 @@ class PromptBuilder:
|
||||
in_mind_reply=None,
|
||||
target_message=None,
|
||||
) -> Optional[str]:
|
||||
|
||||
return await self._build_prompt_normal(chat_stream, message_txt or "", sender_name)
|
||||
|
||||
|
||||
async def _build_prompt_normal(self, chat_stream, message_txt: str, sender_name: str = "某人") -> str:
|
||||
prompt_personality = individuality.get_prompt(x_person=2, level=2)
|
||||
is_group_chat = bool(chat_stream.group_info)
|
||||
@@ -119,7 +117,6 @@ class PromptBuilder:
|
||||
if len(person) >= 3 and person[0] and person[1]:
|
||||
relation_prompt += await relationship_manager.build_relationship_info(person)
|
||||
|
||||
|
||||
mood_prompt = mood_manager.get_mood_prompt()
|
||||
reply_styles1 = [
|
||||
("然后给出日常且口语化的回复,平淡一些", 0.4),
|
||||
|
||||
@@ -309,7 +309,9 @@ class RelationshipManager:
|
||||
"积极回复",
|
||||
"友善和包容的回复",
|
||||
]
|
||||
relation_value_prompt = f"你{relationship_level[level_num]}{person_name},打算{relation_prompt2_list[level_num]}。"
|
||||
relation_value_prompt = (
|
||||
f"你{relationship_level[level_num]}{person_name},打算{relation_prompt2_list[level_num]}。"
|
||||
)
|
||||
elif level_num == 2:
|
||||
relation_value_prompt = ""
|
||||
else:
|
||||
@@ -323,7 +325,9 @@ class RelationshipManager:
|
||||
"积极回复",
|
||||
"友善和包容的回复",
|
||||
]
|
||||
relation_value_prompt = f"你{relationship_level[level_num]}{person_name},打算{relation_prompt2_list[level_num]}。"
|
||||
relation_value_prompt = (
|
||||
f"你{relationship_level[level_num]}{person_name},打算{relation_prompt2_list[level_num]}。"
|
||||
)
|
||||
else:
|
||||
relation_value_prompt = ""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user