From 8326bd04dda90ac6c876199e1e8f3136ed7170fe Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Sat, 17 Aug 2024 06:46:18 -0700 Subject: [PATCH] feat: Add --cache-prompts bool option, default false --- aider/args.py | 6 ++++++ aider/main.py | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/aider/args.py b/aider/args.py index ab1839c41..71d42e34d 100644 --- a/aider/args.py +++ b/aider/args.py @@ -207,6 +207,12 @@ def get_parser(default_config_files, git_root): default="auto", help="Control when the repo map is refreshed (default: auto)", ) + group.add_argument( + "--cache-prompts", + action=argparse.BooleanOptionalAction, + default=False, + help="Enable caching of prompts (forces map_refresh='files') (default: False)", + ) group.add_argument( "--max-chat-history-tokens", type=int, diff --git a/aider/main.py b/aider/main.py index 44ba4e604..b5045cfe8 100644 --- a/aider/main.py +++ b/aider/main.py @@ -508,6 +508,9 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F ) try: + if args.cache_prompts: + args.map_refresh = "files" + coder = Coder.create( main_model=main_model, edit_format=args.edit_format, @@ -533,6 +536,7 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F commands=commands, summarizer=summarizer, map_refresh=args.map_refresh, + cache_prompts=args.cache_prompts, ) except ValueError as err: