From b882d5db4c6ac5bbcf276a52f0ece387ebd31e15 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Sat, 20 Apr 2024 09:47:43 -0700 Subject: [PATCH] Do not require gpt-3.5 in GitRepo --- aider/repo.py | 12 +----------- tests/test_repo.py | 10 +++++++--- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/aider/repo.py b/aider/repo.py index 682810b7d..4538c16a3 100644 --- a/aider/repo.py +++ b/aider/repo.py @@ -5,7 +5,6 @@ import git import pathspec from aider import prompts, utils -from aider.models import DEFAULT_WEAK_MODEL_NAME, Model from aider.sendchat import simple_send_with_retries from .dump import dump # noqa: F401 @@ -19,16 +18,7 @@ class GitRepo: def __init__(self, io, fnames, git_dname, aider_ignore_file=None, models=None): self.io = io - if models: - self.models = models - else: - self.models = [ - Model( - DEFAULT_WEAK_MODEL_NAME, - weak_model=False, - require_model_info=False, - ) - ] + self.models = models if git_dname: check_fnames = [git_dname] diff --git a/tests/test_repo.py b/tests/test_repo.py index 61357a719..30adf25f6 100644 --- a/tests/test_repo.py +++ b/tests/test_repo.py @@ -8,11 +8,15 @@ import git from aider.dump import dump # noqa: F401 from aider.io import InputOutput +from aider.models import Model from aider.repo import GitRepo from aider.utils import GitTemporaryDirectory class TestRepo(unittest.TestCase): + def setUp(self): + self.GPT35 = Model("gpt-3.5-turbo", validate_environment=False) + def test_diffs_empty_repo(self): with GitTemporaryDirectory(): repo = git.Repo() @@ -104,7 +108,7 @@ class TestRepo(unittest.TestCase): def test_get_commit_message(self, mock_send): mock_send.return_value = "a good commit message" - repo = GitRepo(InputOutput(), None, None) + repo = GitRepo(InputOutput(), None, None, models=[self.GPT35]) # Call the get_commit_message method with dummy diff and context result = repo.get_commit_message("dummy diff", "dummy context") @@ -115,7 +119,7 @@ class TestRepo(unittest.TestCase): def test_get_commit_message_strip_quotes(self, mock_send): mock_send.return_value = '"a good commit message"' - repo = GitRepo(InputOutput(), None, None) + repo = GitRepo(InputOutput(), None, None, models=[self.GPT35]) # Call the get_commit_message method with dummy diff and context result = repo.get_commit_message("dummy diff", "dummy context") @@ -126,7 +130,7 @@ class TestRepo(unittest.TestCase): def test_get_commit_message_no_strip_unmatched_quotes(self, mock_send): mock_send.return_value = 'a good "commit message"' - repo = GitRepo(InputOutput(), None, None) + repo = GitRepo(InputOutput(), None, None, models=[self.GPT35]) # Call the get_commit_message method with dummy diff and context result = repo.get_commit_message("dummy diff", "dummy context")