diff --git a/plans/250901_rb8001_chat_history_implementation_plan.md b/plans/250901_rb8001_chat_history_implementation_plan.md new file mode 100644 index 0000000..92a5962 --- /dev/null +++ b/plans/250901_rb8001_chat_history_implementation_plan.md @@ -0,0 +1,62 @@ +# rb8001 카톡 스타일 대화 히스토리 구현 계획 + +## 작성일: 2025-09-01 +## 대상: rb8001 (프로덕션 로빙) +## 참조: rb10508_micro 구현 코드 + +--- + +## 현재 상태 분석 +- **rb10508_micro**: /api/config 엔드포인트 구현됨 (endpoints.py:407) +- **rb8001**: API 엔드포인트 없음 (추가 필요) + +## 수정 필요 파일 + +### 백엔드 (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` - 환경변수 설정 + +### 프론트엔드 (frontend-customer) +1. `src/services/robeing-api.ts` - getConfig(), getMessages() 함수 추가 +2. `src/components/chat-interface.tsx` - 무한 스크롤, 날짜 구분선 구현 + +--- + +## API 스펙 + +```typescript +// GET /api/config +{ message_batch_size: 30, max_messages_in_dom: 200 } + +// GET /api/messages?before={timestamp}&limit=30 +{ + messages: [...], + has_more: true +} +``` + +--- + +## 주의사항 + +### API 경로 +```python +# main.py에 직접 추가 (rb8001은 router 분리 없음) +@app.get("/api/config") +@app.get("/api/messages") +``` + +### rb10508_micro 참조 코드 +```python +# rb10508_micro/app/config.py:101-103 +MESSAGE_BATCH_SIZE: int = int(os.getenv("MESSAGE_BATCH_SIZE", 30)) +SCROLL_THRESHOLD: int = int(os.getenv("SCROLL_THRESHOLD", 100)) +MAX_MESSAGES_IN_DOM: int = int(os.getenv("MAX_MESSAGES_IN_DOM", 200)) +``` + +### 구현 순서 +1. 백엔드 API 추가 (1시간) +2. 프론트엔드 통합 (1시간) +3. 테스트 및 배포 (30분) \ No newline at end of file