feat(ai): Ask Chat RAG embedding 생성 및 백필 파이프라인 추가#197
Merged
Conversation
DailyReportCompletedEvent에 answerEntryId와 reportId를 포함하고, 완료 트랜잭션 커밋 이후 AskChatRagIndexingEventListener에서 ANSWER_ENTRY 문서 embedding을 생성하도록 추가
FAILED embedding 문서를 스케줄러로 재시도하고, retry_count가 embedding-max-retry-count에 도달하면 DEAD_LETTER로 전환하도록 보강
기존 완료 daily answer/report를 현재 embedding version 기준으로 batch 색인하는 backfill service를 추가하고, 관리자 페이지에서 한 batch씩 수동 실행할 수 있는 Ask Chat RAG 탭과 API를 추가함. backfill 결과는 targetCount, indexedCount, failedCount로 확인 가능하며 일부 실패 시 다음 대상 처리를 계속하도록 구성함
backfill-batch-size 설정을 분리해 기존 데이터 이관 batch 크기를 별도로 조절하도록 하고, Testcontainers PostgreSQL 환경에서 backfill 대상 조회와 pgvector embedding 상태 갱신을 검증하는 통합 테스트를 추가함. 테스트 프로필에서는 embedding retry scheduler를 비활성화해 의도치 않은 외부 호출 가능성을 줄임
Collaborator
|
LGTM! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 요약(Summary)
주요 변경사항
RAG 인덱싱 파이프라인
DailyReportCompletedEvent에answerEntryId,reportId,interestCode를 포함하도록 확장DailyReportTxService내부에서 완료 이벤트를 발행해AFTER_COMMITlistener가 실제 커밋 성공 이후 동작하도록 조정AskChatRagIndexingEventListener를 추가해 완료된 daily answer/report를 RAG 문서로 색인ANSWER_ENTRYsource 문서로 저장하고 embedding 생성실패 재시도와 운영 상태 관리
retry_count,last_embedding_attempted_at,DEAD_LETTER상태 추가DEAD_LETTER로 전환AskChatRagEmbeddingRetryScheduler를 추가해FAILED문서를 주기적으로 재시도embedding-retry-enabled,embedding-retry-fixed-delay-ms,embedding-max-retry-count설정 추가기존 데이터 backfill
AskChatRagBackfillService를 통해 현재 embedding version 기준으로 batch 단위 색인 지원embedding-batch-size와 별도로backfill-batch-size를 분리해 운영 batch 크기를 독립 조절 가능하게 구성관리자 페이지
Ask Chat RAG탭 추가POST /admin/api/ask-chat/rag/backfill/daily-answersAPI 추가Run Next Batch로 한 batch씩 수동 실행하고targetCount,indexedCount,failedCount확인 가능테스트
검증
.\gradlew.bat test --tests "com.devkor.ifive.nadab.domain.askchat.*"통과.\gradlew.bat test전체 통과참고 / 리스크
🔗 Related Issue
💬 공유사항
✅ PR Checklist
PR이 다음 요구 사항을 충족하는지 확인하세요.