From fc9f54dbc868373805f660966dd503a28c69bbf5 Mon Sep 17 00:00:00 2001 From: zhayujie Date: Sun, 22 Mar 2026 23:04:50 +0800 Subject: [PATCH] feat(weixin): optimize login qrcode generate --- common/cloud_client.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/common/cloud_client.py b/common/cloud_client.py index 25af8ad1..62b96536 100644 --- a/common/cloud_client.py +++ b/common/cloud_client.py @@ -222,7 +222,14 @@ class CloudClient(LinkAIClient): return existing_ch = self.channel_mgr.get_channel(channel_type) - if existing_ch and not cred_changed: + skip_restart = existing_ch and not cred_changed + if skip_restart and channel_type in ("weixin", "wx"): + login_status = getattr(existing_ch, "login_status", "") + if login_status != "logged_in": + skip_restart = False + logger.info(f"[CloudClient] Channel '{channel_type}' not logged in " + f"(status={login_status}), forcing restart") + if skip_restart: logger.info(f"[CloudClient] Channel '{channel_type}' already running with same config, " "skip restart, reporting status only") threading.Thread( @@ -255,7 +262,14 @@ class CloudClient(LinkAIClient): ).start() else: existing_ch = self.channel_mgr.get_channel(channel_type) - if existing_ch and not cred_changed: + needs_restart = cred_changed or not existing_ch + if not needs_restart and channel_type in ("weixin", "wx"): + login_status = getattr(existing_ch, "login_status", "") + if login_status != "logged_in": + needs_restart = True + logger.info(f"[CloudClient] Channel '{channel_type}' not logged in " + f"(status={login_status}), forcing restart") + if existing_ch and not needs_restart: logger.info(f"[CloudClient] Channel '{channel_type}' already running with same config, " "skip restart, reporting status only") threading.Thread(