重构 ChatGPT 和 DeepSeek 类的初始化逻辑,新增最大历史消息数配置,优化消息处理逻辑,移除冗余代码,提升代码可读性。同时更新消息记录逻辑,确保消息记录功能正常。

This commit is contained in:
Zylan
2025-04-24 13:09:56 +08:00
parent 61cc9c89cc
commit 8227802eb0
5 changed files with 15 additions and 81 deletions

View File

@@ -288,7 +288,6 @@ class Robot(Job):
self.LOG.info(f"To {receiver}:\n{ats}\n{msg}")
self.wcf.send_text(full_msg_content, receiver, at_list)
# ---- 修改记录逻辑 ----
if self.message_summary: # 检查 message_summary 是否初始化成功
# 确定机器人的名字
robot_name = self.allContacts.get(self.wxid, "机器人")
@@ -303,7 +302,6 @@ class Robot(Job):
self.LOG.debug(f"已记录机器人发送的消息到 {receiver}")
else:
self.LOG.warning("MessageSummary 未初始化,无法记录发送的消息")
# ---- 记录逻辑修改结束 ----
except Exception as e:
self.LOG.error(f"发送消息失败: {e}")