feat: Add functionality to press Windows key and update function registry
This commit is contained in:
		@@ -86,17 +86,23 @@ def wait(duration: float) -> None:
 | 
				
			|||||||
    """Waits for the specified duration in seconds."""
 | 
					    """Waits for the specified duration in seconds."""
 | 
				
			||||||
    time.sleep(duration)
 | 
					    time.sleep(duration)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def press_windows_key() -> None:
 | 
				
			||||||
 | 
					    """Presses the Windows key."""
 | 
				
			||||||
 | 
					    pyautogui.hotkey('win')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def reprompt(nextsteps: str, processor) -> None:
 | 
					def reprompt(nextsteps: str, processor) -> None:
 | 
				
			||||||
    """Re-execute GPT and take a new screenshot."""
 | 
					    """Re-execute GPT and take a new screenshot."""
 | 
				
			||||||
    scr = screenshot_to_base64(take_screenshot())
 | 
					    scr = screenshot_to_base64(take_screenshot())
 | 
				
			||||||
    return processor.process(nextsteps, img_data=scr)
 | 
					    return processor.process(nextsteps, img_data=scr)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def _execute(name, args, processor):
 | 
					def _execute(name, args=[], processor=None):
 | 
				
			||||||
    if name == "click_button":
 | 
					    if name == "click_button":
 | 
				
			||||||
        press_mouse(MouseInput(**args))
 | 
					        press_mouse(MouseInput(**args))
 | 
				
			||||||
    elif name == "type_text":
 | 
					    elif name == "type_text":
 | 
				
			||||||
        press_keyboard(KeyboardInput(**args))
 | 
					        press_keyboard(KeyboardInput(**args))
 | 
				
			||||||
    elif name == "wait":
 | 
					    elif name == "wait":
 | 
				
			||||||
        wait(**args)
 | 
					        wait(**args)
 | 
				
			||||||
 | 
					    elif name == "press_windows_key":
 | 
				
			||||||
 | 
					        press_windows_key()
 | 
				
			||||||
    elif name == "reprompt":
 | 
					    elif name == "reprompt":
 | 
				
			||||||
        reprompt(**args, processor=processor)
 | 
					        reprompt(**args, processor=processor)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -110,7 +110,19 @@ FUNCTIONS = [
 | 
				
			|||||||
                "required": ["goal"],
 | 
					                "required": ["goal"],
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    },
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        "type": "function",
 | 
				
			||||||
 | 
					        "function": {
 | 
				
			||||||
 | 
					            "name": "windows_key",
 | 
				
			||||||
 | 
					            "description": "Press the Windows key to open the Start menu.",
 | 
				
			||||||
 | 
					            "parameters": {
 | 
				
			||||||
 | 
					                "type": "object",
 | 
				
			||||||
 | 
					                "properties": {},
 | 
				
			||||||
 | 
					                "required": [],
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user