Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
fixed instant selection
Reagan Hsu47b92ca715e8
diff --git a/browser_use/init_cmd.py b/browser_use/init_cmd.pyindex 596685165..840d98972 100644--- a/browser_use/init_cmd.py+++ b/browser_use/init_cmd.py@@ -10,7 +10,7 @@ from pathlib import Pathimport clickfrom InquirerPy.base.control import Choice-from InquirerPy.prompts.rawlist import RawlistPrompt+from InquirerPy.prompts.list import ListPromptfrom InquirerPy.utils import InquirerPyStylefrom rich.console import Consolefrom rich.panel import Panel@@ -131,33 +131,36 @@ def main(# Interactive template selection if not providedif not template:- # Create choices with descriptions+ # Create choices with numbered display+ template_list = list(INIT_TEMPLATES.keys())choices = [Choice(- name=f'{name:12} - {info["description"]}',+ name=f'{i}. {name:12} - {info["description"]}',value=name,)- for name, info in INIT_TEMPLATES.items()+ for i, (name, info) in enumerate(INIT_TEMPLATES.items(), 1)]# Create the prompt- prompt = RawlistPrompt(+ prompt = ListPrompt(message='Select a template:',choices=choices,default='default',style=inquirer_style,)- # Add custom keybindings for instant selection with number keys- template_list = list(INIT_TEMPLATES.keys())+ # Register custom keybindings for instant selection with number keys+ @prompt.register_kb('1')+ def _(event):+ event.app.exit(result=template_list[0])- # Register number keys 1-3 for instant selection- for i, template_name in enumerate(template_list, 1):+ @prompt.register_kb('2')+ def _(event):+ event.app.exit(result=template_list[1])- @prompt.register_kb(str(i))- def _(event, name=template_name):- """Instantly select template when number key is pressed"""- event.app.exit(result=name)+ @prompt.register_kb('3')+ def _(event):+ event.app.exit(result=template_list[2])template = prompt.execute()