Skip to content

Commit 0e5ae95

Browse files
committed
Fix keyboard_type new line issue
1 parent ef4fb8d commit 0e5ae95

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

operate/main.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@
8282
Objective: {objective}
8383
"""
8484

85-
# - Make sure that a field is active before using TYPE
86-
# IMPORTANT: DO NOT REPEATE ACTIONS CONSECUTIVELY! If something doesn't work try something new
8785

8886
USER_QUESTION = "Hello, I can help you with anything. What would you like done?"
8987

@@ -307,7 +305,9 @@ def get_next_action_from_openai(messages, objective):
307305

308306
new_screenshot_filename = "screenshots/screenshot_with_grid.png"
309307

310-
add_grid_to_image(screenshot_filename, new_screenshot_filename, 380)
308+
add_grid_to_image(screenshot_filename, new_screenshot_filename, 420)
309+
# sleep for a second
310+
time.sleep(1)
311311

312312
with open(new_screenshot_filename, "rb") as img_file:
313313
img_base64 = base64.b64encode(img_file.read()).decode("utf-8")
@@ -334,9 +334,9 @@ def get_next_action_from_openai(messages, objective):
334334
response = client.chat.completions.create(
335335
model="gpt-4-vision-preview",
336336
messages=pseudo_messages,
337-
presence_penalty=0.5,
337+
presence_penalty=1,
338338
frequency_penalty=0.5,
339-
temperature=1.5,
339+
temperature=1,
340340
max_tokens=300,
341341
)
342342

@@ -531,13 +531,13 @@ def draw_label_with_background(position, text, draw, font, bg_width, bg_height):
531531

532532

533533
def keyboard_type(text):
534+
# sleep for 2 seconds
535+
time.sleep(2)
534536
for char in text:
535-
if char == "\n":
537+
if char == "{":
536538
pyautogui.press("enter")
537539
else:
538540
pyautogui.write(char)
539-
540-
pyautogui.press("enter")
541541
return "Type: " + text
542542

543543

0 commit comments

Comments
 (0)