Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

public record BookInfoRes(
BookDetailRes bookDetail, // 책 상세 정보
String aiSummary, // AI가 생성한 요약 문장
List<String> aiSummary, // AI가 생성한 요약 문장
List<String> aiTags, // AI가 선정한 태그들
List<RecommendRes> recommendations, // 추천 책 리스트
boolean isLiked
){
public static BookInfoRes of(
BookDetailRes bookDetailRes,
String aiSummary,
List<String> aiSummary,
List<String> aiTags,
List<RecommendRes> recommendations,
boolean isLiked
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class BookReview extends BaseEntity {
@Column(nullable =true, name = "review_title")
private String reviewTitle;

@Column(nullable = false)
@Column(nullable = false, columnDefinition = "TEXT")
private String content;

@ManyToOne(fetch = FetchType.LAZY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.hansung.leafly.infra.openai.dto.BookSummaryAiRes;
import com.hansung.leafly.infra.openai.dto.RecommendAiRes;
import com.hansung.leafly.infra.openai.exception.OpenaiRequestFailed;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
Expand All @@ -16,6 +17,7 @@
import java.util.Map;

@Component
@Slf4j
public class OpenAiClient {

@Value("${openai.api.key}")
Expand Down Expand Up @@ -62,6 +64,7 @@ private <T> T callOpenAi(String prompt, Class<T> responseType) {
return mapper.readValue(content, responseType);

} catch (Exception e) {
log.error("[OpenAI ERROR] Exception 메시지: {}", e.getMessage());
throw new OpenaiRequestFailed();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
import java.util.List;

public record BookSummaryAiRes(
String summary,
List<String> summary,
List<String> tags
) {}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static String build(Onboarding onboarding) {
public static String build(BookDetailRes book) {
return """
당신은 한국 도서 전문 리뷰어이자 요약 전문가입니다.
아래 책 정보를 기반으로 **정확하고 신뢰할 수 있는 요약(최소 2~3문장)**과
아래 책 정보를 기반으로 **정확하고 신뢰할 수 있는 문장 단위 요약(최소 4~6개 문장)**과
**책의 핵심 주제나 톤을 반영하는 태그 최소 2~5개**를 생성해주세요.

[책 정보]
Expand All @@ -64,20 +64,20 @@ public static String build(BookDetailRes book) {
- 책 설명: %s

[요약 작성 기준]
1. 줄거리를 요약하되 스포일러는 포함하지 않습니다.
2. 책의 핵심 메시지·감정·분위기·주제를 자연스럽게 드러냅니다.
3. 문장은 최소 2~3줄 분량으로 작성합니다.
(너무 짧은 한줄 요약 금지)

1. 줄거리를 문장 단위로 요약합니다.
(예: 요약문 1문장 = 하나의 핵심 아이디어)
2. 스포일러는 포함하지 않습니다.
3. 책의 핵심 메시지·감정·분위기·주제를 자연스럽게 드러냅니다.
4. 총 **4~6개의 문장 요약**을 생성하세요.

[태그 작성 기준]
- #태그 형식으로 작성하세요.
- 최소 2개 이상, 최대 5개 생성하세요.
- 책의 성향/주제/톤/분위기/대상 독자 등을 나타내는 단어로 구성하세요.
- 예시: #우정 #감정 #청소년문학 #소설 #철학 #성장 #심리
- #태그 형식
- 최소 2개, 최대 5개
- 책의 성향/주제/톤/분위기/대상 독자 등을 나타내는 단어

[응답 형식(JSON)]
{
"summary": "여기에 책 요약(최소 2~3문장)",
"summary": ["요약 문장 1", "요약 문장 2", "요약 문장 3"],
"tags": ["#태그1", "#태그2", "#태그3"]
}

Expand Down