Show it a video you love. Get a new video in the same style. An AI crew (Claude Code or Codex) plans, builds and reviews it with you.
JavaScript 2d-animationai-agentsai-videoanimationclaude-codecodexmulti-agentstyle-transfervideo-generation
Default new projects to fine, the only measured mode; mark the other times as estimates
許元豪7a934277c0a8
diff --git a/app/server/index.ts b/app/server/index.tsindex 9da990b..72166e4 100644--- a/app/server/index.ts+++ b/app/server/index.ts@@ -40,7 +40,7 @@ app.post('/api/projects', upload.fields([{ name: 'reference', maxCount: 1 }, { nlet settings;try { settings = Object.fromEntries(Object.entries(J.cleanRounds(req.body)).filter(([, v]) => v != null)); }catch (e) { for (const f of Object.values(files || {}).flat()) try { unlinkSync(f.path); } catch {} return res.status(400).json({ error: (e as Error).message }); }- const quality = ['fast', 'standard', 'fine'].includes(req.body.quality) ? req.body.quality : 'standard';+ const quality = ['fast', 'standard', 'fine'].includes(req.body.quality) ? req.body.quality : undefined; // undefined → DEFAULT_QUALITYconst id = slug();const job = J.createJob({ id, title: (title || brief.split('\n')[0] || '未命名').slice(0, 40), agent, brief, lang, settings, quality,reference: ref ? { type: 'file', src: 'inputs/reference' + (extname(ref.originalname) || '.mp4') } : { type: 'url', src: url.trim() } });diff --git a/app/server/jobs.test.ts b/app/server/jobs.test.tsindex 5f0d4c7..ef95adf 100644--- a/app/server/jobs.test.ts+++ b/app/server/jobs.test.ts@@ -30,10 +30,10 @@ describe('cleanRounds', () => {});describe('project settings', () => {- test('a new project is standard quality and uses that preset', () => {+ test('a new project gets the default (measured) quality and uses that preset', () => {const { id } = newJob();- const P = J.CONFIG.presets.standard;- assert.equal(J.snapshot(id).quality, 'standard');+ const P = J.CONFIG.presets.fine;+ assert.equal(J.snapshot(id).quality, 'fine');assert.deepEqual(J.rounds(id), { castRounds: P.castRounds, chunkRounds: P.chunkRounds, finalRounds: P.finalRounds });});test('a project made before quality modes runs the fine line', () => {@@ -56,8 +56,8 @@ describe('project settings', () => {assert.equal(J.rounds(id).castRounds, 7);assert.equal(J.rounds(id).finalRounds, 4);const snap = J.setRounds(id, { finalRounds: '' });- assert.equal(snap.rounds.values.finalRounds, J.CONFIG.presets.standard.finalRounds);- assert.equal(snap.rounds.defaults.castRounds, J.CONFIG.presets.standard.castRounds);+ assert.equal(snap.rounds.values.finalRounds, J.CONFIG.presets.fine.finalRounds);+ assert.equal(snap.rounds.defaults.castRounds, J.CONFIG.presets.fine.castRounds);});});diff --git a/app/server/jobs.ts b/app/server/jobs.tsindex 7a4814c..3666418 100644--- a/app/server/jobs.ts+++ b/app/server/jobs.ts@@ -15,7 +15,7 @@ import { EventEmitter } from 'node:events';import { runAgent, type AgentResult } from './agents/index.ts';import { checkOutputs, parseJSON, repairPrompt } from './outputs.ts';import { prompts as bootPrompts } from './prompts.ts';-import { QUALITIES, ROUND_KEYS } from '../shared/types.ts';+import { DEFAULT_QUALITY, QUALITIES, ROUND_KEYS } from '../shared/types.ts';import type { AgentKind, CastCharProgress, ChatMessage, ChunkProgress, Config, EngineSnapshot, Job, Lang, LogEntry, LogEvent, Need, NeedRequest, Pipeline, Plan, ProjectSummary, Quality, QualityPreset, Reference, RequiredInput, Review, RoundKey, Rounds, Snapshot, Stage } from '../shared/types.ts';import type { CastMember, Chunk, ChunkReview, Critique, Phase, Production, Prompts, SharedItem, ShotEntry, StepVars } from './types.ts';export { ROUND_KEYS };@@ -207,7 +207,7 @@ export function snapshot(id: string): Snapshot {};}-export function createJob({ id, title, agent, brief, reference, lang = 'zh-TW', settings = {}, quality = 'standard' }: { id: string; title: string; agent: AgentKind; brief: string; reference: Reference; lang?: Lang; settings?: Partial<Rounds>; quality?: Quality }) {+export function createJob({ id, title, agent, brief, reference, lang = 'zh-TW', settings = {}, quality = DEFAULT_QUALITY }: { id: string; title: string; agent: AgentKind; brief: string; reference: Reference; lang?: Lang; settings?: Partial<Rounds>; quality?: Quality }) {const d = dirOf(id); mkdirSync(join(d, 'inputs'), { recursive: true }); mkdirSync(join(d, 'analysis'), { recursive: true });writeFileSync(join(d, 'brief.md'), brief || '');const job: Job = { id, title, agent, lang, reference, settings, quality, stage: 'new', sessionId: null, sessions: {}, createdAt: now(), chat: [], log: [], needs: [], waived: [], pipeline: {} };diff --git a/app/shared/types.ts b/app/shared/types.tsindex 7490865..f4aac64 100644--- a/app/shared/types.ts+++ b/app/shared/types.ts@@ -24,6 +24,9 @@ export interface QualityPreset extends Rounds {// Minutes from plan approval to the finished film, for a 30 s film (scaled by length in the UI). From real runs:// fine 167 and 222 min (6upkv, v8z8p); fast and standard are first estimates until measured.export const QUALITY_MINUTES: Record<Quality, [number, number]> = { fast: [50, 80], standard: [100, 150], fine: [170, 230] };+// Which of those come from real runs (the others are shown as estimates). New projects default to a measured mode.+export const QUALITY_MEASURED: Record<Quality, boolean> = { fast: false, standard: false, fine: true };+export const DEFAULT_QUALITY: Quality = 'fine';export interface Config extends Rounds {presets: Record<Quality, QualityPreset>;diff --git a/app/web/src/App.tsx b/app/web/src/App.tsxindex 31a9f1d..94c7f59 100644--- a/app/web/src/App.tsx+++ b/app/web/src/App.tsx@@ -1,4 +1,5 @@import React, { useEffect, useMemo, useRef, useState } from 'react';+import { DEFAULT_QUALITY } from '../../shared/types.ts';import type { AgentKind, AgentStatus, Config, ProjectSummary, Quality } from '../../shared/types.ts';import { api } from './api.ts';import { I, BrandMark, Orb, Seg, AutoText, ago, RoundsEditor, QualityPicker, QUALITY_INFO, estimate } from './ui.tsx';@@ -91,7 +92,7 @@ function Composer({ agents }: { agents?: Partial<AgentStatus> }) {const [brief, setBrief] = useState(''), [agent, setAgent] = useState<AgentKind>('claude'), [inputs, setInputs] = useState<File[]>([]);const [drag, setDrag] = useState(false), [busy, setBusy] = useState(false), [err, setErr] = useState('');const [rounds, setRounds] = useState<RoundValues>({}), [roundsOpen, setRoundsOpen] = useState(false), [config, setConfig] = useState<Config | null>(null);- const [quality, setQuality] = useState<Quality>('standard'), [qualityOpen, setQualityOpen] = useState(false);+ const [quality, setQuality] = useState<Quality>(DEFAULT_QUALITY), [qualityOpen, setQualityOpen] = useState(false);useEffect(() => { api.config().then(setConfig).catch(() => {}); }, []);const preset = config?.presets?.[quality], defaults = preset ? { castRounds: preset.castRounds, chunkRounds: preset.chunkRounds, finalRounds: preset.finalRounds } : null;const customRounds = Object.entries(rounds).filter(([, v]) => v != null);@@ -143,7 +144,7 @@ function Composer({ agents }: { agents?: Partial<AgentStatus> }) {<button className={`tool-chip ${inputs.length ? 'on' : ''}`} onClick={() => assets.current!.click()} title="配樂、歌詞、圖片、Logo、自家角色設計圖"><I n="clip" />素材{inputs.length > 0 && <span className="n">{inputs.length}</span>}</button><input ref={assets} type="file" multiple hidden onChange={(e) => setInputs([...e.target.files!])} />- <button className={`tool-chip ${quality !== 'standard' ? 'on' : ''}`} onClick={() => { setQualityOpen(!qualityOpen); setRoundsOpen(false); }} aria-expanded={qualityOpen} title="品質越高,檢查越細、時間越長">+ <button className={`tool-chip ${quality !== DEFAULT_QUALITY ? 'on' : ''}`} onClick={() => { setQualityOpen(!qualityOpen); setRoundsOpen(false); }} aria-expanded={qualityOpen} title="品質越高,檢查越細、時間越長"><I n="spark" />{QUALITY_INFO[quality].label}</button>{defaults && <button className={`tool-chip ${customRounds.length ? 'on' : ''}`} onClick={() => { setRoundsOpen(!roundsOpen); setQualityOpen(false); }} aria-expanded={roundsOpen} title="每一關最多審查、修改幾輪"><I n="sliders" /><span className="lbl-wide">審查輪數</span>{customRounds.length > 0 && <span className="n">{customRounds.length}</span>}</button>}diff --git a/app/web/src/i18n.ts b/app/web/src/i18n.tsindex b147482..d45e954 100644--- a/app/web/src/i18n.ts+++ b/app/web/src/i18n.ts@@ -31,7 +31,7 @@ const EN: Record<string, string> = {'先拆解與企劃,你核准前不會開始生成 · Ctrl+Enter 送出': 'Analysis and planning come first — nothing renders until you approve · Ctrl+Enter to send','先拆解與企劃,你核准前不會開始生成': 'Analysis and planning come first — nothing renders until you approve', 'Ctrl+Enter 送出': 'Ctrl+Enter to send',// quality modes- '到上限,先繼續': 'At the limit, carried on', '快速': 'Fast', '標準': 'Standard', '精緻': 'Fine', '品質': 'Quality', '目前': 'current', '品質越高,檢查越細、時間越長': 'Higher quality: closer checks, more time',+ '到上限,先繼續': 'At the limit, carried on', '(預估)': ' (estimate)', '快速': 'Fast', '標準': 'Standard', '精緻': 'Fine', '品質': 'Quality', '目前': 'current', '品質越高,檢查越細、時間越長': 'Higher quality: closer checks, more time','先看方向:只修一眼看得出的硬傷,到上限就先交件': 'See the direction first: fixes only defects you notice at once, delivers at the round limit','大部分情況:高潮逐格檢查,其他鏡頭看連續影格': 'Most projects: climaxes checked frame by frame, other shots as motion strips','要交出去的成品:每個姿勢變化逐格檢查,高潮要贏參考片': 'A film to deliver: every pose change checked frame by frame, climaxes must beat the reference',diff --git a/app/web/src/ui.tsx b/app/web/src/ui.tsxindex 2cdada6..25988da 100644--- a/app/web/src/ui.tsx+++ b/app/web/src/ui.tsx@@ -1,6 +1,6 @@import React, { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';import type { CSSProperties, ReactNode, TextareaHTMLAttributes } from 'react';-import { QUALITIES, QUALITY_MINUTES } from '../../shared/types.ts';+import { QUALITIES, QUALITY_MEASURED, QUALITY_MINUTES } from '../../shared/types.ts';import type { Quality, RoundKey, Rounds } from '../../shared/types.ts';// ---------- icons (SF-Symbols-like strokes) ----------@@ -191,7 +191,7 @@ export function QualityPicker({ value, onChange, durS, current, disabled, showTi<div className="q-pick" role="radiogroup">{QUALITIES.map((q) => (<button key={q} role="radio" aria-checked={value === q} className={`q-opt ${value === q ? 'on' : ''}`} disabled={disabled} onClick={() => onChange(q)}>- <div className="row"><b>{QUALITY_INFO[q].label}</b>{current === q && <span className="tiny faint">目前</span>}<span className="grow" />{showTime && <span className="tiny q-time">{estimate(q, durS)}</span>}</div>+ <div className="row"><b>{QUALITY_INFO[q].label}</b>{current === q && <span className="tiny faint">目前</span>}<span className="grow" />{showTime && <span className="tiny q-time">{estimate(q, durS)}{!QUALITY_MEASURED[q] && <span className="faint">(預估)</span>}</span>}</div><div className="tiny muted">{QUALITY_INFO[q].what}</div></button>))}diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.mdindex 642407d..ef7da3b 100644--- a/docs/ARCHITECTURE.md+++ b/docs/ARCHITECTURE.md@@ -90,6 +90,7 @@ final critic (fresh): the climaxes against the reference, then the whole film; v| standard | 2 / 3 / 2, +1 while shrinking | one-frame pose changes in the climax shots, everything visible at normal speed | pauses for the user || fine | 3 / 3 / 2, +3 while shrinking | every pose change checked frame by frame; a climax must beat the reference | pauses for the user |+New projects default to fine, the only mode measured on real runs so far; the UI marks the other times as estimates.Upgrading a finished film (for example fast → fine) starts a new final review under the stricter bar and fixes fromthe current film. Projects made before modes existed run the fine line. Times shown in the UI(`QUALITY_MINUTES`, scaled by film length) come from real runs: fine 167–222 min for a 30 s film.