2 Commits

Author SHA1 Message Date
2d98c4176b music-lab: Suno 디버깅 로그를 print()로 변경 (uvicorn 로그에 확실히 출력)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-04 12:50:46 +09:00
f7c583b806 music-lab: Suno SUCCESS 응답 디버깅 로깅 추가
실제 응답 구조 파악을 위해 keys/body 로깅 추가.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-04 12:47:14 +09:00

View File

@@ -103,7 +103,7 @@ def run_suno_generation(task_id: str, params: dict) -> None:
# ── 1단계: 곡 생성 요청 ──
payload = _build_suno_payload(params)
logger.info("Suno generate request: %s", payload)
print(f"[SUNO DEBUG] generate payload: {payload}")
resp = requests.post(
f"{SUNO_BASE_URL}/generate",
@@ -123,6 +123,7 @@ 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가 없습니다")
@@ -261,11 +262,17 @@ 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":
# 완료 — sunoData 배열에서 트랙 추출
tracks = data.get("sunoData") or data.get("data") or []
# 완료 — 트랙 추출 (디버깅용 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
if tracks:
return tracks
update_task(task_id, "failed", 0, "", error="Suno 생성 완료했으나 트랙 데이터 없음")
update_task(task_id, "failed", 0, "",
error=f"Suno 생성 완료했으나 트랙 데이터 없음 (keys: {list(data.keys())})")
return None
elif status in error_statuses:
error_msg = data.get("errorMessage") or data.get("msg") or f"Suno 생성 실패 ({status})"