Skip to content

Commit 117aeb1

Browse files
authored
Merge pull request #170 from prgrms-web-devcourse-final-project/develop
chore[deploy]
2 parents 8bfecf7 + 855d546 commit 117aeb1

File tree

21 files changed

+679
-434
lines changed

21 files changed

+679
-434
lines changed

.github/workflows/CI-CD_Pipeline.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,7 @@ jobs:
263263
PROD_DATASOURCE_DRIVER=com.mysql.cj.jdbc.Driver
264264
PROD_DATASOURCE_USERNAME=root
265265
PROD_DATASOURCE_PASSWORD=${{ secrets.DB_PASSWORD }}
266-
# 추후 validate 변경
267-
PROD_JPA_HIBERNATE_DDL_AUTO=create
266+
PROD_JPA_HIBERNATE_DDL_AUTO=none
268267
269268
PROD_REDIS_HOST=redis
270269
PROD_REDIS_PORT=6379
@@ -274,7 +273,6 @@ jobs:
274273
PROD_QDRANT_PORT=6334
275274
276275
send_email_address=${{ secrets.SEND_EMAIL_ADDRESS }}
277-
email_address=${{ secrets.EMAIL_ADDRESS }}
278276
send_email_password=${{ secrets.EMAIL_PASSWORD }}
279277
280278
PROD_SENTRY_DSN=${{ secrets.SENTRY_DSN }}

backend/src/main/java/com/ai/lawyer/domain/chatbot/service/ChatBotService.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,12 @@ public class ChatBotService {
5757
// 멤버 조회 -> 벡터 검색 (판례, 법령) -> 프롬프트 생성 (시스템, 유저) -> 채팅 클라이언트 호출 (스트림) -> 응답 저장, 제목/키워드 추출
5858
public Flux<ChatResponse> sendMessage(Long memberId, ChatRequest chatChatRequestDto, Long roomId) {
5959

60-
Member member = memberRepository.findById(memberId).orElseThrow(
61-
() -> new IllegalArgumentException("존재하지 않는 회원입니다.")
60+
if(memberId == null) {
61+
log.error("해당 멤버는 존재하지 않거나, accessToken이 만료되거나 잘못되었습니다.");
62+
}
63+
64+
Member member = memberRepository.findById(memberId)
65+
.orElseThrow(() -> new IllegalArgumentException("존재하지 않는 회원입니다.")
6266
);
6367

6468
// 벡터 검색 (판례, 법령)
@@ -150,11 +154,11 @@ private void handlerTasks(ChatRequest chatDto, History history, String fullRespo
150154
setHistoryTitle(chatDto, history, fullResponse);
151155

152156
// 채팅 기록 저장
153-
saveChat(history, MessageType.USER, chatDto.getMessage(), similarCaseDocuments, similarLawDocuments);
154-
saveChat(history, MessageType.ASSISTANT, fullResponse, similarCaseDocuments, similarLawDocuments);
157+
saveChatWithDocuments(history, MessageType.USER, chatDto.getMessage(), similarCaseDocuments, similarLawDocuments);
158+
saveChatWithDocuments(history, MessageType.ASSISTANT, fullResponse, similarCaseDocuments, similarLawDocuments);
155159

156160
// 키워드 추출 및 키워드 랭킹 저장 (법과 관련 없는 질문은 제외)
157-
if (!fullResponse.contains("해당 질문은 법과 관련된")) {
161+
if (!fullResponse.contains("해당 질문은 법률")) {
158162
extractAndUpdateKeywordRanks(chatDto.getMessage());
159163
}
160164

@@ -178,13 +182,13 @@ private void extractAndUpdateKeywordRanks(String message) {
178182
}
179183

180184
private void setHistoryTitle(ChatRequest chatDto, History history, String fullResponse) {
181-
String targetText = fullResponse.contains("해당 질문은 법과 관련된") ? chatDto.getMessage() : fullResponse;
185+
String targetText = fullResponse.contains("해당 질문은 법률") ? chatDto.getMessage() : fullResponse;
182186
TitleExtractionDto titleDto = keywordExtract(targetText, titleExtraction, TitleExtractionDto.class);
183187
history.setTitle(titleDto.getTitle());
184188
historyRepository.save(history);
185189
}
186190

187-
private void saveChat(History history, MessageType type, String message, List<Document> similarCaseDocuments, List<Document> similarLawDocuments) {
191+
private void saveChatWithDocuments(History history, MessageType type, String message, List<Document> similarCaseDocuments, List<Document> similarLawDocuments) {
188192
Chat chat = chatRepository.save(Chat.builder()
189193
.historyId(history)
190194
.type(type)

backend/src/main/java/com/ai/lawyer/domain/law/controller/LawController.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@ public class LawController {
2424
@GetMapping(value = "/list/save")
2525
@Operation(summary = "키워드 관련 법령 데이터 저장(벡엔드 전용 API)", description = "벡엔드 데이터 저장용 API입니다")
2626
public ResponseEntity<?> getStatisticsCard(
27-
@RequestParam String query,
28-
@RequestParam int page
27+
@RequestParam String query
2928
) throws Exception {
3029
long startTime = System.currentTimeMillis();
3130

32-
lawService.saveLaw(query, page);
31+
lawService.saveLaw(query);
3332

3433
long endTime = System.currentTimeMillis();
3534
long elapsedTime = endTime - startTime;

backend/src/main/java/com/ai/lawyer/domain/law/repository/LawRepositoryCustomImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@ public Page<LawsDto> searchLaws(LawSearchRequestDto searchRequest) {
107107
return new PageImpl<>(content, pageable, 0);
108108
}
109109

110-
// 2. 조회한 법령 ID 목록 추출
110+
// 조회한 법령 ID 목록 추출
111111
List<Long> lawIds = content.stream()
112112
.map(LawsDto::getId)
113-
.collect(Collectors.toList());
113+
.toList();
114114

115-
// 3. 법령별 첫 번째 조 내용 조회 - 반복문으로 각각 조회
115+
// 3. 법령별 첫 번째 조 내용 조회 - 반복문으로 각각 조회
116116
Map<Long, String> firstJoContentMap = new HashMap<>();
117117
for (Long lawId : lawIds) {
118118
String firstJoContent = queryFactory

0 commit comments

Comments
 (0)