mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 17:24:59 +00:00
Merge 3e5388ce6e
into 3caab85931
This commit is contained in:
commit
19002a4f5b
4 changed files with 28 additions and 8 deletions
|
@ -262,6 +262,16 @@ def get_parser(default_config_files, git_root):
|
||||||
default=2,
|
default=2,
|
||||||
help="Multiplier for map tokens when no files are specified (default: 2)",
|
help="Multiplier for map tokens when no files are specified (default: 2)",
|
||||||
)
|
)
|
||||||
|
group.add_argument(
|
||||||
|
"--map-cache-dir",
|
||||||
|
metavar="MAP_CACHE_DIR",
|
||||||
|
dest="map_cache_dir",
|
||||||
|
default=".",
|
||||||
|
help=(
|
||||||
|
"Directory for the repository map cache .aider.tags.cache.v3"
|
||||||
|
" (default: current directory)"
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
##########
|
##########
|
||||||
group = parser.add_argument_group("History Files")
|
group = parser.add_argument_group("History Files")
|
||||||
|
@ -553,7 +563,7 @@ def get_parser(default_config_files, git_root):
|
||||||
help="Run tests, fix problems found and then exit",
|
help="Run tests, fix problems found and then exit",
|
||||||
default=False,
|
default=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
##########
|
##########
|
||||||
group = parser.add_argument_group("Analytics")
|
group = parser.add_argument_group("Analytics")
|
||||||
group.add_argument(
|
group.add_argument(
|
||||||
|
|
|
@ -335,7 +335,11 @@ class Coder:
|
||||||
file_watcher=None,
|
file_watcher=None,
|
||||||
auto_copy_context=False,
|
auto_copy_context=False,
|
||||||
auto_accept_architect=True,
|
auto_accept_architect=True,
|
||||||
|
map_cache_dir='.',
|
||||||
):
|
):
|
||||||
|
# initialize from args.map_cache_dir
|
||||||
|
self.map_cache_dir = map_cache_dir
|
||||||
|
|
||||||
# Fill in a dummy Analytics if needed, but it is never .enable()'d
|
# Fill in a dummy Analytics if needed, but it is never .enable()'d
|
||||||
self.analytics = analytics if analytics is not None else Analytics()
|
self.analytics = analytics if analytics is not None else Analytics()
|
||||||
|
|
||||||
|
@ -492,7 +496,7 @@ class Coder:
|
||||||
if use_repo_map and self.repo and has_map_prompt:
|
if use_repo_map and self.repo and has_map_prompt:
|
||||||
self.repo_map = RepoMap(
|
self.repo_map = RepoMap(
|
||||||
map_tokens,
|
map_tokens,
|
||||||
self.root,
|
self.map_cache_dir,
|
||||||
self.main_model,
|
self.main_model,
|
||||||
io,
|
io,
|
||||||
self.gpt_prompts.repo_content_prefix,
|
self.gpt_prompts.repo_content_prefix,
|
||||||
|
|
|
@ -996,6 +996,7 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
|
||||||
detect_urls=args.detect_urls,
|
detect_urls=args.detect_urls,
|
||||||
auto_copy_context=args.copy_paste,
|
auto_copy_context=args.copy_paste,
|
||||||
auto_accept_architect=args.auto_accept_architect,
|
auto_accept_architect=args.auto_accept_architect,
|
||||||
|
map_cache_dir=args.map_cache_dir,
|
||||||
)
|
)
|
||||||
except UnknownEditFormat as err:
|
except UnknownEditFormat as err:
|
||||||
io.tool_error(str(err))
|
io.tool_error(str(err))
|
||||||
|
|
|
@ -46,7 +46,7 @@ class RepoMap:
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
map_tokens=1024,
|
map_tokens=1024,
|
||||||
root=None,
|
map_cache_dir='.',
|
||||||
main_model=None,
|
main_model=None,
|
||||||
io=None,
|
io=None,
|
||||||
repo_content_prefix=None,
|
repo_content_prefix=None,
|
||||||
|
@ -59,9 +59,8 @@ class RepoMap:
|
||||||
self.verbose = verbose
|
self.verbose = verbose
|
||||||
self.refresh = refresh
|
self.refresh = refresh
|
||||||
|
|
||||||
if not root:
|
self.map_cache_dir = map_cache_dir
|
||||||
root = os.getcwd()
|
self.root = os.getcwd()
|
||||||
self.root = root
|
|
||||||
|
|
||||||
self.load_tags_cache()
|
self.load_tags_cache()
|
||||||
self.cache_threshold = 0.95
|
self.cache_threshold = 0.95
|
||||||
|
@ -84,6 +83,12 @@ class RepoMap:
|
||||||
self.io.tool_output(
|
self.io.tool_output(
|
||||||
f"RepoMap initialized with map_mul_no_files: {self.map_mul_no_files}"
|
f"RepoMap initialized with map_mul_no_files: {self.map_mul_no_files}"
|
||||||
)
|
)
|
||||||
|
self.io.tool_output(
|
||||||
|
f"RepoMap initialized with map_cache_dir: {self.map_cache_dir}"
|
||||||
|
)
|
||||||
|
self.io.tool_output(
|
||||||
|
f"RepoMap assumes repo root is: {self.root}"
|
||||||
|
)
|
||||||
|
|
||||||
def token_count(self, text):
|
def token_count(self, text):
|
||||||
len_text = len(text)
|
len_text = len(text)
|
||||||
|
@ -182,7 +187,7 @@ class RepoMap:
|
||||||
if isinstance(getattr(self, "TAGS_CACHE", None), dict):
|
if isinstance(getattr(self, "TAGS_CACHE", None), dict):
|
||||||
return
|
return
|
||||||
|
|
||||||
path = Path(self.root) / self.TAGS_CACHE_DIR
|
path = Path(self.map_cache_dir) / self.TAGS_CACHE_DIR
|
||||||
|
|
||||||
# Try to recreate the cache
|
# Try to recreate the cache
|
||||||
try:
|
try:
|
||||||
|
@ -214,7 +219,7 @@ class RepoMap:
|
||||||
self.TAGS_CACHE = dict()
|
self.TAGS_CACHE = dict()
|
||||||
|
|
||||||
def load_tags_cache(self):
|
def load_tags_cache(self):
|
||||||
path = Path(self.root) / self.TAGS_CACHE_DIR
|
path = Path(self.map_cache_dir) / self.TAGS_CACHE_DIR
|
||||||
try:
|
try:
|
||||||
self.TAGS_CACHE = Cache(path)
|
self.TAGS_CACHE = Cache(path)
|
||||||
except SQLITE_ERRORS as e:
|
except SQLITE_ERRORS as e:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue