suno task id -> song id 상태확인 변경 .
This commit is contained in:
1 parent
9a7c55de49
commit
2acf4e2cb6
3 files changed
+17
-17
No files matched your search
@@ -22,7 +22,7 @@ type GenerationStatus = 'idle' | 'generating_lyric' | 'generating_song' | 'polli
|
||||
|
||||
interface SavedGenerationState {
|
||||
taskId: string;
|
||||
sunoTaskId: string;
|
||||
songId: string;
|
||||
lyrics: string;
|
||||
status: GenerationStatus;
|
||||
timestamp: number;
|
||||
@@ -71,10 +71,10 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
|
||||
const audioRef = useRef<HTMLAudioElement>(null);
|
||||
const languageDropdownRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
const saveToStorage = (taskId: string, sunoTaskId: string, currentLyrics: string, currentStatus: GenerationStatus) => {
|
||||
const saveToStorage = (taskId: string, songId: string, currentLyrics: string, currentStatus: GenerationStatus) => {
|
||||
const data: SavedGenerationState = {
|
||||
taskId,
|
||||
sunoTaskId,
|
||||
songId,
|
||||
lyrics: currentLyrics,
|
||||
status: currentStatus,
|
||||
timestamp: Date.now(),
|
||||
@@ -114,7 +114,7 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
|
||||
}
|
||||
setStatus('polling');
|
||||
setStatusMessage('노래를 생성하고 있습니다... (새로고침 후 복구됨)');
|
||||
resumePolling(savedState.taskId, savedState.sunoTaskId, savedState.lyrics, 0);
|
||||
resumePolling(savedState.taskId, savedState.songId, savedState.lyrics, 0);
|
||||
}
|
||||
}, []);
|
||||
|
||||
@@ -146,11 +146,11 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
|
||||
}
|
||||
}, [videoGenerationStatus, songTaskId, onNext]);
|
||||
|
||||
const resumePolling = async (taskId: string, sunoTaskId: string, currentLyrics: string, currentRetryCount: number = 0) => {
|
||||
const resumePolling = async (taskId: string, songId: string, currentLyrics: string, currentRetryCount: number = 0) => {
|
||||
try {
|
||||
const downloadResponse = await waitForSongComplete(
|
||||
taskId,
|
||||
sunoTaskId,
|
||||
songId,
|
||||
(pollStatus: string) => {
|
||||
if (pollStatus === 'pending') {
|
||||
setStatusMessage('노래를 생성하고 있습니다...');
|
||||
@@ -221,8 +221,8 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
|
||||
throw new Error(songResponse.error_message || '음악 생성 요청에 실패했습니다.');
|
||||
}
|
||||
|
||||
saveToStorage(songResponse.task_id, songResponse.suno_task_id, currentLyrics, 'polling');
|
||||
await resumePolling(songResponse.task_id, songResponse.suno_task_id, currentLyrics, currentRetryCount);
|
||||
saveToStorage(songResponse.task_id, songResponse.song_id, currentLyrics, 'polling');
|
||||
await resumePolling(songResponse.task_id, songResponse.song_id, currentLyrics, currentRetryCount);
|
||||
|
||||
} catch (error) {
|
||||
console.error('Song regeneration failed:', error);
|
||||
@@ -396,9 +396,9 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
|
||||
|
||||
setStatus('polling');
|
||||
setStatusMessage('노래를 생성하고 있습니다...');
|
||||
saveToStorage(songResponse.task_id, songResponse.suno_task_id, lyricDetailResponse.lyric_result, 'polling');
|
||||
saveToStorage(songResponse.task_id, songResponse.song_id, lyricDetailResponse.lyric_result, 'polling');
|
||||
|
||||
await resumePolling(songResponse.task_id, songResponse.suno_task_id, lyricDetailResponse.lyric_result, 0);
|
||||
await resumePolling(songResponse.task_id, songResponse.song_id, lyricDetailResponse.lyric_result, 0);
|
||||
|
||||
} catch (error) {
|
||||
console.error('Music generation failed:', error);
|
||||
|
||||
Reference in new issue
Block a user