Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use the latest user messages block instead of single message #585

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

yrobla
Copy link
Contributor

@yrobla yrobla commented Jan 14, 2025

Depending on the tooling, the user request is splitted between several user/assistant blocks. So use this logic instead of just picking the latest user message one, to identify code snippets and secrets

Closes: #580

Depending on the tooling, the user request is splitted between several
user/assistant blocks. So use this logic instead of just picking the
latest user message one, to identify code snippets and secrets

Closes: #580

# Iterate in reverse to find the last block of consecutive 'user' messages
for i in reversed(range(len(messages))):
if messages[i]["role"] == "user" or messages[i]["role"] == "assistant":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we include the assistant messages? This reads to me as if we would get all the user messages until the first system message?

Maybe it would be nice to have some tests so that the purpose is easier to see through them?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

can't extract code snippets in aider
2 participants