33import com .ai .lawyer .domain .chatbot .dto .ChatDto .ChatRequest ;
44import com .ai .lawyer .domain .chatbot .dto .ChatDto .ChatResponse ;
55import com .ai .lawyer .domain .chatbot .service .ChatBotService ;
6+ import com .ai .lawyer .global .util .AuthUtil ;
67import io .swagger .v3 .oas .annotations .Operation ;
78import io .swagger .v3 .oas .annotations .tags .Tag ;
89import lombok .RequiredArgsConstructor ;
910import lombok .extern .slf4j .Slf4j ;
1011import org .springframework .http .ResponseEntity ;
11- import org .springframework .security .core .annotation .AuthenticationPrincipal ;
1212import org .springframework .stereotype .Controller ;
1313import org .springframework .web .bind .annotation .PathVariable ;
1414import org .springframework .web .bind .annotation .PostMapping ;
@@ -27,15 +27,19 @@ public class ChatBotController {
2727
2828 @ Operation (summary = "01. 새로운 채팅" , description = "첫 메시지 전송으로 새로운 채팅방을 생성하고 챗봇과 대화를 시작" )
2929 @ PostMapping ("/message" )
30- public ResponseEntity <Flux <ChatResponse >> postNewMessage (
31- @ AuthenticationPrincipal Long memberId ,
32- @ RequestBody ChatRequest chatRequest ) {
30+ public ResponseEntity <Flux <ChatResponse >> postNewMessage (@ RequestBody ChatRequest chatRequest ) {
31+ Long memberId = AuthUtil . getAuthenticatedMemberId ();
32+ log . debug ( "새로운 채팅 요청: memberId={}" , memberId );
3333 return ResponseEntity .ok (chatBotService .sendMessage (memberId , chatRequest , null ));
3434 }
3535
3636 @ Operation (summary = "02. 기존 채팅" , description = "기존 채팅방에 메시지를 보내고 챗봇과 대화를 이어감" )
3737 @ PostMapping ("{roomId}/message" )
38- public ResponseEntity <Flux <ChatResponse >> postMessage (@ AuthenticationPrincipal Long memberId , @ RequestBody ChatRequest chatRequest , @ PathVariable (value = "roomId" , required = false ) Long roomId ) {
38+ public ResponseEntity <Flux <ChatResponse >> postMessage (
39+ @ RequestBody ChatRequest chatRequest ,
40+ @ PathVariable (value = "roomId" , required = false ) Long roomId ) {
41+ Long memberId = AuthUtil .getAuthenticatedMemberId ();
42+ log .debug ("기존 채팅 요청: memberId={}, roomId={}" , memberId , roomId );
3943 return ResponseEntity .ok (chatBotService .sendMessage (memberId , chatRequest , roomId ));
4044 }
4145
0 commit comments