feat: 비동기 파이프라인 + fal Seedance 2.0 + Azure Blob 갤러리

[비동기 처리]
- POST /api/generate → 즉시 job_id 반환 (202), 백그라운드 ThreadPoolExecutor
- GET /api/jobs/{id} 상태 폴링 (queued→running→done/error)
- MAX_CONCURRENT_JOBS 환경변수로 동시 처리 수 제어

[영상 생성 백엔드]
- VIDEO_BACKEND=fal: fal.ai Seedance 2.0 reference-to-video (멀티이미지 9장 + 9:16 세로)
- VIDEO_BACKEND=higgsfield: Higgsfield (dop/seedance v1/kling, 단일 이미지)
- 파일명 ASCII 정규화 (한글 파일명 → fal 업로드 codec 에러 방지)

[Remotion 안정화]
- BrandLines/SellingBadge/HookTitle interpolate 범위 역전 크래시 수정
- _timings() 를 고정값 clamp → 영상 길이 비례 스케일로 변경
- 폰트 NanumMyeongjo weight 800 제거, latin subset 제거 (요청 수 ~50% 감소)
- render() 반환값에 임시 파일 목록 추가, 완료/실패 시 자동 정리

[Azure Blob Storage]
- 완성 영상·메타데이터 JSON 자동 업로드 (azure_storage.py)
- /api/outputs: Azure List Blobs 우선, 로컬 fallback
- video_url을 Azure 공개 URL로 갱신 (SAS 불필요)

[갤러리 UI]
- 상단 "생성된 영상" 버튼 → 9:16 썸네일 그리드 + 상세 재생/다운로드
- 생성 실패 시 데모 폴백 제거 → 에러 카드 표시

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
HyeongBaeYangandClaude Sonnet 4.6 committed 2026-06-01 14:41:33 +09:00
1 parent 154bf5b992
commit 31afa04aa9
7 files changed
+342 -12

No files matched your search

+111 -9
View File
@@ -163,6 +163,16 @@
/* Brand logo */
.brand-logo{height:30px;width:auto;display:block;}
/* ===== Gallery ===== */
.gallery-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:24px;}
@media(max-width:760px){.gallery-grid{grid-template-columns:repeat(2,1fr);}}
@media(max-width:480px){.gallery-grid{grid-template-columns:1fr;}}
.gallery-card{cursor:pointer;border-radius:20px;overflow:hidden;background:var(--bg-2);border:1px solid var(--stroke-1);transition:.15s;}
.gallery-card:hover{border-color:var(--ado-mint);transform:translateY(-2px);box-shadow:0 8px 28px rgba(0,0,0,0.35);}
.gallery-thumb{position:relative;aspect-ratio:9/16;background:var(--bg-3);overflow:hidden;}
.gallery-play{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,0.28);opacity:0;transition:.15s;color:#fff;}
.gallery-card:hover .gallery-play{opacity:1;}
/* Hero selling-point field (emphasized) */
.field-hero label{color:var(--ado-mint);}
.field-hero textarea{min-height:64px;border-color:rgba(148,251,224,0.35);} /* 절반 축소 */
@@ -255,6 +265,9 @@ function App(){
const [note, setNote] = useState("");
const [script, setScript] = useState(null); // {intro,selling,story,cta}
const [scriptEditing, setScriptEditing] = useState({});
const [gallery, setGallery] = useState(null); // null=미로드 / []~[...]=로드됨
const [galleryOpen, setGalleryOpen] = useState(false);
const [galleryVideo, setGalleryVideo] = useState(null); // 선택된 영상 {job_id,video_url,...}
const [scriptLoading, setScriptLoading] = useState(false);
const fileRef = useRef();
const pollRef = useRef(null); // 진행 중인 폴링 타이머 (언마운트/리셋 시 정리)
@@ -369,6 +382,22 @@ function App(){
navigator.clipboard.writeText(editedCaption).then(()=>{ setCopied(true); setTimeout(()=>setCopied(false), 1800); });
}
function openGallery(){
setGalleryOpen(true);
setGalleryVideo(null);
fetch(`${API_BASE}/api/outputs`)
.then(r=> r.ok ? r.json() : Promise.reject())
.then(list=> setGallery(list))
.catch(()=> setGallery([]));
}
function closeGallery(){ setGalleryOpen(false); setGalleryVideo(null); }
function fmtDate(ts){
if(!ts) return "";
const d = new Date(ts * 1000);
return `${d.getFullYear()}.${String(d.getMonth()+1).padStart(2,"0")}.${String(d.getDate()).padStart(2,"0")} ${String(d.getHours()).padStart(2,"0")}:${String(d.getMinutes()).padStart(2,"0")}`;
}
// 백엔드 없을 때 입력값 기반 폴백 (Vercel 정적 배포에서도 동작)
function localScript(){
if(kind === "message"){
@@ -417,10 +446,83 @@ function App(){
<div>
<div className="topbar">
<img className="brand-logo" src="./assets/ado2-logo-white.png" alt="ADO2.AI" />
<div className="step-count"><b>{stepIdx+1}</b> / 4</div>
<div style={{display:"flex",alignItems:"center",gap:16}}>
{!galleryOpen && <div className="step-count"><b>{stepIdx+1}</b> / 4</div>}
<button className="btn btn-ghost" style={{height:40,padding:"0 18px",fontSize:14}} onClick={galleryOpen ? closeGallery : openGallery}>
{galleryOpen ? "← 돌아가기" : "생성된 영상"}
</button>
</div>
</div>
<div className="wrap">
{step==="setup" && (
{/* 갤러리 오버레이 */}
{galleryOpen && !galleryVideo && (
<div>
<div style={{marginBottom:32}}>
<h2 style={{font:"800 32px/1.15 var(--font)",margin:"0 0 8px",letterSpacing:"-0.018em"}}>생성된 영상</h2>
<p style={{font:"500 17px/1.55 var(--font)",color:"var(--text-teal-1)",margin:0}}>지금까지 만들어진 영상을 다운로드하거나 다시 볼 수 있습니다.</p>
</div>
{gallery === null && (
<div style={{textAlign:"center",padding:"60px 0",color:"var(--text-teal-3)"}}>
<div className="spinner" style={{margin:"0 auto 16px"}}></div>불러오는 중…
</div>
)}
{gallery && gallery.length === 0 && (
<div className="card" style={{textAlign:"center",padding:"60px 0",color:"var(--text-teal-3)"}}>
아직 완성된 영상이 없습니다.
</div>
)}
{gallery && gallery.length > 0 && (
<div className="gallery-grid">
{gallery.map(v=>(
<div key={v.job_id} className="gallery-card" onClick={()=>setGalleryVideo(v)}>
<div className="gallery-thumb">
<video src={(API_BASE||"")+v.video_url} muted playsInline preload="metadata" style={{width:"100%",height:"100%",objectFit:"cover",borderRadius:16,display:"block"}}/>
<div className="gallery-play"><Icon.Play size={22}/></div>
</div>
<div style={{padding:"14px 4px 4px"}}>
<div style={{font:"700 16px/1.3 var(--font)",color:"var(--text-mute-2)",marginBottom:4,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}}>{v.biz_name || v.job_id}</div>
<div style={{font:"500 13px/1 var(--font)",color:"var(--text-teal-3)"}}>{fmtDate(v.created_at)}</div>
</div>
</div>
))}
</div>
)}
</div>
)}
{/* 갤러리 상세 (영상 선택 시) */}
{galleryOpen && galleryVideo && (
<div className="card">
<button onClick={()=>setGalleryVideo(null)} className="btn btn-ghost" style={{marginBottom:24,height:40,padding:"0 18px",fontSize:14}}>← 목록으로</button>
<div className="result-grid">
<div className="phone">
<video src={(API_BASE||"")+galleryVideo.video_url} controls playsInline autoPlay></video>
</div>
<div>
<h2 className="res-h">{galleryVideo.biz_name || galleryVideo.job_id}</h2>
<p className="res-sub">{fmtDate(galleryVideo.created_at)}</p>
{galleryVideo.profile && (
<div className="res-badges" style={{marginBottom:20}}>
<span className="tone-chip"><i></i>{galleryVideo.profile}</span>
</div>
)}
{galleryVideo.caption && (
<>
<div className="cap-head"><span className="lbl">업로드 캡션</span></div>
<div className="caption-box">{galleryVideo.caption}</div>
</>
)}
<div className="res-actions">
<a className="btn btn-primary" href={(API_BASE||"")+galleryVideo.video_url} download><Icon.Download/> 다운로드</a>
</div>
</div>
</div>
</div>
)}
{/* 메인 생성 플로우 (갤러리 닫혀있을 때만) */}
{!galleryOpen && step==="setup" && (
<div className="hero">
<div className="eyebrow">ADO2 Hookit · 8초 숏폼</div>
<h1 className="hero-title">사진 몇 장과 한마디면,<br/><em>8초 홍보 영상</em>이 됩니다</h1>
@@ -428,17 +530,17 @@ function App(){
</div>
)}
<div className="stepper">
{!galleryOpen && <div className="stepper">
{STEPS.map((s,i)=>(
<div key={s.k} className={"step"+(i===stepIdx?" active":"")+(i<stepIdx?" done":"")}>
<div className="num">{i<stepIdx ? <Icon.Check size={20}/> : s.n}</div>
<div><b>{s.b}</b><span>{s.s}</span></div>
</div>
))}
</div>
</div>}
{/* STEP 1 — UPLOAD */}
{step==="setup" && (
{!galleryOpen && step==="setup" && (
<div className="card">
<h2>사진 업로드</h2>
<p className="sub">홍보할 장소나 물건 사진 4~5장. 전경 1장 · 디테일 2~3장을 섞으면 영상의 서사가 살아납니다.</p>
@@ -476,7 +578,7 @@ function App(){
)}
{/* STEP 2 — INTERVIEW (사람이 직접 답 = 인텔리전스) */}
{step==="interview" && (
{!galleryOpen && step==="interview" && (
<div className="card">
<h2>몇 가지만 알려주세요</h2>
<p className="sub">사장님·마케터가 가장 잘 아는 정보로 카피를 만듭니다.</p>
@@ -560,7 +662,7 @@ function App(){
)}
{/* STEP 3 — GENERATING */}
{step==="generating" && (
{!galleryOpen && step==="generating" && (
<div className="card">
<h2>영상 생성 중</h2>
<p className="sub">한 번의 생성으로 트랜지션·자막·사운드까지 완성됩니다.</p>
@@ -587,7 +689,7 @@ function App(){
)}
{/* STEP 4 — RESULT (성공: 영상 / 실패: 에러 카드) */}
{step==="result" && errMsg && (
{!galleryOpen && step==="result" && errMsg && (
<div className="card">
<h2 className="res-h">영상 생성에 실패했습니다</h2>
<p className="res-sub">아래 사유를 확인하고 다시 시도해 주세요. (데모 영상은 표시하지 않습니다)</p>
@@ -598,7 +700,7 @@ function App(){
</div>
</div>
)}
{step==="result" && !errMsg && videoUrl && (
{!galleryOpen && step==="result" && !errMsg && videoUrl && (
<div className="card">
<div className="result-grid">
<div className="phone">