added [browser] extra; refac the pip install utils

This commit is contained in:
Paul Gauthier 2024-07-14 17:22:17 +01:00
parent 057c1af449
commit 76dad84285
13 changed files with 257 additions and 151 deletions

View file

@ -148,6 +148,15 @@ def scrub_sensitive_info(args, text):
return text
def check_streamlit_install(io):
return utils.check_pip_install_extra(
io,
"streamlit",
"You need to install the aider browser feature",
["aider-chat[browser]"],
)
def launch_gui(args):
from streamlit.web import cli
@ -318,10 +327,6 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
litellm.client_session = httpx.Client(verify=False)
if args.gui and not return_coder:
launch_gui(argv)
return
if args.dark_mode:
args.user_input_color = "#32FF32"
args.tool_error_color = "#FF3333"
@ -355,6 +360,12 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
editingmode=editing_mode,
)
if args.gui and not return_coder:
if not check_streamlit_install(io):
return
launch_gui(argv)
return
for fname in loaded_dotenvs:
io.tool_output(f"Loaded {fname}")