Do not require gpt-3.5 in GitRepo

This commit is contained in:
Paul Gauthier 2024-04-20 09:47:43 -07:00
parent 9b26eeb9eb
commit b882d5db4c
2 changed files with 8 additions and 14 deletions

View file

@ -5,7 +5,6 @@ import git
import pathspec import pathspec
from aider import prompts, utils from aider import prompts, utils
from aider.models import DEFAULT_WEAK_MODEL_NAME, Model
from aider.sendchat import simple_send_with_retries from aider.sendchat import simple_send_with_retries
from .dump import dump # noqa: F401 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): def __init__(self, io, fnames, git_dname, aider_ignore_file=None, models=None):
self.io = io self.io = io
if models: self.models = models
self.models = models
else:
self.models = [
Model(
DEFAULT_WEAK_MODEL_NAME,
weak_model=False,
require_model_info=False,
)
]
if git_dname: if git_dname:
check_fnames = [git_dname] check_fnames = [git_dname]

View file

@ -8,11 +8,15 @@ import git
from aider.dump import dump # noqa: F401 from aider.dump import dump # noqa: F401
from aider.io import InputOutput from aider.io import InputOutput
from aider.models import Model
from aider.repo import GitRepo from aider.repo import GitRepo
from aider.utils import GitTemporaryDirectory from aider.utils import GitTemporaryDirectory
class TestRepo(unittest.TestCase): class TestRepo(unittest.TestCase):
def setUp(self):
self.GPT35 = Model("gpt-3.5-turbo", validate_environment=False)
def test_diffs_empty_repo(self): def test_diffs_empty_repo(self):
with GitTemporaryDirectory(): with GitTemporaryDirectory():
repo = git.Repo() repo = git.Repo()
@ -104,7 +108,7 @@ class TestRepo(unittest.TestCase):
def test_get_commit_message(self, mock_send): def test_get_commit_message(self, mock_send):
mock_send.return_value = "a good commit message" 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 # Call the get_commit_message method with dummy diff and context
result = repo.get_commit_message("dummy diff", "dummy 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): def test_get_commit_message_strip_quotes(self, mock_send):
mock_send.return_value = '"a good commit message"' 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 # Call the get_commit_message method with dummy diff and context
result = repo.get_commit_message("dummy diff", "dummy 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): def test_get_commit_message_no_strip_unmatched_quotes(self, mock_send):
mock_send.return_value = 'a good "commit message"' 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 # Call the get_commit_message method with dummy diff and context
result = repo.get_commit_message("dummy diff", "dummy context") result = repo.get_commit_message("dummy diff", "dummy context")