Feat: [4.0.0] 뉴스 요약에 주식 시장 영향 분석 기능 추가
All checks were successful
news-summary-bot-cicd / build_push_deploy (push) Successful in 11m18s
All checks were successful
news-summary-bot-cicd / build_push_deploy (push) Successful in 11m18s
요약 프롬프트에 증권 애널리스트 역할을 통합하여 API 1회 호출로 시장 영향, 관련 섹터, 주목 종목, 전망을 함께 생성. 모든 필드는 단순 문자열로 유지하여 파싱 안정성 확보. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
13
CLAUDE.md
13
CLAUDE.md
@@ -28,14 +28,14 @@ n8n(YouTube API로 새 영상 감지) → `POST /api/news/summarize` → 자막
|
||||
|
||||
- `app/main.py` — FastAPI 엔드포인트 (`/summarize`, `/health`) — Nginx가 `/api/news/` prefix를 strip
|
||||
- `app/transcript.py` — YouTube 자막 추출 (`yt-dlp` + 쿠키 인증)
|
||||
- `app/summarizer.py` — Claude Sonnet 4.6으로 요약 생성
|
||||
- `app/summarizer.py` — Claude Sonnet 4.6으로 요약 + 주식 시장 영향 분석 생성
|
||||
- `app/config.py` — 환경변수 설정 (pydantic-settings)
|
||||
|
||||
### API 응답 형식
|
||||
|
||||
```json
|
||||
// 성공
|
||||
{"video_url": "...", "title": "...", "channel_name": "...", "status": "ok", "oneliner": "한줄 요약", "main_points": "• 포인트1\n• 포인트2", "conclusion": "결론", "summary": "**한줄 요약**\n\n• 포인트1\n• 포인트2\n\n> 결론"}
|
||||
{"video_url": "...", "title": "...", "channel_name": "...", "status": "ok", "oneliner": "한줄 요약", "main_points": "• 포인트1\n• 포인트2", "conclusion": "결론", "market_impact": "시장 영향 요약", "sectors": "📈 섹터명 — 이유\n📉 섹터명 — 이유", "watchlist": "• 종목명(코드) — 이유\n• 종목명(코드) — 이유", "outlook": "전망 및 액션 포인트", "summary": "통합 요약 텍스트"}
|
||||
|
||||
// 스킵 (라이브/쇼츠)
|
||||
{"video_url": "...", "title": "...", "channel_name": "...", "status": "skipped", "reason": "라이브/예정 영상은 요약 대상이 아닙니다"}
|
||||
@@ -44,7 +44,8 @@ n8n(YouTube API로 새 영상 감지) → `POST /api/news/summarize` → 자막
|
||||
{"video_url": "...", "title": "...", "channel_name": "...", "status": "error", "error_type": "ValueError", "error_message": "..."}
|
||||
```
|
||||
|
||||
> `summary`는 `oneliner` + `main_points` + `conclusion`을 합친 Discord embed용 통합 필드.
|
||||
> `summary`는 `oneliner` + `main_points` + `conclusion` + `market_impact` + `sectors` + `watchlist` + `outlook`을 합친 Discord embed용 통합 필드.
|
||||
> 주식 분석 필드(`market_impact`, `sectors`, `watchlist`, `outlook`)는 뉴스와 무관 시 "해당 뉴스는 주식 시장과 직접적 연관이 없습니다"로 fallback.
|
||||
|
||||
## 환경변수
|
||||
|
||||
@@ -194,13 +195,17 @@ return $input.all().filter(item => {
|
||||
fields: [
|
||||
{ name: "📋 주요 내용", value: $json.main_points, inline: false },
|
||||
{ name: "🎯 결론 / 시사점", value: $json.conclusion, inline: false },
|
||||
{ name: "📈 시장 영향", value: $json.market_impact, inline: false },
|
||||
{ name: "🏭 관련 섹터", value: $json.sectors, inline: false },
|
||||
{ name: "👀 주목 종목", value: $json.watchlist, inline: false },
|
||||
{ name: "🔮 전망", value: $json.outlook, inline: false },
|
||||
{ name: "🔗 원본 영상", value: $json.video_url, inline: false }
|
||||
],
|
||||
thumbnail: {
|
||||
url: "https://img.youtube.com/vi/" + $json.video_url.split("v=")[1] + "/hqdefault.jpg"
|
||||
},
|
||||
footer: {
|
||||
text: "YouTube 뉴스 요약 봇 • " + $json.channel_name
|
||||
text: "⚠️ 투자 참고용 · 판단의 책임은 본인에게 있습니다 • " + $json.channel_name
|
||||
},
|
||||
timestamp: new Date().toISOString()
|
||||
}]
|
||||
|
||||
Reference in New Issue
Block a user