Skip to content

Commit

Permalink
Merge pull request #48 from kookmin-sw/backend/feat/#47
Browse files Browse the repository at this point in the history
Backend/feat/#47
  • Loading branch information
J-Yong99 authored Apr 2, 2024
2 parents ed47881 + ba090c7 commit d744a36
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.moment.scheduler.client;

import com.moment.scheduler.dto.request.AiModelRunRequestDTO;
import com.moment.scheduler.dto.response.AiModelRunResponseDTO;
import com.moment.scheduler.dto.response.EmotionResponseDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name = "ai-service")
Expand All @@ -15,6 +17,6 @@ public interface AiClient {
* @Param String fileName
*/
@PostMapping("/ai/run")
AiModelRunResponseDTO.RunModel runAi(@RequestParam String file_name);
AiModelRunResponseDTO.RunModel runAi(@RequestBody AiModelRunRequestDTO.RunModel request);

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ public class AiController {

@PostMapping("/run")
public AiModelRunResponseDTO.RunModel runAi(@RequestBody AiModelRunRequestDTO.RunModel request) {
return aiService.runAi(request.getFileName());
return aiService.runAi(request.getFile_name());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class AiModelRunRequestDTO {
@NoArgsConstructor
@AllArgsConstructor
public static class RunModel {
private String fileName;
private String file_name;
private String file_path;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public static class RunModel {
private final String status;
private final EmotionResponseDTO.GetEmotionList emotions;
private final String text;
private final List<String> log;
private final String error;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public static class GetEmotionList {
private final Float happy;
private final Float sad;
private final Float angry;
private final Float excited;
private final Float neutral;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.moment.scheduler.service;

import com.moment.scheduler.client.AiClient;
import com.moment.scheduler.dto.request.AiModelRunRequestDTO;
import com.moment.scheduler.dto.response.AiModelRunResponseDTO;
import com.moment.scheduler.dto.response.EmotionResponseDTO;
import lombok.AllArgsConstructor;
Expand All @@ -10,8 +11,14 @@
@AllArgsConstructor
public class AiService {
private final AiClient aiClient;
private final static String file_path = "";

public AiModelRunResponseDTO.RunModel runAi(String fileName) {
return aiClient.runAi(fileName);
return aiClient.runAi(
AiModelRunRequestDTO.RunModel.builder()
.file_name(fileName)
.file_path(file_path)
.build()
);
}
}

0 comments on commit d744a36

Please sign in to comment.