mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-25 23:05:00 +00:00
rename
This commit is contained in:
parent
9cef379abd
commit
a874d617d3
4 changed files with 15 additions and 15 deletions
|
@ -35,12 +35,12 @@ class Coder:
|
||||||
def check_model_availability(self, main_model):
|
def check_model_availability(self, main_model):
|
||||||
available_models = openai.Model.list()
|
available_models = openai.Model.list()
|
||||||
model_ids = [model.id for model in available_models["data"]]
|
model_ids = [model.id for model in available_models["data"]]
|
||||||
return main_model.value in model_ids
|
return main_model.name in model_ids
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
io,
|
io,
|
||||||
main_model=models.GPT4.value,
|
main_model=models.GPT4.name,
|
||||||
fnames=None,
|
fnames=None,
|
||||||
pretty=True,
|
pretty=True,
|
||||||
show_diffs=False,
|
show_diffs=False,
|
||||||
|
@ -84,7 +84,7 @@ class Coder:
|
||||||
self.main_model = main_model
|
self.main_model = main_model
|
||||||
if main_model == models.GPT35:
|
if main_model == models.GPT35:
|
||||||
self.io.tool_output(
|
self.io.tool_output(
|
||||||
f"Using {main_model.value} (experimental): disabling ctags/repo-maps.",
|
f"Using {main_model.name} (experimental): disabling ctags/repo-maps.",
|
||||||
)
|
)
|
||||||
self.gpt_prompts = prompts.GPT35()
|
self.gpt_prompts = prompts.GPT35()
|
||||||
else:
|
else:
|
||||||
|
@ -435,7 +435,7 @@ class Coder:
|
||||||
|
|
||||||
def send(self, messages, model=None, silent=False):
|
def send(self, messages, model=None, silent=False):
|
||||||
if not model:
|
if not model:
|
||||||
model = self.main_model.value
|
model = self.main_model.name
|
||||||
|
|
||||||
self.resp = ""
|
self.resp = ""
|
||||||
interrupted = False
|
interrupted = False
|
||||||
|
@ -620,7 +620,7 @@ class Coder:
|
||||||
def get_commit_message(self, diffs, context):
|
def get_commit_message(self, diffs, context):
|
||||||
if len(diffs) >= 4 * 1024 * 4:
|
if len(diffs) >= 4 * 1024 * 4:
|
||||||
self.io.tool_error(
|
self.io.tool_error(
|
||||||
f"Diff is too large for {models.GPT35.value} to generate a commit message."
|
f"Diff is too large for {models.GPT35.name} to generate a commit message."
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -634,12 +634,12 @@ class Coder:
|
||||||
try:
|
try:
|
||||||
commit_message, interrupted = self.send(
|
commit_message, interrupted = self.send(
|
||||||
messages,
|
messages,
|
||||||
model=models.GPT35.value,
|
model=models.GPT35.name,
|
||||||
silent=True,
|
silent=True,
|
||||||
)
|
)
|
||||||
except openai.error.InvalidRequestError:
|
except openai.error.InvalidRequestError:
|
||||||
self.io.tool_error(
|
self.io.tool_error(
|
||||||
f"Failed to generate commit message using {models.GPT35.value} due to an invalid"
|
f"Failed to generate commit message using {models.GPT35.name} due to an invalid"
|
||||||
" request."
|
" request."
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
@ -650,7 +650,7 @@ class Coder:
|
||||||
|
|
||||||
if interrupted:
|
if interrupted:
|
||||||
self.io.tool_error(
|
self.io.tool_error(
|
||||||
f"Unable to get commit message from {models.GPT35.value}. Use /commit to try again."
|
f"Unable to get commit message from {models.GPT35.name}. Use /commit to try again."
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -780,7 +780,7 @@ class Coder:
|
||||||
elif self.main_model == models.GPT35:
|
elif self.main_model == models.GPT35:
|
||||||
method = self.update_files_gpt35
|
method = self.update_files_gpt35
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"apply_updates() doesn't support {self.main_model.value}")
|
raise ValueError(f"apply_updates() doesn't support {self.main_model.name}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
edited = method(content)
|
edited = method(content)
|
||||||
|
|
|
@ -15,7 +15,7 @@ class Commands:
|
||||||
def __init__(self, io, coder):
|
def __init__(self, io, coder):
|
||||||
self.io = io
|
self.io = io
|
||||||
self.coder = coder
|
self.coder = coder
|
||||||
self.tokenizer = tiktoken.encoding_for_model(coder.main_model.value)
|
self.tokenizer = tiktoken.encoding_for_model(coder.main_model.name)
|
||||||
|
|
||||||
def is_command(self, inp):
|
def is_command(self, inp):
|
||||||
if inp[0] == "/":
|
if inp[0] == "/":
|
||||||
|
|
|
@ -76,15 +76,15 @@ def main(args=None, input=None, output=None):
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--model",
|
"--model",
|
||||||
metavar="MODEL",
|
metavar="MODEL",
|
||||||
default=models.GPT4.value,
|
default=models.GPT4.name,
|
||||||
help=f"Specify the model to use for the main chat (default: {models.GPT4.value})",
|
help=f"Specify the model to use for the main chat (default: {models.GPT4.name})",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-3",
|
"-3",
|
||||||
action="store_const",
|
action="store_const",
|
||||||
dest="model",
|
dest="model",
|
||||||
const=models.GPT35.value,
|
const=models.GPT35.name,
|
||||||
help=f"Use {models.GPT35.value} model for the main chat (not advised)",
|
help=f"Use {models.GPT35.name} model for the main chat (not advised)",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--pretty",
|
"--pretty",
|
||||||
|
|
|
@ -88,7 +88,7 @@ class RepoMap:
|
||||||
else:
|
else:
|
||||||
self.has_ctags = False
|
self.has_ctags = False
|
||||||
|
|
||||||
self.tokenizer = tiktoken.encoding_for_model(main_model.value)
|
self.tokenizer = tiktoken.encoding_for_model(main_model.name)
|
||||||
self.repo_content_prefix = repo_content_prefix
|
self.repo_content_prefix = repo_content_prefix
|
||||||
|
|
||||||
def get_repo_map(self, chat_files, other_files):
|
def get_repo_map(self, chat_files, other_files):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue