Skip to content

채팅 AI 서버 연동#180

Merged
Goder-0 merged 1 commit intomainfrom
feature/#178-connect-chat-ai
Mar 1, 2026
Merged

채팅 AI 서버 연동#180
Goder-0 merged 1 commit intomainfrom
feature/#178-connect-chat-ai

Conversation

@ckdals4600
Copy link
Contributor

@ckdals4600 ckdals4600 commented Feb 26, 2026

관련 이슈

PR 설명

  • 외부 AI 서버와 연동하여 RAG 기반 채팅 답변을 생성하는 Feign Client 및 서비스 구현함.
  • 답변 생성 과정의 상태 추적 및 모니터링 강화를 위해 로깅 추가함.

작업 내용

API 명세

  • AI 채팅 답변 요청 (generateAnswer)
    • Endpoint: POST /webhook/chat-answer
    • 동작: 사용자 질문 및 대화 기록을 AI 서버로 전송하고, 분석된 답변 및 참조 링크, 추론 과정을 List 형태로 수신함.

Rag Request DTO 수정

  • "history" 요청 시 기존 질문 내용만 보내던 부분을 질문 내용 및 해당 질문의 role을 포함하여 요청하도록 수정
    • 기존
        {
            "userId": 1,
            "question": "Gemini 관련 링크 찾아줘",
            "history": [
                         "네이버 링크는 naver.com입니다.",
                          "네이버 링크 알려줘"
             ]
            "mode": "detailed"
        }
    • 변경 후
        {
            "userId": 1,
            "question": "Gemini 관련 링크 찾아줘",
            "history": [{
                       "role":"system",
                       "content":"네이버 링크는 naver.com입니다."
                  },
                  {
                       "role":"user",
                       "content":"네이버 링크 알려줘"
                  }]
            "mode": "detailed"
        }

비즈니스 로직

  • RagAnswerFeign 신규 작성: AI 서버(ai.server.url)와 통신하는 Feign Client 인터페이스 구현함.
  • AnswerClient 구현체 프로파일 분리:
    • RagAnswerClient (!test 프로파일): 실제 Feign Client를 호출하며, 통신 예외 발생 시 트랜잭션 롤백 없이 에러 로그를 남기고 null을 반환하도록 Soft Fail 처리함. 응답받은 List 데이터 중 첫 번째 요소를 반환함.
    • MockAnswerClient (test 프로파일): 외부 API 호출 없이 더미 데이터를 반환하도록 구현함.
  • ChatFacade 로깅 추가:
    • 작업 취소(isCancelled), 예외 발생(ex != null), 결과값 누락(result == null) 등 예외 상황별 상세 로그(info/error) 기록 로직 추가함.

@ckdals4600 ckdals4600 linked an issue Feb 26, 2026 that may be closed by this pull request
@ckdals4600 ckdals4600 self-assigned this Feb 26, 2026
@ckdals4600 ckdals4600 force-pushed the feature/#178-connect-chat-ai branch from 68529f3 to aa7f690 Compare February 26, 2026 14:43
@ckdals4600 ckdals4600 requested review from Goder-0 and minibr February 27, 2026 14:02
@ckdals4600 ckdals4600 force-pushed the feature/#178-connect-chat-ai branch from aa7f690 to 836e2a8 Compare February 28, 2026 10:37
@github-actions
Copy link

📊 코드 커버리지 리포트

Overall Project 89.59% -0.4% 🍏
Files changed 78.57% 🍏

File Coverage
RagChatService.java 100% 🍏
RagAnswerClient.java 100% 🍏
MockAnswerClient.java 100% 🍏
ChatFacade.java 90.7% -8.72% 🍏

@Goder-0 Goder-0 merged commit 665f62f into main Mar 1, 2026
1 check passed
@Goder-0 Goder-0 deleted the feature/#178-connect-chat-ai branch March 1, 2026 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

채팅 AI 서버 연동

2 participants