Files
xiaoxia-saas/apps/web/src/pages/generate/constants.ts
T
xiaoxia 8e227bb682
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 3m53s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 5m5s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 5m51s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 5m55s
AI Code Review / AI Code Review (pull_request) Successful in 10m3s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 13m49s
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 15m48s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Successful in 2m9s
CI/CD Pipeline / PR Build Web Image (pull_request) Successful in 50s
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 2m47s
CI/CD Pipeline / Validate - Code Quality (pull_request) Successful in 36m27s
CI/CD Pipeline / CI Gate (pull_request) Successful in 30s
ACR Cleanup / ACR Image Cleanup (pull_request_target) Waiting to run
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 1m46s
CI/CD Pipeline / Production Browser E2E (pull_request) Failing after 448h30m19s
CI/CD Pipeline / Deploy Production (pull_request) Failing after 448h30m20s
CI/CD Pipeline / Build Production Worker Image (pull_request) Failing after 448h30m21s
CI/CD Pipeline / Integration Tests (pull_request) Failing after 448h30m22s
CI/CD Pipeline / Build Production Web Image (pull_request) Failing after 448h30m21s
CI/CD Pipeline / PR Build Worker Image (pull_request) Failing after 448h50m22s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 448h52m14s
CI/CD Pipeline / ACR Image Cleanup (pull_request) Failing after 449h6m47s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 449h6m47s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Failing after 449h6m49s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 449h6m51s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 449h6m51s
CI/CD Pipeline / Canary Release to Production (pull_request) Failing after 449h4m20s
CI/CD Pipeline / Build Production API Image (pull_request) Failing after 449h4m22s
CI/CD Pipeline / PR Build API Image (pull_request) Failing after 449h24m33s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 449h40m48s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 449h40m52s
feat(generate): 合并步骤4(选择标题)和步骤5(生成预览)为一个步骤
- STEPS 从7步缩减为6步,合并后步骤名称保持"选择标题"
- Step4TitleSettings 合并原 Step5GeneratePreview 的 TitleStylePanel
  - 标题文字输入 + AI生成标题(原Step4)
  - 位置/字号/字体/颜色/粗斜体/描边阴影/样式预设(原Step5)
- 右侧实时预览播放器从 step 4-6 调整为 step 4-5
- 下一步校验增加预览就绪检查(previewReady)
- 步骤6/7重新编号为5/6(封面/确认生成)
- 删除 Step5GeneratePreview.tsx(功能已并入 Step4)
- 更新 smoke test 移除对已删除组件的引用
2026-08-28 22:18:36 +08:00

215 lines
6.5 KiB
TypeScript

/**
* 智能剪辑页面 — 常量定义
*/
import type { CoverConfig } from "./types/cover"
/* ── 克隆声音状态配置 ── */
export const CLONE_STATUS_CONFIG: Record<string, { label: string; color: string }> = {
ready: { label: "就绪", color: "var(--secondary-color, #10b981)" },
processing: { label: "克隆中", color: "var(--accent-color, #f59e0b)" },
failed: { label: "失败", color: "var(--error-color, #ef4444)" },
}
/* ── 模板渐变色映射(根据 mode 分配视觉样式) ── */
export const MODE_GRADIENTS: Record<string, string> = {
pip: "linear-gradient(135deg, #fbbf24, #f59e0b)",
one_take: "linear-gradient(135deg, #3b82f6, #1d4ed8)",
voice_over: "linear-gradient(135deg, #6366f1, #4f46e5)",
voice_pip: "linear-gradient(135deg, #10b981, #059669)",
}
/* ── 配音性别图标 ── */
export const VOICE_GENDER_ICON: Record<string, string> = {
female: "🎀",
male: "🎙️",
child: "🧒",
neutral: "✨",
}
/* ── 步骤定义 ── */
export const STEPS = [
{ key: 1, label: "选择模板" },
{ key: 2, label: "选择素材" },
{ key: 3, label: "选择配音" },
{ key: 4, label: "选择标题" },
{ key: 5, label: "选择封面" },
{ key: 6, label: "确认生成" },
]
/* ── 标题位置选项 ── */
export const POSITION_OPTIONS = [
{ value: "top", label: "顶部" },
{ value: "center", label: "居中" },
{ value: "bottom", label: "底部" },
]
/* ── 标题字体选项 ── */
export const FONT_OPTIONS = [
"思源黑体",
"思源宋体",
"苹方",
"PingFang",
"微软雅黑",
"楷体",
"华康俪金黑",
]
/* ── 标题字体 CSS font-family 映射(中文显示名 → 浏览器可识别的字体栈) ── */
export const FONT_FAMILY_MAP: Record<string, string> = {
思源黑体: '"Source Han Sans SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif',
思源宋体: '"Source Han Serif SC", "Noto Serif SC", "Songti SC", "SimSun", serif',
苹方: '"PingFang SC", -apple-system, "Helvetica Neue", sans-serif',
PingFang: '"PingFang SC", -apple-system, "Helvetica Neue", sans-serif',
微软雅黑: '"Microsoft YaHei", "PingFang SC", sans-serif',
楷体: '"KaiTi", "STKaiti", "DFKai-SB", serif',
华康俪金黑: '"华康俪金黑", "DFLiJinHei-W8", "Source Han Sans SC", "Microsoft YaHei", sans-serif',
}
export function getFontFamily(font: string): string {
return FONT_FAMILY_MAP[font] || FONT_FAMILY_MAP["思源黑体"]
}
/* ── 标题样式预设 ── */
export const TITLE_PRESETS = [
{
key: "classic_white",
label: "经典白字",
style: { size: 28, color: "#ffffff", bold: true, italic: false, stroke: true, shadow: false },
previewStyle: {
fontWeight: 700,
color: "#ffffff",
WebkitTextStroke: "1px #000000",
fontSize: "20px",
},
},
{
key: "black_gold",
label: "黑金质感",
style: { size: 32, color: "#d4a843", bold: true, italic: false, stroke: false, shadow: true },
previewStyle: {
fontWeight: 700,
color: "#d4a843",
textShadow: "1px 1px 3px rgba(0,0,0,0.8)",
fontSize: "20px",
},
},
{
key: "fresh_minimal",
label: "清新简约",
style: { size: 24, color: "#333333", bold: false, italic: false, stroke: false, shadow: false },
previewStyle: { fontWeight: 400, color: "#333333", fontSize: "18px" },
},
{
key: "variety_show",
label: "综艺花字",
style: { size: 36, color: "#ff4081", bold: true, italic: false, stroke: true, shadow: true },
previewStyle: {
fontWeight: 900,
color: "#ff4081",
WebkitTextStroke: "1.5px #ffffff",
textShadow: "2px 2px 4px rgba(0,0,0,0.5)",
fontSize: "22px",
},
},
{
key: "business",
label: "商务极简",
style: { size: 24, color: "#1a1a1a", bold: false, italic: false, stroke: false, shadow: false },
previewStyle: { fontWeight: 400, color: "#1a1a1a", fontSize: "17px" },
},
{
key: "retro_film",
label: "复古胶片",
style: { size: 28, color: "#e8d5b7", bold: false, italic: false, stroke: false, shadow: true },
previewStyle: {
fontWeight: 400,
color: "#e8d5b7",
textShadow: "2px 2px 6px rgba(0,0,0,0.7)",
fontSize: "18px",
},
},
{
key: "neon_glow",
label: "霓虹发光",
style: { size: 32, color: "#00e5ff", bold: true, italic: false, stroke: false, shadow: true },
previewStyle: {
fontWeight: 700,
color: "#00e5ff",
textShadow: "0 0 4px #00e5ff, 0 0 8px #00e5ff, 0 0 16px rgba(0,229,255,0.5)",
fontSize: "20px",
},
},
{
key: "handwriting",
label: "手写字",
style: { size: 28, color: "#333333", bold: false, italic: false, stroke: false, shadow: true },
previewStyle: {
fontWeight: 400,
color: "#333333",
textShadow: "1px 1px 2px rgba(0,0,0,0.3)",
fontSize: "20px",
},
},
]
/* ── 封面模式 ── */
export const COVER_MODE_LABELS: Record<string, string> = {
auto: "智能封面",
frame: "抽帧选封面",
upload: "上传封面",
}
export const COVER_MODE_ICONS: Record<string, string> = {
auto: "🤖",
frame: "🎞️",
upload: "📤",
}
/* ── 智能匹配推荐理由 ── */
export const SMART_MATCH_REASONS = [
"画面清晰度高,构图专业",
"与描述场景高度契合",
"时长适中,适合剪辑节奏",
"色彩风格统一",
"包含关键动作镜头",
"镜头运动流畅自然",
"光影效果出色",
"人物表情生动",
]
/* ── AI 标题模板 ── */
export const AI_TITLE_TEMPLATES: Record<string, string[]> = {
catchy: [
"震惊!{topic}居然还能这样操作",
"99%的人都不知道的{topic}秘诀",
"{topic}的终极指南,看完直接封神",
"别再走弯路了!{topic}看这一篇就够",
"一个视频讲透{topic},建议收藏",
],
emotional: [
"致每一个在{topic}路上坚持的人",
"关于{topic},我想说句真心话",
"{topic}背后的故事,看完沉默了",
"为什么我劝你一定要了解{topic}",
"这才是{topic}最动人的样子",
],
informative: [
"{topic}完整科普:从入门到精通",
"深度解析{topic}的核心原理",
"{topic}行业趋势报告|2026最新版",
"三分钟带你全面了解{topic}",
"{topic}常见问题与解决方案汇总",
],
}
/* ── 默认封面设置 ── */
export const DEFAULT_COVER_SETTINGS: CoverConfig = {
enabled: true,
mode: "auto",
frame_time: 0,
upload_url: "",
ai_suggested_time: null,
thumbnail_url: "",
}