mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-26 22:45:00 +00:00
feat: better place to create history file dirs (InputOutput ctr)
this decreases number of IO operations
This commit is contained in:
parent
52d04430db
commit
f695e71398
1 changed files with 2 additions and 2 deletions
|
@ -308,9 +308,11 @@ class InputOutput:
|
||||||
self.yes = yes
|
self.yes = yes
|
||||||
|
|
||||||
self.input_history_file = input_history_file
|
self.input_history_file = input_history_file
|
||||||
|
Path(self.input_history_file).parent.mkdir(parents=True, exist_ok=True)
|
||||||
self.llm_history_file = llm_history_file
|
self.llm_history_file = llm_history_file
|
||||||
if chat_history_file is not None:
|
if chat_history_file is not None:
|
||||||
self.chat_history_file = Path(chat_history_file)
|
self.chat_history_file = Path(chat_history_file)
|
||||||
|
self.chat_history_file.parent.mkdir(parents=True, exist_ok=True)
|
||||||
else:
|
else:
|
||||||
self.chat_history_file = None
|
self.chat_history_file = None
|
||||||
|
|
||||||
|
@ -731,7 +733,6 @@ class InputOutput:
|
||||||
if not self.input_history_file:
|
if not self.input_history_file:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
Path(self.input_history_file).parent.mkdir(parents=True, exist_ok=True)
|
|
||||||
FileHistory(self.input_history_file).append_string(inp)
|
FileHistory(self.input_history_file).append_string(inp)
|
||||||
# Also add to the in-memory history if it exists
|
# Also add to the in-memory history if it exists
|
||||||
if self.prompt_session and self.prompt_session.history:
|
if self.prompt_session and self.prompt_session.history:
|
||||||
|
@ -1117,7 +1118,6 @@ class InputOutput:
|
||||||
text += "\n"
|
text += "\n"
|
||||||
if self.chat_history_file is not None:
|
if self.chat_history_file is not None:
|
||||||
try:
|
try:
|
||||||
self.chat_history_file.parent.mkdir(parents=True, exist_ok=True)
|
|
||||||
with self.chat_history_file.open("a", encoding=self.encoding, errors="ignore") as f:
|
with self.chat_history_file.open("a", encoding=self.encoding, errors="ignore") as f:
|
||||||
f.write(text)
|
f.write(text)
|
||||||
except (PermissionError, OSError) as err:
|
except (PermissionError, OSError) as err:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue