检查是否为冲突导致的bug

This commit is contained in:
meng_xi_pan
2025-04-02 04:20:53 +08:00
parent 5a83edb783
commit 59043abefc
9 changed files with 33 additions and 8 deletions

View File

@@ -4,8 +4,7 @@ from .plugins.utils.statistic import LLMStatistics
from .plugins.moods.moods import MoodManager
from .plugins.schedule.schedule_generator import bot_schedule
from .plugins.chat.emoji_manager import emoji_manager
from .plugins.chat.person_info import person_info_manager
from .plugins.relationship.relationship_manager import relationship_manager
from .plugins.person_info.person_info import person_info_manager
from .plugins.willing.willing_manager import willing_manager
from .plugins.chat.chat_stream import chat_manager
from .heart_flow.heartflow import heartflow

View File

@@ -5,7 +5,7 @@ MaiMBot插件系统
from .chat.chat_stream import chat_manager
from .chat.emoji_manager import emoji_manager
from .relationship.relationship_manager import relationship_manager
from .person_info.relationship_manager import relationship_manager
from .moods.moods import MoodManager
from .willing.willing_manager import willing_manager
from .schedule.schedule_generator import bot_schedule

View File

@@ -1,5 +1,5 @@
from .emoji_manager import emoji_manager
from ..relationship.relationship_manager import relationship_manager
from ..person_info.relationship_manager import relationship_manager
from .chat_stream import chat_manager
from .message_sender import message_manager
from ..storage.storage import MessageStorage

View File

@@ -167,7 +167,7 @@ def get_recent_group_speaker(chat_stream_id: int, sender, limit: int = 12) -> li
and user_info.user_id != global_config.BOT_QQ
and (user_info.platform, user_info.user_id, user_info.user_nickname) not in who_chat_in_group
and len(who_chat_in_group) < 5
): # 排除重复排除消息发送者排除bot(此处bot的平台强制为了qq可能需要更改),限制加载的关系数目
): # 排除重复排除消息发送者排除bot限制加载的关系数目
who_chat_in_group.append((user_info.platform, user_info.user_id, user_info.user_nickname))
return who_chat_in_group
@@ -345,6 +345,15 @@ def calculate_typing_time(input_string: str, chinese_time: float = 0.2, english_
- 如果只有一个中文字符将使用3倍的中文输入时间
- 在所有输入结束后额外加上回车时间0.3秒
"""
# 如果输入是列表,将其连接成字符串
if isinstance(input_string, list):
input_string = ''.join(input_string)
# 确保现在是字符串类型
if not isinstance(input_string, str):
input_string = str(input_string)
mood_manager = MoodManager.get_instance()
# 将0-1的唤醒度映射到-1到1
mood_arousal = mood_manager.current_mood.arousal

View File

@@ -17,6 +17,7 @@ from ...message import UserInfo, Seg
from src.heart_flow.heartflow import heartflow
from src.common.logger import get_module_logger, CHAT_STYLE_CONFIG, LogConfig
from ...chat.chat_stream import chat_manager
from ...person_info.relationship_manager import relationship_manager
# 定义日志配置
chat_config = LogConfig(
@@ -135,6 +136,14 @@ class ThinkFlowChat:
await heartflow.get_subheartflow(stream_id).do_thinking_after_reply(response_set, chat_talking_prompt)
async def _update_relationship(self, message, response_set):
"""更新关系"""
ori_response = ",".join(response_set)
stance, emotion = await self.gpt._get_emotion_tags(ori_response, message.processed_plain_text)
await relationship_manager.calculate_update_relationship_value(
chat_stream=message.chat_stream, label=emotion, stance=stance
)
async def process_message(self, message_data: str) -> None:
"""处理消息并生成回复"""
timing_results = {}
@@ -267,6 +276,12 @@ class ThinkFlowChat:
timer2 = time.time()
timing_results["更新心流"] = timer2 - timer1
# # 更新关系
# timer1 = time.time()
# await self._update_relationship(message, response_set)
# timer2 = time.time()
# timing_results["更新关系"] = timer2 - timer1
# 输出性能计时结果
if do_reply:
timing_str = " | ".join([f"{step}: {duration:.2f}" for step, duration in timing_results.items()])

View File

@@ -147,6 +147,8 @@ class ResponseGenerator:
- 严格基于文字直接表达的对立关系判断
"""
logger.info(prompt)
# 调用模型生成结果
result, _, _ = await self.model_sum.generate_response(prompt)
result = result.strip()

View File

@@ -6,10 +6,10 @@ from ...memory_system.Hippocampus import HippocampusManager
from ...moods.moods import MoodManager
from ...schedule.schedule_generator import bot_schedule
from ...config.config import global_config
from ...chat.utils import get_recent_group_detailed_plain_text
from ...chat.utils import get_recent_group_detailed_plain_text, get_recent_group_speaker
from ...chat.chat_stream import chat_manager
from src.common.logger import get_module_logger
from .relationship_manager import relationship_manager
from ...person_info.relationship_manager import relationship_manager
from src.heart_flow.heartflow import heartflow

View File

@@ -1,5 +1,5 @@
from src.common.logger import get_module_logger, LogConfig, RELATION_STYLE_CONFIG
from .chat_stream import ChatStream
from ..chat.chat_stream import ChatStream
import math
from bson.decimal128 import Decimal128
from .person_info import person_info_manager