mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 06:15:00 +00:00
fixed pattern to handle files without extensions
This commit is contained in:
parent
c02501d690
commit
4311b2117a
1 changed files with 5 additions and 3 deletions
8
coder.py
8
coder.py
|
@ -179,6 +179,8 @@ class Coder:
|
|||
if interrupted:
|
||||
content += "\n^C KeyboardInterrupt"
|
||||
|
||||
Path("tmp.last-edit.md").write_text(content)
|
||||
|
||||
self.cur_messages += [
|
||||
dict(role="assistant", content=content),
|
||||
]
|
||||
|
@ -204,7 +206,7 @@ class Coder:
|
|||
dict(role="user", content=prompts.files_content_gpt_edits),
|
||||
dict(role="assistant", content="Ok."),
|
||||
]
|
||||
self.commit(self.cur_messages)
|
||||
# self.commit(self.cur_messages)
|
||||
self.cur_messages = []
|
||||
return True
|
||||
|
||||
|
@ -299,14 +301,14 @@ class Coder:
|
|||
self.console.print(md)
|
||||
|
||||
pattern = re.compile(
|
||||
r"(^```\S*\s*)?^((?:[a-zA-Z]:\\|/)?(?:[\w\s.-]+[\\/])*\w+\.\w+)\s+(^```\S*\s*)?^<<<<<<< ORIGINAL\n(.*?\n?)^=======\n(.*?)^>>>>>>> UPDATED", # noqa: E501
|
||||
r"(^```\S*\s*)?^((?:[a-zA-Z]:\\|/)?(?:[\w\s.-]+[\\/])*\w+(\.\w+)?)\s+(^```\S*\s*)?^<<<<<<< ORIGINAL\n(.*?\n?)^=======\n(.*?)^>>>>>>> UPDATED", # noqa: E501
|
||||
re.MULTILINE | re.DOTALL,
|
||||
)
|
||||
|
||||
def update_files(self, content, inp):
|
||||
edited = set()
|
||||
for match in self.pattern.finditer(content):
|
||||
_, path, _, original, updated = match.groups()
|
||||
_, path, _, _, original, updated = match.groups()
|
||||
|
||||
if path not in self.fnames:
|
||||
if not Path(path).exists():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue