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
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Binary file modified .gradle/file-system.probe
Binary file not shown.
64 changes: 54 additions & 10 deletions src/main/java/com/team4/giftidea/controller/GptController.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,21 @@ private String generatePrompt(List<String> processedMessages, String relation, S
return extractKeywordsAndReasonsCoupleWoman(theme, combinedMessages);
}
} else if ("parent".equals(relation)) {
return extractKeywordsAndReasonsParents(theme, combinedMessages);
if ("male".equals(sex)) {
return extractKeywordsAndReasonsDad(theme, combinedMessages);
} else if ("female".equals(sex)) {
return extractKeywordsAndReasonsMom(theme, combinedMessages);
}
} else if ("friend".equals(relation)) {
return extractKeywordsAndReasonsFriend(theme, combinedMessages);
} else if ("housewarming".equals(theme)) {
return extractKeywordsAndReasonsHousewarming(combinedMessages);
} else if ("valentine".equals(theme)) {
return extractKeywordsAndReasonsSeasonal(theme, combinedMessages);
if ("male".equals(sex)) {
return extractKeywordsAndReasonsSeasonalMan(theme, combinedMessages);
} else if ("female".equals(sex)) {
return extractKeywordsAndReasonsSeasonalWoman(theme, combinedMessages);
}
}

