diff --git a/platforms/chatgpt/oauth_client.py b/platforms/chatgpt/oauth_client.py index d5032f8..5435b3a 100644 --- a/platforms/chatgpt/oauth_client.py +++ b/platforms/chatgpt/oauth_client.py @@ -835,6 +835,7 @@ class OAuthClient: prefer_passwordless_login=False, allow_phone_verification=True, force_new_browser=False, + screen_hint="login", complete_about_you_if_needed=False, first_name="", last_name="", @@ -856,6 +857,7 @@ class OAuthClient: prefer_passwordless_login: 是否强制走 passwordless OTP 链路 allow_phone_verification: add_phone 后是否允许进入手机号验证码分支 complete_about_you_if_needed: 命中 about_you 后是否自动提交资料完成注册 + screen_hint: authorize/continue 的 screen_hint(login/signup) first_name: about_you 名字 last_name: about_you 姓氏 birthdate: about_you 生日,格式 YYYY-MM-DD @@ -876,7 +878,8 @@ class OAuthClient: f"prefer_passwordless_login={'on' if prefer_passwordless_login else 'off'}, " f"allow_phone_verification={'on' if allow_phone_verification else 'off'}, " f"complete_about_you_if_needed={'on' if complete_about_you_if_needed else 'off'}, " - f"force_new_browser={'on' if force_new_browser else 'off'}" + f"force_new_browser={'on' if force_new_browser else 'off'}, " + f"screen_hint={screen_hint or 'login'}" ) if force_new_browser: @@ -932,7 +935,7 @@ class OAuthClient: impersonate=impersonate, authorize_url=authorize_url, authorize_params=authorize_params, - screen_hint="login", + screen_hint=str(screen_hint or "login"), ) if not state: if not self.last_error: diff --git a/platforms/chatgpt/refresh_token_registration_engine.py b/platforms/chatgpt/refresh_token_registration_engine.py index 43c1b9b..54ded9e 100644 --- a/platforms/chatgpt/refresh_token_registration_engine.py +++ b/platforms/chatgpt/refresh_token_registration_engine.py @@ -444,6 +444,11 @@ class RefreshTokenRegistrationEngine: oauth_client = self._build_oauth_client() self._log("3. 新开 OAuth session,按 screen_hint=login + passwordless OTP 登录...") self._log("4. 若命中 about_you,则在 OAuth 会话内提交姓名+生日,再继续 workspace/token") + oauth_screen_hint = "login" + if registration_message == "pending_about_you_submission": + oauth_screen_hint = "signup" + self._log("OAuth 使用 screen_hint=signup 以恢复未完成的 about_you") + tokens = oauth_client.login_and_get_tokens( result.email, self.password, @@ -455,6 +460,7 @@ class RefreshTokenRegistrationEngine: prefer_passwordless_login=True, allow_phone_verification=False, force_new_browser=True, + screen_hint=oauth_screen_hint, complete_about_you_if_needed=True, first_name=first_name, last_name=last_name,