Add `enableMessageDebugging` configuration setting
The `enableMessageDebugging` configuration setting has been introduced
to manage user access to debug functionalities via Gerrit messages. This
setting currently controls the usage of `--debug` option of the
`/review` command.
Change-Id: I199cf959eb9a423ae1628242f222dabefd96b075
Signed-off-by: Patrizio <patrizio.gelosi@amarulasolutions.com>
diff --git a/README.md b/README.md
index f63ab97..e751994 100644
--- a/README.md
+++ b/README.md
@@ -182,6 +182,8 @@
- `ignoreOutdatedInlineComments`: Determines if inline comments made on non-latest Patch Sets should be disregarded. By
default, this is set to false, meaning all inline comments are used for generating new responses and identifying
repetitions. If enabled (true), inline comments from previous Patch Sets are excluded from these considerations.
+- `enableMessageDebugging`: This setting controls the activation of debugging functionalities through messages (default
+ value is false). When set to true, it enables commands and options like `--debug` for users.
#### Optional Parameters for Global Configuration only
diff --git a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/PatchSetReviewer.java b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/PatchSetReviewer.java
index cea8b4c..68e02d4 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/PatchSetReviewer.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/PatchSetReviewer.java
@@ -64,11 +64,13 @@
}
ChangeSetDataHandler.update(config, change, gerritClient, changeSetData);
- ChatGptResponseContent reviewReply = getReviewReply(change, patchSet);
- log.debug("ChatGPT response: {}", reviewReply);
+ if (changeSetData.getReviewSystemMessage() == null) {
+ ChatGptResponseContent reviewReply = getReviewReply(change, patchSet);
+ log.debug("ChatGPT response: {}", reviewReply);
- retrieveReviewBatches(reviewReply, change);
- clientReviewProvider.get().setReview(change, reviewBatches, getReviewScore());
+ retrieveReviewBatches(reviewReply, change);
+ }
+ clientReviewProvider.get().setReview(change, reviewBatches, changeSetData, getReviewScore());
}
private void setCommentBatchMap(ReviewBatch batchMap, Integer batchID) {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/config/Configuration.java b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/config/Configuration.java
index 4dd4ab3..2b8a5ae 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/config/Configuration.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/config/Configuration.java
@@ -84,6 +84,7 @@
private static final boolean DEFAULT_IGNORE_OUTDATED_INLINE_COMMENTS = false;
private static final boolean DEFAULT_IGNORE_RESOLVED_CHAT_GPT_COMMENTS = true;
private static final boolean DEFAULT_FORCE_CREATE_ASSISTANT = false;
+ private static final boolean DEFAULT_ENABLE_MESSAGE_DEBUGGING = false;
// Config setting keys
public static final String KEY_GPT_SYSTEM_PROMPT = "gptSystemPrompt";
@@ -124,6 +125,7 @@
private static final String KEY_IGNORE_OUTDATED_INLINE_COMMENTS = "ignoreOutdatedInlineComments";
private static final String KEY_IGNORE_RESOLVED_CHAT_GPT_COMMENTS = "ignoreResolvedChatGptComments";
private static final String KEY_FORCE_CREATE_ASSISTANT = "forceCreateAssistant";
+ private static final String KEY_ENABLE_MESSAGE_DEBUGGING = "enableMessageDebugging";
private final OneOffRequestContext context;
@Getter
@@ -284,6 +286,10 @@
return getBoolean(KEY_FORCE_CREATE_ASSISTANT, DEFAULT_FORCE_CREATE_ASSISTANT);
}
+ public boolean getEnableMessageDebugging() {
+ return getBoolean(KEY_ENABLE_MESSAGE_DEBUGGING, DEFAULT_ENABLE_MESSAGE_DEBUGGING);
+ }
+
public boolean getIgnoreOutdatedInlineComments() {
return getBoolean(KEY_IGNORE_OUTDATED_INLINE_COMMENTS, DEFAULT_IGNORE_OUTDATED_INLINE_COMMENTS);
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/api/gerrit/GerritClientComments.java b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/api/gerrit/GerritClientComments.java
index 26df1f2..e67a3d8 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/api/gerrit/GerritClientComments.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/api/gerrit/GerritClientComments.java
@@ -137,7 +137,7 @@
}
private void addLastComments(GerritChange change) {
- ClientMessage clientMessage = new ClientMessage(config, changeSetData, change);
+ ClientMessage clientMessage = new ClientMessage(config, changeSetData);
try {
List<GerritComment> latestComments = retrieveComments(change);
if (latestComments == null) {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/api/gerrit/GerritClientReview.java b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/api/gerrit/GerritClientReview.java
index 556789d..e0ab87c 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/api/gerrit/GerritClientReview.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/api/gerrit/GerritClientReview.java
@@ -11,6 +11,7 @@
import com.google.gerrit.server.util.ManualRequestContext;
import com.google.inject.Inject;
import com.googlesource.gerrit.plugins.chatgpt.config.Configuration;
+import com.googlesource.gerrit.plugins.chatgpt.mode.common.model.data.ChangeSetData;
import com.googlesource.gerrit.plugins.chatgpt.mode.common.model.review.ReviewBatch;
import lombok.extern.slf4j.Slf4j;
@@ -31,8 +32,13 @@
super(config, accountCache);
}
- public void setReview(GerritChange change, List<ReviewBatch> reviewBatches, Integer reviewScore) throws Exception {
- ReviewInput reviewInput = buildReview(reviewBatches, reviewScore);
+ public void setReview(
+ GerritChange change,
+ List<ReviewBatch> reviewBatches,
+ ChangeSetData changeSetData,
+ Integer reviewScore
+ ) throws Exception {
+ ReviewInput reviewInput = buildReview(reviewBatches, changeSetData, reviewScore);
if (reviewInput.comments == null && reviewInput.message == null) {
return;
}
@@ -53,13 +59,38 @@
}
}
- public void setReview(GerritChange change, List<ReviewBatch> reviewBatches) throws Exception {
- setReview(change, reviewBatches, null);
+ public void setReview(
+ GerritChange change,
+ List<ReviewBatch> reviewBatches,
+ ChangeSetData changeSetData
+ ) throws Exception {
+ setReview(change, reviewBatches, changeSetData, null);
}
- private ReviewInput buildReview(List<ReviewBatch> reviewBatches, Integer reviewScore) {
+ private ReviewInput buildReview(List<ReviewBatch> reviewBatches, ChangeSetData changeSetData, Integer reviewScore) {
ReviewInput reviewInput = ReviewInput.create();
Map<String, List<CommentInput>> comments = new HashMap<>();
+ String systemMessage = EMPTY_REVIEW_MESSAGE;
+ if (changeSetData.getReviewSystemMessage() != null) {
+ systemMessage = changeSetData.getReviewSystemMessage();
+ }
+ else {
+ comments = getReviewComments(reviewBatches);
+ if (reviewScore != null) {
+ reviewInput.label(LabelId.CODE_REVIEW, reviewScore);
+ }
+ }
+ if (comments.isEmpty()) {
+ reviewInput.message(systemMessage);
+ }
+ else {
+ reviewInput.comments = comments;
+ }
+ return reviewInput;
+ }
+
+ private Map<String, List<CommentInput>> getReviewComments(List<ReviewBatch> reviewBatches) {
+ Map<String, List<CommentInput>> comments = new HashMap<>();
for (ReviewBatch reviewBatch : reviewBatches) {
String message = sanitizeChatGptMessage(reviewBatch.getContent());
if (message.trim().isEmpty()) {
@@ -74,15 +105,15 @@
if (reviewBatch.getLine() != null || reviewBatch.getRange() != null) {
filenameComment.line = reviewBatch.getLine();
Optional.ofNullable(reviewBatch.getRange())
- .ifPresent(
- r -> {
- Comment.Range range = new Comment.Range();
- range.startLine = r.startLine;
- range.startCharacter = r.startCharacter;
- range.endLine = r.endLine;
- range.endCharacter = r.endCharacter;
- filenameComment.range = range;
- });
+ .ifPresent(
+ r -> {
+ Comment.Range range = new Comment.Range();
+ range.startLine = r.startLine;
+ range.startCharacter = r.startCharacter;
+ range.endLine = r.endLine;
+ range.endCharacter = r.endCharacter;
+ filenameComment.range = range;
+ });
filenameComment.inReplyTo = reviewBatch.getId();
unresolved = !config.getInlineCommentsAsResolved();
}
@@ -93,16 +124,7 @@
filenameComments.add(filenameComment);
comments.putIfAbsent(filename, filenameComments);
}
- if (comments.isEmpty()) {
- reviewInput.message(EMPTY_REVIEW_MESSAGE);
- }
- else {
- reviewInput.comments = comments;
- }
- if (reviewScore != null) {
- reviewInput.label(LabelId.CODE_REVIEW, reviewScore);
- }
- return reviewInput;
+ return comments;
}
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/commands/ClientCommands.java b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/commands/ClientCommands.java
index 43edc62..e77decd 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/commands/ClientCommands.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/commands/ClientCommands.java
@@ -1,7 +1,7 @@
package com.googlesource.gerrit.plugins.chatgpt.mode.common.client.commands;
-import com.googlesource.gerrit.plugins.chatgpt.data.ChangeSetDataHandler;
-import com.googlesource.gerrit.plugins.chatgpt.mode.common.client.api.gerrit.GerritChange;
+import com.googlesource.gerrit.plugins.chatgpt.config.Configuration;
+import com.googlesource.gerrit.plugins.chatgpt.mode.common.client.ClientBase;
import com.googlesource.gerrit.plugins.chatgpt.mode.common.client.prompt.Directives;
import com.googlesource.gerrit.plugins.chatgpt.mode.common.model.data.ChangeSetData;
import lombok.Getter;
@@ -13,9 +13,11 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import static com.googlesource.gerrit.plugins.chatgpt.settings.Settings.MESSAGE_DEBUGGING_FUNCTIONALITIES_DISABLED;
+
@Slf4j
@Getter
-public class ClientCommands {
+public class ClientCommands extends ClientBase {
private enum COMMAND_SET {
REVIEW,
REVIEW_LAST,
@@ -52,7 +54,8 @@
@Getter
private boolean containingHistoryCommand;
- public ClientCommands(ChangeSetData changeSetData, GerritChange change) {
+ public ClientCommands(Configuration config, ChangeSetData changeSetData) {
+ super(config);
this.changeSetData = changeSetData;
directives = new Directives(changeSetData);
containingHistoryCommand = false;
@@ -110,13 +113,20 @@
switch (option) {
case FILTER:
boolean value = Boolean.parseBoolean(reviewOptionsMatcher.group(2));
- log.info("Option 'replyFilterEnabled' set to {}", value);
+ log.debug("Option 'replyFilterEnabled' set to {}", value);
changeSetData.setReplyFilterEnabled(value);
break;
case DEBUG:
- log.info("Response Mode set to Debug");
- changeSetData.setDebugMode(true);
- changeSetData.setReplyFilterEnabled(false);
+ if (config.getEnableMessageDebugging()) {
+ log.debug("Response Mode set to Debug");
+ changeSetData.setDebugMode(true);
+ changeSetData.setReplyFilterEnabled(false);
+ }
+ else {
+ changeSetData.setReviewSystemMessage(MESSAGE_DEBUGGING_FUNCTIONALITIES_DISABLED);
+ log.debug("Unable to set Response Mode to Debug: `enableMessageDebugging` config must be " +
+ "set to true");
+ }
break;
}
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/messages/ClientMessage.java b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/messages/ClientMessage.java
index 8e3a0bf..749564f 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/messages/ClientMessage.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/messages/ClientMessage.java
@@ -2,7 +2,6 @@
import com.googlesource.gerrit.plugins.chatgpt.config.Configuration;
import com.googlesource.gerrit.plugins.chatgpt.mode.common.client.ClientBase;
-import com.googlesource.gerrit.plugins.chatgpt.mode.common.client.api.gerrit.GerritChange;
import com.googlesource.gerrit.plugins.chatgpt.mode.common.client.commands.ClientCommands;
import com.googlesource.gerrit.plugins.chatgpt.mode.common.model.data.ChangeSetData;
import lombok.Getter;
@@ -22,14 +21,14 @@
@Getter
private String message;
- public ClientMessage(Configuration config, ChangeSetData changeSetData, GerritChange change) {
+ public ClientMessage(Configuration config, ChangeSetData changeSetData) {
super(config);
botMentionPattern = getBotMentionPattern();
- clientCommands = new ClientCommands(changeSetData, change);
+ clientCommands = new ClientCommands(config, changeSetData);
}
- public ClientMessage(Configuration config, ChangeSetData changeSetData, GerritChange change, String message) {
- this(config, changeSetData, change);
+ public ClientMessage(Configuration config, ChangeSetData changeSetData, String message) {
+ this(config, changeSetData);
this.message = message;
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/prompt/ChatGptComment.java b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/prompt/ChatGptComment.java
index 5a4a364..36253c2 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/prompt/ChatGptComment.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/prompt/ChatGptComment.java
@@ -2,7 +2,6 @@
import com.googlesource.gerrit.plugins.chatgpt.config.Configuration;
import com.googlesource.gerrit.plugins.chatgpt.mode.common.client.ClientBase;
-import com.googlesource.gerrit.plugins.chatgpt.mode.common.client.api.gerrit.GerritChange;
import com.googlesource.gerrit.plugins.chatgpt.mode.common.client.messages.ClientMessage;
import com.googlesource.gerrit.plugins.chatgpt.mode.common.model.api.gerrit.GerritComment;
import com.googlesource.gerrit.plugins.chatgpt.mode.common.model.data.ChangeSetData;
@@ -12,17 +11,15 @@
public class ChatGptComment extends ClientBase {
protected ClientMessage commentMessage;
- private final GerritChange change;
private final ChangeSetData changeSetData;
- public ChatGptComment(Configuration config, ChangeSetData changeSetData, GerritChange change) {
+ public ChatGptComment(Configuration config, ChangeSetData changeSetData) {
super(config);
- this.change = change;
this.changeSetData = changeSetData;
}
protected String getCleanedMessage(GerritComment commentProperty) {
- commentMessage = new ClientMessage(config, changeSetData, change, commentProperty.getMessage());
+ commentMessage = new ClientMessage(config, changeSetData, commentProperty.getMessage());
if (isFromAssistant(commentProperty)) {
commentMessage.removeDebugMessages();
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/prompt/ChatGptHistory.java b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/prompt/ChatGptHistory.java
index b2b50e3..f0624d5 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/prompt/ChatGptHistory.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/prompt/ChatGptHistory.java
@@ -1,7 +1,6 @@
package com.googlesource.gerrit.plugins.chatgpt.mode.common.client.prompt;
import com.googlesource.gerrit.plugins.chatgpt.config.Configuration;
-import com.googlesource.gerrit.plugins.chatgpt.mode.common.client.api.gerrit.GerritChange;
import com.googlesource.gerrit.plugins.chatgpt.mode.common.model.api.chatgpt.ChatGptRequestMessage;
import com.googlesource.gerrit.plugins.chatgpt.mode.common.model.api.gerrit.GerritComment;
import com.googlesource.gerrit.plugins.chatgpt.mode.common.model.data.ChangeSetData;
@@ -31,8 +30,8 @@
private boolean filterActive;
- public ChatGptHistory(Configuration config, ChangeSetData changeSetData, GerritChange change, GerritClientData gerritClientData) {
- super(config, changeSetData, change);
+ public ChatGptHistory(Configuration config, ChangeSetData changeSetData, GerritClientData gerritClientData) {
+ super(config, changeSetData);
CommentData commentData = gerritClientData.getCommentData();
commentMap = commentData.getCommentMap();
patchSetCommentMap = commentData.getPatchSetCommentMap();
diff --git a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/prompt/ChatGptUserPrompt.java b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/prompt/ChatGptUserPrompt.java
index 5a4b3aa..8b7a788 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/prompt/ChatGptUserPrompt.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/prompt/ChatGptUserPrompt.java
@@ -17,10 +17,10 @@
public ChatGptUserPrompt(Configuration config, ChangeSetData changeSetData, GerritChange change, GerritClientData gerritClientData) {
if (change.getIsCommentEvent()) {
- chatGptUserPromptBase = new ChatGptUserPromptRequests(config, changeSetData, change, gerritClientData);
+ chatGptUserPromptBase = new ChatGptUserPromptRequests(config, changeSetData, gerritClientData);
}
else {
- chatGptUserPromptBase = new ChatGptUserPromptReview(config, changeSetData, change, gerritClientData);
+ chatGptUserPromptBase = new ChatGptUserPromptReview(config, changeSetData, gerritClientData);
}
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/prompt/ChatGptUserPromptBase.java b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/prompt/ChatGptUserPromptBase.java
index 78482dc..bd3b8e2 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/prompt/ChatGptUserPromptBase.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/prompt/ChatGptUserPromptBase.java
@@ -1,7 +1,6 @@
package com.googlesource.gerrit.plugins.chatgpt.mode.common.client.prompt;
import com.googlesource.gerrit.plugins.chatgpt.config.Configuration;
-import com.googlesource.gerrit.plugins.chatgpt.mode.common.client.api.gerrit.GerritChange;
import com.googlesource.gerrit.plugins.chatgpt.mode.common.client.patch.code.InlineCode;
import com.googlesource.gerrit.plugins.chatgpt.mode.common.client.patch.diff.FileDiffProcessed;
import com.googlesource.gerrit.plugins.chatgpt.mode.common.model.api.chatgpt.ChatGptMessageItem;
@@ -29,11 +28,11 @@
@Getter
protected List<GerritComment> commentProperties;
- public ChatGptUserPromptBase(Configuration config, ChangeSetData changeSetData, GerritChange change, GerritClientData gerritClientData) {
+ public ChatGptUserPromptBase(Configuration config, ChangeSetData changeSetData, GerritClientData gerritClientData) {
this.gerritClientData = gerritClientData;
fileDiffsProcessed = gerritClientData.getFileDiffsProcessed();
commentData = gerritClientData.getCommentData();
- gptMessageHistory = new ChatGptHistory(config, changeSetData, change, gerritClientData);
+ gptMessageHistory = new ChatGptHistory(config, changeSetData, gerritClientData);
messageItems = new ArrayList<>();
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/prompt/ChatGptUserPromptRequests.java b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/prompt/ChatGptUserPromptRequests.java
index 1cde7c5..0c23bbd 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/prompt/ChatGptUserPromptRequests.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/prompt/ChatGptUserPromptRequests.java
@@ -1,7 +1,6 @@
package com.googlesource.gerrit.plugins.chatgpt.mode.common.client.prompt;
import com.googlesource.gerrit.plugins.chatgpt.config.Configuration;
-import com.googlesource.gerrit.plugins.chatgpt.mode.common.client.api.gerrit.GerritChange;
import com.googlesource.gerrit.plugins.chatgpt.mode.common.model.api.chatgpt.ChatGptMessageItem;
import com.googlesource.gerrit.plugins.chatgpt.mode.common.model.api.chatgpt.ChatGptRequestMessage;
import com.googlesource.gerrit.plugins.chatgpt.mode.common.model.data.ChangeSetData;
@@ -12,8 +11,12 @@
@Slf4j
public class ChatGptUserPromptRequests extends ChatGptUserPromptBase {
- public ChatGptUserPromptRequests(Configuration config, ChangeSetData changeSetData, GerritChange change, GerritClientData gerritClientData) {
- super(config, changeSetData, change, gerritClientData);
+ public ChatGptUserPromptRequests(
+ Configuration config,
+ ChangeSetData changeSetData,
+ GerritClientData gerritClientData
+ ) {
+ super(config, changeSetData, gerritClientData);
commentProperties = commentData.getCommentProperties();
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/prompt/ChatGptUserPromptReview.java b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/prompt/ChatGptUserPromptReview.java
index 7c87b63..c65b4a9 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/prompt/ChatGptUserPromptReview.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/prompt/ChatGptUserPromptReview.java
@@ -1,7 +1,6 @@
package com.googlesource.gerrit.plugins.chatgpt.mode.common.client.prompt;
import com.googlesource.gerrit.plugins.chatgpt.config.Configuration;
-import com.googlesource.gerrit.plugins.chatgpt.mode.common.client.api.gerrit.GerritChange;
import com.googlesource.gerrit.plugins.chatgpt.mode.common.model.api.chatgpt.ChatGptMessageItem;
import com.googlesource.gerrit.plugins.chatgpt.mode.common.model.api.chatgpt.ChatGptRequestMessage;
import com.googlesource.gerrit.plugins.chatgpt.mode.common.model.data.ChangeSetData;
@@ -13,8 +12,12 @@
@Slf4j
public class ChatGptUserPromptReview extends ChatGptUserPromptBase {
- public ChatGptUserPromptReview(Configuration config, ChangeSetData changeSetData, GerritChange change, GerritClientData gerritClientData) {
- super(config, changeSetData, change, gerritClientData);
+ public ChatGptUserPromptReview(
+ Configuration config,
+ ChangeSetData changeSetData,
+ GerritClientData gerritClientData
+ ) {
+ super(config, changeSetData, gerritClientData);
commentProperties = new ArrayList<>(commentData.getCommentMap().values());
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/model/data/ChangeSetData.java b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/model/data/ChangeSetData.java
index 158ac15..af99c68 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/model/data/ChangeSetData.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/model/data/ChangeSetData.java
@@ -27,5 +27,5 @@
private Boolean replyFilterEnabled = true;
private Boolean debugMode = false;
private Set<String> directives = new HashSet<>();
-
+ private String reviewSystemMessage;
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/settings/Settings.java b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/settings/Settings.java
index ca32c0d..ad8344e 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/settings/Settings.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/settings/Settings.java
@@ -17,6 +17,8 @@
public static final String GERRIT_COMMIT_MESSAGE_PREFIX = "Subject: ";
public static final String EMPTY_REVIEW_MESSAGE = "No update to show for this Change Set";
+ public static final String MESSAGE_DEBUGGING_FUNCTIONALITIES_DISABLED = "Message Debugging functionalities are " +
+ "disabled";
public enum MODES {
stateless,
diff --git a/src/test/java/com/googlesource/gerrit/plugins/chatgpt/integration/CodeReviewPluginIT.java b/src/test/java/com/googlesource/gerrit/plugins/chatgpt/integration/CodeReviewPluginIT.java
index 2c1535f..e814f64 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/chatgpt/integration/CodeReviewPluginIT.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/chatgpt/integration/CodeReviewPluginIT.java
@@ -66,6 +66,7 @@
@Test
public void setReview() throws Exception {
+ ChangeSetData changeSetData = new ChangeSetData(1, config.getVotingMinScore(), config.getMaxReviewFileSize());
when(config.getGerritUserName()).thenReturn("Your Gerrit username");
List<ReviewBatch> reviewBatches = new ArrayList<>();
@@ -73,6 +74,6 @@
reviewBatches.get(0).setContent("message");
GerritClientReview gerritClientReview = new GerritClientReview(config, accountCache);
- gerritClientReview.setReview(new GerritChange("Your changeId"), reviewBatches);
+ gerritClientReview.setReview(new GerritChange("Your changeId"), reviewBatches, changeSetData);
}
}