mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-03 19:24:59 +00:00
refactor to use io.read_text
This commit is contained in:
parent
5f9947a727
commit
9cab570f87
2 changed files with 19 additions and 22 deletions
|
@ -1,24 +1,6 @@
|
|||
from pathlib import Path
|
||||
|
||||
from .dump import dump # noqa: F401
|
||||
|
||||
|
||||
def quoted_file(fname, display_fname, fence=("```", "```"), number=False):
|
||||
prompt = "\n"
|
||||
prompt += display_fname
|
||||
prompt += f"\n{fence[0]}\n"
|
||||
|
||||
file_content = Path(fname).read_text()
|
||||
lines = file_content.splitlines()
|
||||
for i, line in enumerate(lines, start=1):
|
||||
if number:
|
||||
prompt += f"{i:4d} "
|
||||
prompt += line + "\n"
|
||||
|
||||
prompt += f"{fence[1]}\n"
|
||||
return prompt
|
||||
|
||||
|
||||
def show_messages(messages, title=None, functions=None):
|
||||
if title:
|
||||
print(title.upper(), "*" * 50)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue