refactor: improve documentation URL handling and error messages

This commit is contained in:
Paul Gauthier 2024-10-30 11:40:56 -07:00 committed by Paul Gauthier (aider)
parent e9beb1336c
commit 7e574bc214
3 changed files with 8 additions and 5 deletions

View file

@ -607,13 +607,13 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
problem = models.sanity_check_models(io, main_model) problem = models.sanity_check_models(io, main_model)
if problem: if problem:
io.tool_output("You can skip this check with --no-show-model-warnings") io.tool_output("You can skip this check with --no-show-model-warnings")
io.tool_output()
try: try:
if io.confirm_ask( if io.confirm_ask(
"Open documentation url for more info?", subject=urls.model_warnings "Open documentation url for more info?", subject=urls.model_warnings
): ):
webbrowser.open(urls.model_warnings) webbrowser.open(urls.model_warnings)
io.tool_output()
except KeyboardInterrupt: except KeyboardInterrupt:
return 1 return 1
@ -830,7 +830,11 @@ def check_and_load_imports(io, verbose=False):
except Exception as err: except Exception as err:
io.tool_error(str(err)) io.tool_error(str(err))
io.tool_output("Error loading required imports. Did you install aider properly?") io.tool_output("Error loading required imports. Did you install aider properly?")
io.tool_output("https://aider.chat/docs/install/install.html") if io.confirm_ask(
"Open documentation url for more info?", subject=urls.install_properly
):
webbrowser.open(urls.install_properly)
sys.exit(1) sys.exit(1)
installs[str(key)] = True installs[str(key)] = True
@ -867,6 +871,7 @@ def load_slow_imports(swallow=True):
raise e raise e
if __name__ == "__main__": if __name__ == "__main__":
status = main() status = main()
sys.exit(status) sys.exit(status)

View file

@ -1042,9 +1042,6 @@ def sanity_check_model(io, model):
for match in possible_matches: for match in possible_matches:
io.tool_output(f"- {match}") io.tool_output(f"- {match}")
if show:
io.tool_output(f"For more info, see: {urls.model_warnings}")
return show return show

View file

@ -10,3 +10,4 @@ llms = "https://aider.chat/docs/llms.html"
large_repos = "https://aider.chat/docs/faq.html#can-i-use-aider-in-a-large-mono-repo" large_repos = "https://aider.chat/docs/faq.html#can-i-use-aider-in-a-large-mono-repo"
github_issues = "https://github.com/Aider-AI/aider/issues/new" github_issues = "https://github.com/Aider-AI/aider/issues/new"
git_index_version = "https://github.com/Aider-AI/aider/issues/211" git_index_version = "https://github.com/Aider-AI/aider/issues/211"
install_properly = "https://aider.chat/docs/troubleshooting/imports.html"