Skip to content

Commit

Permalink
add msg as formtype
Browse files Browse the repository at this point in the history
  • Loading branch information
Yinnii committed Oct 19, 2023
1 parent bdc6fd5 commit 3ed2236
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,8 @@ public Response chat(String body) {
@ApiOperation(
value = "Get the chat response from biwibot",
notes = "Returns the chat response from biwibot")
public Response biwibot(String body, @FormDataParam("channel") String channel) {
System.out.println("Input:" + body);
public Response biwibot(@FormDataParam("msg") String msg, @FormDataParam("channel") String channel) {
System.out.println("Msg:" + msg);
System.out.println("Channel:" + channel);
JSONParser p = new JSONParser(JSONParser.MODE_PERMISSIVE);
JSONObject json = null;
Expand All @@ -585,10 +585,8 @@ public Response biwibot(String body, @FormDataParam("channel") String channel) {
String question = null;

try {
json = (JSONObject) p.parse(body);
System.out.println(json.toJSONString());
question = json.getAsString("msg");
channel = json.getAsString("channel");
// json = (JSONObject) p.parse(body);
question = msg;
chatResponse.put("channel", channel);
newEvent.put("question", question);
newEvent.put("channel", channel);
Expand Down Expand Up @@ -616,7 +614,7 @@ public Response biwibot(String body, @FormDataParam("channel") String channel) {
chatResponse.appendField("AIResponse", "An error has occurred.");
}
System.out.println(chatResponse);
} catch (ParseException | IOException | InterruptedException e) {
} catch ( IOException | InterruptedException e) {
e.printStackTrace();
chatResponse.appendField("AIResponse", "An error has occurred.");
} catch (Throwable e) {
Expand Down

0 comments on commit 3ed2236

Please sign in to comment.