Merge pull request #980 from tcmofashi/dev

Fix: 恢复tamplate_info功能/为maim_message>=0.3.0增加自定义logger
This commit is contained in:
SengokuCola
2025-05-23 15:49:36 +08:00
committed by GitHub
9 changed files with 192 additions and 52 deletions

View File

@@ -7,6 +7,7 @@ from typing import List, Optional, Dict, Any, Deque
from src.chat.message_receive.chat_stream import ChatStream
from src.chat.message_receive.chat_stream import chat_manager
from rich.traceback import install
from src.chat.utils.prompt_builder import global_prompt_manager
from src.common.logger_manager import get_logger
from src.chat.utils.timer_calculator import Timer
from src.chat.heart_flow.observation.observation import Observation
@@ -279,8 +280,9 @@ class HeartFChatting:
thinking_id = "tid" + str(round(time.time(), 2))
self._current_cycle.set_thinking_id(thinking_id)
# 主循环:思考->决策->执行
loop_info = await self._observe_process_plan_action_loop(cycle_timers, thinking_id)
async with global_prompt_manager.async_message_scope(self.chat_stream.context.get_template_name()):
logger.debug(f"模板 {self.chat_stream.context.get_template_name()}")
loop_info = await self._observe_process_plan_action_loop(cycle_timers, thinking_id)
self._current_cycle.set_loop_info(loop_info)

View File

@@ -120,7 +120,6 @@ class PromptBuilder:
relation_prompt += await relationship_manager.build_relationship_info(person)
else:
logger.warning(f"Invalid person tuple encountered for relationship prompt: {person}")
mood_prompt = mood_manager.get_mood_prompt()
reply_styles1 = [
("然后给出日常且口语化的回复,平淡一些", 0.4),
@@ -141,9 +140,11 @@ class PromptBuilder:
[style[0] for style in reply_styles2], weights=[style[1] for style in reply_styles2], k=1
)[0]
memory_prompt = ""
related_memory = await HippocampusManager.get_instance().get_memory_from_text(
text=message_txt, max_memory_num=2, max_memory_length=2, max_depth=3, fast_retrieval=False
)
related_memory_info = ""
if related_memory:
for memory in related_memory: