docs: record conversation_log schema and sequence alignment changes

This commit is contained in:
Claude-51124 2025-12-04 21:18:00 +09:00
parent 3bac534e9b
commit 2e6a652855
3 changed files with 9 additions and 4 deletions

View File

@ -17,6 +17,7 @@ rb8001의 중복 대화 저장 문제를 해결하고, FastAPI 구조 원칙(311
### 장기 개선 목표 ### 장기 개선 목표
- 계층 분리 원칙 위반 15건 해결 - 계층 분리 원칙 위반 15건 해결
- 유지보수성 및 확장성 향상 - 유지보수성 및 확장성 향상
- Conversation/Message 온톨로지 기반 통합 로그(actor, source_channel, channel_id, context_node 등)로 전환 + Celery/Redis 비동기 큐 도입 검토 (ChromaDB, intent_review_queue 백그라운드 처리)
--- ---

View File

@ -144,7 +144,7 @@
### 2.10 conversation_log 테이블 (실제 DB: conversation_log, 0건) ### 2.10 conversation_log 테이블 (실제 DB: conversation_log, 0건)
**실제 DB 컬럼**: user_id(FK), message, response, intent, channel_id, timestamp 등 **실제 DB 컬럼**: user_id(FK), message, response, intent, channel_id, timestamp 등
**코드 수정**: robeing_id, slack_user_id 컬럼 제거 (DB에 없음) **코드 수정**: robeing_id, slack_user_id 컬럼 제거 (DB에 없음), channel_id만 사용
| 파일 경로 | 라인 번호 | 작업 내용 | | 파일 경로 | 라인 번호 | 작업 내용 |
|-----------|-----------|-----------| |-----------|-----------|-----------|
@ -156,6 +156,9 @@
| robeing-monitor/app/state/state_service.py | 173-177 | SELECT 쿼리 (최근 로그, slack_user_id 없음) | | robeing-monitor/app/state/state_service.py | 173-177 | SELECT 쿼리 (최근 로그, slack_user_id 없음) |
| robeing-monitor/app/state/state_service.py | 194-203 | SELECT 쿼리 (7일간, slack_user_id 없음) | | robeing-monitor/app/state/state_service.py | 194-203 | SELECT 쿼리 (7일간, slack_user_id 없음) |
**2025-12-04 추가**:
- rb8001/app/state/conversation_repository.py에서 ConversationLog 생성 시 실제 스키마에 맞춰 `user_id`+`channel_id`만 저장하도록 수정, `ensure_conversation_log_sequence_aligned()`로 시퀀스 정렬 후 INSERT 일관 유지
### 2.11 user_preference 테이블 (실제 DB: user_preference, 0건) ### 2.11 user_preference 테이블 (실제 DB: user_preference, 0건)
**실제 DB 컬럼**: user_id(FK), slack_user_id, news_keywords[], briefing_enabled, briefing_time, created_at, updated_at **실제 DB 컬럼**: user_id(FK), slack_user_id, news_keywords[], briefing_enabled, briefing_time, created_at, updated_at
**코드 모델**: user_preference 참조 (복수형 차이) **코드 모델**: user_preference 참조 (복수형 차이)

View File

@ -26,7 +26,8 @@
- app/router/router.py: X-User-Id 헤더 우선 사용 처리 - app/router/router.py: X-User-Id 헤더 우선 사용 처리
### 2. conversation_log id 자동증가 해결 ### 2. conversation_log id 자동증가 해결
- 테이블에 SERIAL 없어 MAX(id)+1로 수동 생성 - 테이블에 SERIAL 없어 MAX(id)+1로 수동 생성 (`ensure_conversation_log_sequence_aligned()` 도입, rb8001/app/state/database.py)
- 2025-12-04: save_conversation()에서 이 함수를 동기 호출하도록 정리 (await 제거), 향후에는 앱 시작 시 1회 + APScheduler 주기 실행으로 이동 예정
### 3. Gateway Slack ID→UUID 변환 ### 3. Gateway Slack ID→UUID 변환
- oauth_id와 oauth_provider='slack' 조건으로 조회 - oauth_id와 oauth_provider='slack' 조건으로 조회