Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

Added wait action

Dillon DuPont2ba67d399d6b
diff --git a/libs/python/agent/agent/human_tool/ui.py b/libs/python/agent/agent/human_tool/ui.py
index f4a9fb4fb6..39c41bc651 100644
--- a/libs/python/agent/agent/human_tool/ui.py
+++ b/libs/python/agent/agent/human_tool/ui.py
@@ -368,6 +368,10 @@ class HumanCompletionUI:
"""Submit a hotkey action."""
return self.submit_action("keypress", keys=keys)
+ def submit_wait_action(self) -> str:
+ """Submit a wait action with no kwargs."""
+ return self.submit_action("wait")
+
def submit_description_click(self, description: str, action_type: str = "click", button: str = "left") -> str:
"""Submit a description-based action."""
if action_type == "click":
@@ -515,6 +519,16 @@ def create_ui():
)
description_submit_btn = gr.Button("Submit Description Action")
+ # Misc actions
+ with gr.Accordion("🧰 Misc Actions", open=False):
+ with gr.Group():
+ misc_action_dropdown = gr.Dropdown(
+ label="Misc Action",
+ choices=["wait"],
+ value="wait"
+ )
+ misc_submit_btn = gr.Button("Submit Misc Action")
+
status_display = gr.Textbox(
label="Status",
interactive=False,
@@ -615,6 +629,23 @@ def create_ui():
outputs=[call_dropdown, screenshot_image, conversation_chatbot, submit_btn]
)
+ # Misc action handler
+ def handle_misc_submit(selected_action):
+ if selected_action == "wait":
+ result = ui_handler.submit_wait_action()
+ ui_handler.wait_for_pending_calls()
+ return result
+ return f"Unsupported misc action: {selected_action}"
+
+ misc_submit_btn.click(
+ fn=handle_misc_submit,
+ inputs=[misc_action_dropdown],
+ outputs=[status_display]
+ ).then(
+ fn=ui_handler.wait_for_pending_calls,
+ outputs=[call_dropdown, screenshot_image, conversation_chatbot, submit_btn]
+ )
+
# Load initial data
demo.load(
fn=ui_handler.refresh_pending_calls,