From b80e7d1c145c39fb3cfa7beb508784d58ab2d65f Mon Sep 17 00:00:00 2001 From: ylytdeng Date: Tue, 31 Mar 2026 18:43:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=96=B0=E7=BE=A4/=E6=96=B0=E8=81=94?= =?UTF-8?q?=E7=B3=BB=E4=BA=BA=E8=87=AA=E5=8A=A8=E5=88=B7=E6=96=B0=E8=81=94?= =?UTF-8?q?=E7=B3=BB=E4=BA=BA=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 检测到消息的用户名不在联系人缓存中时,自动重新加载 contact.db,解决新建群聊一直显示 chatroom ID 的问题。 Co-Authored-By: Claude Opus 4.6 (1M context) --- monitor_web.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/monitor_web.py b/monitor_web.py index db139a1..41859e6 100644 --- a/monitor_web.py +++ b/monitor_web.py @@ -1275,6 +1275,11 @@ class SessionMonitor: if is_new: display = self.contact_names.get(username, username) is_group = '@chatroom' in username + # 新群/新联系人不在缓存中时,重新加载联系人 + if display == username and username not in self.contact_names: + refreshed = load_contact_names() + self.contact_names.update(refreshed) + display = self.contact_names.get(username, username) sender = '' if is_group: sender = self.contact_names.get(curr['sender'], curr['sender_name'] or curr['sender'])