use ~/.aider/caches

This commit is contained in:
Paul Gauthier 2024-07-05 10:06:23 -03:00
parent 3d51102de5
commit 81195dad02
2 changed files with 4 additions and 5 deletions

View file

@ -63,7 +63,7 @@ def get_index():
) )
from llama_index.core.node_parser import MarkdownNodeParser from llama_index.core.node_parser import MarkdownNodeParser
dname = Path.home() / ".aider" / ("help." + __version__) dname = Path.home() / ".aider" / "caches" / ("help." + __version__)
if dname.exists(): if dname.exists():
storage_context = StorageContext.from_defaults( storage_context = StorageContext.from_defaults(
@ -90,7 +90,7 @@ def get_index():
nodes += parser.get_nodes_from_documents([doc]) nodes += parser.get_nodes_from_documents([doc])
index = VectorStoreIndex(nodes, show_progress=True) index = VectorStoreIndex(nodes, show_progress=True)
dname.parent.mkdir(exist_ok=True) dname.parent.mkdir(parents=True, exist_ok=True)
index.storage_context.persist(dname) index.storage_context.persist(dname)
return index return index

View file

@ -8,7 +8,7 @@ import aider
def check_version(print_cmd): def check_version(print_cmd):
fname = Path.home() / ".aider/versioncheck" fname = Path.home() / ".aider" / "caches" / "versioncheck"
day = 60 * 60 * 24 day = 60 * 60 * 24
if fname.exists() and time.time() - fname.stat().st_mtime < day: if fname.exists() and time.time() - fname.stat().st_mtime < day:
return return
@ -35,8 +35,7 @@ def check_version(print_cmd):
else: else:
print_cmd(f"{py} -m pip install --upgrade aider-chat") print_cmd(f"{py} -m pip install --upgrade aider-chat")
if not fname.parent.exists(): fname.parent.mkdir(parents=True, exist_ok=True)
fname.parent.mkdir()
fname.touch() fname.touch()
return is_update_available return is_update_available
except Exception as err: except Exception as err: