fix:更改心流运行结构,反正能跑

This commit is contained in:
SengokuCola
2025-04-22 23:16:57 +08:00
parent 8d50a381e4
commit bcf295905e
13 changed files with 280 additions and 456 deletions

View File

@@ -11,7 +11,7 @@ from src.plugins.respon_info_catcher.info_catcher import info_catcher_manager
from ..utils.timer_calculater import Timer
from src.plugins.moods.moods import MoodManager
from src.heart_flow.sub_heartflow import SubHeartflow
# 定义日志配置
llm_config = LogConfig(
# 使用消息发送专用样式
@@ -39,6 +39,7 @@ class ResponseGenerator:
async def generate_response(
self,
sub_hf: SubHeartflow,
reason: str,
message: MessageRecv,
thinking_id: str,
@@ -55,7 +56,7 @@ class ResponseGenerator:
current_model = self.model_normal
current_model.temperature = global_config.llm_normal["temp"] * arousal_multiplier # 激活度越高,温度越高
model_response = await self._generate_response_with_model(
reason, message, current_model, thinking_id
sub_hf, reason, message, current_model, thinking_id
)
if model_response:
@@ -70,7 +71,7 @@ class ResponseGenerator:
return None
async def _generate_response_with_model(
self, reason: str, message: MessageRecv, model: LLMRequest, thinking_id: str
self, sub_hf: SubHeartflow, reason: str, message: MessageRecv, model: LLMRequest, thinking_id: str
) -> str:
sender_name = ""
@@ -78,15 +79,14 @@ class ResponseGenerator:
sender_name = f"<{message.chat_stream.user_info.platform}:{message.chat_stream.user_info.user_id}:{message.chat_stream.user_info.user_nickname}:{message.chat_stream.user_info.user_cardname}>"
# 构建prompt
with Timer() as t_build_prompt:
prompt = await prompt_builder.build_prompt(
build_mode="focus",
reason=reason,
chat_stream=message.chat_stream,
message_txt=message.processed_plain_text,
sender_name=sender_name,
stream_id=message.chat_stream.stream_id,
subheartflow=sub_hf
)
logger.info(f"构建prompt时间: {t_build_prompt.human_readable}")