From a2660eb70331be20c48ce1b5d7e49e47c504d2a7 Mon Sep 17 00:00:00 2001 From: happybell80 Date: Mon, 1 Sep 2025 22:39:54 +0900 Subject: [PATCH] =?UTF-8?q?docs:=20rb8001=20=EA=B3=84=ED=9A=8D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20-=20/api/history=EB=A7=8C=20=ED=95=84=EC=9A=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - /api/messages 삭제, /api/history 추가 - Frontend 수정 불필요 (이미 구현됨) - main.py만 수정하면 완료 --- ...rb8001_chat_history_implementation_plan.md | 42 +++++++++---------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/plans/250901_rb8001_chat_history_implementation_plan.md b/plans/250901_rb8001_chat_history_implementation_plan.md index 0515c20..30db304 100644 --- a/plans/250901_rb8001_chat_history_implementation_plan.md +++ b/plans/250901_rb8001_chat_history_implementation_plan.md @@ -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 \ No newline at end of file +### 실제 필요 작업 (간단!) +1. ✅ 백엔드 대부분 완료 (bbf9c50 커밋) +2. ⚠️ **rb8001 main.py 수정만 필요**: + - `/api/messages` 엔드포인트 삭제 + - `/api/history` 엔드포인트 추가 (get_paginated_conversations 사용) +3. ✅ Frontend 수정 불필요 (이미 /api/history 호출 중) +4. ✅ 배포는 Gitea Actions 자동 처리 \ No newline at end of file