handle missing max_map_tokens/max_context_window

This commit is contained in:
Paul Gauthier 2024-05-23 13:46:08 -07:00
parent 6345cd3734
commit a4a6066858

View file

@ -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