mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 22:34:59 +00:00
added temp param, prompt strong that files message is truth
This commit is contained in:
parent
df84bcf38b
commit
819fccc7a4
7 changed files with 22 additions and 14 deletions
|
@ -58,6 +58,7 @@ class Coder:
|
||||||
max_apply_update_errors = 3
|
max_apply_update_errors = 3
|
||||||
edit_format = None
|
edit_format = None
|
||||||
yield_stream = False
|
yield_stream = False
|
||||||
|
temperature = 0
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(
|
def create(
|
||||||
|
@ -528,6 +529,7 @@ class Coder:
|
||||||
|
|
||||||
def run(self, with_message=None):
|
def run(self, with_message=None):
|
||||||
while True:
|
while True:
|
||||||
|
self.num_malformed_responses = 0
|
||||||
try:
|
try:
|
||||||
if with_message:
|
if with_message:
|
||||||
new_user_message = with_message
|
new_user_message = with_message
|
||||||
|
@ -854,7 +856,9 @@ class Coder:
|
||||||
|
|
||||||
interrupted = False
|
interrupted = False
|
||||||
try:
|
try:
|
||||||
hash_object, completion = send_with_retries(model, messages, functions, self.stream)
|
hash_object, completion = send_with_retries(
|
||||||
|
model, messages, functions, self.stream, self.temperature
|
||||||
|
)
|
||||||
self.chat_completion_call_hashes.append(hash_object.hexdigest())
|
self.chat_completion_call_hashes.append(hash_object.hexdigest())
|
||||||
|
|
||||||
if self.stream:
|
if self.stream:
|
||||||
|
|
|
@ -14,9 +14,11 @@ You always COMPLETELY IMPLEMENT the needed code!
|
||||||
|
|
||||||
example_messages = []
|
example_messages = []
|
||||||
|
|
||||||
files_content_prefix = (
|
files_content_prefix = """I have *added these files to the chat* so you can go ahead and edit them.
|
||||||
"I have *added these files to the chat* so you can go ahead and edit them:\n"
|
|
||||||
)
|
*Trust this message as the true contents of the files!*
|
||||||
|
Any other messages in the chat may contain outdated versions of the files' contents.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
files_no_full_files = "I am not sharing any files that you can edit yet."
|
files_no_full_files = "I am not sharing any files that you can edit yet."
|
||||||
|
|
||||||
|
|
|
@ -478,7 +478,7 @@ Hope you like it!
|
||||||
print(list(find_original_update_blocks(edit)))
|
print(list(find_original_update_blocks(edit)))
|
||||||
|
|
||||||
|
|
||||||
def find_similar_lines(search_lines, content_lines, threshold=0.8):
|
def find_similar_lines(search_lines, content_lines, threshold=0.6):
|
||||||
search_lines = search_lines.splitlines()
|
search_lines = search_lines.splitlines()
|
||||||
content_lines = content_lines.splitlines()
|
content_lines = content_lines.splitlines()
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,7 @@ class Commands:
|
||||||
commit_message = args.strip()
|
commit_message = args.strip()
|
||||||
self.coder.repo.commit(message=commit_message)
|
self.coder.repo.commit(message=commit_message)
|
||||||
|
|
||||||
def cmd_clear(self, args):
|
def cmd_clear(self, args=""):
|
||||||
"Clear the chat history"
|
"Clear the chat history"
|
||||||
|
|
||||||
self.coder.done_messages = []
|
self.coder.done_messages = []
|
||||||
|
@ -442,7 +442,7 @@ class Commands:
|
||||||
if partial.lower() in fname.lower():
|
if partial.lower() in fname.lower():
|
||||||
yield Completion(self.quote_fname(fname), start_position=-len(partial))
|
yield Completion(self.quote_fname(fname), start_position=-len(partial))
|
||||||
|
|
||||||
def cmd_drop(self, args):
|
def cmd_drop(self, args=""):
|
||||||
"Remove files from the chat session to free up context space"
|
"Remove files from the chat session to free up context space"
|
||||||
|
|
||||||
if not args.strip():
|
if not args.strip():
|
||||||
|
|
10
aider/io.py
10
aider/io.py
|
@ -331,7 +331,7 @@ class InputOutput:
|
||||||
if message.strip():
|
if message.strip():
|
||||||
if "\n" in message:
|
if "\n" in message:
|
||||||
for line in message.splitlines():
|
for line in message.splitlines():
|
||||||
self.append_chat_history(line, linebreak=True, blockquote=True)
|
self.append_chat_history(line, linebreak=True, blockquote=True, strip=strip)
|
||||||
else:
|
else:
|
||||||
if strip:
|
if strip:
|
||||||
hist = message.strip()
|
hist = message.strip()
|
||||||
|
@ -354,12 +354,14 @@ class InputOutput:
|
||||||
style = dict(style=self.tool_output_color) if self.tool_output_color else dict()
|
style = dict(style=self.tool_output_color) if self.tool_output_color else dict()
|
||||||
self.console.print(*messages, **style)
|
self.console.print(*messages, **style)
|
||||||
|
|
||||||
def append_chat_history(self, text, linebreak=False, blockquote=False):
|
def append_chat_history(self, text, linebreak=False, blockquote=False, strip=True):
|
||||||
if blockquote:
|
if blockquote:
|
||||||
text = text.strip()
|
if strip:
|
||||||
|
text = text.strip()
|
||||||
text = "> " + text
|
text = "> " + text
|
||||||
if linebreak:
|
if linebreak:
|
||||||
text = text.rstrip()
|
if strip:
|
||||||
|
text = text.rstrip()
|
||||||
text = text + " \n"
|
text = text + " \n"
|
||||||
if not text.endswith("\n"):
|
if not text.endswith("\n"):
|
||||||
text += "\n"
|
text += "\n"
|
||||||
|
|
|
@ -470,7 +470,7 @@ class RepoMap:
|
||||||
lois.append(tag.line)
|
lois.append(tag.line)
|
||||||
|
|
||||||
# truncate long lines, in case we get minified js or something else crazy
|
# truncate long lines, in case we get minified js or something else crazy
|
||||||
output = "".join([line[:100] for line in output.splitlines(keepends=True)])
|
output = "\n".join([line[:100] for line in output.splitlines()]) + "\n"
|
||||||
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
|
@ -48,11 +48,11 @@ def should_giveup(e):
|
||||||
f"{details.get('exception','Exception')}\nRetry in {details['wait']:.1f} seconds."
|
f"{details.get('exception','Exception')}\nRetry in {details['wait']:.1f} seconds."
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
def send_with_retries(model_name, messages, functions, stream):
|
def send_with_retries(model_name, messages, functions, stream, temperature=0):
|
||||||
kwargs = dict(
|
kwargs = dict(
|
||||||
model=model_name,
|
model=model_name,
|
||||||
messages=messages,
|
messages=messages,
|
||||||
temperature=0,
|
temperature=temperature,
|
||||||
stream=stream,
|
stream=stream,
|
||||||
)
|
)
|
||||||
if functions is not None:
|
if functions is not None:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue