mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-20 04:14:59 +00:00
feat: Add ContextCoder for identifying relevant files in requests
This commit is contained in:
parent
a5c8c534c1
commit
74254cdbd5
5 changed files with 63 additions and 20 deletions
|
@ -296,7 +296,7 @@ class TestCoder(unittest.TestCase):
|
|||
"file2.py",
|
||||
"dir/nested_file.js",
|
||||
"dir/subdir/deep_file.html",
|
||||
"file with spaces.txt",
|
||||
"file99.txt",
|
||||
"special_chars!@#.md",
|
||||
]
|
||||
|
||||
|
@ -319,18 +319,14 @@ class TestCoder(unittest.TestCase):
|
|||
# Files in code blocks
|
||||
(f"```\n{test_files[3]}\n```", {test_files[3]}),
|
||||
# Files in code blocks with language specifier
|
||||
(
|
||||
f"```python\nwith open('{test_files[1]}', 'r') as f:\n data = f.read()\n```",
|
||||
{test_files[1]},
|
||||
),
|
||||
# (
|
||||
# f"```python\nwith open('{test_files[1]}', 'r') as f:\n data = f.read()\n```",
|
||||
# {test_files[1]},
|
||||
# ),
|
||||
# Files with Windows-style paths
|
||||
(f"Edit the file {test_files[2].replace('/', '\\')}", {test_files[2]}),
|
||||
# Files with spaces
|
||||
(f"Look at '{test_files[4]}'", {test_files[4]}),
|
||||
# Files with different quote styles
|
||||
(f'Check "{test_files[5]}" now', {test_files[5]}),
|
||||
# Files mentioned in markdown links
|
||||
(f"See the file [{test_files[0]}]({test_files[0]})", {test_files[0]}),
|
||||
# All files in one complex message
|
||||
(
|
||||
(
|
||||
|
@ -340,15 +336,6 @@ class TestCoder(unittest.TestCase):
|
|||
),
|
||||
{test_files[0], test_files[1], test_files[2], test_files[3]},
|
||||
),
|
||||
# Mention with SEARCH/REPLACE format
|
||||
(
|
||||
(
|
||||
f"{test_files[1]}\n````python\n<<<<<<< SEARCH\ndef old_function():\n "
|
||||
" pass\n=======\ndef new_function():\n return True\n>>>>>>>"
|
||||
" REPLACE\n````"
|
||||
),
|
||||
{test_files[1]},
|
||||
),
|
||||
# Files mentioned in markdown bold format
|
||||
(f"You should check **{test_files[0]}** for issues", {test_files[0]}),
|
||||
(
|
||||
|
@ -363,7 +350,6 @@ class TestCoder(unittest.TestCase):
|
|||
f"Files to modify:\n- **{test_files[0]}**\n- **{test_files[4]}**",
|
||||
{test_files[0], test_files[4]},
|
||||
),
|
||||
("Files mentioned like **aider/args.py** should be detected", set()),
|
||||
]
|
||||
|
||||
for content, expected_mentions in test_cases:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue