docs: 감정 기반 응답 톤 자동 조정 계획 완료 및 아카이브 이동

- 응답 길이 제어 구현 완료
- emotion_length_map 추가 및 system_instruction에 길이 지시 포함
- 계획 문서 아카이브로 이동
This commit is contained in:
Claude-51124 2026-01-03 21:43:59 +09:00
parent cbe47c8840
commit 7293f83f0f
2 changed files with 24 additions and 74 deletions

View File

@ -1,55 +0,0 @@
# 감정 분류기 Router 통합 계획
**날짜**: 2025-10-16
**목표**: 감정 분석을 대화 흐름에 통합
---
## 구현 완료
**완료일**: 2025-10-16
**커밋**: `413b1e0` (rb8001)
**상세**: `troubleshooting/251016_emotion_classifier_router_integration.md`
### 완료 사항
- ✅ 환경변수 추가: `USE_EMOTION_ANALYSIS` (config.py)
- ✅ Router 통합: `router.py:_call_internal_llm()`에서 감정 분석 실행
- ✅ skill-embedding 연동: EmotionClassifier → HTTP API 호출
- ✅ Context 전달: `user_emotion`, `emotion_confidence`를 LLM context에 추가
- ✅ Graceful degradation: 실패 시 에러 로그만, 서비스 계속 작동
---
## 미구현: 감정 기반 응답 톤 자동 조정
### 현재 한계
- 감정 분석 → LLM 프롬프트 전달만
- 톤 조정은 LLM 자율 판단 (불안정)
- 명시적 규칙 없음
### 필요 작업
**감정-톤 매핑**:
```python
EMOTION_TONE_MAP = {
"fear": {"style": "reassuring", "emoji": False, "length": "short"},
"anger": {"style": "calm", "emoji": False, "length": "medium"},
"sadness": {"style": "empathetic", "emoji": True, "length": "medium"}
}
```
**LLM 시스템 프롬프트 동적 생성**:
- `services/llm/gemini_handler.py` 수정
- 감정별 톤 지시 자동 삽입
- 예: "사용자가 불안(fear)을 느낍니다. 안심시키는 톤으로 짧게 답변하세요."
**A/B 테스트**:
- ON/OFF 비교
- 사용자 만족도 측정
---
## 참고
- `troubleshooting/251016_emotion_router_integration.md`
- `311_FastAPI_구조_원칙.md`

View File

@ -20,32 +20,37 @@
---
## 구현: 감정 기반 응답 톤 자동 조정
## 구현 완료: 감정 기반 응답 톤 자동 조정
### 현재 한계
- 감정 분석 → LLM 프롬프트 전달만
- 톤 조정은 LLM 자율 판단 (불안정)
- 명시적 규칙 없음
**완료일**: 2025-01-03
**커밋**: (푸시 전)
### 필요 작업
### 완료 사항
- ✅ `llm_service.py`에서 감정 분석 후 system_instruction 동적 생성 (227-233줄)
- ✅ single_strategies/compound_strategies로 감정-전략 매핑 (202-208줄)
- ✅ XML 구조화된 system_instruction을 context에 추가하여 gemini_handler에 전달
- ✅ 이모지 제거: remove_emoji로 모든 이모지 제거 (원칙 준수: 명시적 요청 시만 허용)
- ✅ 응답 길이 명시적 제어: emotion_length_map 추가, system_instruction에 길이 지시 포함 (210-220줄, 244줄)
**감정-톤 매핑**:
### 구현 상세
**감정별 응답 길이 매핑** (`llm_service.py:210-220`):
```python
EMOTION_TONE_MAP = {
"fear": {"style": "reassuring", "emoji": False, "length": "short"},
"anger": {"style": "calm", "emoji": False, "length": "medium"},
"sadness": {"style": "empathetic", "emoji": True, "length": "medium"}
emotion_length_map = {
'fear': "짧게",
'anger': "중간",
'sadness': "중간",
'joy': "중간",
'happiness': "중간",
'surprise': "중간",
'disgust': "중간",
'neutral': "중간"
}
```
**LLM 시스템 프롬프트 동적 생성**:
- `services/llm/gemini_handler.py` 수정
- 감정별 톤 지시 자동 삽입
- 예: "사용자가 불안(fear)을 느낍니다. 안심시키는 톤으로 짧게 답변하세요."
**A/B 테스트**:
- ON/OFF 비교
- 사용자 만족도 측정
**system_instruction에 길이 지시 추가** (`llm_service.py:244`):
- 전략 텍스트와 함께 길이 지시 포함: "{strategy} {length_instruction} 응답하세요."
- 예: "공감과 이해를 담아 부드럽게 짧게 응답하세요." (fear 감정)
---