docs: Top-p 구현 정보 추가 - 파일 위치, 줄번호, 수정 계획

- 핵심 파일 4개 위치:줄번호 명시
- EmotionState 확장 검토
- DB 스키마 변경 계획
- 복합 감정 매핑 예시

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
happybell80 2025-10-02 16:57:20 +09:00
parent 888c864b68
commit 4b2544c88b

View File

@ -55,17 +55,29 @@ fear 45% + sadness 30% = 75% (> 70%)
### 3. 구현 계획 ### 3. 구현 계획
#### emotion_llm.py 수정 #### 핵심 파일 위치
- analyze_user_emotion() 반환값 확장 - emotion/base.py:19-50 (EmotionState 구조)
- EmotionState에 복합 감정 필드 추가 또는 별도 반환 - emotion_llm.py:26-98 (analyze_user_emotion)
- llm_service.py:86-94 (프롬프트 조절)
- database.py:172-177 (DB 저장)
#### llm_service.py 수정 #### emotion_llm.py:26-98 수정
- Top-p 70% 로직 추가
- 복합 감정 리스트 반환 (EmotionState 확장 또는 별도)
#### llm_service.py:86-94 수정
- 단일/복합 감정 구분
- 복합 감정별 system_instruction 매핑 - 복합 감정별 system_instruction 매핑
- 단일/복합 감정 구분 로직 - fear+sadness: "조심스럽고 따뜻하게"
- anger+disgust: "침착하고 객관적으로"
#### DB 스키마 검토 #### database.py:172-177 수정
- top_label → top_emotions (array) - top_label (VARCHAR) → top_emotions (JSONB array)
- top_p → cumulative_p (누적 확률) - top_p (FLOAT) → cumulative_p (FLOAT)
#### EmotionState 확장 검토
- 현재: emotion_dist, entropy, dominant, confidence
- 추가 필요: top_emotions (List[str]), cumulative_p (float)
## 참고 문헌 ## 참고 문헌
- Top-p Sampling: https://en.wikipedia.org/wiki/Top-p_sampling - Top-p Sampling: https://en.wikipedia.org/wiki/Top-p_sampling