sturdy-dev / codereview.gpt

Reviews your Pull/Merge Requests using ChatGPT
MIT License
550 stars 68 forks source link

Split patch file in multiple pieces so we can provide ChatGPT with a larger context #20

Closed nickveenhof closed 1 year ago

nickveenhof commented 1 year ago

We had the problem with large patches that we had to work with a maximum token size of 4096 tokens.

The following changes were made:

  1. Split the patch with the parse-diff library
  2. Recompile the patch again with different pieces, and add enough context for ChatGPT to understand the changes
  3. Truncate only long patch pieces, instead of the entire patch
  4. Exclude package.json files, as those don't provide additional value, similar to binary files

This should provide a much more complete code review compared to the previous version.

Solves #19

nickveenhof commented 1 year ago

Let's get it in and go from there :)