Skip to content

Commit

Permalink
Merge pull request #103 from Chat-ITC/main
Browse files Browse the repository at this point in the history
fix: user의 선호 언어가 상관없음일 때 예외 처리 구현
  • Loading branch information
YongGoose authored Sep 23, 2023
2 parents 814b9ab + ea31c79 commit 1f7fb9f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,5 @@ public ChatGptRequestDto(String model, String content) {
this.messages.add(new Message("system","너는 유능한 IT 개발자야. IT에 관한 지식이 풍부하며 IT 관련 질문에 반드시 답할 수 있어."));
this.messages.add(new Message("user", content));
this.max_tokens = 800;

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,18 @@ public ResponseEntity<?> getQuestionTitleFromLanguage(
String type = memberPrincipal.getMember().getSkill_language();
String level = memberPrincipal.getMember().getUser_level();

List<QuestionTitleResponseDto> questionList = questionService.findRandomQuestionsByLanguage(type, level);
Map<Object, Object> resultMap = new HashMap<>();
if (type.equals("상관없음")) {
resultMap.put("level", level);
return ResponseEntity.ok()
.body(resultMap);
}

List<QuestionTitleResponseDto> questionList = questionService.findRandomQuestionsByLanguage(type, level);
if (questionList.isEmpty()) {
return ResponseEntity.ok()
.body("question이 비어있습니다.");
}
Map<Object, Object> resultMap = new HashMap<>();
resultMap.put("quiz", questionList);
resultMap.put("level", level);
return ResponseEntity.ok()
Expand Down

0 comments on commit 1f7fb9f

Please sign in to comment.