DOCS/journey/troubleshooting/250828_conversation_logs_channel_구분_개선.md
Claude-51124 22557e7132 docs: 오래된 트러블슈팅 아카이브 및 구조 정리
- 7-8월 초기 구축 문서 12개를 _archive/troubleshooting/2025_07-08_initial_setup/로 이동
- book/300_architecture/390_human_in_the_loop_intent_learning.md를 journey/research/intent_classification/로 이동 (개발 여정 문서)
- 빈 폴더 제거 (journey/assets/*)
2025-11-17 14:06:05 +09:00

1.9 KiB

conversation_log 채널 구분 개선

날짜: 2025-08-28
테이블: conversation_log
상태: 해결 완료 (2025-08-28)

현재 상황 (DB 확인)

channel_id 건수 실제 내역
web 55 Frontend(46) + Slack DM(9) 혼재
C0920L68267 10 Slack 채널
dm_summary 3 시스템

문제: Slack DM이 "D..."로 저장되지 않고 "web"으로 저장됨

코드 위치

  • Frontend: rb8001/main.py:73channel="web" 하드코딩
  • Slack: rb8001/app/router/slack_handler.py:169event.get("channel")

해결 방안

구현 완료 (2025-08-28)

# 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 스키마 개선 (선택)

ALTER TABLE conversation_log 
ADD COLUMN thread_ts VARCHAR(20),     -- 쓰레드 구분
ADD COLUMN channel_type VARCHAR(20);  -- public_channel/private_channel/im/mpim

Slack 채널 ID 체계

  • C로 시작: 공개/비공개 채널
  • D로 시작: 1:1 DM
  • G로 시작: 그룹 DM/MPIM
  • 쓰레드: 같은 channel_id + thread_ts로 구분

구현 결과

  • Frontend: "frontend"
  • Slack 채널: "C..."
  • Slack DM: "D..."

해결 내용:

  1. rb8001에 /api/message 엔드포인트 추가
  2. Frontend 요청은 channel="frontend"로 명시적 설정
  3. Slack 요청은 기존대로 event['channel'] 사용 (D/C/G 프리픽스 자동 구분)