feat:精简处理器上下文
This commit is contained in:
@@ -62,6 +62,10 @@ class ChattingInfoProcessor(BaseProcessor):
|
||||
# 改为异步任务,不阻塞主流程
|
||||
# asyncio.create_task(self.chat_compress(obs))
|
||||
|
||||
# 设置聊天ID
|
||||
if hasattr(obs, "chat_id"):
|
||||
obs_info.set_chat_id(obs.chat_id)
|
||||
|
||||
# 设置说话消息
|
||||
if hasattr(obs, "talking_message_str"):
|
||||
# print(f"设置说话消息:obs.talking_message_str: {obs.talking_message_str}")
|
||||
@@ -72,6 +76,14 @@ class ChattingInfoProcessor(BaseProcessor):
|
||||
# print(f"设置截断后的说话消息:obs.talking_message_str_truncate: {obs.talking_message_str_truncate}")
|
||||
obs_info.set_talking_message_str_truncate(obs.talking_message_str_truncate)
|
||||
|
||||
# 设置简短版本的说话消息
|
||||
if hasattr(obs, "talking_message_str_short"):
|
||||
obs_info.set_talking_message_str_short(obs.talking_message_str_short)
|
||||
|
||||
# 设置截断简短版本的说话消息
|
||||
if hasattr(obs, "talking_message_str_truncate_short"):
|
||||
obs_info.set_talking_message_str_truncate_short(obs.talking_message_str_truncate_short)
|
||||
|
||||
if hasattr(obs, "mid_memory_info"):
|
||||
# print(f"设置之前聊天信息:obs.mid_memory_info: {obs.mid_memory_info}")
|
||||
obs_info.set_previous_chat_info(obs.mid_memory_info)
|
||||
@@ -82,7 +94,8 @@ class ChattingInfoProcessor(BaseProcessor):
|
||||
chat_type = "group"
|
||||
else:
|
||||
chat_type = "private"
|
||||
obs_info.set_chat_target(obs.chat_target_info.get("person_name", "某人"))
|
||||
if hasattr(obs, "chat_target_info") and obs.chat_target_info:
|
||||
obs_info.set_chat_target(obs.chat_target_info.get("person_name", "某人"))
|
||||
obs_info.set_chat_type(chat_type)
|
||||
|
||||
# logger.debug(f"聊天信息处理器处理后的信息: {obs_info}")
|
||||
|
||||
@@ -149,7 +149,8 @@ class ExpressionSelectorProcessor(BaseProcessor):
|
||||
if observations:
|
||||
for observation in observations:
|
||||
if isinstance(observation, ChattingObservation):
|
||||
chat_info = observation.get_observe_info()
|
||||
# chat_info = observation.get_observe_info()
|
||||
chat_info = observation.talking_message_str_truncate_short
|
||||
break
|
||||
|
||||
if not chat_info:
|
||||
|
||||
@@ -144,7 +144,7 @@ def init_prompt():
|
||||
fetch_info_prompt = """
|
||||
|
||||
{name_block}
|
||||
以下是你对{person_name}的了解,请你从中提取用户的有关"{info_type}"的信息,如果用户没有相关信息,请输出none:
|
||||
以下是你在之前与{person_name}的交流中,产生的对{person_name}的了解,请你从中提取用户的有关"{info_type}"的信息,如果用户没有相关信息,请输出none:
|
||||
{person_impression_block}
|
||||
{points_text_block}
|
||||
请严格按照以下json输出格式,不要输出多余内容:
|
||||
@@ -547,8 +547,7 @@ class PersonImpressionpProcessor(BaseProcessor):
|
||||
for observation in observations:
|
||||
if isinstance(observation, ChattingObservation):
|
||||
chat_observe_info = observation.get_observe_info()
|
||||
chat_observe_info = chat_observe_info[-300:]
|
||||
|
||||
# latest_message_time = observation.last_observe_time
|
||||
# 从聊天观察中提取用户信息并更新消息段
|
||||
# 获取最新的非bot消息来更新消息段
|
||||
latest_messages = get_raw_msg_by_timestamp_with_chat(
|
||||
|
||||
@@ -112,7 +112,8 @@ class ToolProcessor(BaseProcessor):
|
||||
|
||||
is_group_chat = observation.is_group_chat
|
||||
|
||||
chat_observe_info = observation.get_observe_info()
|
||||
# chat_observe_info = observation.get_observe_info()
|
||||
chat_observe_info = observation.talking_message_str_truncate_short
|
||||
# person_list = observation.person_list
|
||||
|
||||
# 获取时间信息
|
||||
|
||||
Reference in New Issue
Block a user