mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 22:34:59 +00:00
For /help, turn down the repo map
This commit is contained in:
parent
66f7cfb38f
commit
e4c637724f
3 changed files with 12 additions and 3 deletions
|
@ -231,6 +231,7 @@ class Coder:
|
|||
attribute_committer=True,
|
||||
attribute_commit_message=False,
|
||||
aider_commit_hashes=None,
|
||||
map_mul_no_files=8,
|
||||
):
|
||||
if not fnames:
|
||||
fnames = []
|
||||
|
@ -323,6 +324,7 @@ class Coder:
|
|||
if not self.repo:
|
||||
self.find_common_root()
|
||||
|
||||
max_inp_tokens = self.main_model.info.get("max_input_tokens") or 0
|
||||
if main_model.use_repo_map and self.repo and self.gpt_prompts.repo_content_prefix:
|
||||
self.repo_map = RepoMap(
|
||||
map_tokens,
|
||||
|
@ -331,7 +333,8 @@ class Coder:
|
|||
io,
|
||||
self.gpt_prompts.repo_content_prefix,
|
||||
self.verbose,
|
||||
self.main_model.info.get("max_input_tokens"),
|
||||
max_inp_tokens,
|
||||
map_mul_no_files=map_mul_no_files,
|
||||
)
|
||||
|
||||
if max_chat_history_tokens is None:
|
||||
|
|
|
@ -662,6 +662,8 @@ class Commands:
|
|||
from_coder=self.coder,
|
||||
edit_format="help",
|
||||
summarize_from_coder=False,
|
||||
map_tokens=512,
|
||||
map_mul_no_files=1,
|
||||
)
|
||||
user_msg = self.help.ask(args)
|
||||
user_msg += """
|
||||
|
|
|
@ -41,6 +41,7 @@ class RepoMap:
|
|||
repo_content_prefix=None,
|
||||
verbose=False,
|
||||
max_context_window=None,
|
||||
map_mul_no_files=8,
|
||||
):
|
||||
self.io = io
|
||||
self.verbose = verbose
|
||||
|
@ -52,6 +53,7 @@ class RepoMap:
|
|||
self.load_tags_cache()
|
||||
|
||||
self.max_map_tokens = map_tokens
|
||||
self.map_mul_no_files = map_mul_no_files
|
||||
self.max_context_window = max_context_window
|
||||
|
||||
self.token_count = main_model.token_count
|
||||
|
@ -70,10 +72,12 @@ class RepoMap:
|
|||
max_map_tokens = self.max_map_tokens
|
||||
|
||||
# With no files in the chat, give a bigger view of the entire repo
|
||||
MUL = 8
|
||||
padding = 4096
|
||||
if max_map_tokens and self.max_context_window:
|
||||
target = min(max_map_tokens * MUL, self.max_context_window - padding)
|
||||
target = min(
|
||||
max_map_tokens * self.map_mul_no_files,
|
||||
self.max_context_window - padding,
|
||||
)
|
||||
else:
|
||||
target = 0
|
||||
if not chat_files and self.max_context_window and target > 0:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue