프로그래스바 수정, 이미지 분류 추가 및 UI 수정
This commit is contained in:
1 parent
8a39a34630
commit
2f720dfa92
12 files changed
+98
-43
No files matched your search
@@ -52,6 +52,21 @@ const getEffectiveGenre = (selectedGenre: string): string => {
|
||||
return genreMap[selectedGenre] || 'pop';
|
||||
};
|
||||
|
||||
// 실제 영상 생성에 사용된 genre 값(kpop, hip-hop 등)을 화면 표시용 라벨로 변환
|
||||
const getGenreDisplayLabel = (genreValue: string, t: (key: string) => string): string => {
|
||||
const displayMap: Record<string, string> = {
|
||||
kpop: 'K-POP',
|
||||
pop: 'POP',
|
||||
ballad: t('soundStudio.genreBallad'),
|
||||
'hip-hop': 'Hip-Hop',
|
||||
rnb: 'R&B',
|
||||
edm: 'EDM',
|
||||
jazz: 'JAZZ',
|
||||
rock: 'ROCK',
|
||||
};
|
||||
return displayMap[genreValue] || genreValue;
|
||||
};
|
||||
|
||||
const sanitizeError = (message: string, fallback: string): string => {
|
||||
if (
|
||||
message.includes('Traceback') ||
|
||||
@@ -110,7 +125,8 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
|
||||
const saveSongCompletionData = () => {
|
||||
const completionData = {
|
||||
businessName: businessInfo?.customer_name || '알 수 없음',
|
||||
genre: selectedGenre,
|
||||
// '자동 선택'처럼 UI에서 고른 값이 아니라, 실제 영상 생성에 사용된 genre(usedGenre)를 저장
|
||||
genre: usedGenre ? getGenreDisplayLabel(usedGenre, t) : selectedGenre,
|
||||
lyrics: lyrics,
|
||||
timestamp: Date.now(),
|
||||
};
|
||||
@@ -367,6 +383,9 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
|
||||
try {
|
||||
const language = LANGUAGE_MAP[selectedLang] || 'Korean';
|
||||
const isInstrumental = selectedType === '배경음악';
|
||||
// 수동 선택한 장르는 가사 생성 시점부터 넘겨서, 그 장르 템포에 맞는 줄 수로 가사를 쓰게 한다.
|
||||
// '자동 선택'이면 넘기지 않고, 가사 생성 결과로 받은 recommended genre를 그대로 쓴다.
|
||||
const manualGenre = selectedGenre === '자동 선택' ? undefined : genreMap[selectedGenre];
|
||||
|
||||
// 1. 가사 생성 요청
|
||||
console.log('[SoundStudio] Sending m_id:', mId);
|
||||
@@ -380,6 +399,7 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
|
||||
industry,
|
||||
orientation,
|
||||
...(isInstrumental && { instrumental: true }),
|
||||
...(manualGenre && { genre: manualGenre }),
|
||||
});
|
||||
|
||||
if (!lyricResponse.success || !lyricResponse.task_id) {
|
||||
@@ -387,6 +407,9 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
|
||||
}
|
||||
|
||||
let songLyrics: string | undefined;
|
||||
// BGM 모드는 백엔드가 가사/장르 추천 없이 즉시 completed 처리하므로 GPT 추천 장르가 없다.
|
||||
// 이 경우에만 기존 랜덤 선택 로직으로 폴백한다.
|
||||
let effectiveGenre = manualGenre || getEffectiveGenre(selectedGenre);
|
||||
|
||||
if (!isInstrumental) {
|
||||
// 2. 가사 생성 상태 폴링 → 완료 시 상세 조회
|
||||
@@ -411,12 +434,12 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
|
||||
|
||||
setLyrics(lyricDetailResponse.lyric_result);
|
||||
songLyrics = lyricDetailResponse.lyric_result;
|
||||
// 가사와 함께 확정된 장르(수동 선택값 또는 GPT 추천값)를 그대로 음악 생성에 사용
|
||||
effectiveGenre = lyricDetailResponse.genre || effectiveGenre;
|
||||
}
|
||||
|
||||
setStatus('generating_song');
|
||||
setStatusMessage(t('soundStudio.generatingSong'));
|
||||
|
||||
const effectiveGenre = getEffectiveGenre(selectedGenre);
|
||||
setUsedGenre(effectiveGenre);
|
||||
|
||||
const songResponse = await generateSong(imageTaskId, {
|
||||
@@ -698,19 +721,22 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
|
||||
<div className="lyrics-display">
|
||||
{lyrics ? (() => {
|
||||
const lines = lyrics.split('\n').filter(l => l.trim());
|
||||
const outro = lines.slice(-1);
|
||||
const body = lines.slice(0, -1);
|
||||
const half = Math.ceil(body.length / 2);
|
||||
const sections = [
|
||||
{ tag: '[Verse]', lines: body.slice(0, half) },
|
||||
{ tag: '[Chorus]', lines: body.slice(half) },
|
||||
{ tag: '[Outro]', lines: outro },
|
||||
].filter(s => s.lines.length > 0);
|
||||
const sections: { tag: string | null; lines: string[] }[] = [];
|
||||
lines.forEach(line => {
|
||||
const tagMatch = line.trim().match(/^\[(.+)\]$/);
|
||||
if (tagMatch) {
|
||||
sections.push({ tag: `[${tagMatch[1]}]`, lines: [] });
|
||||
} else if (sections.length === 0) {
|
||||
sections.push({ tag: null, lines: [line] });
|
||||
} else {
|
||||
sections[sections.length - 1].lines.push(line);
|
||||
}
|
||||
});
|
||||
return (
|
||||
<div className="lyrics-paragraphs">
|
||||
{sections.map((section, i) => (
|
||||
{sections.filter(s => s.lines.length > 0).map((section, i) => (
|
||||
<div key={i} className="lyrics-section">
|
||||
<span className="lyrics-tag">{section.tag}</span>
|
||||
{section.tag && <span className="lyrics-tag">{section.tag}</span>}
|
||||
<p className="lyrics-paragraph">{section.lines.join('\n')}</p>
|
||||
</div>
|
||||
))}
|
||||
|
||||
Reference in new issue
Block a user