feat: Add a dictionary to cache abs_root_path results

This commit is contained in:
Paul Gauthier (aider) 2024-08-05 16:28:44 -03:00
parent b654a16b48
commit a864ab9888

View file

@ -71,6 +71,7 @@ class Coder:
test_outcome = None
multi_response_content = ""
rejected_urls = set()
abs_root_path_cache = {}
@classmethod
def create(
@ -397,8 +398,10 @@ class Coder:
return True
def abs_root_path(self, path):
if path not in self.abs_root_path_cache:
res = Path(self.root) / path
return utils.safe_abs_path(res)
self.abs_root_path_cache[path] = utils.safe_abs_path(res)
return self.abs_root_path_cache[path]
fences = [
("``" + "`", "``" + "`"),