Merge pull request #591 from paul-gauthier/restore-chat-history

Restore prior chat history on launch
This commit is contained in:
paul-gauthier 2024-05-11 07:49:43 -07:00 committed by GitHub
commit 45b2ba8a10
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 68 additions and 29 deletions

View file

@ -165,6 +165,9 @@ class Coder:
for fname in self.get_inchat_relative_files():
lines.append(f"Added {fname} to the chat.")
if self.done_messages:
lines.append("Restored previous conversation history.")
return lines
def __init__(
@ -188,6 +191,7 @@ class Coder:
aider_ignore_file=None,
cur_messages=None,
done_messages=None,
max_chat_history_tokens=None,
):
if not fnames:
fnames = []
@ -282,14 +286,22 @@ class Coder:
self.verbose,
)
if max_chat_history_tokens is None:
max_chat_history_tokens = self.main_model.max_chat_history_tokens
self.summarizer = ChatSummary(
self.main_model.weak_model,
self.main_model.max_chat_history_tokens,
max_chat_history_tokens,
)
self.summarizer_thread = None
self.summarized_done_messages = []
if not self.done_messages:
history_md = self.io.read_text(self.io.chat_history_file)
if history_md:
self.done_messages = self.summarizer.split_chat_history_markdown(history_md)
self.summarize_start()
# validate the functions jsonschema
if self.functions:
for function in self.functions: