From 95431bf2f83622a7d280d35b108168ac90246657 Mon Sep 17 00:00:00 2001 From: happybell80 Date: Thu, 2 Oct 2025 15:31:19 +0900 Subject: [PATCH] =?UTF-8?q?docs:=20=EA=B0=90=EC=A0=95=20DB=20=EC=A0=80?= =?UTF-8?q?=EC=9E=A5=20=EB=AC=B8=EC=A0=9C=20=EC=9B=90=EC=9D=B8=20=EB=B6=84?= =?UTF-8?q?=EC=84=9D=20=EB=B0=8F=20=ED=8C=8C=EC=9D=BC=20=ED=81=AC=EA=B8=B0?= =?UTF-8?q?=20=EC=A0=9C=ED=95=9C=20300=EC=A4=84=EB=A1=9C=20=EA=B0=95?= =?UTF-8?q?=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 20251002_emotion_db_storage_fix.md: llm_service.py 주석 처리 문제 확인 - 311_FastAPI_구조_원칙.md: 파일 크기 제한 500줄 → 300줄 변경 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- 300_architecture/311_FastAPI_구조_원칙.md | 8 ++++---- .../20251002_emotion_db_storage_fix.md | 20 ++++++++++++++++++- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/300_architecture/311_FastAPI_구조_원칙.md b/300_architecture/311_FastAPI_구조_원칙.md index f651372..15ce208 100644 --- a/300_architecture/311_FastAPI_구조_원칙.md +++ b/300_architecture/311_FastAPI_구조_원칙.md @@ -58,7 +58,7 @@ ### services/ - `{도메인}_{기능}.py`: coldmail_filter.py, ir_analyzer.py -- 한 파일 최대 500줄 +- 한 파일 최대 300줄 ### state/ (Repository 패턴) - `database.py`: 통합 DB 접근 @@ -162,9 +162,9 @@ async def get_connection(): ## 7. 파일 크기 제한 -- **한 파일 최대 500줄** +- **한 파일 최대 300줄** - 초과 시 기능별 분리 -- 예: `services/email_integration.py` (800줄) → `email_send.py` + `email_fetch.py` +- 예: `services/email_integration.py` (500줄) → `email_send.py` + `email_fetch.py` ## 8. Import 규칙 @@ -187,7 +187,7 @@ from app.services import coldmail_filter # ✅ 모듈 import - [ ] DB 접근은 state를 통하는가? - [ ] 비즈니스 로직이 router에 있지 않은가? - [ ] 순환 import 가능성은 없는가? -- [ ] 파일 크기가 500줄 이하인가? +- [ ] 파일 크기가 300줄 이하인가? ## 10. 예외 상황 diff --git a/troubleshooting/20251002_emotion_db_storage_fix.md b/troubleshooting/20251002_emotion_db_storage_fix.md index 9101721..12af6c5 100644 --- a/troubleshooting/20251002_emotion_db_storage_fix.md +++ b/troubleshooting/20251002_emotion_db_storage_fix.md @@ -39,4 +39,22 @@ ## 검증 필요 - 배포 후 Slack 대화 시 실제 저장 확인 -- user_id UUID 변환 정상 작동 확인 \ No newline at end of file +- user_id UUID 변환 정상 작동 확인 + +## 추가 발견 (2025-10-02 15:00) +**문제**: emotion_readings 테이블 여전히 3건, DB 저장 로그 없음 + +### 코드 흐름 확인 +1. **Slack 메시지 처리**: router.py:116 route_message() +2. **LLM 호출**: router.py:384 _call_internal_llm() → llm_service.py:81 process_request() +3. **감정 분석**: llm_service.py:119 analyze_user_emotion() 호출 (정상) +4. **DB 저장 누락**: llm_service.py:134-138 generate_response_with_emotion() 주석 처리됨 + +### 원인 +- DB 저장 코드: emotion_llm.py:159-181 (generate_response_with_emotion 내부) +- llm_service.py:134-138 주석 처리로 해당 함수 도달 불가능 +- analyze_user_emotion()은 감정 분석만 수행, DB 저장 없음 +- 계층 확인: emotion_llm.py:161에서 state.database.save_emotion_reading() 호출 (정상 패턴) + +### 해결 방법 +llm_service.py:134-138 주석 해제 \ No newline at end of file