docs: 명언 로테이션 개선 방안 문서화

- 날짜 기반 로테이션으로 방향 변경
- DB 불필요, 코드 수정만으로 구현 가능
- 환경변수 우선순위 및 구현 세부사항 추가

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
happybell80 2025-09-26 10:40:38 +09:00
parent e626baca42
commit 981606c6a6

View File

@ -0,0 +1,55 @@
# 명언 로테이션 개선
## 날짜: 2025-09-26
## 작성자: happybell80
## 관련 서비스: skill_news
## 상태: 개선 필요
---
## 1. 현재 상황
### 파일 위치
- 코드: `/home/happybell80/ivada_project/skill_news/app/services/naver_startup_news_service.py`
- 데이터: `/home/happybell80/ivada_project/skill_news/app/data/slack_messages.md`
### 현재 구현 (라인 96-116)
```python
def _get_random_messages(self) -> Tuple[str, str, Tuple[str, str, str]]:
"""랜덤 오프닝/클로징/명언 메시지 선택"""
# 라인 111: random.choice(openings)
# 라인 113: random.choice(closings)
# 라인 116: random.choice(quotes)
```
### 문제점
- 완전 랜덤 선택으로 같은 명언이 연속 반복될 수 있음
- 20개 오프닝, 20개 클로징, 명언 개수는 로더에서 로깅됨 (라인 88)
- 로테이션 순서나 사용 기록 추적 없음
- 환경변수(HEADLINES_OPENER/CLOSER) 설정 시 랜덤 선택 건너뜀 (라인 105-107)
---
## 2. 개선 방안
### 로테이션 방식 (날짜 기반)
- 오늘 날짜를 기준으로 인덱스 계산
- 인덱스 = (오늘의 일수) % (명언 개수)
- DB 수정 불필요, 코드만 변경
### 구현 필요사항
1. _get_random_messages() 메서드 수정
2. random.choice() 대신 날짜 기반 인덱스 사용
```python
from datetime import datetime
today = datetime.now().timetuple().tm_yday # 1-365
opener = openings[today % len(openings)] if openings else default_opener
closer = closings[today % len(closings)] if closings else default_closer
quote = quotes[today % len(quotes)] if quotes else default_quote
```
3. 환경변수 우선순위 유지 (설정 시 로테이션 비활성)
---
## 3. 기한
- 1일 (2025-09-27까지)