mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 09:14:59 +00:00
wip: Changed the prompt messages and added a function to show messages.
This commit is contained in:
parent
e4d38f89bb
commit
d4845dfb43
3 changed files with 13 additions and 10 deletions
|
@ -164,8 +164,7 @@ class Coder:
|
||||||
all_content = files_content
|
all_content = files_content
|
||||||
|
|
||||||
if self.repo is not None:
|
if self.repo is not None:
|
||||||
tracked_files = set(self.repo.git.ls_files().splitlines())
|
files_listing = get_tags_map(self.get_all_abs_files())
|
||||||
files_listing = "\n".join(tracked_files)
|
|
||||||
repo_content = prompts.repo_content_prefix
|
repo_content = prompts.repo_content_prefix
|
||||||
repo_content += files_listing
|
repo_content += files_listing
|
||||||
|
|
||||||
|
@ -180,6 +179,7 @@ class Coder:
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
utils.show_messages(messages, "FILES")
|
||||||
return files_messages
|
return files_messages
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
|
@ -6,10 +6,13 @@ import subprocess
|
||||||
# from aider.dump import dump
|
# from aider.dump import dump
|
||||||
|
|
||||||
|
|
||||||
def get_tags_map(filenames):
|
def get_tags_map(filenames, root_dname=None):
|
||||||
|
if not root_dname:
|
||||||
|
root_dname = os.getcwd()
|
||||||
|
|
||||||
tags = []
|
tags = []
|
||||||
for filename in filenames:
|
for filename in filenames:
|
||||||
tags += get_tags(filename)
|
tags += get_tags(filename, root_dname)
|
||||||
if not tags:
|
if not tags:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -32,16 +35,16 @@ def get_tags_map(filenames):
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
def split_path(path):
|
def split_path(path, root_dname):
|
||||||
path = os.path.relpath(path, os.getcwd())
|
path = os.path.relpath(path, root_dname)
|
||||||
path_components = path.split(os.sep)
|
path_components = path.split(os.sep)
|
||||||
res = [pc + os.sep for pc in path_components[:-1]]
|
res = [pc + os.sep for pc in path_components[:-1]]
|
||||||
res.append(path_components[-1])
|
res.append(path_components[-1])
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
def get_tags(filename):
|
def get_tags(filename, root_dname):
|
||||||
yield split_path(filename)
|
yield split_path(filename, root_dname)
|
||||||
|
|
||||||
cmd = ["ctags", "--fields=+S", "--output-format=json", filename]
|
cmd = ["ctags", "--fields=+S", "--output-format=json", filename]
|
||||||
output = subprocess.check_output(cmd).decode("utf-8")
|
output = subprocess.check_output(cmd).decode("utf-8")
|
||||||
|
|
|
@ -79,10 +79,10 @@ files_content_gpt_no_edits = "I wasn't able to see any properly formatted edits
|
||||||
|
|
||||||
files_content_local_edits = "I made some changes to the files myself."
|
files_content_local_edits = "I made some changes to the files myself."
|
||||||
|
|
||||||
repo_content_prefix = "These are the files in the git repo:\n\n"
|
repo_content_prefix = "Here is a map showing all the other files and their content:\n\n"
|
||||||
|
|
||||||
files_content_prefix = (
|
files_content_prefix = (
|
||||||
"These are the *ONLY* files you can propose changes to (ask if you need to see others):\n\n"
|
"You can propose changes to *only* these files (ask if you need to see others):\n\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
files_content_suffix = (
|
files_content_suffix = (
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue