From fef2a91b75165c98a60f16be7236c4b185307780 Mon Sep 17 00:00:00 2001 From: happybell80 Date: Mon, 1 Sep 2025 22:01:54 +0900 Subject: [PATCH] =?UTF-8?q?docs:=20rb8001=20=EB=8C=80=ED=99=94=20=ED=9E=88?= =?UTF-8?q?=EC=8A=A4=ED=86=A0=EB=A6=AC=20=EA=B5=AC=ED=98=84=20=EA=B3=84?= =?UTF-8?q?=ED=9A=8D=20-=20=ED=99=95=EC=9D=B8=EB=90=9C=20=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 실제 DB 스키마 추가 (conversation_logs) - rb8001 현재 구조 상세 명시 - 구현 순서 구체화 --- ...ion_logs_및_robing_stats_활용_계획.md | 19 +++++--- ...rb8001_chat_history_implementation_plan.md | 45 ++++++++++++++++--- 2 files changed, 51 insertions(+), 13 deletions(-) diff --git a/ideas/250818_conversation_logs_및_robing_stats_활용_계획.md b/ideas/250818_conversation_logs_및_robing_stats_활용_계획.md index 80a9373..4e15e3c 100644 --- a/ideas/250818_conversation_logs_및_robing_stats_활용_계획.md +++ b/ideas/250818_conversation_logs_및_robing_stats_활용_계획.md @@ -30,13 +30,18 @@ robeing_settings: 0 records (0 KB) ### 2.1 테이블 구조 (현재) ```sql CREATE TABLE conversation_logs ( - id UUID PRIMARY KEY, - robeing_id VARCHAR(100), - user_id UUID, - message TEXT, - response TEXT, - created_at TIMESTAMP, - metadata JSON + id INTEGER PRIMARY KEY (auto-increment), + robeing_id VARCHAR, + channel_id VARCHAR, + message VARCHAR, + response VARCHAR, + intent VARCHAR, + confidence DOUBLE PRECISION, + timestamp TIMESTAMP, + user_id UUID (FK → users), + slack_user_id VARCHAR(100), + thread_ts VARCHAR(128), + channel_type VARCHAR(32) ); ``` diff --git a/plans/250901_rb8001_chat_history_implementation_plan.md b/plans/250901_rb8001_chat_history_implementation_plan.md index 92a5962..bc0085a 100644 --- a/plans/250901_rb8001_chat_history_implementation_plan.md +++ b/plans/250901_rb8001_chat_history_implementation_plan.md @@ -8,15 +8,19 @@ ## 현재 상태 분석 - **rb10508_micro**: /api/config 엔드포인트 구현됨 (endpoints.py:407) -- **rb8001**: API 엔드포인트 없음 (추가 필요) +- **rb8001**: + - database.py: ConversationLog 모델 있음 (line 52) + - get_recent_conversations() 함수 있음 (line 81) + - get_paginated_conversations() 함수 없음 (추가 필요) + - main.py: @app.get() 직접 사용, router 분리 없음 ## 수정 필요 파일 ### 백엔드 (rb8001) -1. `app/core/config.py` - 환경변수 추가 (MESSAGE_BATCH_SIZE=30, USER_MAPPING) -2. `app/state/database.py` - get_paginated_conversations() 함수 추가 -3. `main.py` - /api/config, /api/messages 엔드포인트 추가 -4. `docker-compose.yml` - 환경변수 설정 +1. `app/core/config.py` - 환경변수 추가 (MESSAGE_BATCH_SIZE=30, MAX_MESSAGES_IN_DOM=200) +2. `app/state/database.py` - get_paginated_conversations() 함수 추가 (기존 get_recent_conversations 참고) +3. `main.py` - @app.get() 직접 추가 (/api/config, /api/messages) +4. `.env` 파일 - 환경변수 설정 (docker-compose.yml 아님) ### 프론트엔드 (frontend-customer) 1. `src/services/robeing-api.ts` - getConfig(), getMessages() 함수 추가 @@ -39,6 +43,28 @@ --- +## 데이터베이스 스키마 + +```sql +-- conversation_logs 테이블 (실제) +CREATE TABLE conversation_logs ( + id INTEGER PRIMARY KEY (auto-increment), + robeing_id VARCHAR, + channel_id VARCHAR, + message VARCHAR, + response VARCHAR, + intent VARCHAR, + confidence DOUBLE PRECISION, + timestamp TIMESTAMP, + user_id UUID (FK → users), + slack_user_id VARCHAR(100), + thread_ts VARCHAR(128), + channel_type VARCHAR(32) +); +``` + +--- + ## 주의사항 ### API 경로 @@ -58,5 +84,12 @@ MAX_MESSAGES_IN_DOM: int = int(os.getenv("MAX_MESSAGES_IN_DOM", 200)) ### 구현 순서 1. 백엔드 API 추가 (1시간) + - config.py 환경변수 추가 + - database.py에 get_paginated_conversations() 구현 + - main.py에 엔드포인트 직접 추가 2. 프론트엔드 통합 (1시간) -3. 테스트 및 배포 (30분) \ No newline at end of file + - robeing-api.ts 함수 추가 + - chat-interface.tsx 무한 스크롤 구현 +3. 테스트 및 배포 (30분) + - curl localhost:8001/api/config 테스트 + - 51124 서버 docker compose down && up -d --build \ No newline at end of file