mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 08:14:59 +00:00
Added --verbose support to repomap
This commit is contained in:
parent
e43a48ee10
commit
7bc26e6762
2 changed files with 15 additions and 4 deletions
|
@ -93,7 +93,12 @@ class Coder:
|
|||
self.pretty = pretty
|
||||
self.show_diffs = show_diffs
|
||||
|
||||
self.repo_map = RepoMap(use_ctags, self.root, self.main_model)
|
||||
if self.verbose:
|
||||
rm_io = io
|
||||
else:
|
||||
rm_io = None
|
||||
|
||||
self.repo_map = RepoMap(use_ctags, self.root, self.main_model, rm_io)
|
||||
|
||||
def find_common_root(self):
|
||||
if self.abs_fnames:
|
||||
|
|
|
@ -49,7 +49,9 @@ class RepoMap:
|
|||
ctags_cmd = ["ctags", "--fields=+S", "--extras=-F", "--output-format=json"]
|
||||
TAGS_CACHE = None
|
||||
|
||||
def __init__(self, use_ctags=None, root=None, main_model="gpt-4"):
|
||||
def __init__(self, use_ctags=None, root=None, main_model="gpt-4", io=None):
|
||||
self.io = io
|
||||
|
||||
if not root:
|
||||
root = os.getcwd()
|
||||
self.root = root
|
||||
|
@ -92,13 +94,17 @@ class RepoMap:
|
|||
|
||||
if self.use_ctags:
|
||||
files_listing = self.get_tags_map(other_files)
|
||||
if self.token_count(files_listing) < max_map_tokens:
|
||||
num_tokens = self.token_count(files_listing)
|
||||
self.io.tool_output(f"ctags map: {num_tokens/1024:.1f} k-tokens")
|
||||
if num_tokens < max_map_tokens:
|
||||
ctags_msg = " with selected ctags info"
|
||||
return files_listing, ctags_msg
|
||||
|
||||
files_listing = self.get_simple_files_map(other_files)
|
||||
ctags_msg = ""
|
||||
if self.token_count(files_listing) < max_map_tokens:
|
||||
num_tokens = self.token_count(files_listing)
|
||||
self.io.tool_output(f"simple map: {num_tokens/1024:.1f} k-tokens")
|
||||
if num_tokens < max_map_tokens:
|
||||
return files_listing, ctags_msg
|
||||
|
||||
def get_simple_files_map(self, other_files):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue