diff --git a/aider/coders/senior_coder.py b/aider/coders/senior_coder.py index aac4867a7..84669983c 100644 --- a/aider/coders/senior_coder.py +++ b/aider/coders/senior_coder.py @@ -16,8 +16,12 @@ class SeniorCoder(AskCoder): return kwargs = dict() - kwargs["main_model"] = Model(self.main_model.junior_model_name) - kwargs["edit_format"] = self.main_model.junior_edit_format + + # Use the junior_model from the main_model if it exists, otherwise use the main_model itself + junior_model = self.main_model.junior_model or self.main_model + + kwargs["main_model"] = junior_model + kwargs["edit_format"] = junior_model.edit_format kwargs["suggest_shell_commands"] = False kwargs["map_tokens"] = 0 kwargs["total_cost"] = self.total_cost