mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-23 22:04:59 +00:00
aider: Added display_fname
arg to quoted_file
and updated call to quoted_file
to pass relative file path.
# Context: USER: add a display_fname arg to quoted_file. add it, not fname, into the prompt. change the call to quoted_file to pass along the fname relative to self.root ASSISTANT: To add a `display_fname` argument to the `quoted_file` function and update the call to `quoted_file`, follow these changes: 1. Add the `display_fname` argument to the `quoted_file` function definition. 2. Replace `fname` with `display_fname` in the prompt string. 3. Update the call to `quoted_file` in the `get_files_content` method to pass the relative file path. Here are the code changes: ```python aider/utils.py <<<<<<< ORIGINAL def quoted_file(fname): prompt = "\n" prompt += fname ======= def quoted_file(fname, display_fname): prompt = "\n" prompt += display_fname >>>>>>> UPDATED prompt += "\n```\n" prompt += Path(fname).read_text() prompt += "\n```\n" return prompt ``` ```python aider/coder.py <<<<<<< ORIGINAL for fname in self.fnames: prompt += utils.quoted_file(fname) ======= for fname in self.fnames: relative_fname = os.path.relpath(fname, self.root) prompt += utils.quoted_file(fname, relative_fname) >>>>>>> UPDATED return prompt ```
This commit is contained in:
parent
27324c39d8
commit
2339dd4803
2 changed files with 4 additions and 3 deletions
|
@ -132,7 +132,8 @@ class Coder:
|
|||
def get_files_content(self):
|
||||
prompt = ""
|
||||
for fname in self.fnames:
|
||||
prompt += utils.quoted_file(fname)
|
||||
relative_fname = os.path.relpath(fname, self.root)
|
||||
prompt += utils.quoted_file(fname, relative_fname)
|
||||
return prompt
|
||||
|
||||
def get_last_modified(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue