Introduce `forceCreateAssistant` option

Added a configuration option, `forceCreateAssistant`, which forces the
creation of a new assistant at each stateful patch-set review request.
This option is primarily intended for debugging purposes.

Change-Id: I3ebd2361cc48168318080a3157aa84eee808f5f6
Signed-off-by: Patrizio <patrizio.gelosi@amarulasolutions.com>
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 7da35e4..4dd4ab3 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
@@ -83,6 +83,7 @@
     private static final boolean DEFAULT_PATCH_SET_COMMENTS_AS_RESOLVED = false;
     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;
 
     // Config setting keys
     public static final String KEY_GPT_SYSTEM_PROMPT = "gptSystemPrompt";
@@ -122,6 +123,7 @@
     private static final String KEY_PATCH_SET_COMMENTS_AS_RESOLVED = "patchSetCommentsAsResolved";
     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 final OneOffRequestContext context;
     @Getter
@@ -278,6 +280,10 @@
         return getBoolean(KEY_IGNORE_RESOLVED_CHAT_GPT_COMMENTS, DEFAULT_IGNORE_RESOLVED_CHAT_GPT_COMMENTS);
     }
 
+    public boolean getForceCreateAssistant() {
+        return getBoolean(KEY_FORCE_CREATE_ASSISTANT, DEFAULT_FORCE_CREATE_ASSISTANT);
+    }
+
     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/stateful/client/api/chatgpt/ChatGptAssistant.java b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/stateful/client/api/chatgpt/ChatGptAssistant.java
index d1c14c3..717648c 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/stateful/client/api/chatgpt/ChatGptAssistant.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/stateful/client/api/chatgpt/ChatGptAssistant.java
@@ -42,7 +42,7 @@
 
     public void setupAssistant() {
         String assistantId = pluginDataHandler.getValue(KEY_ASSISTANT_ID);
-        if (assistantId == null) {
+        if (assistantId == null || config.getForceCreateAssistant()) {
             String fileId = uploadRepoFiles();
             pluginDataHandler.setValue(KEY_FILE_ID, fileId);
             assistantId = createAssistant(fileId);