Skip to content
This repository has been archived by the owner on Oct 20, 2024. It is now read-only.

Commit

Permalink
[FIX]: edu/news/content to enum (#53)
Browse files Browse the repository at this point in the history
* [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 코드 추가

* [FIX] #52 Post Entity enum type 추가

---------

Co-authored-by: 박세진 <[email protected]>
Co-authored-by: Sejin Park <[email protected]>
  • Loading branch information
3 people authored Jan 7, 2024
1 parent a918f98 commit 8f59b4d
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ public String getChatResponse(String prompt) {
return "request error";
}
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class CommentService {
@Autowired
private RestTemplate restTemplate;


@Value("${chatgpt.api-key}")
private String apiKey;
private final ObjectMapper objectMapper = new ObjectMapper()
Expand All @@ -56,7 +57,6 @@ public HttpEntity<ChatgptRequest> buildHttpEntity(ChatgptRequest chatGptRequest)

// gpt 단답
public ChatgptResponse getResponse(HttpEntity<ChatgptRequest> chatGptRequestHttpEntity) {

SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory.setConnectTimeout(60000);
//답변이 길어질 경우 TimeOut Error가 발생하니 1분정도 설정해줍니다.
Expand Down Expand Up @@ -91,7 +91,6 @@ public ChatgptResponse askQuestion(ChatgptQuestionRequest questionRequest) {
);
}


public String getChatResponse(String question){
String responseFromGPT=chatGptService.getChatResponse(question);
return responseFromGPT;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.finfellows.domain.educontent.domain;

import com.finfellows.domain.common.BaseEntity;
import com.finfellows.domain.post.domain.ContentType;
import com.finfellows.domain.post.domain.Post;
import jakarta.persistence.*;
import lombok.AccessLevel;
Expand All @@ -25,6 +26,10 @@ public class EduContent extends BaseEntity {
@JoinColumn(name="post_id")
private Post post;

@Enumerated(EnumType.STRING)
@Column(name="contentType")
private ContentType contentType;


@Column(name="title")
private String title;
Expand All @@ -37,6 +42,12 @@ public EduContent(Post post, String title, String content){
this.post=post;
this.title=title;
this.content=content;
this.contentType = ContentType.EDU_CONTENT;
}

public void updateContent(String title, String content) {
this.title = title;
this.content = content;
}

public void updateContent(String title, String content) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import lombok.Getter;
import lombok.NoArgsConstructor;


import java.time.LocalDateTime;

@Getter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import java.time.LocalDateTime;


@Getter
@Builder
@AllArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.finfellows.domain.newscontent.domain;

import com.finfellows.domain.common.BaseEntity;

import com.finfellows.domain.post.domain.ContentType;

import com.finfellows.domain.post.domain.Post;
import jakarta.persistence.*;
import lombok.Builder;
Expand Down Expand Up @@ -29,11 +32,17 @@ public class NewsContent extends BaseEntity {
@Column(name="content")
private String content;

@Enumerated(EnumType.STRING)
@Column(name="contentType")
private ContentType contentType;

@Builder
public NewsContent(Post post, String title, String content){
this.post=post;
this.title=title;
this.content=content;
this.contentType = ContentType.NEWS_CONTENT;

}

public void updateContent(String title, String content) {
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/finfellows/domain/post/domain/Content.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,18 @@ public class Content {
@Column(name="content")
private String content;

@Enumerated(EnumType.STRING)
@Column(name="contentType")
private ContentType contentType;


@Builder
public Content(Post post_id, String title, String content){
this.post_id=post_id;
this.title=title;
this.content=content;
this.contentType = ContentType.CONTENT;

}

public void updateContent(String title, String content) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.finfellows.domain.post.domain;

public enum ContentType {
EDU_CONTENT,
NEWS_CONTENT,
CONTENT
}
7 changes: 6 additions & 1 deletion src/main/java/com/finfellows/domain/post/domain/Post.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,14 @@ public class Post extends BaseEntity {
@JoinColumn(name="writer_id")
private User writer;

@Enumerated(EnumType.STRING)
@Column(name="contentType")
private ContentType contentType;

@Builder
public Post(User writer){
public Post(User writer, ContentType contentType){
this.writer=writer;
this.contentType=contentType;
}

}

0 comments on commit 8f59b4d

Please sign in to comment.