배경음악 재시도 오류 수정 및 subtitle 확인을 위한 엔드포인트 추가
This commit is contained in:
1 parent
9910d0146c
commit
f3195628d2
6 files changed
+87
-13
No files matched your search
@@ -1,7 +1,7 @@
|
||||
|
||||
import React, { useState, useEffect, useRef } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { generateVideo, waitForVideoComplete } from '../../utils/api';
|
||||
import { generateVideo, waitForVideoComplete, getSubtitleStatus, waitForSubtitleComplete } from '../../utils/api';
|
||||
import SocialPostingModal from '../../components/SocialPostingModal';
|
||||
import { useTutorial } from '../../components/Tutorial/useTutorial';
|
||||
import { TUTORIAL_KEYS } from '../../components/Tutorial/tutorialSteps';
|
||||
@@ -174,10 +174,19 @@ const CompletionContent: React.FC<CompletionContentProps> = ({
|
||||
|
||||
hasStartedGeneration.current = true;
|
||||
setVideoStatus('generating');
|
||||
setStatusMessage(t('completion.requestingGeneration'));
|
||||
setStatusMessage(t('completion.checkingSubtitle'));
|
||||
setErrorMessage(null);
|
||||
|
||||
try {
|
||||
// 자막 완료 여부 확인 후 미완료면 폴링
|
||||
const subtitleStatus = await getSubtitleStatus(songTaskId);
|
||||
if (subtitleStatus.status !== 'completed') {
|
||||
setStatusMessage(t('completion.waitingSubtitle'));
|
||||
await waitForSubtitleComplete(songTaskId);
|
||||
}
|
||||
|
||||
setStatusMessage(t('completion.requestingGeneration'));
|
||||
|
||||
const savedRatio = localStorage.getItem('castad_video_ratio');
|
||||
const orientation = (savedRatio === 'horizontal' || savedRatio === 'vertical') ? savedRatio : 'vertical';
|
||||
|
||||
@@ -491,11 +500,15 @@ const CompletionContent: React.FC<CompletionContentProps> = ({
|
||||
return <p className="comp2-lyrics-text">{t('completion.noLyricsBGM')}</p>;
|
||||
}
|
||||
const lines = songCompletionData.lyrics.split('\n').filter((l: string) => l.trim());
|
||||
const size = Math.ceil(lines.length / 3);
|
||||
const intro = lines.slice(0, 1);
|
||||
const outro = lines.slice(-1);
|
||||
const body = lines.slice(1, -1);
|
||||
const half = Math.ceil(body.length / 2);
|
||||
const sections = [
|
||||
{ tag: '[Verse]', lines: lines.slice(0, size) },
|
||||
{ tag: '[Chorus]', lines: lines.slice(size, size * 2) },
|
||||
{ tag: '[Outro]', lines: lines.slice(size * 2) },
|
||||
{ tag: '[Intro]', lines: intro },
|
||||
{ tag: '[Verse]', lines: body.slice(0, half) },
|
||||
{ tag: '[Chorus]', lines: body.slice(half) },
|
||||
{ tag: '[Outro]', lines: outro },
|
||||
].filter(s => s.lines.length > 0);
|
||||
return (
|
||||
<div className="comp2-lyrics-paragraphs">
|
||||
|
||||
@@ -153,10 +153,10 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
|
||||
'ROCK': 'rock',
|
||||
};
|
||||
|
||||
const isInstrumental = selectedType === '배경음악';
|
||||
const songResponse = await generateSong(imageTaskId, {
|
||||
genre: genreMap[selectedGenre] || 'pop',
|
||||
language,
|
||||
lyrics: currentLyrics,
|
||||
...(isInstrumental ? { instrumental: true, lyrics: '' } : { language, lyrics: currentLyrics }),
|
||||
});
|
||||
|
||||
if (!songResponse.success) {
|
||||
@@ -606,12 +606,15 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
|
||||
<div className="lyrics-display">
|
||||
{lyrics ? (() => {
|
||||
const lines = lyrics.split('\n').filter(l => l.trim());
|
||||
const size = Math.ceil(lines.length / 3);
|
||||
const outroLines = lines.slice(size * 2).slice(0, 2);
|
||||
const intro = lines.slice(0, 1);
|
||||
const outro = lines.slice(-1);
|
||||
const body = lines.slice(1, -1);
|
||||
const half = Math.ceil(body.length / 2);
|
||||
const sections = [
|
||||
{ tag: '[Verse]', lines: lines.slice(0, size) },
|
||||
{ tag: '[Chorus]', lines: lines.slice(size, size * 2) },
|
||||
{ tag: '[Outro]', lines: outroLines },
|
||||
{ tag: '[Intro]', lines: intro },
|
||||
{ tag: '[Verse]', lines: body.slice(0, half) },
|
||||
{ tag: '[Chorus]', lines: body.slice(half) },
|
||||
{ tag: '[Outro]', lines: outro },
|
||||
].filter(s => s.lines.length > 0);
|
||||
return (
|
||||
<div className="lyrics-paragraphs">
|
||||
|
||||
Reference in new issue
Block a user