enable inline import alert and fix inline imports (#2856)

This commit is contained in:
Shuchang Zheng
2025-07-01 12:48:00 -07:00
committed by GitHub
parent 47f9f1dabb
commit 41f77a40c8
7 changed files with 13 additions and 18 deletions

View File

@@ -1,4 +1,6 @@
from typing import Any, Dict
import ast
import re
from typing import Any, Dict, Match
import structlog
from openai.types.responses.response import Response as OpenAIResponse
@@ -862,8 +864,6 @@ def _parse_ui_tars_response(response_content: str, browser_window_dimension: Res
Extracts essential parsing logic from action_parser.py without the complex coordinate transformations.
"""
import re
text = response_content.strip()
# Convert point format to coordinates if needed
@@ -947,7 +947,6 @@ def _parse_ui_tars_response(response_content: str, browser_window_dimension: Res
def _parse_single_action(action_str: str) -> dict[str, Any] | None:
"""Parse a single action string into structured data."""
import ast
try:
# Clean up the action string
@@ -990,9 +989,6 @@ def _parse_single_action(action_str: str) -> dict[str, Any] | None:
def _convert_point_to_coordinates(text: str) -> str:
"""Convert <point>x y</point> format to (x,y) format."""
import re
from typing import Match
pattern = r"<point>(\d+)\s+(\d+)</point>"
def replace_match(match: Match[str]) -> str:
@@ -1154,8 +1150,6 @@ def _extract_ui_tars_coordinates(box_str: str, browser_window_dimension: Resolut
format to relative coordinates (0-1 range), then multiplied by screen dimensions
to get absolute pixel coordinates.
"""
import ast
if not box_str:
return None, None