From 2e6a65285519a50e8f0126eb31ea1bd4eb9fb790 Mon Sep 17 00:00:00 2001 From: Claude-51124 Date: Thu, 4 Dec 2025 21:18:00 +0900 Subject: [PATCH] docs: record conversation_log schema and sequence alignment changes --- .../251123_rb8001_계층_분리_리팩토링_계획.md | 1 + ...happybell80_PostgreSQL_테이블명_단수형_통일.md | 7 +++++-- ...ppybell80_UUID_체계_전환_및_대화저장_오류.md | 5 +++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/journey/plans/251123_rb8001_계층_분리_리팩토링_계획.md b/journey/plans/251123_rb8001_계층_분리_리팩토링_계획.md index 1af4795..b7b22aa 100644 --- a/journey/plans/251123_rb8001_계층_분리_리팩토링_계획.md +++ b/journey/plans/251123_rb8001_계층_분리_리팩토링_계획.md @@ -17,6 +17,7 @@ rb8001의 중복 대화 저장 문제를 해결하고, FastAPI 구조 원칙(311 ### 장기 개선 목표 - 계층 분리 원칙 위반 15건 해결 - 유지보수성 및 확장성 향상 +- Conversation/Message 온톨로지 기반 통합 로그(actor, source_channel, channel_id, context_node 등)로 전환 + Celery/Redis 비동기 큐 도입 검토 (ChromaDB, intent_review_queue 백그라운드 처리) --- diff --git a/journey/troubleshooting/250911_happybell80_PostgreSQL_테이블명_단수형_통일.md b/journey/troubleshooting/250911_happybell80_PostgreSQL_테이블명_단수형_통일.md index de9519b..fba4abb 100644 --- a/journey/troubleshooting/250911_happybell80_PostgreSQL_테이블명_단수형_통일.md +++ b/journey/troubleshooting/250911_happybell80_PostgreSQL_테이블명_단수형_통일.md @@ -144,7 +144,7 @@ ### 2.10 conversation_log 테이블 (실제 DB: conversation_log, 0건) **실제 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 | 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건) **실제 DB 컬럼**: user_id(FK), slack_user_id, news_keywords[], briefing_enabled, briefing_time, created_at, updated_at **코드 모델**: user_preference 참조 (복수형 차이) @@ -248,4 +251,4 @@ **교훈**: - DB 테이블명은 단수형 사용이 PostgreSQL 관례 - 코드와 DB 구조 일치 필수 -- 존재하지 않는 테이블은 주석 처리로 명시 \ No newline at end of file +- 존재하지 않는 테이블은 주석 처리로 명시 diff --git a/journey/troubleshooting/250924_happybell80_UUID_체계_전환_및_대화저장_오류.md b/journey/troubleshooting/250924_happybell80_UUID_체계_전환_및_대화저장_오류.md index 3e6bd81..29d0193 100644 --- a/journey/troubleshooting/250924_happybell80_UUID_체계_전환_및_대화저장_오류.md +++ b/journey/troubleshooting/250924_happybell80_UUID_체계_전환_및_대화저장_오류.md @@ -26,7 +26,8 @@ - app/router/router.py: X-User-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 변환 - oauth_id와 oauth_provider='slack' 조건으로 조회 @@ -116,4 +117,4 @@ robeing-gateway/app/ ### 관련 문제 - Slack 요청은 OAuth 인증 없이 직접 `/slack/events`로 전송 - JWT 토큰 없이 Slack 웹훅이 직접 호출 -- DB에서 oauth_id로 UUID 조회 시 oauth_provider='slack' 조건 필수 \ No newline at end of file +- DB에서 oauth_id로 UUID 조회 시 oauth_provider='slack' 조건 필수