Merge branch 'main' into call-graph

This commit is contained in:
Paul Gauthier 2023-06-01 09:07:26 -07:00
commit 3c9991b38f
2 changed files with 15 additions and 5 deletions

View file

@ -93,7 +93,12 @@ class Coder:
self.pretty = pretty self.pretty = pretty
self.show_diffs = show_diffs 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): def find_common_root(self):
if self.abs_fnames: if self.abs_fnames:

View file

@ -59,7 +59,9 @@ class RepoMap:
IDENT_CACHE_FILE = ".aider.ident.cache" IDENT_CACHE_FILE = ".aider.ident.cache"
TAGS_CACHE_FILE = ".aider.tags.cache" TAGS_CACHE_FILE = ".aider.tags.cache"
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: if not root:
root = os.getcwd() root = os.getcwd()
self.root = root self.root = root
@ -103,14 +105,17 @@ class RepoMap:
if self.use_ctags: if self.use_ctags:
files_listing = self.get_tags_map(other_files) files_listing = self.get_tags_map(other_files)
tokens = self.token_count(files_listing) num_tokens = self.token_count(files_listing)
if tokens < max_map_tokens: 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" ctags_msg = " with selected ctags info"
return files_listing, ctags_msg return files_listing, ctags_msg
files_listing = self.get_simple_files_map(other_files) files_listing = self.get_simple_files_map(other_files)
ctags_msg = "" 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 return files_listing, ctags_msg
def get_simple_files_map(self, other_files): def get_simple_files_map(self, other_files):