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