Skip to content

PRINTFILM: AI short-video marketing and AI short-drama creation platform

Rebrand to PRINTFILM and ship a light marketing homepage for the science-video platform.

yi60ad66cfaf79
diff --git a/README.md b/README.md
index 8e8bd0a..8226dc7 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
-# 纸戏 FrameCut
+# PRINTFILM
-模板驱动的 AI 短视频创作平台(MVP)。同一条生成流水线,多套视觉风格模板。
+科普视频平台:模板驱动的 AI 短视频创作。同一条生成流水线,多套视觉风格模板。
## 能力(本期)
diff --git a/backend/app/__init__.py b/backend/app/__init__.py
index 0c696aa..57f5c57 100644
--- a/backend/app/__init__.py
+++ b/backend/app/__init__.py
@@ -1 +1 @@
-"""AI Movie platform backend."""
\ No newline at end of file
+"""PRINTFILM platform backend."""
\ No newline at end of file
diff --git a/backend/app/api/projects.py b/backend/app/api/projects.py
index 8a9e9e5..0196cb7 100644
--- a/backend/app/api/projects.py
+++ b/backend/app/api/projects.py
@@ -224,11 +224,12 @@ async def generate_project(
}:
raise HTTPException(status_code=409, detail="生成进行中,请稍后")
- # 额度暂时不限制
- project.status = ProjectStatus.SCRIPTING
- project.progress = 1
+ # Resume: clear error, keep existing shots/media (pipeline skips finished stages)
project.error_msg = None
project.final_video_url = None
+ project.status = ProjectStatus.SCRIPTING
+ if project.progress <= 0:
+ project.progress = 1
await db.commit()
task_id = pipeline.start_pipeline(project_id)
# Persist celery id on a job row when available
diff --git a/backend/app/config.py b/backend/app/config.py
index 063148b..2e79db2 100644
--- a/backend/app/config.py
+++ b/backend/app/config.py
@@ -6,7 +6,7 @@ from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8", extra="ignore")
- app_name: str = "AI Movie"
+ app_name: str = "PRINTFILM"
debug: bool = True
secret_key: str = "dev-secret-change-me"
access_token_expire_minutes: int = 60 * 24 * 7
diff --git a/backend/app/services/ark.py b/backend/app/services/ark.py
index 74c35f2..1e83f7a 100644
--- a/backend/app/services/ark.py
+++ b/backend/app/services/ark.py
@@ -12,6 +12,7 @@ import time
from dataclasses import dataclass
from pathlib import Path
from typing import Any
+from urllib.parse import urlparse
import httpx
@@ -343,6 +344,29 @@ class ArkGateway:
return data["url"]
return None
+ @staticmethod
+ def _seedance_prompt_text(prompt: str) -> str:
+ """Seedance 2.0 may require JSON text with summary_caption (BodyFormat)."""
+ clean = (prompt or "").strip() or "画面轻微动态,保持主体外形稳定"
+ clean = re.sub(r"\s+", " ", clean).strip()
+ if clean.startswith("{"):
+ try:
+ obj = json.loads(clean)
+ if isinstance(obj, dict):
+ if not str(obj.get("summary_caption") or "").strip():
+ obj["summary_caption"] = str(
+ obj.get("prompt") or obj.get("text") or clean
+ )[:500]
+ return json.dumps(obj, ensure_ascii=False)
+ except json.JSONDecodeError:
+ pass
+ return json.dumps({"summary_caption": clean[:500]}, ensure_ascii=False)
+
+ @staticmethod
+ def _seedance_duration(duration: int | float) -> int:
+ # Seedance 2.0 common range is 4–12s (some accounts reject <4)
+ return int(max(4, min(int(round(float(duration))), 12)))
+
async def gen_video_i2v(
self,
image_url: str,
@@ -352,29 +376,35 @@ class ArkGateway:
character_consistency: bool = True,
resolution: str = "480p",
ratio: str | None = None,
+ prompt_as_json: bool = True,
) -> str:
if self.mock:
digest = hashlib.md5(f"{image_url}:{prompt}".encode()).hexdigest()[:10]
return f"mock-task-{digest}"
- # Seedance needs reachable image: prefer http(s), else data URI from local file
- image_ref = await self._resolve_image_ref(image_url)
+ # Seedance needs a publicly reachable https image (data URI often rejected / odd errors)
+ image_ref = await self._resolve_image_ref(image_url, prefer_https=True)
+ text = self._seedance_prompt_text(prompt) if prompt_as_json else (
+ (prompt or "").strip() or "画面轻微动态,保持主体外形稳定"
+ )
content: list[dict[str, Any]] = [
- {"type": "text", "text": prompt},
- {"type": "image_url", "image_url": {"url": image_ref}},
+ {"type": "text", "text": text},
+ {
+ "type": "image_url",
+ "image_url": {"url": image_ref},
+ "role": "first_frame",
+ },
]
body: dict[str, Any] = {
"model": self.settings.model_video,
"content": content,
- "duration": int(max(2, min(duration, self.settings.max_shot_duration))),
+ "duration": self._seedance_duration(duration),
"ratio": ratio or self.settings.ark_video_ratio,
"resolution": resolution,
"watermark": False,
"generate_audio": False,
}
- # Optional consistency flag — ignored if API rejects unknown fields
- if character_consistency:
- body["character_consistency"] = True
+ # Do not send character_consistency — unknown fields have caused BodyFormat failures
async with httpx.AsyncClient(timeout=60.0) as client:
resp = await client.post(
@@ -382,9 +412,17 @@ class ArkGateway:
headers=self._headers(),
json=body,
)
+ if resp.status_code >= 400 and prompt_as_json:
+ # Fallback: plain text prompt
+ body["content"][0]["text"] = (prompt or "").strip() or "画面轻微动态"
+ resp = await client.post(
+ self._url("/contents/generations/tasks"),
+ headers=self._headers(),
+ json=body,
+ )
if resp.status_code >= 400:
- # Retry without character_consistency if rejected
- body.pop("character_consistency", None)
+ # Last try: drop role
+ body["content"][1].pop("role", None)
resp = await client.post(
self._url("/contents/generations/tasks"),
headers=self._headers(),
@@ -444,6 +482,58 @@ class ArkGateway:
await storage.download_to(result.url, dest)
return storage.rel_static_url(dest)
+ async def gen_and_wait_video(
+ self,
+ image_url: str,
+ prompt: str,
+ duration: int,
+ *,
+ project_id: int,
+ shot_no: int,
+ character_consistency: bool = True,
+ resolution: str = "480p",
+ ratio: str | None = None,
+ max_attempts: int = 3,
+ ) -> str:
+ """Create Seedance i2v task and wait; retry on summary_caption / transient BodyFormat."""
+ last_err: Exception | None = None
+ for attempt in range(max_attempts):
+ use_json = attempt != 1 # attempt0 json, attempt1 plain, attempt2 json again
+ try:
+ task_id = await self.gen_video_i2v(
+ image_url,
+ prompt,
+ duration,
+ character_consistency=character_consistency,
+ resolution=resolution,
+ ratio=ratio,
+ prompt_as_json=use_json,
+ )
+ return await self.wait_video(task_id, project_id=project_id, shot_no=shot_no)
+ except Exception as exc: # noqa: BLE001
+ last_err = exc
+ msg = str(exc)
+ retryable = any(
+ k in msg
+ for k in (
+ "summary_caption",
+ "BodyFormat",
+ "InvalidParameter",
+ "poll timeout",
+ )
+ )
+ logger.warning(
+ "Seedance attempt %s/%s shot=%s failed: %s",
+ attempt + 1,
+ max_attempts,
+ shot_no,
+ msg[:300],
+ )
+ if not retryable or attempt >= max_attempts - 1:
+ break
+ await asyncio.sleep(1.5 * (attempt + 1))
+ raise RuntimeError(str(last_err) if last_err else "video generation failed")
+
async def tts(
self,
text: str,
@@ -635,15 +725,34 @@ class ArkGateway:
check=False,
)
- async def _resolve_image_ref(self, image_url: str) -> str:
- if image_url.startswith("http://") or image_url.startswith("https://") or image_url.startswith("data:"):
- return image_url
- local = storage.local_path_from_url(image_url)
+ async def _resolve_image_ref(self, image_url: str, *, prefer_https: bool = False) -> str:
+ raw = (image_url or "").strip()
+ if raw.startswith("https://"):
+ return raw
+ if raw.startswith("http://"):
+ # Ark cloud cannot fetch LAN/localhost; keep only if public host
+ host = (urlparse(raw).hostname or "").lower()
+ if host and host not in {"localhost", "127.0.0.1", "::1"} and not host.startswith(
+ ("192.168.", "10.")
+ ):
+ return raw
+ if prefer_https:
+ # Seedance 2.0: avoid data URI (often Invalid base64 / odd BodyFormat)
+ local = storage.local_path_from_url(raw)
+ if local and local.exists():
+ raise RuntimeError(
+ "Seedance 需要公网可访问的图片 URL(image_ark_url),本地图无法提交"
+ )
+ if raw.startswith("data:"):
+ raise RuntimeError("Seedance 不支持 data URI 图片,请使用 Ark CDN https 链接")
+ if raw.startswith("http://") or raw.startswith("https://") or raw.startswith("data:"):
+ return raw
+ local = storage.local_path_from_url(raw)
if local and local.exists():
# Prefer data URI so Seedance can read without public CDN
return storage.file_to_data_uri(local)
# Last resort: absolute local public URL (only works if Ark can reach your machine)
- return storage.to_public_url(image_url)
+ return storage.to_public_url(raw)
def _write_mock_image(self, prompt: str, size: str | None = None) -> str:
digest = hashlib.md5(prompt.encode()).hexdigest()[:8]
diff --git a/backend/app/services/ffmpeg_compose.py b/backend/app/services/ffmpeg_compose.py
index fc13501..4deb4e2 100644
--- a/backend/app/services/ffmpeg_compose.py
+++ b/backend/app/services/ffmpeg_compose.py
@@ -40,6 +40,37 @@ class ComposeOptions:
ratio: str = "16:9"
mode: str = "full" # full | image_text
resolution_mode: str = "preview" # preview | hd
+ # One continuous TTS track for the whole film (preferred over per-shot audio)
+ full_audio_path: Path | None = None
+
+
+def allocate_durations_by_narration(
+ narrations: list[str],
+ total_audio_dur: float,
+ *,
+ min_shot: float = 0.8,
+) -> list[float]:
+ """Split continuous TTS length across shots by narration character weight."""
+ n = len(narrations)
+ if n == 0:
+ return []
+ total = max(float(total_audio_dur), min_shot * n)
+ weights = [max(len((t or "").strip()), 1) for t in narrations]
+ wsum = float(sum(weights))
+ raw = [total * (w / wsum) for w in weights]
+ # Ensure minimums then renormalize
+ capped = [max(d, min_shot) for d in raw]
+ csum = sum(capped)
+ if csum > total + 1e-6:
+ # shrink proportionally above min
+ extra = csum - total
+ flexible = [max(0.0, d - min_shot) for d in capped]
+ fsum = sum(flexible) or 1.0
+ capped = [d - extra * (f / fsum) for d, f in zip(capped, flexible)]
+ # Fix float drift on last shot
+ head = [round(d, 3) for d in capped[:-1]]
+ last = max(min_shot, round(total - sum(head), 3))
+ return [*head, last]
def probe_duration(path: Path) -> float | None:
@@ -274,8 +305,8 @@ def _write_ass(
) -> None:
"""Write ASS with PlayRes matching canvas; captions refresh by clause over time."""
portrait = (h / max(w, 1)) > 1.2
- font_size = 22 if portrait else 18
- margin_v = 48 if portrait else 32
+ font_size = 30 if portrait else 26
+ margin_v = 56 if portrait else 40
max_chars = 16 if portrait else 24
font_name = "Microsoft YaHei"
if font:
@@ -429,8 +460,8 @@ def _bottom_caption_drawtext(
"""Pixel-sized bottom captions via drawtext (avoids libass PlayRes blow-up)."""
portrait = (h / max(w, 1)) > 1.2
max_chars = 16 if portrait else 24
- font_size = 18 if portrait else 16
- y = max(0, h - font_size - (48 if portrait else 36))
+ font_size = 26 if portrait else 24
+ y = max(0, h - font_size - (56 if portrait else 44))
windows = _timed_caption_windows(
narration,
start=0.0,
@@ -448,8 +479,8 @@ def _bottom_caption_drawtext(
# Commas in enable= must be escaped for filtergraph
parts.append(
f"drawtext=text='{te}'{font_opt}:fontsize={font_size}:"
- f"fontcolor=white:borderw=2:[email protected]:"
- f"box=1:[email protected]:boxborderw=6:"
+ f"fontcolor=white:borderw=3:[email protected]:"
+ f"box=1:[email protected]:boxborderw=8:"
f"x=(w-text_w)/2:y={y}:"
f"enable='between(t\\,{a:.2f}\\,{b:.2f})'"
)
@@ -467,28 +498,28 @@ def _overlay_drawtext(w: int, h: int, title: str, subtitle: str, font: str | Non
subtitle = subtitle[:17] + "…"
title_e = _escape_drawtext(title)
sub_e = _escape_drawtext(subtitle)
- # Portrait 720 → title ~22 / sub ~15
- title_size = max(18, min(24, int(w * 0.032)))
- sub_size = max(14, min(17, int(w * 0.024)))
- title_y = int(h * 0.05)
- sub_y = title_y + title_size + int(h * 0.01)
+ # Portrait 720 → title ~30 / sub ~22(相对原字号大约大两号)
+ title_size = max(26, min(32, int(w * 0.042)))
+ sub_size = max(20, min(25, int(w * 0.032)))
+ title_y = int(h * 0.045)
+ sub_y = title_y + title_size + int(h * 0.012)
parts: list[str] = []
# Soft top vignette so white text stays readable on bright skies
- parts.append(f"drawbox=x=0:y=0:w={w}:h={int(h * 0.16)}:[email protected]:t=fill")
+ parts.append(f"drawbox=x=0:y=0:w={w}:h={int(h * 0.18)}:[email protected]:t=fill")
font_opt = f":fontfile='{_escape_fontfile(font)}'" if font else ""
if title_e:
parts.append(
f"drawtext=text='{title_e}'{font_opt}:fontsize={title_size}:"
- f"fontcolor=white:borderw=2:[email protected]:"
+ f"fontcolor=white:borderw=3:[email protected]:"
f"x=(w-text_w)/2:y={title_y}"
)
if sub_e:
parts.append(
f"drawtext=text='{sub_e}'{font_opt}:fontsize={sub_size}:"
- f"fontcolor=white:borderw=2:[email protected]:"
+ f"fontcolor=white:borderw=3:[email protected]:"
f"x=(w-text_w)/2:y={sub_y}"
)
return ",".join(parts)
@@ -645,13 +676,17 @@ def compose_project(
with tempfile.TemporaryDirectory(prefix="framecut_") as tmp:
tmp_path = Path(tmp)
segment_paths: list[Path] = []
+ continuous = bool(opts.full_audio_path and opts.full_audio_path.exists())
for shot in shots:
seg = tmp_path / f"shot_{shot.shot_no:03d}.mp4"
audio = tmp_path / f"shot_{shot.shot_no:03d}.m4a"
video = tmp_path / f"shot_{shot.shot_no:03d}_v.mp4"
- if shot.audio_path and shot.audio_path.exists():
+ if continuous:
+ # Visual-only segments; continuous narration muxed after concat
+ _make_silent_audio(audio, shot.duration)
+ elif shot.audio_path and shot.audio_path.exists():
# Keep full narration; do not truncate to planned duration when audio is longer
audio_dur = probe_duration(shot.audio_path) or shot.duration
use_dur = max(shot.duration, audio_dur)
@@ -773,19 +808,46 @@ def compose_project(
]
)
- # Captions already burned per-shot via drawtext — remux only.
- _run(
- [
- ffmpeg,
- "-y",
- "-i",
- str(merged),
- "-c",
- "copy",
- "-movflags",
- "+faststart",
- str(output),
- ]
- )
+ if continuous and opts.full_audio_path:
+ # Replace silent concat audio with one continuous narration track
+ voiced = tmp_path / "voiced.mp4"
+ _run(
+ [
+ ffmpeg,
+ "-y",
+ "-i",
+ str(merged),
+ "-i",
+ str(opts.full_audio_path),
+ "-map",
+ "0:v:0",
+ "-map",
+ "1:a:0",
+ "-c:v",
+ "copy",
+ "-c:a",
+ "aac",
+ "-shortest",
+ "-movflags",
+ "+faststart",
+ str(voiced),
+ ]
+ )
+ shutil.copy2(voiced, output)
+ else:
+ # Captions already burned per-shot via drawtext — remux only.
+ _run(
+ [
+ ffmpeg,
+ "-y",
+ "-i",
+ str(merged),
+ "-c",
+ "copy",
+ "-movflags",
+ "+faststart",
+ str(output),
+ ]
+ )
return output
diff --git a/backend/app/services/pipeline.py b/backend/app/services/pipeline.py
index d069896..922ac8d 100644
--- a/backend/app/services/pipeline.py
+++ b/backend/app/services/pipeline.py
@@ -5,6 +5,7 @@ from __future__ import annotations
import asyncio
import logging
import shutil
+from pathlib import Path
from sqlalchemy import select
from sqlalchemy.orm import selectinload
@@ -13,7 +14,14 @@ from app.config import get_settings
from app.database import AsyncSessionLocal
from app.models import PipelineJob, Project, ProjectStatus, Shot, ShotStatus
from app.services.ark import get_ark
-from app.services.ffmpeg_compose import ComposeOptions, ShotMedia, compose_project, is_near_silent_audio, probe_duration
+from app.services.ffmpeg_compose import (
+ ComposeOptions,
+ ShotMedia,
+ allocate_durations_by_narration,
+ compose_project,
+ is_near_silent_audio,
+ probe_duration,
+)
from app.services.progress import publish_progress
from app.services import storage
from app.services.style_lock import (
@@ -21,6 +29,7 @@ from app.services.style_lock import (
merge_negative,
seedream_ref_urls,
strip_lock_blocks,
+ template_is_photoreal,
)
from app.services.voices import resolve_speaker
@@ -138,6 +147,78 @@ async def _ensure_not_cancelled(project_id: int) -> None:
raise PipelineCancelled(f"project {project_id} cancelled")
+def _full_narration_path(project_id: int) -> Path:
+ return storage.project_dir(project_id) / "full_narration.mp3"
+
+
+def join_shot_narrations(narrations: list[str]) -> str:
+ """Merge per-shot旁白 into one continuous TTS script (punctuation = natural breath)."""
+ parts: list[str] = []
+ for raw in narrations:
+ t = (raw or "").strip()
+ if not t:
+ continue
+ if t[-1] not in "。!?;…,.!?;":
+ t += "。"
+ parts.append(t)
+ return "".join(parts)
+
+
+def _continuous_audio_ok(project_id: int) -> bool:
+ path = _full_narration_path(project_id)
+ return path.exists() and path.stat().st_size > 2000 and not is_near_silent_audio(path)
+
+
+async def _synthesize_continuous_audio(
+ project_id: int,
+ *,
+ voice: str,
+ shot_rows: list,
+ force: bool = False,
+) -> Path:
+ """One TTS pass for the whole film; redistribute shot durations by narration weight."""
+ dest = _full_narration_path(project_id)
+ narrations = [(getattr(s, "narration", None) or "") for s in shot_rows]
+ full_text = join_shot_narrations(narrations)
+ if not full_text.strip():
+ raise ValueError("全部镜头旁白为空,无法配音")
+
+ ark = get_ark()
+ if force or not _continuous_audio_ok(project_id):
+ hint = sum(max(float(getattr(s, "duration", 4) or 4), 2.0) for s in shot_rows)
+ audio_url = await ark.tts(
+ full_text,
+ voice,
+ project_id=project_id,
+ shot_no=0,
+ duration_hint=hint,
+ )
+ src = storage.local_path_from_url(audio_url or "")
+ if not src or not src.exists():
+ raise RuntimeError("整片配音生成失败")
+ if src.resolve() != dest.resolve():
+ dest.write_bytes(src.read_bytes())
+
+ dur = await asyncio.to_thread(probe_duration, dest)
+ if not dur or dur < 0.8:
+ raise RuntimeError("整片配音时长异常")
+
+ allocated = allocate_durations_by_narration(narrations, dur)
+ async with _db_write_lock:
+ async with AsyncSessionLocal() as db:
+ for shot, new_dur in zip(shot_rows, allocated):
+ row = await db.get(Shot, shot.id)
+ if not row:
+ continue
+ row.duration = float(new_dur)
+ # Point every shot at the same continuous file (compose prefers full_narration)
+ row.audio_url = storage.rel_static_url(dest)
+ if row.status == ShotStatus.PENDING:
+ row.status = ShotStatus.AUDIO_READY
+ await db.commit()
+ return dest
+
+
async def _resume_plan(project_id: int) -> tuple[bool, bool, bool, bool]:
"""Return (image_text, skip_script, skip_assets, skip_videos).
@@ -165,7 +246,7 @@ async def _resume_plan(project_id: int) -> tuple[bool, bool, bool, bool]:
return False
return not is_near_silent_audio(path)
- has_audio = all(_audio_ok(s) for s in shots)
+ has_audio = _continuous_audio_ok(project_id) or all(_audio_ok(s) for s in shots)
has_videos = all(bool(s.video_url) for s in shots)
# Keep existing storyboard if any media already exists
skip_script = any(bool(s.image_url or s.audio_url or s.video_url) for s in shots)
@@ -437,7 +518,11 @@ def _image_size_for(project: Project) -> str | None:
def _project_image_negative(project: Project) -> str:
tpl = project.template
- return merge_negative(tpl.negative_prompt if tpl else "", image_text=_is_image_text(project))
+ return merge_negative(
+ tpl.negative_prompt if tpl else "",
+ image_text=_is_image_text(project),
+ photoreal=template_is_photoreal(tpl),
+ )
def _project_base_refs(project: Project) -> list[str]:
@@ -453,6 +538,7 @@ def _locked_shot_prompt(project: Project, img_prompt: str) -> str:
_effective_style(project),
strip_lock_blocks(img_prompt),
getattr(project, "character_bible", None) or "",
+ photoreal=template_is_photoreal(project.template),
)
@@ -507,6 +593,7 @@ async def _parallel_image_and_audio(project_id: int) -> None:
]
style_prefix = _effective_style(project)
character_bible = getattr(project, "character_bible", None) or ""
+ photoreal = template_is_photoreal(tpl)
base_refs = _project_base_refs(project)
# If some shots already have images (resume), use them as consistency anchors
existing_anchor = _consistency_ref_from_shots(shot_rows)
@@ -518,23 +605,18 @@ async def _parallel_image_and_audio(project_id: int) -> None:
return
img_sem = asyncio.Semaphore(max(1, cfg.pipeline_image_concurrency))
- aud_sem = asyncio.Semaphore(max(1, cfg.pipeline_audio_concurrency))
done_img = 0
- done_aud = 0
progress_lock = asyncio.Lock()
+ need_audio = not _continuous_audio_ok(project_id)
- async def bump(kind: str) -> None:
- nonlocal done_img, done_aud
+ async def bump_images() -> None:
+ nonlocal done_img
async with progress_lock:
- if kind == "img":
- done_img += 1
- else:
- done_aud += 1
- # 18 → 70 while images+audio complete
- img_w = 0.55 if image_text else 0.45
- aud_w = 0.45 if image_text else 0.25
- frac = (done_img / total) * img_w + (done_aud / total) * aud_w
- pct = 18 + int(52 * frac)
+ done_img += 1
+ # 18 → ~55 while images; audio fills the rest when done
+ img_w = 0.7 if image_text else 0.55
+ frac = (done_img / max(total, 1)) * img_w
+ pct = 18 + int(40 * frac)
async with _db_write_lock:
async with AsyncSessionLocal() as db:
project = await db.get(Project, project_id)
@@ -548,7 +630,8 @@ async def _parallel_image_and_audio(project_id: int) -> None:
"event": "progress",
"stage": "PARALLEL_ASSETS",
"percent": pct,
- "message": f"出图 {done_img}/{total} · 配音 {done_aud}/{total}",
+ "message": f"出图 {done_img}/{total}"
+ + (" · 整片配音生成中…" if need_audio else " · 配音已就绪"),
"shot": None,
"total": total,
},
@@ -569,15 +652,20 @@ async def _parallel_image_and_audio(project_id: int) -> None:
elif not shot.video_url:
shot.status = ShotStatus.IMAGE_READY
await db.commit()
- await bump("img")
+ await bump_images()
async def one_image(meta: dict, ref_urls: list[str]) -> str | None:
"""Generate one shot; return remote/local URL for consistency chaining."""
await _ensure_not_cancelled(project_id)
if meta.get("has_image"):
- await bump("img")
+ await bump_images()
return None
- prompt = build_locked_image_prompt(style_prefix, strip_lock_blocks(meta["img_prompt"]), character_bible)
+ prompt = build_locked_image_prompt(
+ style_prefix,
+ strip_lock_blocks(meta["img_prompt"]),
+ character_bible,
+ photoreal=photoreal,
+ )
async with img_sem:
await _ensure_not_cancelled(project_id)
img = await ark.gen_image(
@@ -595,8 +683,8 @@ async def _parallel_image_and_audio(project_id: int) -> None:
"""Anchor on first generated shot, then parallelize the rest with that ref."""
need = [m for m in shot_meta if not m.get("has_image")]
already = [m for m in shot_meta if m.get("has_image")]
- for m in already:
- await bump("img")
+ for _m in already:
+ await bump_images()
if not need:
return
@@ -620,44 +708,44 @@ async def _parallel_image_and_audio(project_id: int) -> None:
if isinstance(r, Exception):
raise r
- async def one_audio(meta: dict) -> None:
+ async def run_continuous_audio() -> None:
await _ensure_not_cancelled(project_id)
- if meta.get("has_audio"):
- await bump("aud")
+ if not need_audio:
return
- async with aud_sem:
- await _ensure_not_cancelled(project_id)
- audio_url = await ark.tts(
- meta["narration"],
- voice,
- project_id=project_id,
- shot_no=meta["shot_no"],
- duration_hint=meta["duration"],
- )
- new_dur = meta["duration"]
- audio_path = storage.local_path_from_url(audio_url or "")
- if audio_path and audio_path.exists():
- dur = await asyncio.to_thread(probe_duration, audio_path)
- if dur and dur > 0.5:
- new_dur = max(float(meta["duration"]), round(dur + 0.35, 2))
+ await publish_progress(
+ project_id,
+ {
+ "event": "progress",
+ "stage": "PARALLEL_ASSETS",
+ "percent": 30,
+ "message": "整片连贯配音中…",
+ },
+ )
+ await _synthesize_continuous_audio(
+ project_id,
+ voice=voice,
+ shot_rows=shot_rows,
+ force=False,
+ )
async with _db_write_lock:
async with AsyncSessionLocal() as db:
- shot = await db.get(Shot, meta["id"])
- if not shot:
- return
- shot.audio_url = audio_url
- shot.duration = new_dur
- if shot.status == ShotStatus.PENDING:
- shot.status = ShotStatus.AUDIO_READY
- elif shot.status == ShotStatus.IMAGE_READY and shot.audio_url:
- # keep IMAGE_READY for UI; audio_url marks TTS done
- pass
- await db.commit()
- await bump("aud")
+ project = await db.get(Project, project_id)
+ if project:
+ project.progress = max(project.progress or 0, 45)
+ await db.commit()
+ await publish_progress(
+ project_id,
+ {
+ "event": "progress",
+ "stage": "PARALLEL_ASSETS",
+ "percent": 48,
+ "message": "整片配音完成",
+ },
+ )
results = await asyncio.gather(
run_images(),
- *(one_audio(m) for m in shot_meta),
+ run_continuous_audio(),
return_exceptions=True,
)
errors = [r for r in results if isinstance(r, Exception)]
@@ -678,7 +766,7 @@ async def _parallel_image_and_audio(project_id: int) -> None:
project = result.scalar_one()
if project.shots:
project.cover_url = sorted(project.shots, key=lambda s: s.shot_no)[0].image_url
- project.status = ProjectStatus.IMAGE_READY if image_text else ProjectStatus.IMAGE_READY
+ project.status = ProjectStatus.IMAGE_READY
project.progress = 70 if image_text else 50
await db.commit()
await publish_progress(
@@ -687,7 +775,7 @@ async def _parallel_image_and_audio(project_id: int) -> None:
"event": "progress",
"stage": "ASSETS_READY",
"percent": 70 if image_text else 50,
- "message": "分镜图与配音已完成",
+ "message": "分镜图与整片配音已完成",
},
)
@@ -754,17 +842,50 @@ async def _parallel_videos(project_id: int) -> None:
async with sem:
await _ensure_not_cancelled(project_id)
prompt = f"{meta['video_prompt']}。运镜:{meta['camera']}。{motion}"
- task_id = await ark.gen_video_i2v(
- meta["image_ref"],
- prompt,
- int(meta["duration"]),
- character_consistency=consistency,
- resolution=resolution,
- ratio=ratio,
- )
- local_video = await ark.wait_video(
- task_id, project_id=project_id, shot_no=meta["shot_no"]
- )
+ try:
+ local_video = await ark.gen_and_wait_video(
+ meta["image_ref"],
+ prompt,
+ int(meta["duration"]),
+ project_id=project_id,
+ shot_no=meta["shot_no"],
+ character_consistency=consistency,
+ resolution=resolution,
+ ratio=ratio,
+ )
+ except Exception as exc: # noqa: BLE001
+ msg = str(exc)
+ # Real-person privacy blocks — skip AI video; compose will use still image
+ if any(
+ k in msg
+ for k in (
+ "PrivacyInformation",
+ "InputImageSensitive",
+ "SensitiveContentDetected",
+ )
+ ):
+ logger.warning(
+ "Seedance privacy skip project=%s shot=%s: %s",
+ project_id,
+ meta["shot_no"],
+ msg[:240],
+ )
+ async with progress_lock:
+ done += 1
+ pct = 55 + int(30 * done / max(total, 1))
+ await publish_progress(
+ project_id,
+ {
+ "event": "progress",
+ "stage": "VIDEOING",
+ "shot": meta["shot_no"],
+ "total": total,
+ "percent": pct,
+ "message": f"镜头 {meta['shot_no']} 含真人已跳过 AI 视频,将用静图合成",
+ },
+ )
+ return
+ raise
async with _db_write_lock:
async with AsyncSessionLocal() as db:
shot = await db.get(Shot, meta["id"])
@@ -833,6 +954,7 @@ async def _image_stage(project_id: int) -> None:
negative = _project_image_negative(project)
style_prefix = _effective_style(project)
bible = getattr(project, "character_bible", None) or ""
+ photoreal = template_is_photoreal(tpl)
anchor: str | None = None
for idx, shot in enumerate(sorted(project.shots, key=lambda s: s.shot_no)):
@@ -842,7 +964,12 @@ async def _image_stage(project_id: int) -> None:
anchor = shot.image_ark_url or shot.image_url
continue
refs = seedream_ref_urls(anchor, *ref_urls) if anchor else list(ref_urls)
- prompt = build_locked_image_prompt(style_prefix, strip_lock_blocks(shot.img_prompt), bible)
+ prompt = build_locked_image_prompt(
+ style_prefix,
+ strip_lock_blocks(shot.img_prompt),
+ bible,
+ photoreal=photoreal,
+ )
img = await ark.gen_image(
prompt,
negative,
@@ -900,15 +1027,16 @@ async def _video_stage(project_id: int) -> None:
await _ensure_not_cancelled(project_id)
prompt = f"{shot.video_prompt}。运镜:{shot.camera}。{motion}"
image_ref = shot.image_ark_url or shot.image_url or ""
- task_id = await ark.gen_video_i2v(
+ local_video = await ark.gen_and_wait_video(
image_ref,
prompt,
int(shot.duration),
+ project_id=project_id,
+ shot_no=shot.shot_no,
character_consistency=consistency,
resolution=resolution,
ratio=ratio,
)
- local_video = await ark.wait_video(task_id, project_id=project_id, shot_no=shot.shot_no)
shot.video_url = local_video
shot.status = ShotStatus.VIDEO_READY
pct = 50 + int(25 * (idx + 1) / max(total, 1))
@@ -930,8 +1058,8 @@ async def _video_stage(project_id: int) -> None:
async def _audio_stage(project_id: int) -> None:
+ """Fallback audio stage — continuous narration for the whole film."""
await _set_status(project_id, ProjectStatus.AUDIOING, 80, "AUDIOING")
- ark = get_ark()
async with AsyncSessionLocal() as db:
result = await db.execute(
select(Project)
@@ -940,35 +1068,14 @@ async def _audio_stage(project_id: int) -> None:
)
project = result.scalar_one()
voice = _project_voice(project)
- total = len(project.shots)
- for idx, shot in enumerate(sorted(project.shots, key=lambda s: s.shot_no)):
- await _ensure_not_cancelled(project_id)
- shot.audio_url = await ark.tts(
- shot.narration,
- voice,
- project_id=project_id,
- shot_no=shot.shot_no,
- duration_hint=shot.duration,
- )
- audio_path = storage.local_path_from_url(shot.audio_url or "")
- if audio_path and audio_path.exists():
- dur = await asyncio.to_thread(probe_duration, audio_path)
- if dur and dur > 0.5:
- shot.duration = max(float(shot.duration), round(dur + 0.35, 2))
- shot.status = ShotStatus.AUDIO_READY
- pct = 80 + int(10 * (idx + 1) / max(total, 1))
- project.progress = pct
- await db.commit()
- await publish_progress(
- project_id,
- {
- "event": "progress",
- "stage": "AUDIOING",
- "shot": shot.shot_no,
- "total": total,
- "percent": pct,
- },
- )
+ shots = sorted(project.shots, key=lambda s: s.shot_no)
+ await _synthesize_continuous_audio(
+ project_id, voice=voice, shot_rows=shots, force=False
+ )
+ await publish_progress(
+ project_id,
+ {"event": "progress", "stage": "AUDIOING", "percent": 88, "message": "整片配音完成"},
+ )
async def _compose_stage(project_id: int) -> None:
@@ -1010,6 +1117,10 @@ async def _compose_stage(project_id: int) -> None:
if mode == "image_text" and ratio == "16:9":
ratio = "9:16"
+ full_audio = _full_narration_path(project_id)
+ if not full_audio.exists():
+ full_audio = None
+
out = storage.project_dir(project_id) / "final.mp4"
await asyncio.to_thread(
compose_project,
@@ -1019,6 +1130,7 @@ async def _compose_stage(project_id: int) -> None:
ratio=ratio,
mode=mode,
resolution_mode=project.resolution_mode or "preview",
+ full_audio_path=full_audio,
),
)
project.final_video_url = storage.rel_static_url(out)
@@ -1092,15 +1204,16 @@ async def regen_shot_video(project_id: int, shot_id: int) -> None:
resolution = "720p"
prompt = f"{shot.video_prompt}。运镜:{shot.camera}。{motion}"
image_ref = shot.image_ark_url or shot.image_url or ""
- task_id = await ark.gen_video_i2v(
+ local_video = await ark.gen_and_wait_video(
image_ref,
prompt,
int(shot.duration),
+ project_id=project_id,
+ shot_no=shot.shot_no,
character_consistency=consistency,
resolution=resolution,
ratio=project.template.default_ratio or cfg.ark_video_ratio,
)
- local_video = await ark.wait_video(task_id, project_id=project_id, shot_no=shot.shot_no)
shot.video_url = local_video
shot.status = ShotStatus.VIDEO_READY
shot.version += 1
@@ -1110,7 +1223,7 @@ async def regen_shot_video(project_id: int, shot_id: int) -> None:
async def regen_shot_audio(project_id: int, shot_id: int) -> None:
- ark = get_ark()
+ """Re-TTS uses continuous full-film narration (editing one shot re-voices the whole track)."""
async with AsyncSessionLocal() as db:
result = await db.execute(
select(Project)
@@ -1121,32 +1234,27 @@ async def regen_shot_audio(project_id: int, shot_id: int) -> None:
shot = next((s for s in project.shots if s.id == shot_id), None)
if not shot:
raise ValueError("shot not found")
- if not (shot.narration or "").strip():
+ if not (shot.narration or "").strip() and not any(
+ (s.narration or "").strip() for s in project.shots
+ ):
raise ValueError("旁白为空,无法配音")
voice = _project_voice(project)
- audio_url = await ark.tts(
- shot.narration,
- voice,
- project_id=project_id,
- shot_no=shot.shot_no,
- duration_hint=float(shot.duration),
- )
- shot.audio_url = audio_url
- audio_path = storage.local_path_from_url(audio_url or "")
- if audio_path and audio_path.exists():
- dur = await asyncio.to_thread(probe_duration, audio_path)
- if dur and dur > 0.5:
- shot.duration = max(float(shot.duration), round(dur + 0.35, 2))
- if shot.status == ShotStatus.PENDING:
- shot.status = ShotStatus.AUDIO_READY
- shot.version += 1
- project.final_video_url = None
- await db.commit()
+ shots = sorted(project.shots, key=lambda s: s.shot_no)
+ await _synthesize_continuous_audio(
+ project_id, voice=voice, shot_rows=shots, force=True
+ )
+ async with AsyncSessionLocal() as db:
+ project = await db.get(Project, project_id)
+ shot = await db.get(Shot, shot_id)
+ if shot:
+ shot.version += 1
+ if project:
+ project.final_video_url = None
+ await db.commit()
async def regen_project_audio_and_compose(project_id: int) -> None:
- """Force re-TTS every shot with current voice, then compose."""
- ark = get_ark()
+ """Force continuous re-TTS with current voice, then compose."""
await _set_status(project_id, ProjectStatus.AUDIOING, 80, "AUDIOING")
async with AsyncSessionLocal() as db:
result = await db.execute(
@@ -1157,38 +1265,31 @@ async def regen_project_audio_and_compose(project_id: int) -> None:
project = result.scalar_one()
voice = _project_voice(project)
shots = sorted(project.shots, key=lambda s: s.shot_no)
- total = max(len(shots), 1)
- for idx, shot in enumerate(shots):
- if not (shot.narration or "").strip():
- continue
- audio_url = await ark.tts(
- shot.narration,
- voice,
- project_id=project_id,
- shot_no=shot.shot_no,
- duration_hint=float(shot.duration),
- )
- shot.audio_url = audio_url
- audio_path = storage.local_path_from_url(audio_url or "")
- if audio_path and audio_path.exists():
- dur = await asyncio.to_thread(probe_duration, audio_path)
- if dur and dur > 0.5:
- shot.duration = max(float(shot.duration), round(dur + 0.35, 2))
- shot.version += 1
- project.progress = 80 + int(10 * (idx + 1) / total)
- await db.commit()
- await publish_progress(
- project_id,
- {
- "event": "progress",
- "stage": "AUDIOING",
- "percent": project.progress,
- "message": f"配音 {idx + 1}/{total}",
- },
- )
project.final_video_url = None
await db.commit()
+ await publish_progress(
+ project_id,
+ {
+ "event": "progress",
+ "stage": "AUDIOING",
+ "percent": 82,
+ "message": "整片连贯配音中…",
+ },
+ )
+ await _synthesize_continuous_audio(
+ project_id, voice=voice, shot_rows=shots, force=True
+ )
+ await publish_progress(
+ project_id,
+ {
+ "event": "progress",
+ "stage": "AUDIOING",
+ "percent": 90,
+ "message": "整片配音完成,开始合成",
+ },
+ )
+
await _compose_stage(project_id)
async with AsyncSessionLocal() as db:
project = await db.get(Project, project_id)
diff --git a/backend/app/services/style_lock.py b/backend/app/services/style_lock.py
index b040cbc..497a490 100644
--- a/backend/app/services/style_lock.py
+++ b/backend/app/services/style_lock.py
@@ -5,26 +5,39 @@ from __future__ import annotations
import re
from urllib.parse import urlparse
-# Terms that cause 真人 / 动漫 / 3D drift across shots
-_STYLE_DRIFT = re.compile(
+# Terms that cause 真人 / 动漫 / 3D drift across shots (for illustration templates)
+_STYLE_DRIFT_ILLUS = re.compile(
r"(写实照片|照片级真实|真人实拍|真实人脸|真人脸|摄影棚人像|电影真人剧照|"
r"超写实皮肤|照片质感|live[\s-]?action|photoreal(?:istic)?|"
r"赛璐璐二次元|日系动漫脸|动漫大眼睛|萌系二次元|3D超写实|CGI写实人像)",
re.IGNORECASE,
)
-_EXTRA_NEGATIVE = (
+# Terms that break photoreal / live-action templates
+_STYLE_DRIFT_PHOTO = re.compile(
+ r"(卡通简笔画|儿童绘本扁平|赛璐璐二次元|日系动漫脸|萌系二次元|"
+ r"剪纸扁平|像素块|水墨写意|贴纸拼贴|Q版三头身)",
+ re.IGNORECASE,
+)
+
+_EXTRA_NEGATIVE_ILLUS = (
"写实照片,真人,真实人脸,摄影棚人像,电影真人剧照,照片级皮肤,"
"风格混杂,镜头间画风跳变,另一套画风,赛璐璐二次元与写实混用"
)
+_EXTRA_NEGATIVE_PHOTO = (
+ "卡通,动漫,赛璐璐,二次元,扁平插画,剪纸,像素风,水墨写意,"
+ "风格混杂,镜头间画风跳变,另一套画风,插画与写实混用"
+)
+
_SCENE_TAG = re.compile(r"【场景】\s*(.+?)(?=\n【|\Z)", re.S)
_LOCK_LINE = re.compile(r"【(?:风格锁定|人物锁定|约束)】[^\n]*")
_PERSON_SETTING = re.compile(r"(?:人物设定|角色设定)[::][^\n【]{0,400}")
-def strip_style_drift(prompt: str) -> str:
- out = _STYLE_DRIFT.sub("", prompt or "")
+def strip_style_drift(prompt: str, *, photoreal: bool = False) -> str:
+ rx = _STYLE_DRIFT_PHOTO if photoreal else _STYLE_DRIFT_ILLUS
+ out = rx.sub("", prompt or "")
out = re.sub(r"[,,]{2,}", ",", out)
return out.strip(",,。 \n\t")
@@ -66,19 +79,26 @@ def build_locked_image_prompt(
style_prefix: str,
img_prompt: str,
character_bible: str = "",
+ *,
+ photoreal: bool = False,
) -> str:
"""Canonical prompt sent to Seedream — style + cast locked every shot."""
- body = strip_lock_blocks(strip_style_drift(img_prompt))
+ body = strip_lock_blocks(strip_style_drift(img_prompt, photoreal=photoreal))
if style_prefix and style_prefix in body:
body = body.replace(style_prefix, "", 1).strip(",, ")
parts: list[str] = []
if style_prefix:
- parts.append(
- f"【风格锁定】{style_prefix}。全片统一此画风,禁止写实摄影与风格跳变"
- )
+ if photoreal:
+ parts.append(
+ f"【风格锁定】{style_prefix}。全片统一此画风,禁止卡通动漫与风格跳变"
+ )
+ else:
+ parts.append(
+ f"【风格锁定】{style_prefix}。全片统一此画风,禁止写实摄影与风格跳变"
+ )
if (character_bible or "").strip():
parts.append(
- f"【人物锁定】{(character_bible or '').strip()}。人物外形全片一致,禁止换脸换装"
+ f"【人物锁定】{(character_bible or '').strip()}。凡出现人物必须严格沿用以上外形,禁止换脸换装"
)
if body:
parts.append(f"【场景】{body}")
@@ -86,15 +106,32 @@ def build_locked_image_prompt(
return "\n".join(parts)
-def merge_negative(template_negative: str, *, image_text: bool = False) -> str:
+def merge_negative(
+ template_negative: str,
+ *,
+ image_text: bool = False,
+ photoreal: bool = False,
+) -> str:
base = (template_negative or "").strip(",, ")
- parts = [p for p in (base, _EXTRA_NEGATIVE) if p]
+ extra = _EXTRA_NEGATIVE_PHOTO if photoreal else _EXTRA_NEGATIVE_ILLUS
+ parts = [p for p in (base, extra) if p]
merged = ",".join(parts)
if image_text and "文字" not in merged:
merged = f"{merged},画面文字,字幕,水印,标题字"
return merged
+def template_is_photoreal(tpl) -> bool:
+ """True when template opts into live-action / photoreal style."""
+ if tpl is None:
+ return False
+ cfg = getattr(tpl, "seedream_config", None) or {}
+ if isinstance(cfg, dict) and cfg.get("photoreal"):
+ return True
+ cats = getattr(tpl, "category", None) or []
+ return any(c in {"真人感", "写实感"} for c in cats)
+
+
def seedream_ref_urls(*candidates: str | None) -> list[str]:
"""Normalize refs for Seedream — **public https only**.
diff --git a/backend/app/services/templates_seed.py b/backend/app/services/templates_seed.py
index 1d5b050..6de2bc6 100644
--- a/backend/app/services/templates_seed.py
+++ b/backend/app/services/templates_seed.py
@@ -1,12 +1,194 @@
-"""内置风格模板 — 提示词与风格描述统一中文。"""
+"""内置风格模板 — 提示词与风格描述统一中文。
+
+分类约定(category[0] 为主分类,用于首页筛选):
+电影感 / 真人感 / 写实感 / 科普 / 儿童 / 国风 / 科幻 / 动漫 / 商业 / 复古 / 纪录片 / 奇幻 / 图文 / 悬疑
+真人感、写实感模板须在 seedream_config 设 photoreal: true。
+"""
TEMPLATES: list[dict] = [
+ {
+ "id": "portrait_story",
+ "name": "竖屏图文故事",
+ "description": "竖屏插画叙事,电影感构图,适合历史人文短片。",
+ "category": ["图文", "电影感", "故事"],
+ "preview_cover": "/static/templates/covers/portrait_story.png",
+ "style_prefix": "统一二维概念插画,细腻光影与电影感构图,非写实摄影、非日系赛璐璐动漫,竖屏主体偏中下,顶部留白便于叠字,画面干净无文字",
+ "negative_prompt": "写实照片,真人,真实人脸,摄影棚,电影真人剧照,日系动漫赛璐璐,画面文字,字幕,水印,标题字,logo,模糊",
+ "default_ratio": "9:16",
+ "shot_duration_min": 4,
+ "shot_duration_max": 12,
+ "llm_system_addon": "按故事节拍拆镜:起承转合。每镜 title 短标题、subtitle 叠字副标题、text 为可朗读旁白。画面必须全片统一插画风与人物外形,禁止某镜突然变成真人照片或另一套动漫风。",
+ "seedream_config": {
+ "ref_images": [],
+ "strength": 0.7,
+ "pipeline_mode": "image_text",
+ "character_prompt": "故事主角外形固定:年龄感、发型发色、服装配色与辨识物全片一致,细腻插画五官,非真人照片",
+ "extra_prompt": "竖屏构图,主体偏中下,顶部约1/4留白,电影感光影,画面内无文字",
+ },
+ "seedance_config": {
+ "motion_bias": "缓慢推近或轻拉远",
+ "character_consistency": True,
+ },
+ "audio_config": {"voice_preset": "narrator_calm", "bgm_mood": "叙事氛围"},
+ "subtitle_config": {"font": "SourceHanSans", "position": "top"},
+ "sort_order": 5,
+ "is_active": True,
+ "is_premium": False,
+ },
+ {
+ "id": "live_cinematic",
+ "name": "真人电影感",
+ "description": "真人实拍电影质感,戏剧光影与浅景深,适合叙事短片。",
+ "category": ["电影感", "真人感"],
+ "preview_cover": "/static/templates/covers/live_cinematic.png",
+ "style_prefix": "真人电影感摄影,电影级打光与浅景深,胶片质感与轻微颗粒,青橙调色,写实皮肤与真实材质,宽银幕构图,非卡通非动漫",
+ "negative_prompt": "卡通,动漫,赛璐璐,二次元,扁平插画,剪纸,像素,夸张五官,塑料皮肤,水印,画面文字",
+ "default_ratio": "16:9",
+ "shot_duration_min": 4,
+ "shot_duration_max": 12,
+ "llm_system_addon": "按真人电影分镜:建立镜头→中景→特写。全片必须同一真人写实画风与同一演员外形,禁止某镜变成卡通。",
+ "seedream_config": {
+ "ref_images": [],
+ "strength": 0.75,
+ "pipeline_mode": "full",
+ "photoreal": True,
+ "character_prompt": "真人演员外形固定:年龄、发型发色、面部特征、服装全片一致,写实皮肤质感",
+ "extra_prompt": "电影打光、浅景深、胶片颗粒,真实场景材质",
+ },
+ "seedance_config": {
+ "motion_bias": "电影感推轨或轻微横移,自然运动模糊",
+ "character_consistency": True,
+ },
+ "audio_config": {"voice_preset": "narrator_calm", "bgm_mood": "电影氛围"},
+ "subtitle_config": {"font": "SourceHanSans", "position": "bottom"},
+ "sort_order": 6,
+ "is_active": True,
+ "is_premium": False,
+ },
+ {
+ "id": "live_person",
+ "name": "真人感叙事",
+ "description": "生活化真人出镜感,适合人物故事、口播与纪实短片。",
+ "category": ["真人感", "故事"],
+ "preview_cover": "/static/templates/covers/live_person.png",
+ "style_prefix": "真人感生活摄影,自然光与柔和环境光,真实人物五官与皮肤质感,纪实构图,非棚拍浓妆,非卡通非动漫",
+ "negative_prompt": "卡通,动漫,赛璐璐,二次元,美颜过度磨皮,CGI假人,扁平插画,水印,画面文字",
+ "default_ratio": "9:16",
+ "shot_duration_min": 3,
+ "shot_duration_max": 12,
+ "llm_system_addon": "人物叙事节奏,旁白口语化。全片统一真人写实画风与同一人物外形。",
+ "seedream_config": {
+ "ref_images": [],
+ "strength": 0.72,
+ "pipeline_mode": "image_text",
+ "photoreal": True,
+ "character_prompt": "真人出镜主角:年龄气质、发型发色、服装日常感固定,自然表情,全片同一人",
+ "extra_prompt": "自然光、生活场景、竖屏主体清晰,顶部可留白叠字",
+ },
+ "seedance_config": {
+ "motion_bias": "轻微手持感,缓慢推近",
+ "character_consistency": True,
+ },
+ "audio_config": {"voice_preset": "warm_storyteller", "bgm_mood": "温暖人文"},
+ "subtitle_config": {"font": "SourceHanSans", "position": "top"},
+ "sort_order": 7,
+ "is_active": True,
+ "is_premium": False,
+ },
+ {
+ "id": "photo_realism",
+ "name": "写实摄影",
+ "description": "照片级写实质感,适合产品、风光与纪实科普。",
+ "category": ["写实感", "摄影"],
+ "preview_cover": "/static/templates/covers/photo_realism.png",
+ "style_prefix": "照片级写实摄影,清晰细节与真实材质,自然色彩,高动态范围,微距或风光皆可,非卡通非插画非动漫",
+ "negative_prompt": "卡通,动漫,赛璐璐,扁平插画,油画笔触,剪纸,像素,过度HDR伪色,水印,画面文字",
+ "default_ratio": "16:9",
+ "shot_duration_min": 3,
+ "shot_duration_max": 12,
+ "llm_system_addon": "写实镜头语言:全景建立→细节特写。若有人物须外形全片一致;可无人物纯场景。禁止卡通化。",
+ "seedream_config": {
+ "ref_images": [],
+ "strength": 0.7,
+ "pipeline_mode": "full",
+ "photoreal": True,
+ "character_prompt": "若出现人物:写实五官与发型服装固定;若无人物则专注真实场景与材质",
+ "extra_prompt": "照片级细节、真实材质、自然色彩,清晰主体",
+ },
+ "seedance_config": {
+ "motion_bias": "缓慢推近或轻微横移,真实空间感",
+ "character_consistency": True,
+ },
+ "audio_config": {"voice_preset": "narrator_calm", "bgm_mood": "冷静纪实"},
+ "subtitle_config": {"font": "SourceHanSans", "position": "bottom"},
+ "sort_order": 7,
+ "is_active": True,
+ "is_premium": False,
+ },
+ {
+ "id": "film_cinematic",
+ "name": "电影感胶片",
+ "description": "宽银幕胶片质感与戏剧光影,适合叙事短片与氛围故事。",
+ "category": ["电影感", "胶片"],
+ "preview_cover": "/static/templates/covers/film_cinematic.png",
+ "style_prefix": "电影感概念插画,宽银幕构图,胶片颗粒与轻微暗角,戏剧光影(侧光/逆光),青橙调色倾向,浅景深氛围,非写实摄影、非赛璐璐动漫",
+ "negative_prompt": "写实照片,真人,真实人脸,日系动漫,赛璐璐,扁平贴纸风,过曝,水印,画面文字,卡通简笔画",
+ "default_ratio": "16:9",
+ "shot_duration_min": 4,
+ "shot_duration_max": 12,
+ "llm_system_addon": "按电影分镜节奏:建立镜头→特写→反应镜头。台词克制,留白给画面。全片统一胶片插画风与角色外形。",
+ "seedream_config": {
+ "ref_images": [],
+ "strength": 0.72,
+ "pipeline_mode": "full",
+ "character_prompt": "电影感插画主角,明确年龄与发型发色,服装轮廓与辨识物固定,面部细节适中非照片,全片同一人设",
+ "extra_prompt": "胶片颗粒、暗角、戏剧光影,青橙氛围,宽银幕主体明确",
+ },
+ "seedance_config": {
+ "motion_bias": "缓慢推轨或轻微横移,电影感运镜,避免抖动",
+ "character_consistency": True,
+ },
+ "audio_config": {"voice_preset": "narrator_calm", "bgm_mood": "电影氛围"},
+ "subtitle_config": {"font": "SourceHanSans", "position": "bottom"},
+ "sort_order": 8,
+ "is_active": True,
+ "is_premium": False,
+ },
+ {
+ "id": "noir_thriller",
+ "name": "黑色悬疑",
+ "description": "高对比光影与冷调氛围,适合悬疑、案件与暗夜叙事。",
+ "category": ["悬疑", "电影感"],
+ "preview_cover": "/static/templates/covers/noir_thriller.png",
+ "style_prefix": "黑色电影概念插画,高对比明暗交界,冷青灰与少量暖光点缀,雨夜或室内台灯氛围,剪影与侧脸,非写实摄影",
+ "negative_prompt": "明亮粉彩,儿童绘本,日系美少女,写实照片,真人,血腥特写,水印,画面文字",
+ "default_ratio": "16:9",
+ "shot_duration_min": 4,
+ "shot_duration_max": 12,
+ "llm_system_addon": "悬疑节奏:线索→反转→压迫。台词短句,画面多用阴影与构图张力。全片统一黑色电影插画风。",
+ "seedream_config": {
+ "ref_images": [],
+ "strength": 0.72,
+ "pipeline_mode": "full",
+ "character_prompt": "Noir 风插画角色,轮廓清晰,大衣或标志性剪影,面部少光,外形全片一致",
+ "extra_prompt": "高对比阴影、冷调、雨夜或台灯,强构图张力",
+ },
+ "seedance_config": {
+ "motion_bias": "极慢推近,烟雾或雨丝轻微飘动",
+ "character_consistency": True,
+ },
+ "audio_config": {"voice_preset": "narrator_calm", "bgm_mood": "悬疑低沉"},
+ "subtitle_config": {"font": "SourceHanSans", "position": "bottom"},
+ "sort_order": 9,
+ "is_active": True,
+ "is_premium": False,
+ },
{
"id": "vox_papercut",
"name": "Vox剪纸科普",
"description": "低饱和扁平剪纸,适合硬核科普与纪录片节奏。",
"category": ["科普", "剪纸"],
- "preview_cover": "/static/templates/vox_papercut.svg",
+ "preview_cover": "/static/templates/covers/vox_papercut.png",
"style_prefix": "Vox剪纸扁平插画,层叠剪纸边缘,低饱和,干净剪影,科普解说片气质",
"negative_prompt": "写实照片,真人,真实人脸,三维渲染,日系动漫,模糊,噪点,水印,画面文字",
"default_ratio": "16:9",
@@ -30,12 +212,41 @@ TEMPLATES: list[dict] = [
"is_active": True,
"is_premium": False,
},
+ {
+ "id": "docu_warm",
+ "name": "温暖纪实",
+ "description": "纪实插画气质与暖色调,适合人物故事与人文纪录短片。",
+ "category": ["纪录片", "电影感"],
+ "preview_cover": "/static/templates/covers/docu_warm.png",
+ "style_prefix": "温暖纪实概念插画,自然光感,柔和暖棕与米白,生活场景细节,纪录片构图,非写实照片、非动漫赛璐璐",
+ "negative_prompt": "赛博霓虹,日系美少女,血腥,夸张卡通,写实照片,真人,水印,画面文字",
+ "default_ratio": "16:9",
+ "shot_duration_min": 4,
+ "shot_duration_max": 14,
+ "llm_system_addon": "人文纪录节奏:观察→细节→情感落点。旁白平和真诚。全片统一温暖纪实插画风与人物外形。",
+ "seedream_config": {
+ "ref_images": [],
+ "strength": 0.68,
+ "pipeline_mode": "full",
+ "character_prompt": "纪实插画人物,生活化发型服装,亲切五官,年龄感明确,全片同一人设",
+ "extra_prompt": "暖色自然光,生活场景,纪录片式构图,柔和颗粒",
+ },
+ "seedance_config": {
+ "motion_bias": "手持感极轻晃动或缓慢横移,纪实运镜",
+ "character_consistency": True,
+ },
+ "audio_config": {"voice_preset": "warm_storyteller", "bgm_mood": "温暖人文"},
+ "subtitle_config": {"font": "SourceHanSans", "position": "bottom"},
+ "sort_order": 12,
+ "is_active": True,
+ "is_premium": False,
+ },
{
"id": "kids_flat",
"name": "儿童绘本扁平",
"description": "柔和配色与圆润造型,适合儿童科普与故事。",
"category": ["儿童", "绘本"],
- "preview_cover": "/static/templates/kids_flat.svg",
+ "preview_cover": "/static/templates/covers/kids_flat.png",
"style_prefix": "儿童绘本扁平插画,柔和粉彩,圆润造型,友好角色,简洁背景",
"negative_prompt": "恐怖,阴暗,写实照片,复杂纹理,血腥",
"default_ratio": "16:9",
@@ -59,12 +270,41 @@ TEMPLATES: list[dict] = [
"is_active": True,
"is_premium": False,
},
+ {
+ "id": "soft_anime",
+ "name": "柔光动漫",
+ "description": "日系柔光赛璐璐,适合青春故事与情感短片。",
+ "category": ["动漫", "故事"],
+ "preview_cover": "/static/templates/covers/soft_anime.png",
+ "style_prefix": "日系柔光赛璐璐动漫,干净线稿,柔和渐变天空,大眼睛精致五官,统一角色设定,非写实摄影、非水墨、非剪纸",
+ "negative_prompt": "写实照片,真人,真实人脸,水墨,剪纸,像素风,血腥恐怖,水印,画面文字,三头身Q版混用",
+ "default_ratio": "16:9",
+ "shot_duration_min": 3,
+ "shot_duration_max": 12,
+ "llm_system_addon": "青春动漫叙事:情绪镜+对话镜交替。全片必须同一赛璐璐画风与角色外形,禁止某镜变真人。",
+ "seedream_config": {
+ "ref_images": [],
+ "strength": 0.7,
+ "pipeline_mode": "full",
+ "character_prompt": "日系动漫主角,发型发色瞳色固定,校服或常服配色固定,赛璐璐五官,全片同一人设",
+ "extra_prompt": "柔光、干净线稿、柔和天空,统一赛璐璐上色",
+ },
+ "seedance_config": {
+ "motion_bias": "轻微发丝与衣袂飘动,缓慢推近",
+ "character_consistency": True,
+ },
+ "audio_config": {"voice_preset": "warm_storyteller", "bgm_mood": "青春轻音乐"},
+ "subtitle_config": {"font": "SourceHanSans", "position": "bottom"},
+ "sort_order": 22,
+ "is_active": True,
+ "is_premium": False,
+ },
{
"id": "chalk_whiteboard",
"name": "粉笔白板手绘",
"description": "黑板粉笔与白板简笔画,适合课堂讲解风。",
"category": ["科普", "手绘"],
- "preview_cover": "/static/templates/chalk_whiteboard.svg",
+ "preview_cover": "/static/templates/covers/chalk_whiteboard.png",
"style_prefix": "黑板粉笔与白板手绘讲解风,粉笔笔触,示意图箭头,素描线条",
"negative_prompt": "写实照片,光滑三维,杂乱界面",
"default_ratio": "16:9",
@@ -88,12 +328,70 @@ TEMPLATES: list[dict] = [
"is_active": True,
"is_premium": False,
},
+ {
+ "id": "cyber_neon",
+ "name": "赛博霓虹",
+ "description": "霓虹夜城与未来感,适合科技、都市与科幻话题。",
+ "category": ["科幻", "赛博"],
+ "preview_cover": "/static/templates/covers/cyber_neon.png",
+ "style_prefix": "赛博朋克概念插画,霓虹粉青对比,雨夜反光街道,未来都市剪影,高对比夜景,非写实摄影、非儿童绘本",
+ "negative_prompt": "日光沙滩,田园水彩,儿童粉彩,写实照片,真人,水墨留白,水印,画面文字",
+ "default_ratio": "16:9",
+ "shot_duration_min": 3,
+ "shot_duration_max": 12,
+ "llm_system_addon": "科技/都市节奏偏快,每镜一个强视觉符号(霓虹、屏幕、雨夜)。全片统一赛博插画风。",
+ "seedream_config": {
+ "ref_images": [],
+ "strength": 0.72,
+ "pipeline_mode": "full",
+ "character_prompt": "赛博风插画角色,外套剪裁与发色固定,霓虹边缘光,面部非照片,全片同一人设",
+ "extra_prompt": "霓虹粉青、雨夜反光、未来都市,强对比夜景",
+ },
+ "seedance_config": {
+ "motion_bias": "霓虹闪烁,雨丝下落,缓慢穿梭运镜",
+ "character_consistency": True,
+ },
+ "audio_config": {"voice_preset": "urban_editorial", "bgm_mood": "赛博电子"},
+ "subtitle_config": {"font": "DisplaySans", "position": "bottom"},
+ "sort_order": 35,
+ "is_active": True,
+ "is_premium": False,
+ },
+ {
+ "id": "epic_fantasy",
+ "name": "奇幻史诗",
+ "description": "宏大场景与奇幻光影,适合神话、冒险与世界观短片。",
+ "category": ["奇幻", "电影感"],
+ "preview_cover": "/static/templates/covers/epic_fantasy.png",
+ "style_prefix": "奇幻史诗概念插画,宏大远景与英雄中景,暮光与神性光束,岩石城堡与云海,戏剧构图,非写实摄影、非现代都市",
+ "negative_prompt": "现代城市,手机界面,写实照片,真人,儿童简笔画,赛博霓虹,水印,画面文字",
+ "default_ratio": "16:9",
+ "shot_duration_min": 4,
+ "shot_duration_max": 14,
+ "llm_system_addon": "史诗叙事:远景建立世界观→人物登场→冲突高潮。台词可略庄重。全片统一奇幻插画风。",
+ "seedream_config": {
+ "ref_images": [],
+ "strength": 0.72,
+ "pipeline_mode": "full",
+ "character_prompt": "奇幻主角外形固定:盔甲或斗篷轮廓、发色、武器辨识物全片一致,插画五官非照片",
+ "extra_prompt": "宏大场景、暮光神性光束、戏剧构图,史诗氛围",
+ },
+ "seedance_config": {
+ "motion_bias": "缓慢升降镜头,云雾与旗帜飘动",
+ "character_consistency": True,
+ },
+ "audio_config": {"voice_preset": "narrator_calm", "bgm_mood": "史诗管弦"},
+ "subtitle_config": {"font": "SourceHanSans", "position": "bottom"},
+ "sort_order": 38,
+ "is_active": True,
+ "is_premium": False,
+ },
{
"id": "magazine_collage",
"name": "杂志拼贴",
"description": "剪报拼贴与印刷纹理,适合文化话题与品牌故事。",
- "category": ["拼贴", "杂志"],
- "preview_cover": "/static/templates/magazine_collage.svg",
+ "category": ["商业", "拼贴"],
+ "preview_cover": "/static/templates/covers/magazine_collage.png",
"style_prefix": "杂志纸质拼贴,撕边,网纹印刷质感,层叠剪贴,大胆平面构图",
"negative_prompt": "纯净矢量,写实皮肤,脏污发灰的色彩",
"default_ratio": "9:16",
@@ -117,12 +415,41 @@ TEMPLATES: list[dict] = [
"is_active": True,
"is_premium": False,
},
+ {
+ "id": "brand_clean",
+ "name": "极简品牌",
+ "description": "干净色块与强留白,适合产品解说与品牌短片。",
+ "category": ["商业", "极简"],
+ "preview_cover": "/static/templates/covers/brand_clean.png",
+ "style_prefix": "极简品牌概念插画,大面积留白,有限色板(黑白+一强调色),几何构图,干净产品感,非写实摄影、非杂乱拼贴",
+ "negative_prompt": "杂乱纹理,霓虹赛博,血腥,儿童粉彩堆砌,写实照片,真人,水印,画面乱文字",
+ "default_ratio": "9:16",
+ "shot_duration_min": 3,
+ "shot_duration_max": 10,
+ "llm_system_addon": "商业短句:卖点→场景→收束。每镜一个视觉焦点。全片统一极简品牌插画风。",
+ "seedream_config": {
+ "ref_images": [],
+ "strength": 0.68,
+ "pipeline_mode": "image_text",
+ "character_prompt": "极简几何化人物或手部剪影,配色固定,低细节面部,全片外形一致",
+ "extra_prompt": "大留白、有限色板、几何构图,竖屏品牌感",
+ },
+ "seedance_config": {
+ "motion_bias": "色块轻移,极慢推近,干净无抖动",
+ "character_consistency": True,
+ },
+ "audio_config": {"voice_preset": "urban_editorial", "bgm_mood": "极简电子"},
+ "subtitle_config": {"font": "DisplaySans", "position": "center"},
+ "sort_order": 42,
+ "is_active": True,
+ "is_premium": False,
+ },
{
"id": "pixel_retro",
"name": "像素复古科普",
"description": "8-bit/16-bit 像素风,适合科技史与游戏化讲解。",
- "category": ["像素", "复古"],
- "preview_cover": "/static/templates/pixel_retro.svg",
+ "category": ["复古", "像素"],
+ "preview_cover": "/static/templates/covers/pixel_retro.png",
"style_prefix": "复古像素画,16位有限色板,清晰像素块,简单游戏场景,无抗锯齿",
"negative_prompt": "平滑渐变,写实照片,模糊像素",
"default_ratio": "16:9",
@@ -146,12 +473,41 @@ TEMPLATES: list[dict] = [
"is_active": True,
"is_premium": False,
},
+ {
+ "id": "retro_vhs",
+ "name": "复古 VHS",
+ "description": "磁带录像与扫描线质感,适合怀旧故事与年代感内容。",
+ "category": ["复古", "电影感"],
+ "preview_cover": "/static/templates/covers/retro_vhs.png",
+ "style_prefix": "复古 VHS 概念插画,轻微色差与扫描线暗示,1980–90s 色调,圆角电视框感构图,怀旧氛围,非写实照片、非现代超清UI",
+ "negative_prompt": "超清现代广告,赛博霓虹堆砌,写实照片,真人,儿童粉彩,水印,画面乱码文字",
+ "default_ratio": "16:9",
+ "shot_duration_min": 3,
+ "shot_duration_max": 12,
+ "llm_system_addon": "怀旧叙事,旁白可带年代感。全片统一 VHS 插画质感与角色外形。",
+ "seedream_config": {
+ "ref_images": [],
+ "strength": 0.7,
+ "pipeline_mode": "full",
+ "character_prompt": "怀旧风插画人物,年代感发型服装固定,轻微色差边缘,非照片,全片同一人设",
+ "extra_prompt": "扫描线暗示、轻微色差、80/90年代色调,怀旧构图",
+ },
+ "seedance_config": {
+ "motion_bias": "轻微磁带抖动感,慢推,色差微闪",
+ "character_consistency": True,
+ },
+ "audio_config": {"voice_preset": "retro_host", "bgm_mood": "怀旧合成器"},
+ "subtitle_config": {"font": "SourceHanSans", "position": "bottom"},
+ "sort_order": 52,
+ "is_active": True,
+ "is_premium": False,
+ },
{
"id": "ink_guofeng",
"name": "水墨国风",
"description": "水墨留白与写意笔触,适合历史与文化短故事。",
"category": ["国风", "水墨"],
- "preview_cover": "/static/templates/ink_guofeng.svg",
+ "preview_cover": "/static/templates/covers/ink_guofeng.png",
"style_prefix": "中国水墨写意插画,富有表现力的笔触,大量留白,诗意氛围,淡雅墨色,非写实摄影",
"negative_prompt": "写实照片,真人,真实人脸,霓虹,赛博朋克,日系动漫,欧美卡通,画面文字,字幕,水印",
"default_ratio": "9:16",
@@ -175,33 +531,4 @@ TEMPLATES: list[dict] = [
"is_active": True,
"is_premium": False,
},
- {
- "id": "portrait_story",
- "name": "竖屏图文故事",
- "description": "竖屏插画叙事,适合历史人文短片。",
- "category": ["图文", "竖屏", "故事"],
- "preview_cover": "/static/templates/ink_guofeng.svg",
- "style_prefix": "统一二维概念插画,细腻光影与电影感构图,非写实摄影、非日系赛璐璐动漫,竖屏主体偏中下,顶部留白便于叠字,画面干净无文字",
- "negative_prompt": "写实照片,真人,真实人脸,摄影棚,电影真人剧照,日系动漫赛璐璐,画面文字,字幕,水印,标题字,logo,模糊",
- "default_ratio": "9:16",
- "shot_duration_min": 4,
- "shot_duration_max": 12,
- "llm_system_addon": "按故事节拍拆镜:起承转合。每镜 title 短标题、subtitle 叠字副标题、text 为可朗读旁白。画面必须全片统一插画风与人物外形,禁止某镜突然变成真人照片或另一套动漫风。",
- "seedream_config": {
- "ref_images": [],
- "strength": 0.7,
- "pipeline_mode": "image_text",
- "character_prompt": "故事主角外形固定:年龄感、发型发色、服装配色与辨识物全片一致,细腻插画五官,非真人照片",
- "extra_prompt": "竖屏构图,主体偏中下,顶部约1/4留白,电影感光影,画面内无文字",
- },
- "seedance_config": {
- "motion_bias": "缓慢推近或轻拉远",
- "character_consistency": True,
- },
- "audio_config": {"voice_preset": "narrator_calm", "bgm_mood": "叙事氛围"},
- "subtitle_config": {"font": "SourceHanSans", "position": "top"},
- "sort_order": 5,
- "is_active": True,
- "is_premium": False,
- },
]
diff --git a/backend/app/workers/tasks.py b/backend/app/workers/tasks.py
index 09e680a..4d21496 100644
--- a/backend/app/workers/tasks.py
+++ b/backend/app/workers/tasks.py
@@ -58,16 +58,20 @@ def run_pipeline_task(self, project_id: int) -> dict:
return {"ok": False, "cancelled": True, "project_id": project_id}
msg = str(exc)
# Permanent policy / client errors — do not retry
- if any(
+ permanent = any(
x in msg
for x in (
"PolicyViolation",
"SensitiveContent",
"InputTextSensitive",
- "400",
+ "InputImageSensitive",
+ "PrivacyInformation",
+ "BodyFormat",
+ "summary_caption",
)
- ) and "Seedream" in msg:
- logger.error("permanent seedream failure project=%s: %s", project_id, msg[:400])
+ )
+ if permanent:
+ logger.error("permanent pipeline failure project=%s: %s", project_id, msg[:400])
return {"ok": False, "project_id": project_id, "error": msg[:500]}
logger.exception("celery pipeline failed project=%s", project_id)
raise self.retry(exc=exc, countdown=10)
diff --git a/backend/scripts/__init__.py b/backend/scripts/__init__.py
new file mode 100644
index 0000000..246db6f
--- /dev/null
+++ b/backend/scripts/__init__.py
@@ -0,0 +1 @@
+# scripts package
diff --git a/backend/scripts/gen_template_covers.py b/backend/scripts/gen_template_covers.py
new file mode 100644
index 0000000..caf21b2
--- /dev/null
+++ b/backend/scripts/gen_template_covers.py
@@ -0,0 +1,118 @@
+"""Generate template preview covers via Seedream (image model).
+
+Usage (from backend/):
+ .venv\\Scripts\\python.exe -m scripts.gen_template_covers
+"""
+
+from __future__ import annotations
+
+import asyncio
+import logging
+import shutil
+import sys
+from pathlib import Path
+
+# Allow `python -m scripts.gen_template_covers` from backend/
+sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
+
+from sqlalchemy import create_engine, select
+from sqlalchemy.orm import Session
+
+from app.config import get_settings
+from app.models import Template
+from app.services.ark import get_ark
+from app.services.storage import local_path_from_url
+from app.services.templates_seed import TEMPLATES
+
+logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s")
+logger = logging.getLogger("gen_covers")
+
+COVER_DIR = Path(__file__).resolve().parents[1] / "static" / "templates" / "covers"
+SIZE = "2560x1440" # 16:9, meets Seedream min pixels
+CONCURRENCY = 3
+
+
+def cover_prompt(tpl: dict) -> tuple[str, str]:
+ name = tpl["name"]
+ style = tpl.get("style_prefix") or ""
+ cats = "、".join(tpl.get("category") or [])
+ prompt = (
+ f"{style}。"
+ f"作为「{name}」风格模板的封面代表画面,横构图 16:9,"
+ f"主体清晰、氛围强烈,适合作为风格预览缩略图。"
+ f"分类气质:{cats}。"
+ f"画面干净,绝对不要出现任何文字、字幕、logo、水印、边框、UI。"
+ )
+ negative = (
+ f"{tpl.get('negative_prompt') or ''},"
+ "文字,字幕,水印,logo,标题字,边框,海报排版,二维码"
+ )
+ return prompt, negative
+
+
+async def gen_one(sem: asyncio.Semaphore, tpl: dict, ark) -> tuple[str, Path | None, str]:
+ tid = tpl["id"]
+ dest = COVER_DIR / f"{tid}.png"
+ if dest.exists() and dest.stat().st_size > 10_000:
+ logger.info("skip existing %s", tid)
+ return tid, dest, "skip"
+
+ prompt, negative = cover_prompt(tpl)
+ async with sem:
+ logger.info("generating %s …", tid)
+ try:
+ img = await ark.gen_image(
+ prompt,
+ negative,
+ project_id=0,
+ shot_no=0,
+ size=SIZE,
+ )
+ except Exception as exc: # noqa: BLE001
+ logger.error("fail %s: %s", tid, exc)
+ return tid, None, str(exc)
+
+ src = local_path_from_url(img.local_url) if img.local_url else None
+ if not src or not src.exists():
+ return tid, None, "missing local file"
+ COVER_DIR.mkdir(parents=True, exist_ok=True)
+ shutil.copy2(src, dest)
+ logger.info("saved %s (%s bytes)", dest.name, dest.stat().st_size)
+ return tid, dest, "ok"
+
+
+async def run() -> None:
+ settings = get_settings()
+ if settings.ark_mock or not settings.ark_api_key:
+ raise SystemExit("ARK_MOCK is on or ARK_API_KEY missing — cannot generate covers")
+
+ COVER_DIR.mkdir(parents=True, exist_ok=True)
+ ark = get_ark()
+ sem = asyncio.Semaphore(CONCURRENCY)
+ results = await asyncio.gather(*[gen_one(sem, t, ark) for t in TEMPLATES])
+
+ # Patch seed file preview paths in DB
+ engine = create_engine(settings.database_url_sync)
+ ok = 0
+ with Session(engine) as db:
+ for tid, dest, status in results:
+ if not dest or not dest.exists():
+ continue
+ rel = f"/static/templates/covers/{tid}.png"
+ row = db.get(Template, tid)
+ if row:
+ row.preview_cover = rel
+ ok += 1
+ # also update in-memory seed for next restart consistency
+ for t in TEMPLATES:
+ if t["id"] == tid:
+ t["preview_cover"] = rel
+ db.commit()
+ total = len(db.scalars(select(Template)).all())
+ logger.info("covers ready: %s/%s templates (db rows=%s)", ok, len(TEMPLATES), total)
+ for tid, dest, status in results:
+ logger.info(" %s -> %s", tid, status)
+
+
+if __name__ == "__main__":
+ asyncio.run(run())
diff --git a/backend/static/templates/brand_clean.svg b/backend/static/templates/brand_clean.svg
new file mode 100644
index 0000000..adc85b3
--- /dev/null
+++ b/backend/static/templates/brand_clean.svg
@@ -0,0 +1,8 @@
+<svg xmlns='http://www.w3.org/2000/svg' width='640' height='360' viewBox='0 0 640 360'>
+ <rect width='640' height='360' fill='#f5f3ef'/>
+ <rect x='80' y='80' width='200' height='200' fill='#1a1a1a'/>
+ <rect x='320' y='80' width='240' height='90' fill='#e85d4c'/>
+ <rect x='320' y='190' width='240' height='90' fill='#d8d4cc'/>
+ <text x='80' y='320' font-family='Georgia, serif' font-size='32' fill='#1a1a1a'>���L</text>
+ <text x='240' y='320' font-family='sans-serif' font-size='14' fill='#1a1a1a' opacity='0.5'>Brand Clean</text>
+</svg>
diff --git a/backend/static/templates/covers/brand_clean.png b/backend/static/templates/covers/brand_clean.png
new file mode 100644
index 0000000..36676fb
Binary files /dev/null and b/backend/static/templates/covers/brand_clean.png differ
diff --git a/backend/static/templates/covers/chalk_whiteboard.png b/backend/static/templates/covers/chalk_whiteboard.png
new file mode 100644
index 0000000..54cf729
Binary files /dev/null and b/backend/static/templates/covers/chalk_whiteboard.png differ
diff --git a/backend/static/templates/covers/cyber_neon.png b/backend/static/templates/covers/cyber_neon.png
new file mode 100644
index 0000000..0b24456
Binary files /dev/null and b/backend/static/templates/covers/cyber_neon.png differ
diff --git a/backend/static/templates/covers/docu_warm.png b/backend/static/templates/covers/docu_warm.png
new file mode 100644
index 0000000..a720983
Binary files /dev/null and b/backend/static/templates/covers/docu_warm.png differ
diff --git a/backend/static/templates/covers/epic_fantasy.png b/backend/static/templates/covers/epic_fantasy.png
new file mode 100644
index 0000000..65aea58
Binary files /dev/null and b/backend/static/templates/covers/epic_fantasy.png differ
diff --git a/backend/static/templates/covers/film_cinematic.png b/backend/static/templates/covers/film_cinematic.png
new file mode 100644
index 0000000..eb8001f
Binary files /dev/null and b/backend/static/templates/covers/film_cinematic.png differ
diff --git a/backend/static/templates/covers/ink_guofeng.png b/backend/static/templates/covers/ink_guofeng.png
new file mode 100644
index 0000000..b26942c
Binary files /dev/null and b/backend/static/templates/covers/ink_guofeng.png differ
diff --git a/backend/static/templates/covers/kids_flat.png b/backend/static/templates/covers/kids_flat.png
new file mode 100644
index 0000000..2a06e96
Binary files /dev/null and b/backend/static/templates/covers/kids_flat.png differ
diff --git a/backend/static/templates/covers/live_cinematic.png b/backend/static/templates/covers/live_cinematic.png
new file mode 100644
index 0000000..dd00f5f
Binary files /dev/null and b/backend/static/templates/covers/live_cinematic.png differ
diff --git a/backend/static/templates/covers/live_person.png b/backend/static/templates/covers/live_person.png
new file mode 100644
index 0000000..5d4556a
Binary files /dev/null and b/backend/static/templates/covers/live_person.png differ
diff --git a/backend/static/templates/covers/magazine_collage.png b/backend/static/templates/covers/magazine_collage.png
new file mode 100644
index 0000000..21e9def
Binary files /dev/null and b/backend/static/templates/covers/magazine_collage.png differ
diff --git a/backend/static/templates/covers/noir_thriller.png b/backend/static/templates/covers/noir_thriller.png
new file mode 100644
index 0000000..4faf92c
Binary files /dev/null and b/backend/static/templates/covers/noir_thriller.png differ
diff --git a/backend/static/templates/covers/photo_realism.png b/backend/static/templates/covers/photo_realism.png
new file mode 100644
index 0000000..3fc0e8b
Binary files /dev/null and b/backend/static/templates/covers/photo_realism.png differ
diff --git a/backend/static/templates/covers/pixel_retro.png b/backend/static/templates/covers/pixel_retro.png
new file mode 100644
index 0000000..e8fa78f
Binary files /dev/null and b/backend/static/templates/covers/pixel_retro.png differ
diff --git a/backend/static/templates/covers/portrait_story.png b/backend/static/templates/covers/portrait_story.png
new file mode 100644
index 0000000..557827d
Binary files /dev/null and b/backend/static/templates/covers/portrait_story.png differ
diff --git a/backend/static/templates/covers/retro_vhs.png b/backend/static/templates/covers/retro_vhs.png
new file mode 100644
index 0000000..0899bbe
Binary files /dev/null and b/backend/static/templates/covers/retro_vhs.png differ
diff --git a/backend/static/templates/covers/soft_anime.png b/backend/static/templates/covers/soft_anime.png
new file mode 100644
index 0000000..adab454
Binary files /dev/null and b/backend/static/templates/covers/soft_anime.png differ
diff --git a/backend/static/templates/covers/vox_papercut.png b/backend/static/templates/covers/vox_papercut.png
new file mode 100644
index 0000000..e96e25e
Binary files /dev/null and b/backend/static/templates/covers/vox_papercut.png differ
diff --git a/backend/static/templates/cyber_neon.svg b/backend/static/templates/cyber_neon.svg
new file mode 100644
index 0000000..43ef942
--- /dev/null
+++ b/backend/static/templates/cyber_neon.svg
@@ -0,0 +1,13 @@
+<svg xmlns='http://www.w3.org/2000/svg' width='640' height='360' viewBox='0 0 640 360'>
+ <rect width='640' height='360' fill='#0a0618'/>
+ <rect x='80' y='200' width='60' height='160' fill='#1a1030'/>
+ <rect x='160' y='140' width='50' height='220' fill='#221440'/>
+ <rect x='230' y='180' width='70' height='180' fill='#181028'/>
+ <rect x='400' y='120' width='55' height='240' fill='#1e1240'/>
+ <rect x='480' y='160' width='90' height='200' fill='#140c28'/>
+ <line x1='0' y1='300' x2='640' y2='300' stroke='#00e5c0' stroke-width='2' opacity='0.7'/>
+ <line x1='0' y1='310' x2='640' y2='310' stroke='#ff2d95' stroke-width='1.5' opacity='0.5'/>
+ <circle cx='520' cy='80' r='36' fill='#ff2d95' opacity='0.35'/>
+ <text x='48' y='70' font-family='Georgia, serif' font-size='36' fill='#00e5c0'>[Zy</text>
+ <text x='48' y='100' font-family='sans-serif' font-size='14' fill='#ff2d95' opacity='0.8'>Cyber Neon</text>
+</svg>
diff --git a/backend/static/templates/docu_warm.svg b/backend/static/templates/docu_warm.svg
new file mode 100644
index 0000000..b0c713d
--- /dev/null
+++ b/backend/static/templates/docu_warm.svg
@@ -0,0 +1,8 @@
+<svg xmlns='http://www.w3.org/2000/svg' width='640' height='360' viewBox='0 0 640 360'>
+ <rect width='640' height='360' fill='#3d3428'/>
+ <rect x='40' y='40' width='560' height='280' fill='#c4a882' opacity='0.25'/>
+ <rect x='80' y='100' width='240' height='160' fill='#8b7355' opacity='0.7'/>
+ <circle cx='420' cy='140' r='70' fill='#e8c89a' opacity='0.4'/>
+ <text x='80' y='300' font-family='Georgia, serif' font-size='36' fill='#f0e6d4'>)���</text>
+ <text x='80' y='330' font-family='sans-serif' font-size='14' fill='#f0e6d4' opacity='0.6'>Warm Documentary</text>
+</svg>
diff --git a/backend/static/templates/epic_fantasy.svg b/backend/static/templates/epic_fantasy.svg
new file mode 100644
index 0000000..271c2b9
--- /dev/null
+++ b/backend/static/templates/epic_fantasy.svg
@@ -0,0 +1,16 @@
+<svg xmlns='http://www.w3.org/2000/svg' width='640' height='360' viewBox='0 0 640 360'>
+ <defs>
+ <linearGradient id='dusk' x1='0' y1='0' x2='0' y2='1'>
+ <stop offset='0%' stop-color='#2a1848'/>
+ <stop offset='60%' stop-color='#6b3a2a'/>
+ <stop offset='100%' stop-color='#1a1420'/>
+ </linearGradient>
+ </defs>
+ <rect width='640' height='360' fill='url(#dusk)'/>
+ <polygon points='320,60 360,200 280,200' fill='#4a5568' opacity='0.85'/>
+ <polygon points='200,120 260,280 140,280' fill='#3d4a5c' opacity='0.7'/>
+ <polygon points='440,100 500,280 380,280' fill='#354050' opacity='0.75'/>
+ <circle cx='480' cy='80' r='40' fill='#f0c878' opacity='0.5'/>
+ <text x='48' y='70' font-family='Georgia, serif' font-size='36' fill='#f5e6c8'>G{��</text>
+ <text x='48' y='100' font-family='sans-serif' font-size='14' fill='#f5e6c8' opacity='0.55'>Epic Fantasy</text>
+</svg>
diff --git a/backend/static/templates/film_cinematic.svg b/backend/static/templates/film_cinematic.svg
new file mode 100644
index 0000000..891d7e7
--- /dev/null
+++ b/backend/static/templates/film_cinematic.svg
@@ -0,0 +1,15 @@
+<svg xmlns='http://www.w3.org/2000/svg' width='640' height='360' viewBox='0 0 640 360'>
+ <defs>
+ <linearGradient id='g' x1='0' y1='0' x2='1' y2='1'>
+ <stop offset='0%' stop-color='#1a2332'/>
+ <stop offset='100%' stop-color='#3d2a22'/>
+ </linearGradient>
+ </defs>
+ <rect width='640' height='360' fill='url(#g)'/>
+ <rect x='0' y='0' width='640' height='28' fill='#0d0d0d'/>
+ <rect x='0' y='332' width='640' height='28' fill='#0d0d0d'/>
+ <ellipse cx='420' cy='160' rx='140' ry='90' fill='#c4784a' opacity='0.35'/>
+ <rect x='72' y='90' width='200' height='160' rx='4' fill='#2c3d55' opacity='0.9'/>
+ <text x='72' y='290' font-family='Georgia, serif' font-size='36' fill='#e8d5c4'>5q</text>
+ <text x='72' y='318' font-family='sans-serif' font-size='14' fill='#e8d5c4' opacity='0.65'>Cinematic Film</text>
+</svg>
diff --git a/backend/static/templates/live_cinematic.svg b/backend/static/templates/live_cinematic.svg
new file mode 100644
index 0000000..424ac5b
--- /dev/null
+++ b/backend/static/templates/live_cinematic.svg
@@ -0,0 +1,16 @@
+<svg xmlns='http://www.w3.org/2000/svg' width='640' height='360' viewBox='0 0 640 360'>
+ <defs>
+ <linearGradient id='g' x1='0' y1='0' x2='1' y2='1'>
+ <stop offset='0%' stop-color='#121820'/>
+ <stop offset='100%' stop-color='#3a2818'/>
+ </linearGradient>
+ </defs>
+ <rect width='640' height='360' fill='url(#g)'/>
+ <rect x='0' y='0' width='640' height='32' fill='#050505'/>
+ <rect x='0' y='328' width='640' height='32' fill='#050505'/>
+ <ellipse cx='400' cy='170' rx='120' ry='100' fill='#c9a07a' opacity='0.55'/>
+ <circle cx='400' cy='150' r='48' fill='#d4b396'/>
+ <rect x='360' y='198' width='80' height='90' rx='8' fill='#2a3544'/>
+ <text x='48' y='80' font-family='Georgia, serif' font-size='34' fill='#f0e4d4'>�5q</text>
+ <text x='48' y='112' font-family='sans-serif' font-size='14' fill='#f0e4d4' opacity='0.65'>Live Cinematic</text>
+</svg>
diff --git a/backend/static/templates/live_person.svg b/backend/static/templates/live_person.svg
new file mode 100644
index 0000000..8b48ad6
--- /dev/null
+++ b/backend/static/templates/live_person.svg
@@ -0,0 +1,9 @@
+<svg xmlns='http://www.w3.org/2000/svg' width='640' height='360' viewBox='0 0 640 360'>
+ <rect width='640' height='360' fill='#e8e0d4'/>
+ <rect x='200' y='40' width='240' height='280' rx='16' fill='#f5f0e8' stroke='#c8bfb0' stroke-width='3'/>
+ <circle cx='320' cy='140' r='52' fill='#d2b49a'/>
+ <rect x='270' y='200' width='100' height='90' rx='12' fill='#5a7a8c'/>
+ <circle cx='280' cy='100' r='18' fill='#f5e6c8' opacity='0.6'/>
+ <text x='48' y='300' font-family='Georgia, serif' font-size='32' fill='#2a2a2a'>�</text>
+ <text x='48' y='330' font-family='sans-serif' font-size='14' fill='#2a2a2a' opacity='0.55'>Live Person</text>
+</svg>
diff --git a/backend/static/templates/noir_thriller.svg b/backend/static/templates/noir_thriller.svg
new file mode 100644
index 0000000..f73ee1d
--- /dev/null
+++ b/backend/static/templates/noir_thriller.svg
@@ -0,0 +1,8 @@
+<svg xmlns='http://www.w3.org/2000/svg' width='640' height='360' viewBox='0 0 640 360'>
+ <rect width='640' height='360' fill='#0c0c10'/>
+ <polygon points='0,360 280,80 360,80 640,360' fill='#1a1a24'/>
+ <circle cx='480' cy='100' r='48' fill='#f2e8c9' opacity='0.15'/>
+ <rect x='120' y='140' width='80' height='180' fill='#2a2a38' opacity='0.85'/>
+ <text x='48' y='70' font-family='Georgia, serif' font-size='36' fill='#c9c4b8'>�r��</text>
+ <text x='48' y='100' font-family='sans-serif' font-size='14' fill='#c9c4b8' opacity='0.55'>Noir Thriller</text>
+</svg>
diff --git a/backend/static/templates/photo_realism.svg b/backend/static/templates/photo_realism.svg
new file mode 100644
index 0000000..af68709
--- /dev/null
+++ b/backend/static/templates/photo_realism.svg
@@ -0,0 +1,14 @@
+<svg xmlns='http://www.w3.org/2000/svg' width='640' height='360' viewBox='0 0 640 360'>
+ <defs>
+ <linearGradient id='sky' x1='0' y1='0' x2='0' y2='1'>
+ <stop offset='0%' stop-color='#87a8c4'/>
+ <stop offset='100%' stop-color='#d4c4a8'/>
+ </linearGradient>
+ </defs>
+ <rect width='640' height='360' fill='url(#sky)'/>
+ <polygon points='0,260 180,120 320,240 480,100 640,220 640,360 0,360' fill='#5a6b4a'/>
+ <circle cx='520' cy='80' r='42' fill='#f2e0a8' opacity='0.85'/>
+ <rect x='60' y='200' width='90' height='60' fill='#8a9098' opacity='0.7'/>
+ <text x='48' y='70' font-family='Georgia, serif' font-size='34' fill='#1a1a1a'>��Dq</text>
+ <text x='48' y='100' font-family='sans-serif' font-size='14' fill='#1a1a1a' opacity='0.55'>Photo Realism</text>
+</svg>
diff --git a/backend/static/templates/retro_vhs.svg b/backend/static/templates/retro_vhs.svg
new file mode 100644
index 0000000..490e72d
--- /dev/null
+++ b/backend/static/templates/retro_vhs.svg
@@ -0,0 +1,11 @@
+<svg xmlns='http://www.w3.org/2000/svg' width='640' height='360' viewBox='0 0 640 360'>
+ <rect width='640' height='360' fill='#1c1820'/>
+ <rect x='60' y='50' width='520' height='260' fill='#2a2430' stroke='#6b5a78' stroke-width='3'/>
+ <line x1='60' y1='120' x2='580' y2='120' stroke='#ff6b9d' stroke-width='1' opacity='0.4'/>
+ <line x1='60' y1='200' x2='580' y2='200' stroke='#5ec8ff' stroke-width='1' opacity='0.35'/>
+ <line x1='60' y1='280' x2='580' y2='280' stroke='#ffe66d' stroke-width='1' opacity='0.3'/>
+ <text x='90' y='100' font-family='Georgia, serif' font-size='40' fill='#ffe66d'>
+� VHS</text>
+ <text x='90' y='140' font-family='sans-serif' font-size='14' fill='#5ec8ff' opacity='0.85'>Retro Tape</text>
+ <text x='480' y='290' font-family='monospace' font-size='18' fill='#ff6b9d'>� PLAY</text>
+</svg>
diff --git a/backend/static/templates/soft_anime.svg b/backend/static/templates/soft_anime.svg
new file mode 100644
index 0000000..44a1710
--- /dev/null
+++ b/backend/static/templates/soft_anime.svg
@@ -0,0 +1,15 @@
+<svg xmlns='http://www.w3.org/2000/svg' width='640' height='360' viewBox='0 0 640 360'>
+ <defs>
+ <linearGradient id='sky' x1='0' y1='0' x2='0' y2='1'>
+ <stop offset='0%' stop-color='#a8d4f0'/>
+ <stop offset='100%' stop-color='#f7d6e8'/>
+ </linearGradient>
+ </defs>
+ <rect width='640' height='360' fill='url(#sky)'/>
+ <circle cx='480' cy='90' r='55' fill='#fff4c8' opacity='0.9'/>
+ <ellipse cx='200' cy='280' rx='160' ry='40' fill='#fff' opacity='0.35'/>
+ <circle cx='220' cy='200' r='48' fill='#f5c6b8'/>
+ <rect x='190' y='245' width='60' height='70' rx='12' fill='#7eb8e8'/>
+ <text x='48' y='70' font-family='Georgia, serif' font-size='36' fill='#3a4060'>�I�+</text>
+ <text x='48' y='100' font-family='sans-serif' font-size='14' fill='#3a4060' opacity='0.6'>Soft Anime</text>
+</svg>
diff --git a/frontend/index.html b/frontend/index.html
index e1a05bb..a641c7d 100644
--- a/frontend/index.html
+++ b/frontend/index.html
@@ -4,11 +4,12 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <title>纸戏 FrameCut</title>
+ <title>PRINTFILM · 科普视频平台</title>
+ <meta name="description" content="PRINTFILM 科普视频平台:输入主题与风格,自动生成分镜、画面、旁白与成片。" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
- href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700&family=Syne:wght@500;700&family=ZCOOL+XiaoWei&display=swap"
+ href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700&family=Noto+Serif+SC:wght@500;700&family=Space+Grotesk:wght@500;600;700&display=swap"
rel="stylesheet"
/>
</head>
diff --git a/frontend/public/favicon.svg b/frontend/public/favicon.svg
index 6893eb1..69898d9 100644
--- a/frontend/public/favicon.svg
+++ b/frontend/public/favicon.svg
@@ -1 +1,7 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="48" height="46" fill="none" viewBox="0 0 48 46"><path fill="#863bff" d="M25.946 44.938c-.664.845-2.021.375-2.021-.698V33.937a2.26 2.26 0 0 0-2.262-2.262H10.287c-.92 0-1.456-1.04-.92-1.788l7.48-10.471c1.07-1.497 0-3.578-1.842-3.578H1.237c-.92 0-1.456-1.04-.92-1.788L10.013.474c.214-.297.556-.474.92-.474h28.894c.92 0 1.456 1.04.92 1.788l-7.48 10.471c-1.07 1.498 0 3.579 1.842 3.579h11.377c.943 0 1.473 1.088.89 1.83L25.947 44.94z" style="fill:#863bff;fill:color(display-p3 .5252 .23 1);fill-opacity:1"/><mask id="a" width="48" height="46" x="0" y="0" maskUnits="userSpaceOnUse" style="mask-type:alpha"><path fill="#000" d="M25.842 44.938c-.664.844-2.021.375-2.021-.698V33.937a2.26 2.26 0 0 0-2.262-2.262H10.183c-.92 0-1.456-1.04-.92-1.788l7.48-10.471c1.07-1.498 0-3.579-1.842-3.579H1.133c-.92 0-1.456-1.04-.92-1.787L9.91.473c.214-.297.556-.474.92-.474h28.894c.92 0 1.456 1.04.92 1.788l-7.48 10.471c-1.07 1.498 0 3.578 1.842 3.578h11.377c.943 0 1.473 1.088.89 1.832L25.843 44.94z" style="fill:#000;fill-opacity:1"/></mask><g mask="url(#a)"><g filter="url(#b)"><ellipse cx="5.508" cy="14.704" fill="#ede6ff" rx="5.508" ry="14.704" style="fill:#ede6ff;fill:color(display-p3 .9275 .9033 1);fill-opacity:1" transform="matrix(.00324 1 1 -.00324 -4.47 31.516)"/></g><g filter="url(#c)"><ellipse cx="10.399" cy="29.851" fill="#ede6ff" rx="10.399" ry="29.851" style="fill:#ede6ff;fill:color(display-p3 .9275 .9033 1);fill-opacity:1" transform="matrix(.00324 1 1 -.00324 -39.328 7.883)"/></g><g filter="url(#d)"><ellipse cx="5.508" cy="30.487" fill="#7e14ff" rx="5.508" ry="30.487" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(89.814 -25.913 -14.639)scale(1 -1)"/></g><g filter="url(#e)"><ellipse cx="5.508" cy="30.599" fill="#7e14ff" rx="5.508" ry="30.599" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(89.814 -32.644 -3.334)scale(1 -1)"/></g><g filter="url(#f)"><ellipse cx="5.508" cy="30.599" fill="#7e14ff" rx="5.508" ry="30.599" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="matrix(.00324 1 1 -.00324 -34.34 30.47)"/></g><g filter="url(#g)"><ellipse cx="14.072" cy="22.078" fill="#ede6ff" rx="14.072" ry="22.078" style="fill:#ede6ff;fill:color(display-p3 .9275 .9033 1);fill-opacity:1" transform="rotate(93.35 24.506 48.493)scale(-1 1)"/></g><g filter="url(#h)"><ellipse cx="3.47" cy="21.501" fill="#7e14ff" rx="3.47" ry="21.501" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(89.009 28.708 47.59)scale(-1 1)"/></g><g filter="url(#i)"><ellipse cx="3.47" cy="21.501" fill="#7e14ff" rx="3.47" ry="21.501" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(89.009 28.708 47.59)scale(-1 1)"/></g><g filter="url(#j)"><ellipse cx=".387" cy="8.972" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(39.51 .387 8.972)"/></g><g filter="url(#k)"><ellipse cx="47.523" cy="-6.092" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(37.892 47.523 -6.092)"/></g><g filter="url(#l)"><ellipse cx="41.412" cy="6.333" fill="#47bfff" rx="5.971" ry="9.665" style="fill:#47bfff;fill:color(display-p3 .2799 .748 1);fill-opacity:1" transform="rotate(37.892 41.412 6.333)"/></g><g filter="url(#m)"><ellipse cx="-1.879" cy="38.332" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(37.892 -1.88 38.332)"/></g><g filter="url(#n)"><ellipse cx="-1.879" cy="38.332" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(37.892 -1.88 38.332)"/></g><g filter="url(#o)"><ellipse cx="35.651" cy="29.907" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(37.892 35.651 29.907)"/></g><g filter="url(#p)"><ellipse cx="38.418" cy="32.4" fill="#47bfff" rx="5.971" ry="15.297" style="fill:#47bfff;fill:color(display-p3 .2799 .748 1);fill-opacity:1" transform="rotate(37.892 38.418 32.4)"/></g></g><defs><filter id="b" width="60.045" height="41.654" x="-19.77" y="16.149" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="7.659"/></filter><filter id="c" width="90.34" height="51.437" x="-54.613" y="-7.533" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="7.659"/></filter><filter id="d" width="79.355" height="29.4" x="-49.64" y="2.03" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="e" width="79.579" height="29.4" x="-45.045" y="20.029" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="f" width="79.579" height="29.4" x="-43.513" y="21.178" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="g" width="74.749" height="58.852" x="15.756" y="-17.901" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="7.659"/></filter><filter id="h" width="61.377" height="25.362" x="23.548" y="2.284" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="i" width="61.377" height="25.362" x="23.548" y="2.284" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="j" width="56.045" height="63.649" x="-27.636" y="-22.853" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="k" width="54.814" height="64.646" x="20.116" y="-38.415" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="l" width="33.541" height="35.313" x="24.641" y="-11.323" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="m" width="54.814" height="64.646" x="-29.286" y="6.009" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="n" width="54.814" height="64.646" x="-29.286" y="6.009" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="o" width="54.814" height="64.646" x="8.244" y="-2.416" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="p" width="39.409" height="43.623" x="18.713" y="10.588" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter></defs></svg>
\ No newline at end of file
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" fill="none">
+ <rect width="64" height="64" rx="10" fill="#0D1218"/>
+ <rect x="12" y="16" width="40" height="32" rx="3" stroke="#E8EEF2" stroke-width="2.5"/>
+ <circle cx="32" cy="32" r="9" stroke="#2A6F7A" stroke-width="2.5"/>
+ <circle cx="32" cy="32" r="3" fill="#D6FF4B"/>
+ <path d="M32 12v6M32 46v6M12 32h6M46 32h6" stroke="#D6FF4B" stroke-width="2" stroke-linecap="square"/>
+</svg>
diff --git a/frontend/public/hero.jpg b/frontend/public/hero.jpg
new file mode 100644
index 0000000..6aab461
Binary files /dev/null and b/frontend/public/hero.jpg differ
diff --git a/frontend/public/logo.png b/frontend/public/logo.png
new file mode 100644
index 0000000..27ebe9a
Binary files /dev/null and b/frontend/public/logo.png differ
diff --git a/frontend/public/logo.svg b/frontend/public/logo.svg
new file mode 100644
index 0000000..69898d9
--- /dev/null
+++ b/frontend/public/logo.svg
@@ -0,0 +1,7 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" fill="none">
+ <rect width="64" height="64" rx="10" fill="#0D1218"/>
+ <rect x="12" y="16" width="40" height="32" rx="3" stroke="#E8EEF2" stroke-width="2.5"/>
+ <circle cx="32" cy="32" r="9" stroke="#2A6F7A" stroke-width="2.5"/>
+ <circle cx="32" cy="32" r="3" fill="#D6FF4B"/>
+ <path d="M32 12v6M32 46v6M12 32h6M46 32h6" stroke="#D6FF4B" stroke-width="2" stroke-linecap="square"/>
+</svg>
diff --git a/frontend/src/App.css b/frontend/src/App.css
index 150b386..88819e1 100644
--- a/frontend/src/App.css
+++ b/frontend/src/App.css
@@ -19,40 +19,28 @@
}
.brand-mark {
- font-family: 'ZCOOL XiaoWei', 'Noto Serif SC', serif;
- font-size: 1.45rem;
- letter-spacing: 0.04em;
-}
-
-.brand-mark span {
- margin-left: 0.35rem;
- font-family: 'Syne', 'Noto Sans SC', sans-serif;
- font-size: 0.78rem;
- letter-spacing: 0.18em;
- text-transform: uppercase;
- color: var(--muted);
+ display: inline-flex;
+ align-items: center;
+ gap: 0.55rem;
+ font-family: 'Space Grotesk', 'Noto Sans SC', sans-serif;
+ font-size: 1.05rem;
+ font-weight: 600;
+ letter-spacing: 0.12em;
}
-.hero-band {
- padding: 3.5rem 0 2.5rem;
- border-bottom: 1px solid var(--line);
- margin-bottom: 2.5rem;
+.brand-logo {
+ width: 28px;
+ height: 28px;
+ border-radius: 6px;
+ flex-shrink: 0;
}
-.eyebrow {
- color: var(--crimson);
+.brand-word {
letter-spacing: 0.14em;
- text-transform: uppercase;
- font-size: 0.75rem;
- margin: 0 0 0.75rem;
}
-.brand-hero {
- font-family: 'ZCOOL XiaoWei', 'Noto Serif SC', serif;
- font-size: clamp(3.5rem, 10vw, 6.5rem);
- line-height: 0.95;
- margin: 0 0 0.75rem;
- letter-spacing: 0.08em;
+.brand-mark-light {
+ color: var(--hero-ink);
}
.lede {
@@ -86,10 +74,263 @@
color: var(--paper);
}
+.btn.primary.accent {
+ background: var(--accent);
+ border-color: var(--accent);
+ color: var(--ink);
+}
+
.btn.ghost {
background: transparent;
}
+/* ——— PRINTFILM marketing site ——— */
+
+.site {
+ min-height: 100vh;
+}
+
+.site-nav {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ z-index: 5;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 1.15rem clamp(1.25rem, 4vw, 3rem);
+ color: var(--ink);
+}
+
+.site-nav nav {
+ display: flex;
+ gap: 1.15rem;
+ align-items: center;
+ font-size: 0.95rem;
+ font-weight: 500;
+ color: var(--ink);
+}
+
+.site-nav nav a,
+.site-nav nav .linkish {
+ color: var(--ink);
+ opacity: 0.92;
+}
+
+.site-nav nav a:hover,
+.site-nav nav .linkish:hover {
+ opacity: 1;
+ color: var(--teal);
+}
+
+.site-nav .nav-cta {
+ border: 1px solid rgba(13, 18, 24, 0.45);
+ padding: 0.4rem 0.85rem;
+ color: var(--ink);
+ opacity: 1;
+}
+
+.site-hero {
+ position: relative;
+ min-height: 100vh;
+ min-height: 100dvh;
+ display: flex;
+ align-items: flex-end;
+ overflow: hidden;
+ color: var(--ink);
+ background: #f3f6f8;
+}
+
+.site-hero-media {
+ position: absolute;
+ inset: 0;
+}
+
+.site-hero-img {
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+ transform: scale(1.06);
+ animation: hero-drift 22s ease-in-out infinite alternate;
+}
+
+.site-hero-shade {
+ position: absolute;
+ inset: 0;
+ background:
+ linear-gradient(105deg, rgba(248, 250, 252, 0.97) 0%, rgba(248, 250, 252, 0.88) 36%, rgba(248, 250, 252, 0.35) 68%, rgba(248, 250, 252, 0.08) 100%),
+ linear-gradient(180deg, rgba(248, 250, 252, 0.82) 0%, rgba(248, 250, 252, 0.2) 28%, rgba(238, 241, 244, 0.85) 100%);
+}
+
+.site-hero-copy {
+ position: relative;
+ z-index: 1;
+ width: min(720px, 100%);
+ padding: 0 clamp(1.25rem, 4vw, 3rem) clamp(3.5rem, 8vh, 5.5rem);
+ animation: hero-rise 1.1s cubic-bezier(0.22, 1, 0.36, 1) both;
+}
+
+.site-hero-logo {
+ width: 56px;
+ height: 56px;
+ border-radius: 12px;
+ margin-bottom: 1.1rem;
+ animation: hero-rise 1.15s 0.08s cubic-bezier(0.22, 1, 0.36, 1) both;
+}
+
+.site-brand {
+ font-family: 'Space Grotesk', 'Noto Sans SC', sans-serif;
+ font-size: clamp(3.4rem, 11vw, 7rem);
+ font-weight: 700;
+ line-height: 0.92;
+ letter-spacing: 0.06em;
+ margin: 0 0 0.85rem;
+ color: var(--ink);
+}
+
+.site-headline {
+ font-family: 'Noto Serif SC', 'Noto Sans SC', serif;
+ font-size: clamp(1.45rem, 3.2vw, 2.1rem);
+ font-weight: 500;
+ margin: 0 0 0.65rem;
+ letter-spacing: 0.06em;
+ color: var(--ink);
+}
+
+.site-support {
+ max-width: 28rem;
+ margin: 0 0 1.75rem;
+ color: #2a333c;
+ font-size: 1.08rem;
+ font-weight: 500;
+ line-height: 1.65;
+}
+
+.site-section {
+ max-width: 1180px;
+ margin: 0 auto;
+ padding: 4rem clamp(1.25rem, 4vw, 1.5rem) 0;
+}
+
+.site-section h2 {
+ font-family: 'Space Grotesk', 'Noto Serif SC', sans-serif;
+ font-size: clamp(1.7rem, 3vw, 2.2rem);
+ letter-spacing: 0.04em;
+ margin: 0 0 0.35rem;
+}
+
+.site-how {
+ padding-top: 4.5rem;
+}
+
+.how-steps {
+ list-style: none;
+ margin: 2rem 0 0;
+ padding: 0;
+ display: grid;
+ grid-template-columns: repeat(3, 1fr);
+ gap: 1.5rem;
+ border-top: 1px solid var(--line);
+}
+
+.how-steps li {
+ display: flex;
+ flex-direction: column;
+ gap: 0.4rem;
+ padding: 1.5rem 0.25rem 0;
+}
+
+.how-num {
+ font-family: 'Space Grotesk', sans-serif;
+ font-size: 0.85rem;
+ letter-spacing: 0.16em;
+ color: var(--teal);
+}
+
+.how-steps strong {
+ font-family: 'Noto Serif SC', serif;
+ font-size: 1.2rem;
+ font-weight: 600;
+}
+
+.how-steps span:last-child {
+ color: var(--muted);
+ font-size: 0.95rem;
+}
+
+.site-cta-band {
+ margin: 4.5rem clamp(1.25rem, 4vw, 1.5rem) 0;
+ padding: 3.25rem clamp(1.5rem, 4vw, 3rem);
+ background:
+ linear-gradient(135deg, #e8f1f3 0%, #f4f7e8 55%, #eef1f4 100%);
+ color: var(--ink);
+ text-align: left;
+ border: 1px solid var(--line);
+}
+
+.site-cta-band h2 {
+ font-family: 'Noto Serif SC', serif;
+ font-size: clamp(1.5rem, 3vw, 2rem);
+ margin: 0 0 0.5rem;
+}
+
+.site-cta-band p {
+ margin: 0 0 1.4rem;
+ color: var(--muted);
+ max-width: 28rem;
+}
+
+.site-footer {
+ max-width: 1180px;
+ margin: 0 auto;
+ padding: 2.5rem clamp(1.25rem, 4vw, 1.5rem) 3rem;
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ justify-content: space-between;
+ gap: 1rem;
+ color: var(--muted);
+ font-size: 0.9rem;
+}
+
+@keyframes hero-drift {
+ from {
+ transform: scale(1.06) translate3d(0, 0, 0);
+ }
+ to {
+ transform: scale(1.12) translate3d(-1.5%, 1%, 0);
+ }
+}
+
+@keyframes hero-rise {
+ from {
+ opacity: 0;
+ transform: translate3d(0, 28px, 0);
+ }
+ to {
+ opacity: 1;
+ transform: translate3d(0, 0, 0);
+ }
+}
+
+@media (max-width: 800px) {
+ .how-steps {
+ grid-template-columns: 1fr;
+ gap: 0;
+ }
+
+ .how-steps li {
+ padding: 1.25rem 0;
+ border-bottom: 1px solid var(--line);
+ }
+
+ .site-nav nav a:nth-child(1),
+ .site-nav nav a:nth-child(2) {
+ display: none;
+ }
+}
+
.btn.danger {
border-color: var(--crimson);
color: var(--crimson);
@@ -110,11 +351,39 @@
}
.section h2 {
- font-family: 'ZCOOL XiaoWei', serif;
+ font-family: 'Space Grotesk', 'Noto Serif SC', sans-serif;
font-size: 1.8rem;
+ letter-spacing: 0.04em;
margin: 0 0 0.35rem;
}
+.category-filters {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 0.45rem;
+ margin-top: 1rem;
+}
+
+.cat-chip {
+ border: 1px solid var(--line);
+ background: transparent;
+ color: var(--ink);
+ padding: 0.35rem 0.75rem;
+ font-size: 0.85rem;
+ cursor: pointer;
+ transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
+}
+
+.cat-chip:hover {
+ border-color: rgba(42, 111, 122, 0.45);
+}
+
+.cat-chip.active {
+ background: var(--ink);
+ border-color: var(--ink);
+ color: var(--paper);
+}
+
.template-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
@@ -125,7 +394,7 @@
.template-card {
text-align: left;
border: 1px solid var(--line);
- background: rgba(255, 252, 246, 0.72);
+ background: rgba(255, 255, 255, 0.72);
padding: 0;
overflow: hidden;
box-shadow: var(--shadow);
@@ -134,7 +403,7 @@
.template-card:hover {
transform: translateY(-4px);
- border-color: rgba(180, 35, 24, 0.35);
+ border-color: rgba(42, 111, 122, 0.4);
}
.template-card img {
@@ -170,7 +439,7 @@
border: 1px solid var(--line);
padding: 0.15rem 0.45rem;
font-size: 0.75rem;
- color: var(--moss);
+ color: var(--teal);
}
.works-row {
@@ -231,29 +500,30 @@
}
.auth-panel h1 {
- font-family: 'ZCOOL XiaoWei', serif;
- font-size: 2.4rem;
+ font-family: 'Space Grotesk', 'Noto Serif SC', sans-serif;
+ font-size: 2.2rem;
+ letter-spacing: 0.06em;
margin: 0.5rem 0 0;
}
.auth-visual {
position: relative;
overflow: hidden;
- background: #1c1916;
+ background: #0d1218;
}
.ink-wash {
position: absolute;
inset: -20%;
background:
- radial-gradient(circle at 30% 40%, rgba(180, 35, 24, 0.45), transparent 40%),
- radial-gradient(circle at 70% 60%, rgba(242, 235, 224, 0.2), transparent 35%),
+ radial-gradient(circle at 30% 40%, rgba(42, 111, 122, 0.55), transparent 42%),
+ radial-gradient(circle at 72% 58%, rgba(214, 255, 75, 0.18), transparent 38%),
repeating-linear-gradient(
-12deg,
transparent,
transparent 18px,
- rgba(242, 235, 224, 0.04) 18px,
- rgba(242, 235, 224, 0.04) 19px
+ rgba(232, 238, 242, 0.04) 18px,
+ rgba(232, 238, 242, 0.04) 19px
);
animation: drift 14s ease-in-out infinite alternate;
}
@@ -287,7 +557,7 @@
.modal input,
.modal textarea {
border: 1px solid var(--line);
- background: rgba(255, 252, 246, 0.9);
+ background: rgba(255, 255, 255, 0.92);
padding: 0.65rem 0.75rem;
color: var(--ink);
border-radius: 2px;
@@ -304,7 +574,7 @@
.studio-main,
.shot-card,
.modal {
- background: rgba(255, 252, 246, 0.78);
+ background: rgba(255, 255, 255, 0.82);
border: 1px solid var(--line);
box-shadow: var(--shadow);
}
@@ -315,8 +585,9 @@
}
.studio-input h1 {
- font-family: 'ZCOOL XiaoWei', serif;
- font-size: 1.6rem;
+ font-family: 'Space Grotesk', 'Noto Serif SC', sans-serif;
+ font-size: 1.5rem;
+ letter-spacing: 0.04em;
margin: 0 0 1rem;
}
@@ -350,7 +621,7 @@
.progress-bar i {
display: block;
height: 100%;
- background: linear-gradient(90deg, var(--moss), var(--crimson));
+ background: linear-gradient(90deg, var(--teal), var(--accent));
transition: width 0.35s ease;
}
@@ -470,7 +741,7 @@
.modal h3 {
margin: 0;
- font-family: 'ZCOOL XiaoWei', serif;
+ font-family: 'Space Grotesk', 'Noto Serif SC', sans-serif;
}
.modal label {
@@ -522,20 +793,20 @@
grid-template-columns: 36px 160px 1fr;
gap: 0;
border: 1px solid var(--line);
- background: rgba(255, 252, 246, 0.78);
+ background: rgba(255, 255, 255, 0.82);
box-shadow: var(--shadow);
overflow: hidden;
transition: transform 0.2s ease, border-color 0.2s ease;
}
.history-card.selected {
- border-color: rgba(180, 35, 24, 0.45);
- background: rgba(255, 248, 240, 0.95);
+ border-color: rgba(42, 111, 122, 0.5);
+ background: rgba(238, 246, 248, 0.95);
}
.history-card:hover {
transform: translateY(-2px);
- border-color: rgba(180, 35, 24, 0.35);
+ border-color: rgba(42, 111, 122, 0.4);
}
.history-select {
@@ -549,7 +820,7 @@
.history-select input {
width: 1rem;
height: 1rem;
- accent-color: #b42318;
+ accent-color: #2a6f7a;
cursor: pointer;
}
@@ -715,6 +986,19 @@
flex: 0 0 auto;
}
+@media (prefers-reduced-motion: reduce) {
+ .site-hero-img,
+ .site-hero-copy,
+ .site-hero-logo,
+ .ink-wash {
+ animation: none !important;
+ }
+
+ .site-hero-img {
+ transform: none;
+ }
+}
+
@media (max-width: 900px) {
.auth-shell {
grid-template-columns: 1fr;
diff --git a/frontend/src/components/BrandMark.tsx b/frontend/src/components/BrandMark.tsx
new file mode 100644
index 0000000..bb875b4
--- /dev/null
+++ b/frontend/src/components/BrandMark.tsx
@@ -0,0 +1,15 @@
+import { Link } from 'react-router-dom'
+
+type Props = {
+ to?: string
+ light?: boolean
+}
+
+export default function BrandMark({ to = '/', light = false }: Props) {
+ return (
+ <Link to={to} className={light ? 'brand-mark brand-mark-light' : 'brand-mark'}>
+ <img src="/logo.svg" alt="" className="brand-logo" width={28} height={28} />
+ <span className="brand-word">PRINTFILM</span>
+ </Link>
+ )
+}
diff --git a/frontend/src/index.css b/frontend/src/index.css
index 2d9be8b..bbfa4ec 100644
--- a/frontend/src/index.css
+++ b/frontend/src/index.css
@@ -1,13 +1,16 @@
:root {
- --ink: #1a1714;
- --paper: #f2ebe0;
- --paper-deep: #e6dccb;
- --crimson: #b42318;
- --moss: #3d5a45;
- --muted: #6b6258;
- --line: rgba(26, 23, 20, 0.12);
- --shadow: 0 18px 50px rgba(26, 23, 20, 0.08);
- font-family: 'Noto Sans SC', 'Source Han Sans SC', 'PingFang SC', sans-serif;
+ --ink: #0d1218;
+ --paper: #eef1f4;
+ --paper-deep: #e0e6eb;
+ --accent: #d6ff4b;
+ --teal: #2a6f7a;
+ --crimson: #c43c2e;
+ --moss: #2a6f7a;
+ --muted: #5c6770;
+ --line: rgba(13, 18, 24, 0.12);
+ --shadow: 0 18px 50px rgba(13, 18, 24, 0.08);
+ --hero-ink: #e8eef2;
+ font-family: 'Noto Sans SC', 'PingFang SC', sans-serif;
color: var(--ink);
background: var(--paper);
line-height: 1.5;
@@ -30,9 +33,9 @@ body,
body {
background:
- radial-gradient(1200px 600px at 10% -10%, rgba(180, 35, 24, 0.08), transparent 55%),
- radial-gradient(900px 500px at 100% 0%, rgba(61, 90, 69, 0.1), transparent 50%),
- linear-gradient(180deg, #f7f1e7 0%, var(--paper) 40%, #ebe2d4 100%);
+ radial-gradient(1000px 520px at 8% -8%, rgba(42, 111, 122, 0.12), transparent 55%),
+ radial-gradient(800px 420px at 100% 0%, rgba(214, 255, 75, 0.08), transparent 48%),
+ linear-gradient(180deg, #f5f7f9 0%, var(--paper) 42%, #e8edf1 100%);
background-attachment: fixed;
}
diff --git a/frontend/src/pages/AuthPage.tsx b/frontend/src/pages/AuthPage.tsx
index 2d6702b..73f01ba 100644
--- a/frontend/src/pages/AuthPage.tsx
+++ b/frontend/src/pages/AuthPage.tsx
@@ -1,7 +1,8 @@
import { useState } from 'react'
import type { FormEvent } from 'react'
-import { Link, useNavigate } from 'react-router-dom'
+import { useNavigate } from 'react-router-dom'
import { api } from '../api'
+import BrandMark from '../components/BrandMark'
export default function AuthPage() {
const nav = useNavigate()
@@ -33,11 +34,9 @@ export default function AuthPage() {
return (
<div className="auth-shell">
<div className="auth-panel">
- <Link to="/" className="brand-mark">
- 纸戏 <span>FrameCut</span>
- </Link>
+ <BrandMark />
<h1>{mode === 'login' ? '回到工作台' : '创建创作者账号'}</h1>
- <p className="lede">多风格模板驱动的 AI 短视频流水线</p>
+ <p className="lede">PRINTFILM 科普视频平台 · 主题进,成片出</p>
<form onSubmit={onSubmit} className="stack">
{mode === 'register' && (
<label>
diff --git a/frontend/src/pages/HistoryPage.tsx b/frontend/src/pages/HistoryPage.tsx
index 6c8136c..647076f 100644
--- a/frontend/src/pages/HistoryPage.tsx
+++ b/frontend/src/pages/HistoryPage.tsx
@@ -2,6 +2,7 @@ import { useEffect, useMemo, useState } from 'react'
import { Link, useNavigate } from 'react-router-dom'
import { api } from '../api'
import type { Project } from '../api'
+import BrandMark from '../components/BrandMark'
type HistoryItem = Omit<Project, 'shots'>
@@ -188,9 +189,7 @@ export default function HistoryPage() {
return (
<div className="page">
<header className="topbar">
- <Link to="/" className="brand-mark">
- 纸戏 <span>FrameCut</span>
- </Link>
+ <BrandMark />
<nav>
<Link to="/studio">创作</Link>
<Link to="/history">历史</Link>
diff --git a/frontend/src/pages/HomePage.tsx b/frontend/src/pages/HomePage.tsx
index d27f588..5064dd5 100644
--- a/frontend/src/pages/HomePage.tsx
+++ b/frontend/src/pages/HomePage.tsx
@@ -1,7 +1,26 @@
-import { useEffect, useState } from 'react'
+import { useEffect, useMemo, useState } from 'react'
import { Link, useNavigate } from 'react-router-dom'
import { api } from '../api'
import type { Template, User, Work } from '../api'
+import BrandMark from '../components/BrandMark'
+
+/** Primary filter chips; 科普 first for PRINTFILM. */
+const CATEGORY_ORDER = [
+ '科普',
+ '纪录片',
+ '写实感',
+ '真人感',
+ '电影感',
+ '儿童',
+ '动漫',
+ '国风',
+ '科幻',
+ '奇幻',
+ '悬疑',
+ '商业',
+ '复古',
+ '图文',
+]
export default function HomePage() {
const nav = useNavigate()
@@ -9,6 +28,7 @@ export default function HomePage() {
const [templates, setTemplates] = useState<Template[]>([])
const [works, setWorks] = useState<Work[]>([])
const [error, setError] = useState('')
+ const [category, setCategory] = useState('全部')
useEffect(() => {
api
@@ -21,73 +41,135 @@ export default function HomePage() {
}
}, [])
+ const categories = useMemo(() => {
+ const found = new Set<string>()
+ for (const t of templates) {
+ for (const c of t.category || []) {
+ if (CATEGORY_ORDER.includes(c)) found.add(c)
+ }
+ }
+ return ['全部', ...CATEGORY_ORDER.filter((c) => found.has(c))]
+ }, [templates])
+
+ const filtered = useMemo(() => {
+ if (category === '全部') return templates
+ return templates.filter((t) => (t.category || []).includes(category))
+ }, [templates, category])
+
function logout() {
localStorage.removeItem('token')
setUser(null)
}
+ function openTemplate(t: Template) {
+ if (!user) {
+ nav('/auth')
+ return
+ }
+ const mode = t.seedream_config?.pipeline_mode
+ const q =
+ mode === 'image_text' || (!mode && t.default_ratio === '9:16')
+ ? '&mode=image_text'
+ : ''
+ nav(`/studio?template=${t.id}${q}`)
+ }
+
return (
- <div className="page">
- <header className="topbar">
- <Link to="/" className="brand-mark">
- 纸戏 <span>FrameCut</span>
- </Link>
+ <div className="site">
+ <header className="site-nav">
+ <BrandMark />
<nav>
+ <a href="#how">流程</a>
+ <a href="#templates">风格</a>
<Link to="/studio">创作</Link>
{user ? <Link to="/history">历史</Link> : null}
{user ? (
- <>
- <span className="quota">额度不限</span>
- <button type="button" className="linkish" onClick={logout}>
- {user.nickname} · 退出
- </button>
- </>
+ <button type="button" className="linkish" onClick={logout}>
+ {user.nickname} · 退出
+ </button>
) : (
- <Link to="/auth">登录</Link>
+ <Link to="/auth" className="nav-cta">
+ 登录
+ </Link>
)}
</nav>
</header>
- <section className="hero-band">
- <p className="eyebrow">模板驱动 · 全链路字节模型</p>
- <h1 className="brand-hero">纸戏</h1>
- <p className="lede">选风格模板,输入主题,生成分镜到成片。</p>
- <div className="cta-row">
- <button
- className="btn primary"
- type="button"
- onClick={() => nav(user ? '/studio' : '/auth')}
- >
- 开始创作
- </button>
- <a className="btn ghost" href="#templates">
- 浏览模板
- </a>
+ <section className="site-hero" aria-label="PRINTFILM">
+ <div className="site-hero-media" aria-hidden="true">
+ <img src="/hero.jpg?v=light" alt="" className="site-hero-img" />
+ <div className="site-hero-shade" />
+ </div>
+ <div className="site-hero-copy">
+ <img src="/logo.svg" alt="" className="site-hero-logo" width={56} height={56} />
+ <h1 className="site-brand">PRINTFILM</h1>
+ <p className="site-headline">把知识拍成片</p>
+ <p className="site-support">
+ 科普视频平台:输入主题与风格,自动生成分镜、画面、旁白与成片。
+ </p>
+ <div className="cta-row">
+ <button
+ className="btn primary accent"
+ type="button"
+ onClick={() => nav(user ? '/studio' : '/auth')}
+ >
+ 开始创作
+ </button>
+ <a className="btn ghost" href="#templates">
+ 浏览风格
+ </a>
+ </div>
</div>
</section>
- {error && <p className="error pad">{error}</p>}
+ <section id="how" className="site-section site-how">
+ <h2>三步成片</h2>
+ <p className="lede">从主题到成片,一条链路完成科普短视频。</p>
+ <ol className="how-steps">
+ <li>
+ <span className="how-num">01</span>
+ <strong>选定风格</strong>
+ <span>科普、纪录、写实等模板锁定画面气质</span>
+ </li>
+ <li>
+ <span className="how-num">02</span>
+ <strong>写下主题</strong>
+ <span>一句话讲清你要普及的知识点</span>
+ </li>
+ <li>
+ <span className="how-num">03</span>
+ <strong>生成成片</strong>
+ <span>分镜、配图、旁白与剪辑自动完成</span>
+ </li>
+ </ol>
+ </section>
+
+ {error && <p className="error pad site-section">{error}</p>}
- <section id="templates" className="section">
+ <section id="templates" className="site-section">
<h2>风格模板</h2>
- <p className="lede">同一条流水线,不同视觉语言。</p>
+ <p className="lede">为科普内容挑选合适的画面语言。</p>
+ <div className="category-filters" role="tablist" aria-label="模板分类">
+ {categories.map((c) => (
+ <button
+ key={c}
+ type="button"
+ role="tab"
+ aria-selected={category === c}
+ className={category === c ? 'cat-chip active' : 'cat-chip'}
+ onClick={() => setCategory(c)}
+ >
+ {c}
+ </button>
+ ))}
+ </div>
<div className="template-grid">
- {templates.map((t) => (
+ {filtered.map((t) => (
<button
key={t.id}
type="button"
className="template-card"
- onClick={() => {
- if (!user) {
- nav('/auth')
- return
- }
- nav(
- `/studio?template=${t.id}${
- t.id === 'portrait_story' || t.id === 'ink_guofeng' ? '&mode=image_text' : ''
- }`,
- )
- }}
+ onClick={() => openTemplate(t)}
>
<img src={api.assetUrl(t.preview_cover)} alt="" />
<div>
@@ -102,13 +184,17 @@ export default function HomePage() {
</button>
))}
</div>
+ {filtered.length === 0 ? (
+ <p className="muted" style={{ marginTop: '1rem' }}>
+ 该分类暂无模板。
+ </p>
+ ) : null}
</section>
- <section className="section">
- <h2>公开作品</h2>
- {works.length === 0 ? (
- <p className="muted">还没有发布作品,去创作一条吧。</p>
- ) : (
+ {works.length > 0 ? (
+ <section className="site-section">
+ <h2>公开作品</h2>
+ <p className="lede">社区里已经发布的科普短片。</p>
<div className="works-row">
{works.map((w) => (
<article key={w.id} className="work-item">
@@ -117,8 +203,25 @@ export default function HomePage() {
</article>
))}
</div>
- )}
+ </section>
+ ) : null}
+
+ <section className="site-cta-band">
+ <h2>下一支科普短片,从这里开始</h2>
+ <p>主题进,成片出。PRINTFILM 帮你把知识印进每一帧。</p>
+ <button
+ className="btn primary accent"
+ type="button"
+ onClick={() => nav(user ? '/studio' : '/auth')}
+ >
+ 免费开始
+ </button>
</section>
+
+ <footer className="site-footer">
+ <BrandMark />
+ <p>PRINTFILM · 科普视频平台</p>
+ </footer>
</div>
)
}
diff --git a/frontend/src/pages/StudioPage.tsx b/frontend/src/pages/StudioPage.tsx
index 4e47659..a67af23 100644
--- a/frontend/src/pages/StudioPage.tsx
+++ b/frontend/src/pages/StudioPage.tsx
@@ -3,6 +3,7 @@ import type { FormEvent } from 'react'
import { Link, useNavigate, useSearchParams } from 'react-router-dom'
import { api, defaultsFromTemplate } from '../api'
import type { PipelineMode, Project, Shot, Template, VoicePreset } from '../api'
+import BrandMark from '../components/BrandMark'
import { scenePromptForDisplay } from '../promptDisplay'
const RUNNING = new Set([
@@ -415,6 +416,25 @@ export default function StudioPage() {
}
}
+ async function continueGenerate() {
+ if (!project) return
+ setBusy(true)
+ setError('')
+ try {
+ const started = await api.generate(project.id)
+ setProject(started)
+ } catch (err) {
+ setError(err instanceof Error ? err.message : '继续生成失败')
+ try {
+ setProject(await api.getProject(project.id))
+ } catch {
+ /* ignore */
+ }
+ } finally {
+ setBusy(false)
+ }
+ }
+
async function cancelTask() {
if (!project) return
if (!window.confirm('确定取消当前生成任务?')) return
@@ -447,9 +467,7 @@ export default function StudioPage() {
return (
<div className="page studio">
<header className="topbar">
- <Link to="/" className="brand-mark">
- 纸戏 <span>FrameCut</span>
- </Link>
+ <BrandMark />
<nav>
<span className="quota">额度不限</span>
<Link to="/history">历史</Link>
@@ -469,11 +487,24 @@ export default function StudioPage() {
required
disabled={running}
>
- {templates.map((t) => (
- <option key={t.id} value={t.id}>
- {t.name}
- </option>
- ))}
+ {(() => {
+ const groups = new Map<string, Template[]>()
+ for (const t of templates) {
+ const key = (t.category && t.category[0]) || '其他'
+ if (!groups.has(key)) groups.set(key, [])
+ groups.get(key)!.push(t)
+ }
+ return [...groups.entries()].map(([cat, list]) => (
+ <optgroup key={cat} label={cat}>
+ {list.map((t) => (
+ <option key={t.id} value={t.id}>
+ {t.name}
+ {t.category?.length > 1 ? ` · ${t.category.slice(1).join('/')}` : ''}
+ </option>
+ ))}
+ </optgroup>
+ ))
+ })()}
</select>
</label>
<label>
@@ -561,13 +592,16 @@ export default function StudioPage() {
<button className="btn primary" disabled={busy || running}>
{busy
? '处理中…'
- : project && RESUME_COMPOSE.has(project.status) && canResumeCompose(project)
- ? '继续合成短视频'
- : project && !running
- ? '按当前设置重新生成'
- : pipelineMode === 'image_text'
- ? '生成图文短视频'
- : '生成分镜成片'}
+ : project &&
+ (project.status === 'FAILED' || project.status === 'CANCELLED')
+ ? '继续生成'
+ : project && RESUME_COMPOSE.has(project.status) && canResumeCompose(project)
+ ? '继续合成短视频'
+ : project && !running
+ ? '按当前设置重新生成'
+ : pipelineMode === 'image_text'
+ ? '生成图文短视频'
+ : '生成分镜成片'}
</button>
</form>
</aside>
@@ -601,6 +635,23 @@ export default function StudioPage() {
取消任务
</button>
)}
+ {!running &&
+ project.shots.length > 0 &&
+ (project.status === 'FAILED' ||
+ project.status === 'CANCELLED' ||
+ (project.progress > 0 &&
+ project.progress < 100 &&
+ project.status !== 'DONE' &&
+ project.status !== 'DRAFT')) && (
+ <button
+ type="button"
+ className="btn primary"
+ onClick={continueGenerate}
+ disabled={busy}
+ >
+ {busy ? '处理中…' : '继续生成'}
+ </button>
+ )}
{project.shots.some((s) => s.image_url) && !running && (
<>
<button