Improve on agent codes; add auto-running experiments code; Fix some examples

This commit is contained in:
Timothyxxx
2024-01-27 19:47:47 +08:00
parent f8ff612b85
commit 909aa868f3
8 changed files with 283 additions and 56 deletions

View File

@@ -63,6 +63,8 @@ def tag_screenshot(screenshot, accessibility_tree):
def parse_actions_from_string(input_string):
if input_string.strip() in ['WAIT', 'DONE', 'FAIL']:
return [input_string.strip()]
# Search for a JSON string within the input string
actions = []
matches = re.findall(r'```json\s+(.*?)\s+```', input_string, re.DOTALL)
@@ -95,6 +97,9 @@ def parse_actions_from_string(input_string):
def parse_code_from_string(input_string):
if input_string.strip() in ['WAIT', 'DONE', 'FAIL']:
return [input_string.strip()]
# This regular expression will match both ```code``` and ```python code```
# and capture the `code` part. It uses a non-greedy match for the content inside.
pattern = r"```(?:\w+\s+)?(.*?)```"