This repository has been archived by the owner on Oct 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [FEAT] #3 ChatGPT 응답 단답 확인 과정 테스트 * [FIX] #3 SecurityConfig permitAll 추가 * [FEAT] #3 ChatgptRequest 추가 GPT Request DTO format * [FIX] #3 Chatgpt dependencies 추가 * [FEAT] #14 EduContent DTO 생성 * [FIX] #14 Post AccessLevel 수정 * [FEAT] #14 educontent 저장 api 구현 * [FEAT] #14 educontent 조회/상세조회/수정/삭제 api 구현 * [FEAT] #15 newscontent 저장/조회/상세조회/수정/삭제 api 구현 * [FEAT] #19 content 저장/조회/상세조회/수정/삭제 api 구현 * [FEAT] #19 swagger 설정 추가 * [FEAT] #19 readOnly를 위한 Transactional 어노테이션 추가 * [FEAT] #39 chatbot, comment 파일 추가 * fix: chat gpt 수정 * [FIX] #19 Transactional annotation readOnly default 수정 * Revert "[FIX] #19 Transactional annotation readOnly default 수정" This reverts commit 4a18b0ebce60ff41bdacac044fd6c365adf49ca4. * [FIX] #19 Transactional annotation readOnly default 수정 * [FEAT] #39 챗봇 질의응답 기능 개발 인사말 추가, 질의응답, 조회 기능 * [FEAT] educontent created_at 요청/응답 필드 추가 * [FIX] #39 챗봇 요청/응답값 UserId 부분 수정 * [FIX] #39 챗봇 요청/응답값 UserId 부분 수정 * [FIX] #39 swagger 코드 추가 --------- Co-authored-by: 박세진 <[email protected]>
- Loading branch information
1 parent
cae15c3
commit a918f98
Showing
11 changed files
with
230 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/java/com/finfellows/domain/comment/dto/request/CommentRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.finfellows.domain.comment.dto.request; | ||
|
||
import com.finfellows.domain.user.domain.User; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class CommentRequest { | ||
private Long commentId; | ||
private LocalDateTime created_at; | ||
private String greeting; | ||
private String question; | ||
private String answer; | ||
private Long userId; | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/com/finfellows/domain/comment/dto/response/CommentResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.finfellows.domain.comment.dto.response; | ||
|
||
import com.finfellows.domain.user.domain.User; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class CommentResponse { | ||
private Long commentId; | ||
private LocalDateTime created_at; | ||
private String greeting; | ||
private String question; | ||
private String answer; | ||
private Long userId; | ||
} |
54 changes: 53 additions & 1 deletion
54
src/main/java/com/finfellows/domain/comment/presentation/CommentController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,61 @@ | ||
package com.finfellows.domain.comment.presentation; | ||
|
||
import com.finfellows.domain.chatgpt.application.ChatGptService; | ||
import com.finfellows.domain.comment.application.CommentService; | ||
import com.finfellows.domain.comment.dto.response.CommentResponse; | ||
import com.finfellows.domain.user.application.UserService; | ||
import com.finfellows.global.config.security.token.CurrentUser; | ||
import com.finfellows.global.config.security.token.UserPrincipal; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.media.ArraySchema; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.util.List; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/chatbot") | ||
@Tag(name="Chatbot",description = "Chatbot API") | ||
public class CommentController { | ||
private CommentService commentService; | ||
private ChatGptService chatGptService; | ||
private UserService userService; | ||
|
||
|
||
@Autowired | ||
public CommentController(CommentService commentService, ChatGptService chatGptService, UserService userService) { | ||
this.commentService = commentService; | ||
this.chatGptService = chatGptService; | ||
this.userService = userService; | ||
} | ||
|
||
@Operation(summary = "챗봇 질의응답 저장", description = "챗봇 질문과 답변을 저장합니다.") | ||
@ApiResponse(responseCode = "200", description = "챗봇 질문에 대한 답변 응답 성공", content = { | ||
@Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CommentResponse.class))) | ||
}) | ||
@PostMapping("") | ||
public String getChatResponse(@CurrentUser UserPrincipal userPrincipal, @RequestBody String question){ | ||
String answer= commentService.getChatResponse(question); | ||
commentService.saveComment(userPrincipal.getId(), question, answer); | ||
return answer; | ||
} | ||
|
||
@Operation(summary = "챗봇 대화 내용 조회", description = "챗봇 대화 전체 목록을 조회합니다.") | ||
@ApiResponse(responseCode = "200", description = "챗봇 대화 목록 조회 성공", content = { | ||
@Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CommentResponse.class))) | ||
}) | ||
@GetMapping("") | ||
public ResponseEntity<List<CommentResponse>> getAllComments(@CurrentUser UserPrincipal userPrincipal){ | ||
List<CommentResponse> responseList=commentService.getAllComments(userPrincipal.getId()); | ||
return new ResponseEntity<>(responseList, HttpStatus.OK); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.