music-lab: Suno 응답 파싱 수정 — data.response.sunoData 경로로 트랙 추출

디버그 로그 제거.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-04 13:01:01 +09:00
parent 2d98c4176b
commit 1a251cae24

View File

@@ -103,7 +103,6 @@ def run_suno_generation(task_id: str, params: dict) -> None:
# ── 1단계: 곡 생성 요청 ──
payload = _build_suno_payload(params)
print(f"[SUNO DEBUG] generate payload: {payload}")
resp = requests.post(
f"{SUNO_BASE_URL}/generate",
@@ -123,7 +122,6 @@ def run_suno_generation(task_id: str, params: dict) -> None:
error=f"Suno API 거부: {body.get('msg', 'unknown error')}")
return
print(f"[SUNO DEBUG] generate response: {body}")
suno_task_id = body.get("data", {}).get("taskId", "")
if not suno_task_id:
update_task(task_id, "failed", 0, "", error="Suno 응답에 taskId가 없습니다")
@@ -262,17 +260,12 @@ def _poll_until_complete(task_id: str, suno_task_id: str) -> Optional[list]:
elif status == "FIRST_SUCCESS":
update_task(task_id, "processing", max(progress, 60), "첫 번째 트랙 완료, 두 번째 생성 중...")
elif status == "SUCCESS":
# 완료 — 트랙 추출 (디버깅용 print)
import json as _json
print(f"[SUNO DEBUG] SUCCESS response body: {_json.dumps(body, ensure_ascii=False, default=str)[:2000]}")
tracks = data.get("sunoData") or data.get("data") or data.get("tracks") or []
# data 자체가 리스트일 수도 있음
if not tracks and isinstance(data, list):
tracks = data
# data.response.sunoData 에 트랙 배열이 들어있음
response_obj = data.get("response", {})
tracks = response_obj.get("sunoData") or []
if tracks:
return tracks
update_task(task_id, "failed", 0, "",
error=f"Suno 생성 완료했으나 트랙 데이터 없음 (keys: {list(data.keys())})")
update_task(task_id, "failed", 0, "", error="Suno 생성 완료했으나 트랙 데이터 없음")
return None
elif status in error_statuses:
error_msg = data.get("errorMessage") or data.get("msg") or f"Suno 생성 실패 ({status})"