feat: add user confirmation for model warnings

This commit is contained in:
Paul Gauthier 2024-08-30 08:28:21 -07:00 committed by Paul Gauthier (aider)
parent 1639581364
commit 013dac288c
2 changed files with 14 additions and 3 deletions

View file

@ -507,7 +507,14 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
return 1
if args.show_model_warnings:
models.sanity_check_models(io, main_model)
problem = models.sanity_check_models(io, main_model)
if problem:
io.tool_output("You can skip this sanity check with --no-show-model-warnings")
try:
if not io.confirm_ask("Proceed anyway?"):
return 1
except KeyboardInterrupt:
return 1
repo = None
if args.git:

View file

@ -730,9 +730,11 @@ def validate_variables(vars):
def sanity_check_models(io, main_model):
sanity_check_model(io, main_model)
problem_weak = None
problem_strong = sanity_check_model(io, main_model)
if main_model.weak_model and main_model.weak_model is not main_model:
sanity_check_model(io, main_model.weak_model)
problem_weak = sanity_check_model(io, main_model.weak_model)
return problem_strong or problem_weak
def sanity_check_model(io, model):
@ -771,6 +773,8 @@ def sanity_check_model(io, model):
if show:
io.tool_output(f"For more info, see: {urls.model_warnings}\n")
return show
def fuzzy_match_models(name):
name = name.lower()