Skip to content

Commit d3ea62a

Browse files
committed
refactor: modi prompt on service
1 parent 72082cb commit d3ea62a

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/main/java/com/back/domain/chatbot/repository/ChatConversationRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ public interface ChatConversationRepository extends JpaRepository<ChatConversati
1111

1212
List<ChatConversation> findByUserIdOrderByCreatedAtDesc(Long userId);
1313

14-
List<ChatConversation> findTop10ByUserIdOrderByCreatedAtDesc(Long userId);
14+
List<ChatConversation> findTop20ByUserIdOrderByCreatedAtDesc(Long userId);
1515
}

src/main/java/com/back/domain/chatbot/service/ChatbotService.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public ChatResponseDto sendMessage(ChatRequestDto requestDto) {
103103

104104
// 최근 대화 기록 조회 (최신 10개 메시지 - USER와 CHATBOT 메시지 모두 포함)
105105
List<ChatConversation> recentChats =
106-
chatConversationRepository.findTop10ByUserIdOrderByCreatedAtDesc(requestDto.getUserId());
106+
chatConversationRepository.findTop20ByUserIdOrderByCreatedAtDesc(requestDto.getUserId());
107107

108108
// 대화 컨텍스트 생성
109109
String conversationContext = buildConversationContext(recentChats);
@@ -165,7 +165,7 @@ private String buildConversationContext(List<ChatConversation> recentChats) {
165165
* 대화 저장 - 변경사항: 사용자 메시지와 봇 응답을 각각 별도로 저장
166166
*/
167167
@Transactional
168-
private void saveConversation(ChatRequestDto requestDto, String response) {
168+
public void saveConversation(ChatRequestDto requestDto, String response) {
169169
// 1. 사용자 메시지 저장
170170
ChatConversation userMessage = ChatConversation.builder()
171171
.userId(requestDto.getUserId())
@@ -235,7 +235,7 @@ public ChatConversation createGreetingMessage(Long userId) {
235235
*/
236236
@Transactional(readOnly = true)
237237
public boolean isFirstConversation(Long userId) {
238-
return chatConversationRepository.findTop10ByUserIdOrderByCreatedAtDesc(userId).isEmpty();
238+
return chatConversationRepository.findTop20ByUserIdOrderByCreatedAtDesc(userId).isEmpty();
239239
}
240240

241241
// ============ 기존 메서드들 (변경 없음) ============
@@ -354,7 +354,8 @@ private ChatResponseDto handleStepRecommendation(ChatRequestDto requestDto) {
354354
switch (currentStep) {
355355
case 1:
356356
stepRecommendation = getAlcoholStrengthOptions();
357-
chatResponse = "단계별 맞춤 추천을 시작합니다! 🎯\n원하시는 도수를 선택해주세요!";
357+
chatResponse = "단계별로 취향을 찾아드릴게요! 🎯\n원하시는 도수를 선택해주세요! \n " +
358+
"잘 모르는 항목은 '전체'로 체크하셔도 괜찮아요.";
358359
break;
359360
case 2:
360361
stepRecommendation = getAlcoholBaseTypeOptions(requestDto.getSelectedAlcoholStrength());
@@ -471,9 +472,12 @@ private StepRecommendationResponseDto getFinalRecommendations(
471472
))
472473
.collect(Collectors.toList());
473474

475+
// 추천 이유는 각 칵테일별 설명으로 들어가도록 유도
474476
String stepTitle = recommendations.isEmpty()
475477
? "조건에 맞는 칵테일을 찾을 수 없습니다 😢"
476-
: "당신을 위한 맞춤 칵테일 추천입니다! 🍹";
478+
: "짠🎉🎉\n" +
479+
"칵테일의 자세한 정보는 '상세보기'를 클릭해서 확인할 수 있어요.\n" +
480+
"마음에 드는 칵테일은 '킵' 버튼을 눌러 나만의 Bar에 저장해보세요!";
477481

478482
return new StepRecommendationResponseDto(
479483
4,

0 commit comments

Comments
 (0)