commit | 0deb7e87776f68cb5f185dcdc74085c4a362f648 | [log] [tgz] |
---|---|---|
author | xielong <xielong.me@gmail.com> | Sat Jun 17 12:05:48 2023 +0800 |
committer | xielong <xielong.me@gmail.com> | Sat Jun 17 12:05:48 2023 +0800 |
tree | 344c5dc57a9c43e4378195c4541e687d14d84a3b | |
parent | f9d28317eb4b1b54f1dbe9a1e5640337dea51dca [diff] |
Add project documentation
This plugin allows you to use ChatGPT for code review in Gerrit conveniently. After submitting a patch, OpenAI will provide review feedback in the form of comments.
Build: Requires JDK11 or higher, Maven 3.0 or higher.
mvn -U clean package
Install: Upload the compiled jar file to the $gerrit_site/plugins directory, then refer to configuration parameters for settings, and restart Gerrit.
Verify: After installing the plugin, you can see the following information in Gerrit's logs:
INFO com.google.gerrit.server.plugins.PluginLoader : Loaded plugin chatgpt-code-review-gerrit-plugin, version 3.3.0
You can also check the status of the chatgpt-code-review-gerrit-plugin on Gerrit's plugin page as Enabled.
To configure these parameters, you need to modify your Gerrit configuration file (gerrit.config
). The file format is as follows:
[plugin "chatgpt-code-review-gerrit-plugin"] # Required parameters gptToken = {gptToken} gerritAuthBaseUrl = {gerritAuthBaseUrl} gerritUserName = {gerritUserName} gerritPassword = {gerritPassword} # Optional parameters gptModel = {gptModel} gptPrompt = {gptPrompt} gptMaxTokens = {gptMaxTokens} patchSetReduction = {patchSetReduction} maxReviewLines = {maxReviewLines}
gptToken
: OpenAI GPT token.gerritAuthBaseUrl
: The URL of your Gerrit instance. Similar to: https://gerrit.local.team/agerritUserName
: Gerrit username.gerritPassword
: Gerrit password.gptModel
: The default model is gpt-3.5-turbo. You can also configure it to gpt-4 or gpt-4-32k.gptPrompt
: The default prompt is “Act as a Code Review Helper, please review this patch set:”. You can modify it to your preferred prompt.gptMaxTokens
: The default value is 4096 tokens. This determines the maximum dialogue length of ChatGPT. Click here to check the content token count.patchSetReduction
: The default value is false. If set to true, the plugin will attempt to reduce patch content by compressing redundant blank lines, tabs, import statements, etc., in order to decrease the token count.maxReviewLines
: The default value is 1000. This sets a limit on the number of lines of code included in the review.Apache License 2.0