Add bullet points to ChatGPT comments

Introduced bullet points to ChatGPT comments for each item to boost
their readability.

Jira-Id: IT-103
Change-Id: I927c3f6cdedcadf9e6c538312a87ae84cf359a53
Signed-off-by: Patrizio <patrizio.gelosi@amarulasolutions.com>
diff --git a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/GerritClientComments.java b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/GerritClientComments.java
index cf2a574..d1be462 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/GerritClientComments.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/GerritClientComments.java
@@ -28,6 +28,7 @@
 @Slf4j
 public class GerritClientComments extends GerritClientAccount {
     private static final Integer MAX_SECS_GAP_BETWEEN_EVENT_AND_COMMENT = 2;
+    private static final String BULLET_POINT = "* ";
 
     private final Gson gson = new Gson();
     private long commentsStartTimestamp;
@@ -112,15 +113,16 @@
         }
     }
 
-    private void appendMessage(Map<String, Object> map, String message) {
-        if (map.containsKey("message") && map.get("message") != null) {
-            message = map.get("message") + "\n\n" + message;
+    private String joinMessages(List<String> messages) {
+        if (messages.size() == 1) {
+            return messages.get(0);
         }
-        map.put("message", message);
+        return BULLET_POINT + String.join("\n\n" + BULLET_POINT, messages);
     }
 
     private Map<String, Object> getContextProperties(List<HashMap<String, Object>> reviewBatches) {
         Map<String, Object> map = new HashMap<>();
+        List<String> messages = new ArrayList<>();
         Map<String, List<Map<String, Object>>> comments = new HashMap<>();
         for (HashMap<String, Object> reviewBatch : reviewBatches) {
             String message = (String) reviewBatch.get("content");
@@ -140,9 +142,12 @@
                 comments.putIfAbsent(filename, filenameComments);
             }
             else {
-                appendMessage(map, message);
+                messages.add(message);
             }
         }
+        if (!messages.isEmpty()) {
+            map.put("message", joinMessages(messages));
+        }
         if (!comments.isEmpty()) {
             map.put("comments", comments);
         }