mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-07-21 22:27:13 +08:00
feat(weixin): optimize login qrcode generate
This commit is contained in:
@@ -222,7 +222,14 @@ class CloudClient(LinkAIClient):
|
|||||||
return
|
return
|
||||||
|
|
||||||
existing_ch = self.channel_mgr.get_channel(channel_type)
|
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, "
|
logger.info(f"[CloudClient] Channel '{channel_type}' already running with same config, "
|
||||||
"skip restart, reporting status only")
|
"skip restart, reporting status only")
|
||||||
threading.Thread(
|
threading.Thread(
|
||||||
@@ -255,7 +262,14 @@ class CloudClient(LinkAIClient):
|
|||||||
).start()
|
).start()
|
||||||
else:
|
else:
|
||||||
existing_ch = self.channel_mgr.get_channel(channel_type)
|
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, "
|
logger.info(f"[CloudClient] Channel '{channel_type}' already running with same config, "
|
||||||
"skip restart, reporting status only")
|
"skip restart, reporting status only")
|
||||||
threading.Thread(
|
threading.Thread(
|
||||||
|
|||||||
Reference in New Issue
Block a user