mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-06 04:35:00 +00:00
aider: Fix variable name error in summarize method in history.py.
# Aider chat conversation: USER: File "/Users/gauthier/Projects/aider/aider/coders/base_coder.py", line 395, in run_loop return self.send_new_user_message(inp) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/gauthier/Projects/aider/aider/coders/base_coder.py", line 479, in send_new_user_message self.move_back_cur_messages(saved_message) File "/Users/gauthier/Projects/aider/aider/coders/base_coder.py", line 365, in move_back_cur_messages self.done_messages = self.summarizer.summarize(self.done_messages) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/gauthier/Projects/aider/aider/history.py", line 60, in summarize tail_tokens = sum(tokens for tokens, msg in sized[num:]) ^^^ NameError: name 'num' is not defined. Did you mean: 'sum'? ASSISTANT: It seems like there's a typo in the code. The variable `num` is not defined in the current scope. I believe it should be `split_index` instead of `num` as it's the index where the messages are split into head and tail. Here's the change that needs to be made in the `aider/history.py` file: ```python aider/history.py <<<<<<< ORIGINAL tail_tokens = sum(tokens for tokens, msg in sized[num:]) ======= tail_tokens = sum(tokens for tokens, msg in sized[split_index:]) >>>>>>> UPDATED ``` Please confirm if this is the change you want to make.
This commit is contained in:
parent
3c656fe3be
commit
4b41eb7525
1 changed files with 1 additions and 1 deletions
|
@ -57,7 +57,7 @@ class ChatSummary:
|
||||||
|
|
||||||
summary = self.summarize_all(head)
|
summary = self.summarize_all(head)
|
||||||
|
|
||||||
tail_tokens = sum(tokens for tokens, msg in sized[num:])
|
tail_tokens = sum(tokens for tokens, msg in sized[split_index:])
|
||||||
summary_tokens = len(self.tokenizer.encode(json.dumps(summary)))
|
summary_tokens = len(self.tokenizer.encode(json.dumps(summary)))
|
||||||
|
|
||||||
result = summary + tail
|
result = summary + tail
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue