Improve messaging about universal ctags

This commit is contained in:
Paul Gauthier 2023-06-14 16:12:51 -07:00
parent be34086ac0
commit ce8069196c
2 changed files with 12 additions and 6 deletions

View file

@ -117,8 +117,12 @@ class Coder:
self.gpt_prompts.repo_content_prefix, self.gpt_prompts.repo_content_prefix,
) )
if self.repo_map.has_ctags: if self.repo_map.use_ctags:
self.io.tool_output("Using ctags to build repo-map.") self.io.tool_output("Using universal-ctags to build repo-map.")
elif not self.repo_map.has_ctags and map_tokens > 0:
self.io.tool_output("Can't find universal-ctags, using basic repo-map.")
else:
self.io.tool_output("Not using repo map.")
for fname in self.get_inchat_relative_files(): for fname in self.get_inchat_relative_files():
self.io.tool_output(f"Added {fname} to the chat.") self.io.tool_output(f"Added {fname} to the chat.")

View file

@ -83,10 +83,12 @@ class RepoMap:
self.load_tags_cache() self.load_tags_cache()
self.max_map_tokens = map_tokens self.max_map_tokens = map_tokens
if map_tokens > 0: self.has_ctags = self.check_for_ctags()
self.has_ctags = self.check_for_ctags()
if map_tokens > 0 and self.has_ctags:
self.use_ctags = True
else: else:
self.has_ctags = False self.use_ctags = False
self.tokenizer = tiktoken.encoding_for_model(main_model.name) self.tokenizer = tiktoken.encoding_for_model(main_model.name)
self.repo_content_prefix = repo_content_prefix self.repo_content_prefix = repo_content_prefix
@ -122,7 +124,7 @@ class RepoMap:
if not other_files: if not other_files:
return return
if self.has_ctags: if self.use_ctags:
files_listing = self.get_ranked_tags_map(chat_files, other_files) files_listing = self.get_ranked_tags_map(chat_files, other_files)
if files_listing: if files_listing:
num_tokens = self.token_count(files_listing) num_tokens = self.token_count(files_listing)