aider/aider
Paul Gauthier e51e0219ee aider: Add tqdm progress bar to summarize_chat_history_markdown loop.
# Aider chat conversation:

USER: add a tqdm to `summarize_chat_history_markdown` loop

ASSISTANT: ```diff
--- aider/history.py
+++ aider/history.py
@@ ... @@
 from aider.sendchat import simple_send_with_retries
+from tqdm import tqdm

 class ChatSummary:
     def __init__(self, model=None, max_tokens=1024):
@@ ... @@
     def summarize_chat_history_markdown(self, text):
         messages = []
         assistant = []
+        lines = text.splitlines(keepends=True)
+        for line in tqdm(lines, desc="Summarizing chat history"):
-        for line in text.splitlines(keepends=True):
             if line.startswith("# "):
                 continue
             if line.startswith(">"):
                 continue
             if line.startswith("#### /"):
                 continue

             if line.startswith("#### "):
                 if assistant:
                     assistant = "".join(assistant)
                     if assistant.strip():
                         messages.append(dict(role="assistant", content=assistant))
                     assistant = []

                 content = line[5:]
                 if content.strip() and content.strip() != "<blank>":
                     messages.append(dict(role="user", content=line[5:]))
                 continue

             assistant.append(line)

         summary = self.summarize(messages[-40:])
         return summary
```

This diff adds the `tqdm` progress bar to the `summarize_chat_history_markdown` method in the `aider/history.py` file. It wraps the loop that processes the chat history lines with `tqdm`, providing a description for the progress bar.
2024-05-06 09:31:32 -07:00
..
coders pass max_chat_history_tokens into ChatSummary 2024-05-06 09:29:21 -07:00
queries fix(tree-sitter-typescript-tags.scm): Add additional queries. 2024-03-04 15:03:55 -07:00
__init__.py set version to 0.31.2-dev 2024-05-02 12:50:18 -07:00
args.py aider: Added a --max-chat-history-tokens switch and passed it to ChatSummary in Coder. 2024-05-06 09:23:37 -07:00
commands.py added autocomplete for model names 2024-04-30 16:29:10 -07:00
diffs.py use utf-8 2023-07-05 20:51:35 -07:00
dump.py isort 2023-05-28 22:47:38 -07:00
gui.py browser blog post 2024-05-02 10:39:33 -07:00
history.py aider: Add tqdm progress bar to summarize_chat_history_markdown loop. 2024-05-06 09:31:32 -07:00
io.py Remove unnecessary comment and method call in Commands class. 2023-12-11 22:24:02 +13:00
main.py aider: Added max_chat_history_tokens as an explicit argument to the Coder.__init__ method and passed args.max_chat_history_tokens when creating the Coder instance in main(). 2024-05-06 09:25:04 -07:00
mdstream.py catch shutdown errors 2024-01-23 10:45:58 -08:00
models.py gpt-4-0314 with examples as sys 2024-05-04 07:52:22 -07:00
prompts.py On /undo, ask GPT to wait before retrying the changes #450 2024-01-22 13:05:38 -08:00
repo.py Do not require gpt-3.5 in GitRepo 2024-04-20 09:47:43 -07:00
repomap.py cleanup 2024-04-19 12:14:58 -07:00
scrape.py added docstrings 2024-05-01 15:14:14 -07:00
sendchat.py max_time not max_tries 2024-05-04 17:48:01 -07:00
utils.py Tell the AI we are switching code bases 2024-04-30 20:51:24 -07:00
versioncheck.py aider: Add --check-update to make aider check for update and return status in the exit code. 2024-01-04 12:27:31 -08:00
voice.py Quiet litellm 2024-04-23 10:37:43 -07:00