fix: 修复某些空值错误

This commit is contained in:
tcmofashi
2025-03-28 23:30:35 +08:00
parent 002955359f
commit 33d794cd1f
2 changed files with 6 additions and 4 deletions

View File

@@ -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
)
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

View File

@@ -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:
"""从数据库加载或创建新的关系对象"""