docs: PostgreSQL 통합 계획 문서 업데이트 - 확인된 정보로 교체
This commit is contained in:
parent
90807cf907
commit
31e1b39662
@ -15,10 +15,10 @@
|
||||
|
||||
## 2. 기술 분석
|
||||
|
||||
### 현재 구조 (확인 필요)
|
||||
- `router.py`: ChromaDB `search_memories()` 호출만 존재
|
||||
### 현재 구조 (확인 완료)
|
||||
- `router.py` 라인 115-119: context에 user_id, channel, robeing_id만 포함
|
||||
- `_save_conversation()`: PostgreSQL, ChromaDB 둘 다 저장 (구현됨)
|
||||
- LLM 컨텍스트: ChromaDB 검색 결과만 포함
|
||||
- PostgreSQL 조회 함수: 없음 (ConversationLog 모델만 정의)
|
||||
|
||||
### 수정 필요 부분
|
||||
- **파일**: `/home/heejae/rb8001/app/router/router.py`
|
||||
@ -26,29 +26,15 @@
|
||||
|
||||
## 3. 구현 계획
|
||||
|
||||
### 3.1 PostgreSQL 조회 함수 추가 (확인 필요)
|
||||
```python
|
||||
# db_service에 추가 또는 기존 함수 확인
|
||||
async def get_recent_conversations(user_id: str, limit: int = 10):
|
||||
# UUID 형식 검증 필요
|
||||
# conversation_logs 테이블에서 최근 대화 조회
|
||||
pass
|
||||
```
|
||||
### 3.1 PostgreSQL 조회 함수 추가 (신규 구현)
|
||||
- 파일: `rb8001/app/state/database.py`
|
||||
- 함수명: `get_recent_conversations(user_id, limit=10)`
|
||||
- 쿼리: `SELECT user_message, assistant_response FROM conversation_logs`
|
||||
|
||||
### 3.2 route_message 수정
|
||||
```python
|
||||
# 1. 기존 ChromaDB 검색 (유지)
|
||||
relevant_memories = await self.search_memories(user_id, message)
|
||||
|
||||
# 2. PostgreSQL 최근 대화 추가 (신규)
|
||||
recent_conversations = await self.db_service.get_recent_conversations(
|
||||
user_id=user_id,
|
||||
limit=10
|
||||
)
|
||||
|
||||
# 3. 통합 컨텍스트 구성
|
||||
# 형식은 LLM handler 요구사항 확인 필요
|
||||
```
|
||||
### 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)
|
||||
|
||||
## 4. 주의사항
|
||||
|
||||
@ -56,9 +42,8 @@ recent_conversations = await self.db_service.get_recent_conversations(
|
||||
- **성능**: PostgreSQL 조회 추가로 인한 지연 고려
|
||||
- **순서**: 최근 대화를 먼저, 벡터 검색을 보조로
|
||||
|
||||
## 5. 검증 필요 사항
|
||||
## 5. 추가 이슈
|
||||
|
||||
- [ ] db_service에 get_recent_conversations 함수 존재 여부
|
||||
- [ ] LLM handler의 context 형식 요구사항
|
||||
- [ ] conversation_logs 테이블의 정확한 스키마
|
||||
- [ ] user_id UUID 변환 로직 위치
|
||||
- ChromaDB telemetry 오류 발생 중 → `ANONYMIZED_TELEMETRY=false` 설정 필요
|
||||
- user_id UUID 타입 처리 필요 (Frontend=UUID, Slack=변환)
|
||||
- 현재 LLM은 "internal" 사용 (외부 서비스 아님)
|
||||
Loading…
x
Reference in New Issue
Block a user