docs: user_id UUID 타입 불일치 문제 추가

- PostgreSQL conversation_logs 테이블 스키마 문제
- slack_user_id 컬럼 추가 솔루션
- rb8001 코드 수정 방안 제시
This commit is contained in:
happybell80 2025-08-26 00:09:53 +09:00
parent f4a9320828
commit 93fcef1878

View File

@ -151,6 +151,65 @@ graph LR
--- ---
## 추가 문제 해결 (user_id UUID 타입 불일치)
### 발견된 문제
1. **PostgreSQL 저장 실패**
```
PostgreSQL save failed: invalid input syntax for type uuid: "system"
PostgreSQL save failed: invalid input syntax for type uuid: "U0925SXQFDK"
```
2. **원인 분석**
- conversation_logs 테이블의 user_id가 UUID 타입
- rb8001은 Slack user ID (문자열) 전송
- UUID 변환 불가능한 값으로 저장 실패
### DB 스키마 수정 (51123 서버)
```sql
-- slack_user_id 컬럼 추가
ALTER TABLE conversation_logs
ADD COLUMN slack_user_id VARCHAR(255);
-- user_id를 nullable로 변경
ALTER TABLE conversation_logs
ALTER COLUMN user_id DROP NOT NULL;
```
### rb8001 코드 수정 필요
```python
# router.py:338 수정
conversation_log = ConversationLog(
robeing_id=settings.ROBEING_ID,
slack_user_id=user_id, # user_id 대신 slack_user_id 사용
channel_id=channel,
message=message,
response=response,
intent=intent,
confidence=confidence
)
```
### database.py 모델 수정
```python
class ConversationLog(Base):
"""대화 로그 테이블"""
__tablename__ = "conversation_logs"
id = Column(Integer, primary_key=True, index=True)
robeing_id = Column(String, index=True)
user_id = Column(String, nullable=True) # UUID 타입, nullable
slack_user_id = Column(String) # Slack ID 저장용
channel_id = Column(String)
message = Column(String)
response = Column(String)
intent = Column(String)
confidence = Column(Float)
timestamp = Column(DateTime, default=datetime.utcnow)
```
---
## 모니터링 ## 모니터링
### 로그 확인 ### 로그 확인