mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 08:14:59 +00:00
re-enabled quad-backticks, but allow triple-backticks as fences when searching for filenames #2879
This commit is contained in:
parent
3e71c35fdd
commit
0dde77009e
3 changed files with 9 additions and 3 deletions
|
@ -60,7 +60,7 @@ def wrap_fence(name):
|
|||
|
||||
all_fences = [
|
||||
("`" * 3, "`" * 3),
|
||||
# ("`" * 4, "`" * 4), # LLMs ignore and revert to triple-backtick, causing #2879
|
||||
("`" * 4, "`" * 4), # LLMs ignore and revert to triple-backtick, causing #2879
|
||||
wrap_fence("source"),
|
||||
wrap_fence("code"),
|
||||
wrap_fence("pre"),
|
||||
|
|
|
@ -401,6 +401,9 @@ missing_filename_err = (
|
|||
" {fence[0]}"
|
||||
)
|
||||
|
||||
# Always be willing to treat triple-backticks as a fence when searching for filenames
|
||||
triple_backticks = "`" * 3
|
||||
|
||||
|
||||
def strip_filename(filename, fence):
|
||||
filename = filename.strip()
|
||||
|
@ -409,7 +412,7 @@ def strip_filename(filename, fence):
|
|||
return
|
||||
|
||||
start_fence = fence[0]
|
||||
if filename.startswith(start_fence):
|
||||
if filename.startswith(start_fence) or filename.startswith(triple_backticks):
|
||||
return
|
||||
|
||||
filename = filename.rstrip(":")
|
||||
|
@ -546,7 +549,7 @@ def find_filename(lines, fence, valid_fnames):
|
|||
filenames.append(filename)
|
||||
|
||||
# Only continue as long as we keep seeing fences
|
||||
if not line.startswith(fence[0]):
|
||||
if not line.startswith(fence[0]) and not line.startswith(triple_backticks):
|
||||
break
|
||||
|
||||
if not filenames:
|
||||
|
|
|
@ -991,6 +991,9 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
|
|||
analytics.event("exit", reason="Failed to read apply content")
|
||||
return
|
||||
coder.partial_response_content = content
|
||||
# For testing #2879
|
||||
# from aider.coders.base_coder import all_fences
|
||||
# coder.fence = all_fences[1]
|
||||
coder.apply_updates()
|
||||
analytics.event("exit", reason="Applied updates")
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue