mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 22:34:59 +00:00
Added manual control of --edit-format
This commit is contained in:
parent
e1d987725e
commit
75e84017b3
2 changed files with 19 additions and 3 deletions
|
@ -34,7 +34,13 @@ class Coder:
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(
|
def create(
|
||||||
self, main_model, io, openai_api_key, openai_api_base="https://api.openai.com/v1", **kwargs
|
self,
|
||||||
|
main_model,
|
||||||
|
edit_format,
|
||||||
|
io,
|
||||||
|
openai_api_key,
|
||||||
|
openai_api_base="https://api.openai.com/v1",
|
||||||
|
**kwargs,
|
||||||
):
|
):
|
||||||
from . import EditBlockCoder, WholeFileCoder
|
from . import EditBlockCoder, WholeFileCoder
|
||||||
|
|
||||||
|
@ -50,9 +56,12 @@ class Coder:
|
||||||
)
|
)
|
||||||
main_model = models.GPT35_16k
|
main_model = models.GPT35_16k
|
||||||
|
|
||||||
if main_model.edit_format == "diff":
|
if edit_format is None:
|
||||||
|
edit_format = main_model.edit_format
|
||||||
|
|
||||||
|
if edit_format == "diff":
|
||||||
return EditBlockCoder(main_model, io, **kwargs)
|
return EditBlockCoder(main_model, io, **kwargs)
|
||||||
elif main_model.edit_format == "whole":
|
elif edit_format == "whole":
|
||||||
return WholeFileCoder(main_model, io, **kwargs)
|
return WholeFileCoder(main_model, io, **kwargs)
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"{main_model} has unknown edit format {main_model.edit_format}")
|
raise ValueError(f"{main_model} has unknown edit format {main_model.edit_format}")
|
||||||
|
|
|
@ -93,6 +93,12 @@ def main(args=None, input=None, output=None):
|
||||||
const=models.GPT35_16k.name,
|
const=models.GPT35_16k.name,
|
||||||
help=f"Use {models.GPT35_16k.name} model for the main chat (gpt-4 is better)",
|
help=f"Use {models.GPT35_16k.name} model for the main chat (gpt-4 is better)",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--edit-format",
|
||||||
|
metavar="EDIT_FORMAT",
|
||||||
|
default=None,
|
||||||
|
help="Specify what edit format GPT should use (default depends on model)",
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--pretty",
|
"--pretty",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
|
@ -231,6 +237,7 @@ def main(args=None, input=None, output=None):
|
||||||
|
|
||||||
coder = Coder.create(
|
coder = Coder.create(
|
||||||
main_model,
|
main_model,
|
||||||
|
args.edit_format,
|
||||||
io,
|
io,
|
||||||
args.openai_api_key,
|
args.openai_api_key,
|
||||||
args.openai_api_base,
|
args.openai_api_base,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue