diff --git a/plans/250831_rb8001_postgresql_context_integration.md b/plans/250831_rb8001_postgresql_context_integration.md index 27c5fbb..b282fa3 100644 --- a/plans/250831_rb8001_postgresql_context_integration.md +++ b/plans/250831_rb8001_postgresql_context_integration.md @@ -27,14 +27,14 @@ ## 3. 구현 계획 ### 3.1 PostgreSQL 조회 함수 추가 (신규 구현) -- 파일: `rb8001/app/state/database.py` +- 파일: `/home/happybell80/ivada_project/rb8001/app/state/database.py` - 함수명: `get_recent_conversations(user_id, limit=10)` -- 쿼리: `SELECT user_message, assistant_response FROM conversation_logs` +- 쿼리: `SELECT message, response, timestamp FROM conversation_logs WHERE user_id = %s ORDER BY timestamp DESC` -### 3.2 route_message 수정 (라인 115-119) -- 기존: `context = {"user_id", "channel", "robeing_id"}` -- 추가: `"recent_conversations": await db.get_recent_conversations(user_id)` -- LLM handler: Dict[str, Any] 타입 받음 (라인 270-276) +### 3.2 중요: gemini_handler.py 수정 필요 +- **문제**: router.py에서 전달한 context 딕셔너리는 무시됨 (gemini_handler.py:87) +- **해결**: gemini_handler.py에서 context['recent_conversations'] 사용하도록 수정 +- **프롬프트**: `{system}{memory}{recent_chats}\n\n사용자: {message}` ## 4. 주의사항 @@ -46,4 +46,4 @@ - ChromaDB telemetry 오류 발생 중 → `ANONYMIZED_TELEMETRY=false` 설정 필요 - user_id UUID 타입 처리 필요 (Frontend=UUID, Slack=변환) -- 현재 LLM은 "internal" 사용 (외부 서비스 아님) \ No newline at end of file +- LLM: Gemini 2.5 Flash Lite (DEFAULT_LLM_MODEL=gemini-2.5-flash-lite) \ No newline at end of file