응원가 생성을 라인업 발표 이후로 게이트

- 네이버 preview fullLineUp 조회 — 양팀 타자 8명 이상이면 발표로 간주,
  확정 라인업(타순·포지션 실명)을 가사 컨텍스트에 주입
- 생성 윈도우(킥오프 150분 전~) 안에서 발표까지 대기, 킥오프 40분 전까지
  미발표면 라인업 없이 폴백 생성
- 라인업 없이 만든 곡은 발표 후 자동 재생성(업그레이드) — 기존 트랙을
  유지한 채 새 곡 완성 시점에 교체, 실패 시 이전 곡 복귀

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
JinwooKimandClaude Fable 5 committed 2026-08-25 09:59:19 +09:00
1 parent 390e06113d
commit 0fc7598d88
4 files changed
+122 -22

No files matched your search

+7 -2
View File
@@ -32,14 +32,19 @@ def _song_out(s: Song) -> dict:
@router.get("/today")
async def today_songs(league: str = "kbo", db: AsyncSession = Depends(get_db)) -> list[dict]:
today = datetime.now(KST).date()
# 업그레이드(라인업 반영 재생성) 중인 곡도 이전 트랙을 계속 서빙 — 재생 공백 없음
rows = (
await db.execute(
select(Song)
.where(Song.league == league, Song.date_kst == today, Song.status == "complete")
.where(
Song.league == league,
Song.date_kst == today,
Song.status.in_(("complete", "generating")),
)
.order_by(Song.match_id, Song.team_code)
)
).scalars().all()
return [_song_out(s) for s in rows]
return [_song_out(s) for s in rows if s.tracks]
@router.post("/callback")