mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 18:25:00 +00:00
Update the SwitchCoder class to accept any kwargs and pass them to the new coder, moving the model and edit_format into those kwargs.
This commit is contained in:
parent
f440479c48
commit
c23da1d320
2 changed files with 4 additions and 6 deletions
|
@ -16,9 +16,8 @@ from .dump import dump # noqa: F401
|
||||||
|
|
||||||
|
|
||||||
class SwitchCoder(Exception):
|
class SwitchCoder(Exception):
|
||||||
def __init__(self, model=None, edit_format=None):
|
def __init__(self, **kwargs):
|
||||||
self.model = model
|
self.kwargs = kwargs
|
||||||
self.edit_format = edit_format
|
|
||||||
|
|
||||||
|
|
||||||
class Commands:
|
class Commands:
|
||||||
|
@ -43,7 +42,7 @@ class Commands:
|
||||||
model_name = args.strip()
|
model_name = args.strip()
|
||||||
model = models.Model(model_name)
|
model = models.Model(model_name)
|
||||||
models.sanity_check_models(self.io, model)
|
models.sanity_check_models(self.io, model)
|
||||||
raise SwitchCoder(model=model)
|
raise SwitchCoder(main_model=model)
|
||||||
|
|
||||||
def cmd_mode(self, args):
|
def cmd_mode(self, args):
|
||||||
"Switch to a new editing mode"
|
"Switch to a new editing mode"
|
||||||
|
|
|
@ -589,10 +589,9 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
|
||||||
return
|
return
|
||||||
except SwitchCoder as switch:
|
except SwitchCoder as switch:
|
||||||
coder = Coder.create(
|
coder = Coder.create(
|
||||||
main_model=switch.model,
|
|
||||||
edit_format=switch.edit_format,
|
|
||||||
io=io,
|
io=io,
|
||||||
from_coder=coder,
|
from_coder=coder,
|
||||||
|
**switch.kwargs
|
||||||
)
|
)
|
||||||
coder.show_announcements()
|
coder.show_announcements()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue