mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 22:34:59 +00:00
Only expand the repomap if we know it will fit into context window
This commit is contained in:
parent
449cbf507f
commit
1effd73e80
2 changed files with 12 additions and 3 deletions
|
@ -310,6 +310,7 @@ class Coder:
|
|||
io,
|
||||
self.gpt_prompts.repo_content_prefix,
|
||||
self.verbose,
|
||||
self.main_model.info.get("max_input_tokens"),
|
||||
)
|
||||
|
||||
if max_chat_history_tokens is None:
|
||||
|
|
|
@ -40,6 +40,7 @@ class RepoMap:
|
|||
io=None,
|
||||
repo_content_prefix=None,
|
||||
verbose=False,
|
||||
max_context_window=None,
|
||||
):
|
||||
self.io = io
|
||||
self.verbose = verbose
|
||||
|
@ -51,6 +52,7 @@ class RepoMap:
|
|||
self.load_tags_cache()
|
||||
|
||||
self.max_map_tokens = map_tokens
|
||||
self.max_context_window = max_context_window
|
||||
|
||||
self.token_count = main_model.token_count
|
||||
self.repo_content_prefix = repo_content_prefix
|
||||
|
@ -66,9 +68,15 @@ class RepoMap:
|
|||
mentioned_idents = set()
|
||||
|
||||
max_map_tokens = self.max_map_tokens
|
||||
if not chat_files:
|
||||
# with no code in the chat, give a bigger view of the entire repo
|
||||
max_map_tokens *= 16
|
||||
|
||||
# With no files in the chat, give a bigger view of the entire repo
|
||||
MUL = 16
|
||||
if (
|
||||
not chat_files
|
||||
and self.max_context_window
|
||||
and max_map_tokens * MUL < (self.max_context_window - 2048)
|
||||
):
|
||||
max_map_tokens *= MUL
|
||||
|
||||
dump(max_map_tokens)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue