feat(music-lab): Phase 1 DB 마이그레이션 + GenerateRequest 확장 + 커버이미지 엔드포인트
This commit is contained in:
@@ -15,6 +15,7 @@ from .db import (
|
||||
from .local_provider import run_local_generation
|
||||
from .suno_provider import (
|
||||
run_suno_generation, run_suno_extend, run_vocal_removal,
|
||||
run_cover_image,
|
||||
generate_lyrics, get_credits,
|
||||
SUNO_API_KEY, SUNO_MODELS,
|
||||
)
|
||||
@@ -102,6 +103,11 @@ class GenerateRequest(BaseModel):
|
||||
# Suno 전용
|
||||
lyrics: str = "" # 커스텀 가사 ([Verse], [Chorus] 등)
|
||||
instrumental: bool = False # True면 보컬 없이 인스트루멘탈만
|
||||
# Phase 1 신규
|
||||
vocal_gender: Optional[str] = None # "m" | "f"
|
||||
negative_tags: Optional[str] = None # 제외 스타일
|
||||
style_weight: Optional[float] = None # 0.0~1.0
|
||||
audio_weight: Optional[float] = None # 0.0~1.0
|
||||
|
||||
|
||||
@app.post("/api/music/generate")
|
||||
@@ -402,6 +408,26 @@ def vocal_removal(req: VocalRemovalRequest, background_tasks: BackgroundTasks):
|
||||
return {"task_id": task_id, "provider": "suno"}
|
||||
|
||||
|
||||
# ── 커버 이미지 생성 API ────────────────────────────────────────────────────
|
||||
|
||||
class CoverImageRequest(BaseModel):
|
||||
suno_task_id: str # Suno 생성 task ID
|
||||
track_id: Optional[int] = None # 라이브러리 트랙 ID (결과 저장용)
|
||||
|
||||
|
||||
@app.post("/api/music/cover-image")
|
||||
def cover_image(req: CoverImageRequest, background_tasks: BackgroundTasks):
|
||||
"""Suno 곡의 커버 이미지 2장 생성."""
|
||||
if not SUNO_API_KEY:
|
||||
raise HTTPException(status_code=400, detail="Suno API 키가 설정되지 않았습니다")
|
||||
|
||||
task_id = str(uuid.uuid4())
|
||||
params = req.model_dump()
|
||||
create_task(task_id, params, provider="suno")
|
||||
background_tasks.add_task(run_cover_image, task_id, params)
|
||||
return {"task_id": task_id, "provider": "suno"}
|
||||
|
||||
|
||||
# ── 저장된 가사 CRUD API ────────────────────────────────────────────────────
|
||||
|
||||
class LyricsSave(BaseModel):
|
||||
|
||||
Reference in New Issue
Block a user