diff --git a/aider/commands.py b/aider/commands.py index c05138632..270cf7e83 100644 --- a/aider/commands.py +++ b/aider/commands.py @@ -16,9 +16,8 @@ from .dump import dump # noqa: F401 class SwitchCoder(Exception): - def __init__(self, model=None, edit_format=None): - self.model = model - self.edit_format = edit_format + def __init__(self, **kwargs): + self.kwargs = kwargs class Commands: @@ -43,7 +42,7 @@ class Commands: model_name = args.strip() model = models.Model(model_name) models.sanity_check_models(self.io, model) - raise SwitchCoder(model=model) + raise SwitchCoder(main_model=model) def cmd_mode(self, args): "Switch to a new editing mode" diff --git a/aider/main.py b/aider/main.py index 6e06c8d69..13ee913a7 100644 --- a/aider/main.py +++ b/aider/main.py @@ -589,10 +589,9 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F return except SwitchCoder as switch: coder = Coder.create( - main_model=switch.model, - edit_format=switch.edit_format, io=io, from_coder=coder, + **switch.kwargs ) coder.show_announcements()