오늘의 응원가 자동 생성 파이프라인 (Suno)
- 경기 맥락(전날 결과·순위·연전 차수·선발투수) 조립 → LLM 작사 (콜앤리스폰스·섹션 태그 형식) → Suno(sunoapi.org) 생성 → songs 테이블 - 워커: 킥오프 150분 전 윈도우 진입 시 생성 시작 + 2분 주기 폴링 - API: GET /api/songs/today · POST /api/songs/callback(싱크대) · POST /api/songs/generate(관리자 강제 생성) - 프론트: MusicBar 가 경기 상세·메인에서 오늘의 응원가를 동적 로드 (정적 플레이리스트는 폴백 유지) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2a8f2bc1fa
commit
277378477a
11 files changed
+706
-7
No files matched your search
@@ -298,6 +298,47 @@ class RefreshToken(Base):
|
||||
)
|
||||
|
||||
|
||||
class Song(Base):
|
||||
"""오늘의 응원가 — 경기×팀 단위 Suno 생성 트랙.
|
||||
|
||||
가사·스타일은 LLM(경기 맥락 주입)이 쓰고, 음원은 Suno(sunoapi.org)가 생성.
|
||||
audio/image URL 은 제공자 CDN 을 그대로 사용(당일 소비 콘텐츠라 다운로드 불필요).
|
||||
"""
|
||||
|
||||
__tablename__ = "songs"
|
||||
__table_args__ = (
|
||||
UniqueConstraint("match_id", "team_code", name="uq_song_match_team"),
|
||||
)
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
league: Mapped[str] = mapped_column(String, index=True)
|
||||
date_kst: Mapped[date] = mapped_column(Date, index=True) # 경기일 (KST)
|
||||
match_id: Mapped[str] = mapped_column(
|
||||
ForeignKey("matches.match_id", ondelete="CASCADE"), index=True
|
||||
)
|
||||
team_code: Mapped[str] = mapped_column(String)
|
||||
team_name: Mapped[str] = mapped_column(String)
|
||||
|
||||
title: Mapped[str] = mapped_column(String, default="")
|
||||
lyrics: Mapped[str] = mapped_column(String, default="")
|
||||
style: Mapped[str] = mapped_column(String, default="")
|
||||
|
||||
task_id: Mapped[str] = mapped_column(String, default="")
|
||||
# generating(Suno 작업 대기) | complete | failed
|
||||
status: Mapped[str] = mapped_column(String, default="generating", index=True)
|
||||
error: Mapped[str] = mapped_column(String, default="")
|
||||
attempts: Mapped[int] = mapped_column(Integer, default=0) # 실패 재시도 상한용
|
||||
# 완성 트랙 [{title, audioUrl, imageUrl, duration}] — 보통 생성당 2곡
|
||||
tracks: Mapped[list] = mapped_column(JSON, default=list)
|
||||
|
||||
created_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), server_default=func.now()
|
||||
)
|
||||
updated_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), server_default=func.now(), onupdate=func.now()
|
||||
)
|
||||
|
||||
|
||||
class DataCache(Base):
|
||||
"""야구(KBO/MLB) 부가 데이터 캐시 — 프리뷰·순위, API 응답·AI 프롬프트 조립용.
|
||||
|
||||
|
||||
Reference in new issue
Block a user