return "조건에 맞는 선물 추천 기능이 없습니다.";
Expand Down Expand Up @@ -246,7 +254,7 @@ private String generateText(String prompt) {
private String extractKeywordsAndReasonsCoupleMan(String theme, String message) {
String prompt = String.format("""
다음 텍스트를 참고하여 남자 애인이 %s에 선물로 받으면 좋아할 카테고리 3개와 판단에 참고한 대화를 제공해주세요.
카테고리: 남성 지갑, 남성 스니커즈, 백팩, 토트백, 크로스백, 벨트, 선글라스, 향수, 헬스가방, 무선이어폰, 스마트워치
카테고리: 남성 지갑, 남성 스니커즈, 백팩, 토트백, 크로스백, 벨트, 선글라스, 향수, 헬스가방, 무선이어폰, 스마트워치, 맨투맨, 마우스, 키보드, 전기면도기, 게임기

텍스트: %s

Expand All @@ -264,7 +272,7 @@ private String extractKeywordsAndReasonsCoupleMan(String theme, String message)
private String extractKeywordsAndReasonsCoupleWoman(String theme, String message) {
String prompt = String.format("""
다음 텍스트를 참고하여 여자 애인이 %s에 선물로 받으면 좋아할 카테고리 3개와 판단에 참고한 대화를 제공해주세요.
카테고리: 여성 지갑, 여성 스니커즈, 숄더백, 토트백, 크로스백, 향수, 목걸이, 무선이어폰, 스마트워치
카테고리: 여성 지갑, 여성 스니커즈, 숄더백, 토트백, 크로스백, 향수, 목걸이, 무선이어폰, 스마트워치, 에어랩

텍스트: %s

Expand All @@ -279,10 +287,28 @@ private String extractKeywordsAndReasonsCoupleWoman(String theme, String message
return generateText(prompt); // GPT 모델 호출
}

private String extractKeywordsAndReasonsParents(String theme, String message) {
private String extractKeywordsAndReasonsDad(String theme, String message) {
String prompt = String.format("""
다음 텍스트를 참고하여 부모님이 %s에 선물로 받으면 좋아할 카테고리 3개와 판단에 참고한 대화를 제공해주세요.
카테고리: 현금 박스, 안마기기, 아버지 신발, 시계

텍스트: %s

출력 형식:
1. [카테고리1,카테고리2,카테고리3]
2.
- 카테고리1: [근거1]
- 카테고리2: [근거2]
- 카테고리3: [근거3]
""", theme, message);

return generateText(prompt);
}

private String extractKeywordsAndReasonsMom(String theme, String message) {
String prompt = String.format("""
다음 텍스트를 참고하여 부모님이 %s에 선물로 받으면 좋아할 카테고리 3개와 판단에 참고한 대화를 제공해주세요.
카테고리: 현금 박스, 안마기기, 부모님 신발, 건강식품
카테고리: 현금 박스, 안마기기, 어머니 신발, 건강식품, 스카프

텍스트: %s

Expand All @@ -301,7 +327,7 @@ private String extractKeywordsAndReasonsFriend(String theme, String message) {
String prompt = String.format("""
다음 텍스트를 참고하여 친구가 %s에 선물로 받으면 좋아할 카테고리 3개와 판단에 참고한 대화를 제공해주세요.
제시된 카테고리에 없는 추천 선물이 있다면 3개에 포함해주세요.
카테고리: 핸드크림, 텀블러, 립밤
카테고리: 핸드크림, 텀블러, 립밤, 머플러, 비타민, 입욕제, 블루투스 스피커

텍스트: %s

Expand All @@ -319,7 +345,7 @@ private String extractKeywordsAndReasonsFriend(String theme, String message) {
private String extractKeywordsAndReasonsHousewarming(String message) {
String prompt = String.format("""
다음 텍스트를 참고하여 집들이에 선물로 받으면 좋아할 카테고리 3개와 판단에 참고한 대화를 제공해주세요.
카테고리: 조명, 핸드워시, 식기, 디퓨저, 꽃, 오설록 티세트, 휴지
카테고리: 조명, 핸드워시, 식기, 디퓨저, 오설록 티세트, 휴지, 파자마세트, 무드등, 디퓨저, 수건, 전기포트, 에어프라이기

텍스트: %s

Expand All @@ -334,10 +360,28 @@ private String extractKeywordsAndReasonsHousewarming(String message) {
return generateText(prompt);
}

private String extractKeywordsAndReasonsSeasonal(String theme, String message) {
private String extractKeywordsAndReasonsSeasonalMan(String theme, String message) {
String prompt = String.format("""
다음 텍스트를 참고하여 %s에 선물로 받으면 좋아할 카테고리 3개와 판단에 참고한 대화를 제공해주세요.
카테고리: 초콜릿, 수제 초콜릿 키트, 파자마세트, 남자 화장품

텍스트: %s

출력 형식:
1. [카테고리1,카테고리2,카테고리3]
2.
- 카테고리1: [근거1]
- 카테고리2: [근거2]
- 카테고리3: [근거3]
""", theme, message);

return generateText(prompt);
}

private String extractKeywordsAndReasonsSeasonalWoman(String theme, String message) {
String prompt = String.format("""
다음 텍스트를 참고하여 %s에 선물로 받으면 좋아할 카테고리 3개와 판단에 참고한 대화를 제공해주세요.
카테고리: 초콜릿, 수제 초콜릿 키트, 립밤, 파자마세트
카테고리: 초콜릿, 수제 초콜릿 키트, 립밤, 파자마세트, 립스틱

텍스트: %s

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,22 @@ public void crawlAndStoreData() {

// 네이버 키워드 목록
List<String> naverKeywords = List.of(
"현금 박스", "부모님 신발", "건강식품", "헬스가방", "핸드크림", "디퓨저",
"오설록 티세트", "휴지", "초콜릿", "수제 초콜릿 키트", "파자마세트"
"현금 박스", "아버지 신발", "어머니 신발", "건강식품", "헬스가방", "핸드크림", "디퓨저",
"오설록 티세트", "휴지", "초콜릿", "수제 초콜릿 키트", "파자마세트", "남자 화장품", "에어랩",
"무드등", "수건", "전기포트", "에어프라이기", "비타민", "입욕제", "블루투스 스피커", "와인"
);

// 쿠팡 키워드 목록
List<String> coupangKeywords = List.of("안마기기", "무선이어폰", "스마트워치");
List<String> coupangKeywords = List.of(
"안마기기", "무선이어폰", "스마트워치", "등산용품", "스마트폰", "맨투맨", "마우스",
"키보드", "게임기", "전기면도기"
);

// Kream 키워드 목록
List<String> kreamKeywords = List.of(
"남성 지갑", "남성 스니커즈", "백팩", "토트백", "크로스백", "벨트",
"선글라스", "향수", "여성 지갑", "여성 스니커즈", "숄더백", "목걸이",
"텀블러", "립밤", "조명", "핸드워시", "식기"
"선글라스", "향수", "여성 지갑", "여성 스니커즈", "숄더백", "목걸이", "맨투맨",
"텀블러", "립밤", "립스틱", "조명", "핸드워시", "식기", "머플러", "시계", "스카프", "핸드백"
);

log.info("📢 네이버 크롤링 시작...");
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ spring:
multipart:
enabled: true
max-file-size: 100MB
max-request-size: 200MB

logging:
level:
Expand Down