Skip to content

Commit 7aca707

Browse files
authored
Merge pull request #87 from TU-NEBULA/refactor/SCRUM-221
SCRUM 221 : AI 서버 연동 로직 수정
2 parents 572fe6b + d607d95 commit 7aca707

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/main/java/com/team_nebula/nebula/domain/star/service/StarCommandServiceImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public AddBookMarkResponseDTO addBookMark(Long userId, MultipartFile htmlFile, S
219219

220220
Favicon favicon = faviconService.getOrCreateFavicon(siteUrl);
221221

222-
GetThumbnailAndKeywordsResponseDTO responseDTO = aiMessageService.analyzeHtmlFile(userId, htmlFileKey);
222+
GetThumbnailAndKeywordsResponseDTO responseDTO = aiMessageService.analyzeHtmlFile(userId, htmlFileKey, siteUrl);
223223

224224
return AddBookMarkResponseDTO.builder()
225225
.title(title)
@@ -275,7 +275,7 @@ public CreateStarResponseDTO createStar(Long userId, CreateStarRequestDTO reques
275275

276276
// 유저 스타 작업 횟수 증가
277277
// aiService.checkUpdatedCnt(userId);
278-
aiMessageService.sendStarData(userId, lastStar, requestDTO.getS3key(), lastStar.getUserMemo(), lastStar.getSummaryAI(), requestDTO.getKeywordList());
278+
aiMessageService.sendStarData(userId, lastStar, requestDTO.getS3key(), lastStar.getUserMemo(), lastStar.getSummaryAI(), requestDTO.getKeywordList(), lastStar.getTitle(), lastStar.getSiteUrl());
279279

280280
return CreateStarResponseDTO.builder()
281281
.starId(lastStar.getId())

src/main/java/com/team_nebula/nebula/global/AI/service/AiMessageService.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ public class AiMessageService {
2828
@Value("${rabbitmq.queue.save-data}")
2929
private String saveDataQueue;
3030

31-
public GetThumbnailAndKeywordsResponseDTO analyzeHtmlFile(Long userId, String htmlFileKey) {
31+
public GetThumbnailAndKeywordsResponseDTO analyzeHtmlFile(Long userId, String htmlFileKey, String siteUrl) {
3232
try {
3333
// 1. 요청 메시지 생성
3434
Map<String, Object> message = new HashMap<>();
3535
message.put("s3_key", htmlFileKey);
3636
message.put("user_id", userId);
37+
message.put("url", siteUrl);
3738

3839
// 2. JSON 문자열로 변환
3940
String jsonMessage = objectMapper.writeValueAsString(message);
@@ -55,7 +56,7 @@ public GetThumbnailAndKeywordsResponseDTO analyzeHtmlFile(Long userId, String ht
5556
}
5657
}
5758

58-
public void sendStarData(Long userId, Star star, String s3key, String userMemo, String summaryAI, List<String> keywordList){
59+
public void sendStarData(Long userId, Star star, String s3key, String userMemo, String summaryAI, List<String> keywordList, String title, String siteUrl){
5960
try {
6061
Map<String, Object> message = new HashMap<>();
6162
message.put("userId", userId);
@@ -64,6 +65,8 @@ public void sendStarData(Long userId, Star star, String s3key, String userMemo,
6465
message.put("memo", userMemo);
6566
message.put("summary", summaryAI);
6667
message.put("keywords", keywordList);
68+
message.put("title", title);
69+
message.put("url", siteUrl);
6770

6871
String jsonMessage = objectMapper.writeValueAsString(message);
6972

0 commit comments

Comments
 (0)