auto-save 2026-05-12 19:42 (~3)

This commit is contained in:
2026-05-12 19:42:27 +08:00
parent 902c3ed936
commit f901b71d66
3 changed files with 73 additions and 57 deletions

View File

@@ -8,7 +8,7 @@ import {
} from "@xyflow/react"
import { Toaster, toast } from "sonner"
import {
InputNode, DownloadNode, SplitNode, KeyframeNode, ASRNode,
InputNode, KeyframeNode, ASRNode,
TranslateNode, RewriteNode, ImageGenNode, VideoGenNode, ComposeNode,
type NodeData,
} from "@/components/nodes"
@@ -19,8 +19,6 @@ import { FrameLightbox } from "@/components/lightbox"
const NODE_TYPES = {
input: InputNode,
download: DownloadNode,
split: SplitNode,
keyframe: KeyframeNode,
asr: ASRNode,
translate: TranslateNode,
@@ -30,27 +28,23 @@ const NODE_TYPES = {
compose: ComposeNode,
}
// 手布局DAG从左到右
// 拆分后两路:上路 video → keyframe → imagegen → videogen ↘
// 下路 audio → asr → translate → rewrite ────→ compose
// 合并 input + download + split 为一个节点
// 分叉:上路 input → keyframe → imagegen → videogen ↘
// 下路 input → asr → translate → rewrite ────→ compose
const LAYOUT: Array<{ id: string; type: keyof typeof NODE_TYPES; x: number; y: number }> = [
{ id: "input", type: "input", x: 40, y: 240 },
{ id: "download", type: "download", x: 400, y: 240 },
{ id: "split", type: "split", x: 720, y: 240 },
{ id: "keyframe", type: "keyframe", x: 1060, y: 60 },
{ id: "asr", type: "asr", x: 1060, y: 440 },
{ id: "translate", type: "translate", x: 1440, y: 440 },
{ id: "imagegen", type: "imagegen", x: 1480, y: 60 },
{ id: "rewrite", type: "rewrite", x: 1820, y: 440 },
{ id: "videogen", type: "videogen", x: 1860, y: 60 },
{ id: "compose", type: "compose", x: 2240, y: 240 },
{ id: "keyframe", type: "keyframe", x: 460, y: 60 },
{ id: "asr", type: "asr", x: 460, y: 440 },
{ id: "translate", type: "translate", x: 840, y: 440 },
{ id: "imagegen", type: "imagegen", x: 880, y: 60 },
{ id: "rewrite", type: "rewrite", x: 1220, y: 440 },
{ id: "videogen", type: "videogen", x: 1260, y: 60 },
{ id: "compose", type: "compose", x: 1640, y: 240 },
]
const EDGES_RAW: Array<[string, string]> = [
["input", "download"],
["download", "split"],
["split", "keyframe"],
["split", "asr"],
["input", "keyframe"],
["input", "asr"],
["asr", "translate"],
["translate", "rewrite"],
["keyframe", "imagegen"],
@@ -213,9 +207,7 @@ export default function Home() {
// 边的 animated 状态跟 Job 进度联动
useEffect(() => {
const doneOf: Record<string, boolean> = {
input: !!job,
download: !!job?.video_url,
split: !!job && ["frames_extracted", "transcribing", "transcribed"].includes(job.status),
input: !!job?.video_url,
keyframe: !!job && job.frames.length > 0,
asr: !!job && job.transcript.length > 0,
translate: !!job && (job.transcript.some((s) => s.zh) ?? false),