mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 06:15:00 +00:00
WIP: Refactor coder.py to use utils.replace_most_similar_chunk and add utils.strip_quoted_wrapping.
This commit is contained in:
parent
05c39b7329
commit
1b4266c33c
2 changed files with 28 additions and 5 deletions
13
coder.py
13
coder.py
|
@ -16,7 +16,7 @@ from dotenv import load_dotenv
|
|||
from tqdm import tqdm
|
||||
|
||||
from pathlib import Path
|
||||
from utils import replace_most_similar_chunk
|
||||
import utils
|
||||
|
||||
import os
|
||||
import git
|
||||
|
@ -418,11 +418,14 @@ class Coder:
|
|||
|
||||
content = fname.read_text()
|
||||
|
||||
if not before_text and not content:
|
||||
# first populating an empty file
|
||||
new_content = after_text
|
||||
if not before_text:
|
||||
if content:
|
||||
new_content = content + after_text
|
||||
else:
|
||||
# first populating an empty file
|
||||
new_content = after_text
|
||||
else:
|
||||
new_content = replace_most_similar_chunk(content, before_text, after_text)
|
||||
new_content = utils.replace_most_similar_chunk(content, before_text, after_text)
|
||||
if not new_content:
|
||||
self.console.print(f"[red]Failed to apply edit to {fname}")
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue