- gmail_tokens → gmail_token (33 files) - companies → company (17 files) - conversation_logs → conversation_log (27 files) - workspace_members → workspace_member (28 files) All table names now match the actual PostgreSQL schema
1.9 KiB
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:73→channel="web"하드코딩 - Slack:
rb8001/app/router/slack_handler.py:169→event.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..."✅
해결 내용:
- rb8001에
/api/message엔드포인트 추가 - Frontend 요청은 channel="frontend"로 명시적 설정
- Slack 요청은 기존대로 event['channel'] 사용 (D/C/G 프리픽스 자동 구분)