mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 00:35:00 +00:00
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.
This commit is contained in:
parent
64470955d4
commit
e51e0219ee
1 changed files with 3 additions and 1 deletions
|
@ -4,6 +4,7 @@ from aider import models, prompts
|
|||
from aider.dump import dump # noqa: F401
|
||||
from aider.sendchat import simple_send_with_retries
|
||||
|
||||
from tqdm import tqdm
|
||||
|
||||
class ChatSummary:
|
||||
def __init__(self, model=None, max_tokens=1024):
|
||||
|
@ -93,7 +94,8 @@ class ChatSummary:
|
|||
def summarize_chat_history_markdown(self, text):
|
||||
messages = []
|
||||
assistant = []
|
||||
for line in text.splitlines(keepends=True):
|
||||
lines = text.splitlines(keepends=True)
|
||||
for line in tqdm(lines, desc="Summarizing chat history"):
|
||||
if line.startswith("# "):
|
||||
continue
|
||||
if line.startswith(">"):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue