From 68d5378e4f1ef829495b598a54873389440c5a25 Mon Sep 17 00:00:00 2001 From: lakhoune Date: Sun, 8 Oct 2023 16:39:41 +0200 Subject: [PATCH 1/3] bump version --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 989bb17d..d0c135dd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ core.version=1.3.1 service.name=i5.las2peer.services.socialBotManagerService service.class=SocialBotManagerService -service.version=1.7.0 +service.version=.2.1.0 java.version=17 las2peer_user1.name=alice From 46b962eda9800256b9852641059408046e36fa95 Mon Sep 17 00:00:00 2001 From: Samuel Kwong Date: Tue, 10 Oct 2023 22:35:07 +0200 Subject: [PATCH 2/3] Updated action trigger action functionality to support OpenAPI Request type --- .../socialBotManagerService/SocialBotManagerService.java | 9 +++++++-- .../socialBotManagerService/parser/BotParser.java | 7 +++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/social-bot-manager/src/main/java/i5/las2peer/services/socialBotManagerService/SocialBotManagerService.java b/social-bot-manager/src/main/java/i5/las2peer/services/socialBotManagerService/SocialBotManagerService.java index 209c131e..8a441268 100644 --- a/social-bot-manager/src/main/java/i5/las2peer/services/socialBotManagerService/SocialBotManagerService.java +++ b/social-bot-manager/src/main/java/i5/las2peer/services/socialBotManagerService/SocialBotManagerService.java @@ -1343,7 +1343,7 @@ public void performIntentTrigger(BotConfiguration botConfig, BotAgent botAgent, if (botFunction.getActionType().equals(ActionType.SERVICE)) { functionPath = botFunction.getFunctionPath(); } else if (botFunction.getActionType().equals(ActionType.OPENAPI)) { - functionPath = botFunction.getFunctionPath(); + functionPath = botFunction.getFunctionPath(); } JSONObject body = new JSONObject(); HashMap attlist = new HashMap(); @@ -1520,8 +1520,9 @@ public void checkTriggerBot(BotConfiguration botConfig, JSONObject body, BotAgen String functionPath = ""; // add path if the triggered function is a service function - if (triggeredFunction.getActionType().equals(ActionType.SERVICE)) + if (triggeredFunction.getActionType().equals(ActionType.SERVICE) || triggeredFunction.getActionType().equals(ActionType.OPENAPI)){ functionPath = triggeredFunction.getFunctionPath(); + } JSONObject triggeredBody = new JSONObject(); HashMap attlist = new HashMap(); for (ServiceFunction bsf : bot.getBotServiceFunctions().values()) { @@ -2072,6 +2073,10 @@ private void performTrigger(BotConfiguration botConfig, ServiceFunction sf, BotA JSONObject triggerAttributes = new JSONObject(); triggeredBody.put("attributes", triggerAttributes); + //Set the endpoint to the base url for the SBFManager + if (sf.getActionType().equals(ActionType.OPENAPI)){ + client.setConnectorEndpoint(webconnectorUrl); + } try { ClientResponse result = client.sendRequest("POST", diff --git a/social-bot-manager/src/main/java/i5/las2peer/services/socialBotManagerService/parser/BotParser.java b/social-bot-manager/src/main/java/i5/las2peer/services/socialBotManagerService/parser/BotParser.java index bc3dee07..2264859b 100644 --- a/social-bot-manager/src/main/java/i5/las2peer/services/socialBotManagerService/parser/BotParser.java +++ b/social-bot-manager/src/main/java/i5/las2peer/services/socialBotManagerService/parser/BotParser.java @@ -201,6 +201,8 @@ public void parseNodesAndEdges(BotConfiguration config, HashMap headers = new HashMap(); client.setLogin("alice", "pwalice"); From c9c445a626a74c64f7f341ba4c53cb9ad19a6590 Mon Sep 17 00:00:00 2001 From: Samuel Kwong Date: Tue, 10 Oct 2023 22:42:00 +0200 Subject: [PATCH 3/3] remove unnecessary changes to the bot parser while debugging --- .../services/socialBotManagerService/parser/BotParser.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/social-bot-manager/src/main/java/i5/las2peer/services/socialBotManagerService/parser/BotParser.java b/social-bot-manager/src/main/java/i5/las2peer/services/socialBotManagerService/parser/BotParser.java index 2264859b..d9464f25 100644 --- a/social-bot-manager/src/main/java/i5/las2peer/services/socialBotManagerService/parser/BotParser.java +++ b/social-bot-manager/src/main/java/i5/las2peer/services/socialBotManagerService/parser/BotParser.java @@ -798,7 +798,7 @@ private JSONArray swaggerHelperFunction(Bot b) { System.out.println("Service name is:" + s.getServiceName() + "\nBot is : " + b.getName()); if (s.getActionType().equals(ActionType.OPENAPI)) { - JSONObject j = readJsonFromUrl(s.getServiceName() + "/swagger.json"); + JSONObject j = readJsonFromUrl(s.getFunctionPath() + "/swagger.json"); b.addServiceInformation(s.getServiceName(), j); } else { JSONObject j = readJsonFromUrl( @@ -821,7 +821,7 @@ private JSONArray swaggerHelperFunction(Bot b) { if(s.getActionType() == ActionType.SERVICE){ client.setConnectorEndpoint(b.getAddress()+"/" + s.getServiceName() + s.getFunctionPath()); } else { - client.setConnectorEndpoint(s.getServiceName()); + client.setConnectorEndpoint(s.getServiceName() + s.getFunctionPath()); } HashMap headers = new HashMap(); client.setLogin("alice", "pwalice");