Fix: [3.0.1] 응답에 video_url/channel_name 포함 + 요약 프롬프트 개선
All checks were successful
news-summary-bot-cicd / build_push_deploy (push) Successful in 15m25s
All checks were successful
news-summary-bot-cicd / build_push_deploy (push) Successful in 15m25s
- API 응답에 video_url, channel_name을 항상 포함 (n8n Switch 이후 사용) - channel_name 필드를 request body에서 받아 그대로 반환 - 요약 프롬프트: 구체적 수치/사례 포함, 메타 서술 금지, 시청자 액션 제시 - 문서 전체 API 응답 형식 업데이트 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
10
app/main.py
10
app/main.py
@@ -11,6 +11,7 @@ app = FastAPI(title="News Summary Bot")
|
||||
class SummarizeRequest(BaseModel):
|
||||
video_url: str
|
||||
title: str = ""
|
||||
channel_name: str = ""
|
||||
|
||||
|
||||
@app.post("/summarize")
|
||||
@@ -23,21 +24,24 @@ async def summarize_video(
|
||||
|
||||
title = req.title or "제목 없음"
|
||||
|
||||
channel_name = req.channel_name or ""
|
||||
base = {"video_url": req.video_url, "title": title, "channel_name": channel_name}
|
||||
|
||||
try:
|
||||
video_id = extract_video_id(req.video_url)
|
||||
transcript = fetch_transcript(video_id)
|
||||
summary = summarize(transcript, title)
|
||||
except SkipVideo as e:
|
||||
return {"status": "skipped", "title": title, "reason": str(e)}
|
||||
return {**base, "status": "skipped", "reason": str(e)}
|
||||
except Exception as e:
|
||||
return {
|
||||
**base,
|
||||
"status": "error",
|
||||
"title": title,
|
||||
"error_type": type(e).__name__,
|
||||
"error_message": str(e),
|
||||
}
|
||||
|
||||
return {"status": "ok", "title": title, "summary": summary}
|
||||
return {**base, "status": "ok", "summary": summary}
|
||||
|
||||
|
||||
@app.get("/health")
|
||||
|
||||
Reference in New Issue
Block a user