update need verification prompt (#2207)

Co-authored-by: lawyzheng <lawyzheng1106@gmail.com>
This commit is contained in:
Shuchang Zheng
2025-04-22 00:19:35 +08:00
committed by GitHub
parent f2eef5aa6d
commit f9f3940fbd
3 changed files with 10 additions and 6 deletions

View File

@@ -2520,8 +2520,12 @@ class ForgeAgent:
browser_state: BrowserState,
json_response: dict[str, Any],
) -> dict[str, Any]:
need_verification_code = json_response.get("need_verification_code")
if need_verification_code and (task.totp_verification_url or task.totp_identifier) and task.organization_id:
place_to_enter_verification_code = json_response.get("place_to_enter_verification_code")
if (
place_to_enter_verification_code
and (task.totp_verification_url or task.totp_identifier)
and task.organization_id
):
LOG.info("Need verification code", step_id=step.step_id)
verification_code = await poll_verification_code(
task.task_id,

View File

@@ -37,8 +37,8 @@ Reply in JSON format with the following keys:
}]
{% endif %}
}],{% if verification_code_check %}
"verification_code_reasoning": str, // Let's think step by step. Describe what you see and think if a verification code is needed for login or any verification step. Explain why you believe a verification code is needed or not. Has the code been sent and is code available somewhere (email, phone or 2FA device)?
"need_verification_code": bool, // Whether a verification code must be entered on this page now. True only if the code is available to user. If the code is not sent, return false {% endif %}
"verification_code_reasoning": str, // Let's think step by step. Describe what you see and think if there is somewhere on the current page where you must enter the verification code now for login or any verification step. Explain why you believe a verification code needs to be enter somewhere or not. Do not imagine any place to enter the code if the code has not been sent yet.
"place_to_enter_verification_code": bool // Whether there is a place on the current page to enter the verification code now. {% endif %}
}
Consider the action history from the last step and the screenshot together, if actions from the last step don't yield positive impact, try other actions or other action combinations.

View File

@@ -16,8 +16,8 @@ Reply in JSON format with the following keys:
"id": str, // The id of the element to take action on. The id has to be one from the elements list.
"text": str, // The text to input.
}]{% if verification_code_check %}
"verification_code_reasoning": str, // Let's think step by step. Describe what you see and think if a verification code is needed for login or any verification step. Explain why you believe a verification code is needed or not. Has the code been sent and is code available somewhere (email, phone or 2FA device)?
"need_verification_code": bool, // Whether a verification code is needed to proceed. True only if the code is available to user. If the code is not sent, return false {% endif %}
"verification_code_reasoning": str, // Let's think step by step. Describe what you see and think if there is somewhere on the current page where you must enter the verification code now for login or any verification step. Explain why you believe a verification code needs to be enter somewhere or not. Do not imagine any place to enter the code if the code has not been sent yet.
"place_to_enter_verification_code": bool // Whether there is a place on the current page to enter the verificaton code now. {% endif %}
}
User instruction: