From a4a606685862b5c02968a68a9fd5c7ae86de0a18 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Thu, 23 May 2024 13:46:08 -0700 Subject: [PATCH] handle missing max_map_tokens/max_context_window --- aider/repomap.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/aider/repomap.py b/aider/repomap.py index 2e7169f01..4893379f3 100644 --- a/aider/repomap.py +++ b/aider/repomap.py @@ -72,7 +72,10 @@ class RepoMap: # With no files in the chat, give a bigger view of the entire repo MUL = 16 padding = 4096 - target = min(max_map_tokens * MUL, self.max_context_window - padding) + if max_map_tokens and self.max_context_window: + target = min(max_map_tokens * MUL, self.max_context_window - padding) + else: + target = 0 if not chat_files and self.max_context_window and target > 0: max_map_tokens = target