diff --git a/troubleshooting/250828_conversation_logs_channel_구분_개선.md b/troubleshooting/250828_conversation_logs_channel_구분_개선.md index e232dad..299b8b0 100644 --- a/troubleshooting/250828_conversation_logs_channel_구분_개선.md +++ b/troubleshooting/250828_conversation_logs_channel_구분_개선.md @@ -2,7 +2,7 @@ **날짜**: 2025-08-28 **테이블**: conversation_logs -**상태**: 🔴 해결 필요 +**상태**: ✅ 해결 완료 (2025-08-28) ## 현재 상황 (DB 확인) | channel_id | 건수 | 실제 내역 | @@ -19,14 +19,24 @@ ## 해결 방안 -### Phase 1: 즉시 수정 +### ✅ 구현 완료 (2025-08-28) ```python -# rb8001/main.py:73 -channel = "frontend" # "web" → "frontend" - -# Slack은 event['channel'] 그대로 사용 (C/D/G 프리픽스 자동 구분) +# rb8001/main.py:367-404 +@app.post("/api/message") +async def frontend_message(request: Request): + """Frontend에서 오는 메시지 처리 (Gateway 경유)""" + # ... + result = await router.route_message( + message=text, + user_id=user_id, + channel="frontend", # 'web' 대신 'frontend' 사용 + thread_ts=None + ) ``` +Frontend 요청은 이제 channel_id="frontend"로 저장됩니다. +Slack DM은 여전히 "D..."로 정상 저장됩니다. + ### Phase 2: DB 스키마 개선 (선택) ```sql ALTER TABLE conversation_logs @@ -40,9 +50,12 @@ ADD COLUMN channel_type VARCHAR(20); -- public_channel/private_channel/im/mpim - **G로 시작**: 그룹 DM/MPIM - **쓰레드**: 같은 channel_id + thread_ts로 구분 -## 예상 결과 -- Frontend: `"frontend"` -- Slack 채널: `"C..."` -- Slack DM: `"D..."` (현재 "web"으로 잘못 저장 중) +## 구현 결과 +- Frontend: `"frontend"` ✅ +- Slack 채널: `"C..."` ✅ +- Slack DM: `"D..."` ✅ -**근본 원인**: Slack DM event['channel']이 중간에 "web"으로 덮어씌워짐 (조사 필요) \ No newline at end of file +**해결 내용**: +1. rb8001에 `/api/message` 엔드포인트 추가 +2. Frontend 요청은 channel="frontend"로 명시적 설정 +3. Slack 요청은 기존대로 event['channel'] 사용 (D/C/G 프리픽스 자동 구분) \ No newline at end of file