docs: rb8001 계획 수정 - /api/history만 필요

- /api/messages 삭제, /api/history 추가
- Frontend 수정 불필요 (이미 구현됨)
- main.py만 수정하면 완료
This commit is contained in:
happybell80 2025-09-01 22:39:54 +09:00
parent d8ff7168e0
commit a2660eb703

View File

@ -24,16 +24,17 @@
## 수정 필요 파일
### 백엔드 (rb8001)
1. `app/core/config.py` - 환경변수 추가 (MESSAGE_BATCH_SIZE=30, MAX_MESSAGES_IN_DOM=200)
2. `app/state/database.py` - get_paginated_conversations() 함수 추가
- PostgreSQL conversation_logs 테이블에서만 조회
- ChromaDB 사용하지 않음 (히스토리는 DB만)
3. `main.py` - @app.get() 직접 추가 (/api/config, /api/messages)
4. `.env` 파일 - 환경변수 설정 (docker-compose.yml 아님)
1. ✅ `app/core/config.py` - 환경변수 추가 완료
2. ✅ `app/state/database.py` - get_paginated_conversations() 추가 완료
3. `main.py` - 엔드포인트 수정 필요
- ✅ `/api/config` 이미 추가됨
- ❌ `/api/messages` 삭제 필요 (잘못 추가함)
- ⚠️ `/api/history` 추가 필요 (이것만!)
4. ✅ `.env` 파일 - 환경변수 설정 완료
### 프론트엔드 (frontend-customer)
1. `src/services/robeing-api.ts` - getConfig(), getMessages() 함수 추가
2. `src/components/chat-interface.tsx` - 무한 스크롤, 날짜 구분선 구현
1. ✅ 이미 완료됨 (250818 rb10508_micro에서 구현)
2. `/api/history` 호출 중 (수정 불필요)
---
@ -43,7 +44,7 @@
// GET /api/config
{ message_batch_size: 30, max_messages_in_dom: 200 }
// GET /api/messages?before={timestamp}&limit=30
// GET /api/history?before={timestamp}&limit=30
{
messages: [...], // PostgreSQL conversation_logs에서 조회
has_more: true
@ -69,8 +70,8 @@ const token = localStorage.getItem('token');
const decoded = jwt_decode(token);
const userId = decoded.user_id; // UUID 형식
// API 호출
await fetch(`/api/messages?user_id=${userId}&before=${timestamp}`);
// API 호출 (Frontend가 이미 호출 중)
await fetch(`/api/history?before=${timestamp}&limit=30`);
```
---
@ -114,15 +115,10 @@ 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시간)
- config.py 환경변수 추가
- database.py에 get_paginated_conversations() 구현 (PostgreSQL 전용, UUID 처리)
- main.py에 엔드포인트 직접 추가 (JWT 인증 확인)
- 현재 대화는 save_conversation()으로 PostgreSQL에 저장 (UUID로 저장)
2. 프론트엔드 통합 (1시간)
- robeing-api.ts 함수 추가
- chat-interface.tsx 무한 스크롤 구현
3. 테스트 및 배포 (30분)
- curl localhost:8001/api/config 테스트
- 51124 서버 docker compose down && up -d --build
### 실제 필요 작업 (간단!)
1. ✅ 백엔드 대부분 완료 (bbf9c50 커밋)
2. ⚠️ **rb8001 main.py 수정만 필요**:
- `/api/messages` 엔드포인트 삭제
- `/api/history` 엔드포인트 추가 (get_paginated_conversations 사용)
3. ✅ Frontend 수정 불필요 (이미 /api/history 호출 중)
4. ✅ 배포는 Gitea Actions 자동 처리