From 33d794cd1f667379648db212ef8bcb908f3e9f88 Mon Sep 17 00:00:00 2001 From: tcmofashi Date: Fri, 28 Mar 2025 23:30:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=9F=90=E4=BA=9B?= =?UTF-8?q?=E7=A9=BA=E5=80=BC=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/chat/bot.py | 8 +++++--- src/plugins/chat/relationship_manager.py | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/plugins/chat/bot.py b/src/plugins/chat/bot.py index 490003c8f..80d620722 100644 --- a/src/plugins/chat/bot.py +++ b/src/plugins/chat/bot.py @@ -148,7 +148,7 @@ class ChatBot: response = None # 开始组织语言 - if random() < reply_probability: + if random() < reply_probability + 1: bot_user_info = UserInfo( user_id=global_config.BOT_QQ, user_nickname=global_config.BOT_NICKNAME, @@ -183,8 +183,10 @@ class ChatBot: chat_talking_prompt = get_recent_group_detailed_plain_text( stream_id, limit=global_config.MAX_CONTEXT_SIZE, combine=True ) - - await subheartflow_manager.get_subheartflow(stream_id).do_after_reply(response, chat_talking_prompt) + if subheartflow_manager.get_subheartflow(stream_id): + await subheartflow_manager.get_subheartflow(stream_id).do_after_reply(response, chat_talking_prompt) + else: + await subheartflow_manager.create_subheartflow(stream_id).do_after_reply(response, chat_talking_prompt) # print(f"有response: {response}") container = message_manager.get_container(chat.stream_id) thinking_message = None diff --git a/src/plugins/chat/relationship_manager.py b/src/plugins/chat/relationship_manager.py index 65e19d535..9221817c3 100644 --- a/src/plugins/chat/relationship_manager.py +++ b/src/plugins/chat/relationship_manager.py @@ -170,7 +170,7 @@ class RelationshipManager: if key in self.relationships: return self.relationships[key] else: - return 0 + return None async def load_relationship(self, data: dict) -> Relationship: """从数据库加载或创建新的关系对象"""