Added a ChatSummary object to Coder class and used it to summarize chat history.

This commit is contained in:
Paul Gauthier 2023-07-22 10:34:48 -03:00
parent 0d0ac4f61f
commit c26917851f
2 changed files with 5 additions and 3 deletions

View file

@ -9,7 +9,7 @@ from aider.sendchat import simple_send_with_retries
class ChatSummary:
def __init__(self, model, max_tokens=1024):
def __init__(self, model=models.GPT35.name, max_tokens=1024):
self.tokenizer = tiktoken.encoding_for_model(model)
self.max_tokens = max_tokens
@ -38,7 +38,6 @@ class ChatSummary:
head = messages[:num]
tail = messages[num:]
print("=" * 20)
summary = self.summarize_all(head)
tail_tokens = sum(tokens for tokens, msg in sized[num:])