From 5de8c49f489825ddc11f5241a9469235d36045aa Mon Sep 17 00:00:00 2001
From: Ludovic Apvrille <ludovic.apvrille@telecom-paris.fr>
Date: Mon, 3 Apr 2023 20:19:00 +0200
Subject: [PATCH] Adding gradle configuration file for json object

---
 graphminimize/build.gradle            | 2 ++
 graphshow/build.gradle                | 1 +
 launcher/build.gradle                 | 1 +
 src/main/java/myutil/AIInterface.java | 8 ++++----
 ttool/build.gradle                    | 5 +++--
 5 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/graphminimize/build.gradle b/graphminimize/build.gradle
index d0d8963156..7b80aed762 100644
--- a/graphminimize/build.gradle
+++ b/graphminimize/build.gradle
@@ -31,6 +31,8 @@ dependencies {
     compileOnly name: 'commons-math3-3.6.1'
     compileOnly name: 'jfreechart-1.6.0'
     implementation name: 'batik-all-1.14'
+    implementation name: 'json-java'
+    
 }
 
 jar {
diff --git a/graphshow/build.gradle b/graphshow/build.gradle
index ffa1c591f4..d784aed857 100644
--- a/graphshow/build.gradle
+++ b/graphshow/build.gradle
@@ -26,6 +26,7 @@ dependencies {
     implementation name: 'commons-math3-3.6.1'
     implementation name: 'jfreechart-1.6.0'
     implementation name: 'batik-all-1.14'
+    implementation name: 'json-java'
 }
 
 jar {
diff --git a/launcher/build.gradle b/launcher/build.gradle
index 8c97d9b814..1c07d24e9f 100644
--- a/launcher/build.gradle
+++ b/launcher/build.gradle
@@ -18,6 +18,7 @@ dependencies {
     compileOnly name: 'jna-3.3.0'
     implementation name: 'commons-math3-3.6.1'
     implementation name: 'jfreechart-1.6.0'
+    implementation name: 'json-java'
 }
 
 jar {
diff --git a/src/main/java/myutil/AIInterface.java b/src/main/java/myutil/AIInterface.java
index fbb830992c..3ec2a09ebf 100644
--- a/src/main/java/myutil/AIInterface.java
+++ b/src/main/java/myutil/AIInterface.java
@@ -107,10 +107,10 @@ public class AIInterface {
 
     public StringBuilder chat(String text) throws AIInterfaceException {
         connect();
-        JSONObject mainObject = new JSONObject();
+        org.json.JSONObject mainObject = new org.json.JSONObject();
         mainObject.put("model", "gpt-3.5-turbo");
-        JSONArray array = new JSONArray();
-        JSONObject sub = new JSONObject();
+        org.json.JSONArray array = new org.json.JSONArray();
+        org.json.JSONObject sub = new org.json.JSONObject();
         sub.put("role", "system");
         sub.put("content", "You are a helpful assistant.");
         sub = new JSONObject();
@@ -122,7 +122,7 @@ public class AIInterface {
         return getAnswer();
     }
 
-    private void sendJSON(JSONObject _jsonToBeSent) throws AIInterfaceException {
+    private void sendJSON(org.json.JSONObject _jsonToBeSent) throws AIInterfaceException {
         if (connection == null) {
             throw new AIInterfaceException(CONNECTION_PB);
         }
diff --git a/ttool/build.gradle b/ttool/build.gradle
index c07cd91fb4..4065ae363f 100644
--- a/ttool/build.gradle
+++ b/ttool/build.gradle
@@ -13,7 +13,8 @@ sourceSets {
 
     test {
         java {
-            srcDir "${rootProject.absPath}/tests/util/fr.tpt.ttool.tests.util/src"
+            //srcDir "${rootProject.absPath}/tests/util/fr.tpt.ttool.tests.util/src"
+	     srcDir "${rootProject.absPath}/src/test/java"
         }
     }
 }
@@ -38,7 +39,7 @@ dependencies {
     implementation name: 'commons-logging-1.0.4'
     implementation name: 'xmlgraphics-commons-2.6'
     implementation name: 'batik-all-1.14'
-     implementation name: 'xml-apis'
+    implementation name: 'xml-apis'
     implementation name: 'json-java'
     implementation name: 'fop'
     
-- 
GitLab