mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 22:34:59 +00:00
wip
This commit is contained in:
parent
fb8ed21b13
commit
f256b43043
8 changed files with 34 additions and 33 deletions
|
@ -338,6 +338,12 @@ def get_parser(default_config_files, git_root):
|
|||
help="Print the repo map and exit (debug)",
|
||||
default=False,
|
||||
)
|
||||
group.add_argument(
|
||||
"--show-prompts",
|
||||
action="store_true",
|
||||
help="Print the system prompts and exit (debug)",
|
||||
default=False,
|
||||
)
|
||||
group.add_argument(
|
||||
"--message",
|
||||
"--msg",
|
||||
|
|
|
@ -415,6 +415,7 @@ class Coder:
|
|||
all_content = ""
|
||||
|
||||
repo_content = self.get_repo_map()
|
||||
|
||||
if repo_content:
|
||||
if all_content:
|
||||
all_content += "\n"
|
||||
|
|
|
@ -13,3 +13,13 @@ You always COMPLETELY IMPLEMENT the needed code!
|
|||
"""
|
||||
|
||||
example_messages = []
|
||||
|
||||
files_content_prefix = "These are files that you can edit:\n"
|
||||
|
||||
files_no_full_files = "I am not sharing any files that you can edit yet."
|
||||
|
||||
repo_content_prefix = """I'm discussing files that are part of a git repository.
|
||||
Here are summaries of some files present in my git repo.
|
||||
Do not propose changes to these files, treat them as *read-only*.
|
||||
If you need to edit one of them, ask me to *add it to the chat* first.
|
||||
"""
|
||||
|
|
|
@ -12,7 +12,7 @@ Take requests for changes to the supplied code.
|
|||
If the request is ambiguous, ask questions.
|
||||
|
||||
Once you understand the request you MUST:
|
||||
1. List the files you need to modify. Only suggest changes to a *read-write* files. Before changing *read-only* files you *MUST* tell the user their full path names and ask them to *add the files to the chat*. End your reply and wait for their approval.
|
||||
1. List the files you need to modify. Only suggest changes to files that the user has given you permission to edit.
|
||||
2. Think step-by-step and explain the needed changes with a numbered list of short sentences.
|
||||
3. Describe each change with a *SEARCH/REPLACE block* per the examples below. All changes to files must use this *SEARCH/REPLACE block* format. ONLY EVER RETURN CODE IN A *SEARCH/REPLACE BLOCK*!
|
||||
|
||||
|
@ -125,7 +125,7 @@ Every *SEARCH* section must *EXACTLY MATCH* the existing source code, character
|
|||
|
||||
Include *ALL* the code being searched and replaced!
|
||||
|
||||
Only *SEARCH/REPLACE* files that are *read-write*.
|
||||
Only *SEARCH/REPLACE* files that the user has given you permission to edit.
|
||||
|
||||
To move code within a file, use 2 *SEARCH/REPLACE* blocks: 1 to delete it from its current location, 1 to insert it in the new location.
|
||||
|
||||
|
@ -136,13 +136,4 @@ If you want to put code in a new file, use a *SEARCH/REPLACE block* with:
|
|||
|
||||
{lazy_prompt}
|
||||
ONLY EVER RETURN CODE IN A *SEARCH/REPLACE BLOCK*!
|
||||
"""
|
||||
|
||||
files_content_prefix = "These are the *read-write* files:\n"
|
||||
|
||||
files_no_full_files = "I am not sharing any *read-write* files yet."
|
||||
|
||||
repo_content_prefix = """Below here are summaries of files present in the user's git repository.
|
||||
Do not propose changes to these files, they are *read-only*.
|
||||
To make a file *read-write*, ask the user to *add it to the chat*.
|
||||
"""
|
||||
|
|
|
@ -105,13 +105,4 @@ To move code within a file, use 2 hunks: 1 to delete it from its current locatio
|
|||
To make a new file, show a diff from `--- /dev/null` to `+++ path/to/new/file.ext`.
|
||||
|
||||
{lazy_prompt}
|
||||
"""
|
||||
|
||||
files_content_prefix = "These are the *read-write* files:\n"
|
||||
|
||||
files_no_full_files = "I am not sharing any *read-write* files yet."
|
||||
|
||||
repo_content_prefix = """Below here are summaries of some files present in this git repository.
|
||||
Do not propose changes to these files, they are *read-only*.
|
||||
To make a file *read-write*, ask the user to *add it to the chat*.
|
||||
"""
|
||||
|
|
|
@ -61,14 +61,4 @@ Create a new file you MUST return a *file listing* which includes an appropriate
|
|||
{lazy_prompt}
|
||||
"""
|
||||
|
||||
files_content_prefix = "Here is the current content of the files:\n"
|
||||
files_no_full_files = "I am not sharing any files yet."
|
||||
|
||||
redacted_edit_message = "No changes are needed."
|
||||
|
||||
# this coder is not able to handle repo content
|
||||
repo_content_prefix = None
|
||||
|
||||
repo_content_prefix = """Below here are summaries of files present in the user's git repository.
|
||||
Do not propose changes to these files, they are *read-only*.
|
||||
"""
|
||||
|
|
|
@ -7,7 +7,7 @@ import git
|
|||
from dotenv import load_dotenv
|
||||
from streamlit.web import cli
|
||||
|
||||
from aider import __version__, models
|
||||
from aider import __version__, models, utils
|
||||
from aider.args import get_parser
|
||||
from aider.coders import Coder
|
||||
from aider.commands import SwitchModel
|
||||
|
@ -341,6 +341,11 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
|
|||
|
||||
coder.show_announcements()
|
||||
|
||||
if args.show_prompts:
|
||||
messages = coder.format_messages()
|
||||
utils.show_messages(messages)
|
||||
return
|
||||
|
||||
if args.commit:
|
||||
coder.commands.cmd_commit("")
|
||||
return
|
||||
|
|
|
@ -68,6 +68,9 @@ class RepoMap:
|
|||
self.io.tool_error("Disabling repo map, git repo too large?")
|
||||
self.max_map_tokens = 0
|
||||
return
|
||||
|
||||
dump(chat_files, other_files)
|
||||
dump(files_listing)
|
||||
if not files_listing:
|
||||
return
|
||||
|
||||
|
@ -87,6 +90,7 @@ class RepoMap:
|
|||
|
||||
repo_content += files_listing
|
||||
|
||||
dump(repo_content)
|
||||
return repo_content
|
||||
|
||||
def get_rel_fname(self, fname):
|
||||
|
@ -258,8 +262,8 @@ class RepoMap:
|
|||
references[tag.name].append(rel_fname)
|
||||
|
||||
##
|
||||
# dump(defines)
|
||||
# dump(references)
|
||||
dump(defines)
|
||||
dump(references)
|
||||
|
||||
if not references:
|
||||
references = dict((k, list(v)) for k, v in defines.items())
|
||||
|
@ -287,6 +291,7 @@ class RepoMap:
|
|||
try:
|
||||
ranked = nx.pagerank(G, weight="weight", **pers_args)
|
||||
except ZeroDivisionError:
|
||||
dump(ZeroDivisionError)
|
||||
return []
|
||||
|
||||
# distribute the rank from each source node, across all of its out edges
|
||||
|
@ -334,6 +339,8 @@ class RepoMap:
|
|||
ranked_tags = self.get_ranked_tags(chat_fnames, other_fnames)
|
||||
num_tags = len(ranked_tags)
|
||||
|
||||
dump(num_tags)
|
||||
|
||||
lower_bound = 0
|
||||
upper_bound = num_tags
|
||||
best_tree = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue