为了使框架在执行点击操作(click)时能够区分“正常用户意图点击”和“临时处理遮挡(如广告、弹窗)”的操作,我们可以对现有的 action space 做如下扩展:
✅ 修改建议
我们为 click 操作增加一个可选参数 purpose,用于说明该点击行为的目的。该参数的取值可以是:
- "user_intent"(默认值):表示这是用户期望执行的点击操作;
- "dismiss_overlay":表示该点击是为了关闭或移除遮挡(如广告、弹窗等)。
这样框架就可以根据 purpose 的值来区分点击行为,并在日志、追踪、回放等场景下做出不同处理。
🆕 修改后的 action space 定义如下:
<tools>
{
"type": "function",
"function": {
"name_for_human": "mobile_use",
"name": "mobile_use",
"description": "Use a touchscreen to interact with a mobile device, and take screenshots.
* This is an interface to a mobile device with touchscreen. You can perform actions like clicking, typing, swiping, etc.
* Some applications may take time to start or process actions, so you may need to wait and take successive screenshots to see the results of your actions.
* The screen's resolution is 672x1428.",
"parameters": {
"properties": {
"action": {
"description": "The action to perform. The available actions are:
* `key`: Perform a key event on the mobile device.
- This supports adb's `keyevent` syntax.
- Examples: \"volume_up\", \"volume_down\", \"power\", \"camera\", \"clear\".
* `click`: Click the point on the screen with coordinate (x, y).
* `long_press`: Press the point on the screen with coordinate (x, y) for specified seconds.
* `swipe`: Swipe from the starting point with coordinate (x, y) to the end point with coordinates2 (x2, y2).
* `type`: Input the specified text into the activated input box.
* `system_button`: Press the system button.
* `open`: Open an app on the device.
* `wait`: Wait specified seconds for the change to happen.
* `terminate`: Terminate the current task and report its completion status.",
"enum": ["key", "click", "long_press", "swipe", "type", "system_button", "open", "wait", "terminate"],
"type": "string"
},
"coordinate": {
"description": "(x, y): The x (pixels from the left edge) and y (pixels from the top edge) coordinates to move the mouse to. Required only by `action=click`, `action=long_press`, and `action=swipe`.",
"type": "array"
},
"coordinate2": {
"description": "(x, y): The x (pixels from the left edge) and y (pixels from the top edge) coordinates to move the mouse to. Required only by `action=swipe`.",
"type": "array"
},
"text": {
"description": "Required only by `action=key`, `action=type`, and `action=open`.",
"type": "string"
},
"time": {
"description": "The seconds to wait. Required only by `action=long_press` and `action=wait`.",
"type": "number"
},
"button": {
"description": "Back means returning to the previous interface, Home means returning to the desktop, Menu means opening the application background menu, and Enter means pressing the enter. Required only by `action=system_button`",
"enum": ["Back", "Home", "Menu", "Enter"],
"type": "string"
},
"status": {
"description": "The status of the task. Required only by `action=terminate`.",
"type": "string",
"enum": ["success", "failure"]
},
"purpose": {
"description": "Purpose of the click action. Used to distinguish between normal user clicks and clicks used to dismiss overlays such as ads or popups.",
"type": "string",
"enum": ["user_intent", "dismiss_overlay"],
"default": "user_intent"
}
},
"required": ["action"],
"type": "object"
},
"args_format": "Format the arguments as a JSON object."
}
}
</tools>