mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 02:05:00 +00:00
Extend SwitchModel exception to include edit format and update cmd_mode to raise SwitchModel with edit format
This commit is contained in:
parent
11b44cde10
commit
8496390248
1 changed files with 11 additions and 2 deletions
|
@ -16,8 +16,9 @@ from .dump import dump # noqa: F401
|
||||||
|
|
||||||
|
|
||||||
class SwitchModel(Exception):
|
class SwitchModel(Exception):
|
||||||
def __init__(self, model):
|
def __init__(self, model=None, edit_format=None):
|
||||||
self.model = model
|
self.model = model
|
||||||
|
self.edit_format = edit_format
|
||||||
|
|
||||||
|
|
||||||
class Commands:
|
class Commands:
|
||||||
|
@ -42,7 +43,15 @@ 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 SwitchModel(model)
|
raise SwitchModel(model=model)
|
||||||
|
|
||||||
|
def cmd_mode(self, args):
|
||||||
|
"Switch to a new editing mode"
|
||||||
|
|
||||||
|
ef = args.strip()
|
||||||
|
valid_formats = "diff udiff whole".split()
|
||||||
|
|
||||||
|
raise SwitchModel(edit_format=ef)
|
||||||
|
|
||||||
def completions_model(self):
|
def completions_model(self):
|
||||||
models = litellm.model_cost.keys()
|
models = litellm.model_cost.keys()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue