@@ -57,17 +57,13 @@ public class ChatBotService {
5757 // 멤버 조회 -> 벡터 검색 (판례, 법령) -> 프롬프트 생성 (시스템, 유저) -> 채팅 클라이언트 호출 (스트림) -> 응답 저장, 제목/키워드 추출
5858 public Flux <ChatResponse > sendMessage (Long memberId , ChatRequest chatChatRequestDto , Long roomId ) {
5959
60- if (memberId == null ) {
61- log .error ("해당 멤버는 존재하지 않거나, accessToken이 만료되거나 잘못되었습니다." );
62- }
63-
6460 Member member = memberRepository .findById (memberId )
6561 .orElseThrow (() -> new IllegalArgumentException ("존재하지 않는 회원입니다." )
6662 );
6763
6864 // 벡터 검색 (판례, 법령)
69- List <Document > similarCaseDocuments = qdrantService .searchDocument (chatChatRequestDto .getMessage (), "type" , "판례" , 3 );
70- List <Document > similarLawDocuments = qdrantService .searchDocument (chatChatRequestDto .getMessage (), "type" , "법령" , 2 );
65+ List <Document > similarCaseDocuments = qdrantService .searchDocument (chatChatRequestDto .getMessage (), "type" , "판례" );
66+ List <Document > similarLawDocuments = qdrantService .searchDocument (chatChatRequestDto .getMessage (), "type" , "법령" );
7167
7268 // 판례와 법령 정보를 구분 있게 포맷팅
7369 String caseContext = formatting (similarCaseDocuments );
@@ -167,18 +163,19 @@ private void handlerTasks(ChatRequest chatDto, History history, String fullRespo
167163 private void extractAndUpdateKeywordRanks (String message ) {
168164 KeywordExtractionDto keywordResponse = keywordExtract (message , keywordExtraction , KeywordExtractionDto .class );
169165
170- for (String keyword : keywordResponse .getKeyword ()) {
171- KeywordRank keywordRank = keywordRankRepository .findByKeyword (keyword );
172- if (keywordRank == null ) {
173- keywordRank = KeywordRank .builder ()
174- .keyword (keyword )
175- .score (1L )
176- .build ();
177- } else {
178- keywordRank .setScore (keywordRank .getScore () + 1 );
179- }
180- keywordRankRepository .save (keywordRank );
166+ KeywordRank keywordRank = keywordRankRepository .findByKeyword (keywordResponse .getKeyword ());
167+
168+ if (keywordRank == null ) {
169+ keywordRank = KeywordRank .builder ()
170+ .keyword (keywordResponse .getKeyword ())
171+ .score (1L )
172+ .build ();
173+ } else {
174+ keywordRank .setScore (keywordRank .getScore () + 1 );
181175 }
176+
177+ keywordRankRepository .save (keywordRank );
178+
182179 }
183180
184181 private void setHistoryTitle (ChatRequest chatDto , History history , String fullResponse ) {
0 commit comments