diff --git a/openai-service/src/main/java/services/openAIService/OpenAIServiceController.java b/openai-service/src/main/java/services/openAIService/OpenAIServiceController.java index 964d701..cc353a6 100644 --- a/openai-service/src/main/java/services/openAIService/OpenAIServiceController.java +++ b/openai-service/src/main/java/services/openAIService/OpenAIServiceController.java @@ -510,8 +510,13 @@ public ResponseEntity biwibotMaterials(@RequestParam(value = "channe @ApiResponse(responseCode = "500", description = "Setting materials failed.") }) @PostMapping("/setBiwibotMaterials") - public ResponseEntity setBiwibotMaterials(@RequestParam("material") String material, @RequestParam("channel") String channel) { + public ResponseEntity setBiwibotMaterials(@RequestBody JSONObject body, @RequestParam(value= "material", defaultValue = "") String material, @RequestParam(value = "channel", defaultValue = "") String channel) { //Clear hashmap after some time? + if (material == null || material.equals("")) { + material = body.getAsString("material"); + channel = body.getAsString("channel"); + } + selectedMaterial.put(channel, material); System.out.println("Selected Materials are: " + selectedMaterial.toString()); JSONObject response = new JSONObject(); @@ -528,8 +533,11 @@ public ResponseEntity setBiwibotMaterials(@RequestParam("material") @ApiResponse(responseCode = "500", description = "Getting response failed.") }) @PostMapping("/biwibot") - public ResponseEntity biwibot(@RequestParam("msg") String msg, @RequestParam("channel") String channel, @RequestParam(value="sbfmUrl", defaultValue = "default") String sbfmUrl, @RequestParam(value = "material", defaultValue = "default") String material) throws IOException, InterruptedException { - System.out.println("Msg:" + msg); + public ResponseEntity biwibot(@RequestBody JSONObject body, @RequestParam(value = "msg", defaultValue = "") String msg, @RequestParam("channel") String channel, @RequestParam(value="sbfmUrl", defaultValue = "default") String sbfmUrl, @RequestParam(value = "material", defaultValue = "default") String material) throws IOException, InterruptedException { + if (msg == null || msg.equals("")) { + msg = body.getAsString("msg"); + } + System.out.println("Msg:" + body.getAsString("msg")); System.out.println("Channel:" + channel); System.out.println("Material:" + material); Boolean contextOn = false;