db status 조회로 변경 .

This commit is contained in:
HyeongBaeYang committed 2026-01-21 16:19:58 +09:00
1 parent 662b6b80bc
commit e3ed840d12
3 files changed
+37 -65

No files matched your search

+10 -13
View File
@@ -22,7 +22,6 @@ type GenerationStatus = 'idle' | 'generating_lyric' | 'generating_song' | 'polli
interface SavedGenerationState {
taskId: string;
songId: string;
lyrics: string;
status: GenerationStatus;
timestamp: number;
@@ -71,10 +70,9 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
const audioRef = useRef<HTMLAudioElement>(null);
const languageDropdownRef = useRef<HTMLDivElement>(null);
const saveToStorage = (taskId: string, songId: string, currentLyrics: string, currentStatus: GenerationStatus) => {
const saveToStorage = (taskId: string, currentLyrics: string, currentStatus: GenerationStatus) => {
const data: SavedGenerationState = {
taskId,
songId,
lyrics: currentLyrics,
status: currentStatus,
timestamp: Date.now(),
@@ -114,7 +112,7 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
}
setStatus('polling');
setStatusMessage('노래를 생성하고 있습니다... (새로고침 후 복구됨)');
resumePolling(savedState.taskId, savedState.songId, savedState.lyrics, 0);
resumePolling(savedState.taskId, savedState.lyrics, 0);
}
}, []);
@@ -146,16 +144,15 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
}
}, [videoGenerationStatus, songTaskId, onNext]);
const resumePolling = async (taskId: string, songId: string, currentLyrics: string, currentRetryCount: number = 0) => {
const resumePolling = async (taskId: string, currentLyrics: string, currentRetryCount: number = 0) => {
try {
const downloadResponse = await waitForSongComplete(
taskId,
songId,
(pollStatus: string) => {
if (pollStatus === 'pending') {
setStatusMessage('노래를 생성하고 있습니다...');
} else if (pollStatus === 'processing') {
if (pollStatus === 'processing') {
setStatusMessage('노래를 생성하고 있습니다...');
} else if (pollStatus === 'uploading') {
setStatusMessage('노래를 업로드하고 있습니다...');
}
}
);
@@ -221,8 +218,8 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
throw new Error(songResponse.error_message || '음악 생성 요청에 실패했습니다.');
}
saveToStorage(songResponse.task_id, songResponse.song_id, currentLyrics, 'polling');
await resumePolling(songResponse.task_id, songResponse.song_id, currentLyrics, currentRetryCount);
saveToStorage(songResponse.task_id, currentLyrics, 'polling');
await resumePolling(songResponse.task_id, currentLyrics, currentRetryCount);
} catch (error) {
console.error('Song regeneration failed:', error);
@@ -396,9 +393,9 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
setStatus('polling');
setStatusMessage('노래를 생성하고 있습니다...');
saveToStorage(songResponse.task_id, songResponse.song_id, lyricDetailResponse.lyric_result, 'polling');
saveToStorage(songResponse.task_id, lyricDetailResponse.lyric_result, 'polling');
await resumePolling(songResponse.task_id, songResponse.song_id, lyricDetailResponse.lyric_result, 0);
await resumePolling(songResponse.task_id, lyricDetailResponse.lyric_result, 0);
} catch (error) {
console.error('Music generation failed:', error);