From b7eaa0fe7c6f904a1d8e70c5e714410043a312e6 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Mon, 22 Jul 2024 17:24:30 +0200 Subject: [PATCH] Show the correct did-you-mean models #917 --- aider/models.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/aider/models.py b/aider/models.py index fcd638944..1a47c93a9 100644 --- a/aider/models.py +++ b/aider/models.py @@ -672,7 +672,7 @@ def sanity_check_model(io, model): if possible_matches: io.tool_output("Did you mean one of these?") for match in possible_matches: - io.tool_output(f"- {model}") + io.tool_output(f"- {match}") if show: io.tool_output(f"For more info, see: {urls.model_warnings}\n") @@ -708,12 +708,13 @@ def fuzzy_match_models(name): # Check for model names containing the name matching_models = [m for m in chat_models if name in m] if matching_models: - return matching_models + return sorted(set(matching_models)) # Check for slight misspellings - models = list(chat_models) + models = set(chat_models) matching_models = difflib.get_close_matches(name, models, n=3, cutoff=0.8) - return sorted(matching_models) + + return sorted(set(matching_models)) def print_matching_models(io, search):