appleboy / CodeGPT

A CLI written in Go language that writes git commit messages or do a code review brief for you using ChatGPT AI (gpt-4o, gpt-4-turbo, gpt-3.5-turbo model) and automatically installs a git prepare-commit-msg hook.
MIT License
1.16k stars 100 forks source link

How to deal with large git diff that over model's maximum context length limit? #128

Closed doggy8088 closed 7 months ago

doggy8088 commented 8 months ago

When git diff returned too much changes. The CodeGPT will show this:

We are trying to summarize a git diff Error: error, status code: 400, message: This model's maximum context length is 8192 tokens. However, your messages resulted in 28846 tokens. Please reduce the length of the messages.

Is it possible trimming the git diff result so that CodeGPT can still summarize part of the changes?

appleboy commented 8 months ago

Try the following config.

update git diff_unified

codegpt config set git.diff_unified 0

ignore commit file

codegpt config set git.exclude_list aaaa,bbbb,cccc

or

codegpt commit --exclude_list aaaa,bbbb,ccc
doggy8088 commented 8 months ago

Is it possible trimming the git diff result which limiting the length of prompt text?

doggy8088 commented 7 months ago

I think gpt-4-32k already solved my issue.