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

feat: Skip large diffs when generating context for the LLM #2217

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dividedmind
Copy link
Collaborator

@dividedmind dividedmind commented Jan 23, 2025

This skips diffs larger than 5000 characters when generating input for @welcome and @review. Large diffs are replaced with a message, for example

diff --git a/file2.txt b/file2.txt
[Change of size 2078]

Fixes #2173

content: diffContent
.filter(Boolean)
.map((diff) => processPatchset(diff))
.join('\n\n'),
Copy link
Contributor

Choose a reason for hiding this comment

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

I have been looking into this type of limiting as well, and one of the issues I see is that getDiffLog returns, as the name suggests, git log output not git diff output. So, splitting this output would seem to be more naturally done on the commit <sha> (author) rather than on the diff --git line.

WDYT?

commit 5f7fed0d7fab55e9b2cdc6cddbebd9644bca416c
Author: Kevin Gilpin <[email protected]>
Date:   Thu Jan 23 09:49:53 2025 -0500

    refactor: Remove unused code
    
    Locating the git repository - can't find any references to this any more

diff --git a/packages/cli/src/lib/git.ts b/packages/cli/src/lib/git.ts
index 5bd8b0a03..139b10eca 100644
--- a/packages/cli/src/lib/git.ts
+++ b/packages/cli/src/lib/git.ts

Copy link
Contributor

Choose a reason for hiding this comment

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

In other words, maybe it would be better / easier if getDiffLog and getWorkingDiff returned an output that had some structure (at least an array of chunks?) rather than just a string that the caller then has to figure out how to split.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point, I've actually noticed this too and fixed it in the amend below :)

Base automatically changed from develop to main January 23, 2025 15:43
This skips diffs larger than 5000 characters when generating input
for @WELCOME and @review. Large diffs are replaced with a message,
for example

    diff --git a/file2.txt b/file2.txt
    [Change of size 2078]

Fixes #2173
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.

Ignore large files when building the diff for welcome and review purposes
3 participants