Make videos on the computer you already own. FreeVideo runs MiniMax H3 in as little as 8 GB of VRAM and 16 GB of RAM, and adapts its acceleration path to your hardware.
Show and edit each part's description of a long video
Bowen Xuefb84ad1d1818
diff --git a/web/generation_progress.js b/web/generation_progress.jsindex e398d2a..38d1c67 100644--- a/web/generation_progress.js+++ b/web/generation_progress.js@@ -94,6 +94,9 @@ const STALL_SECONDS_BY_PHASE = Object.freeze({starting: 180, encoding: 180, load: 180, sampling: 180, refinement: 180,latent_upscale: 180, sample_finalize: 180, decode: 180, save: 180,dependencies: 180, recovery: 180, other: 180,+ // A long video's part descriptions: the server waits at most 10 min for the model and+ // writes for at most 15 min, then falls back to the whole description on its own.+ describe: 1500,});// Normal stage sentences keep the sampling step or a download's size and speed.// After 15 s of engine silence SUBACTIVITY names the work without counts.@@ -101,6 +104,7 @@ const STALL_SECONDS_BY_PHASE = Object.freeze({// Stage words the product already uses: settings say 一采 / 二采, results say 解码.const ACTIVITY = {prepare: ['Preparing', '正在准备'],+ describe: ['Writing part descriptions', '正在写各段描述'],prompt: ['Encoding the prompt', '正在编码提示词'],combined: ['Encoding the prompt and references', '正在编码提示词和参考素材'],load: ['Loading the video model', '正在载入视频模型'],@@ -194,7 +198,7 @@ function activityLabel(message, t, plan = {}, secondPass = false, references = freturn steps('pass1', twoPass ? 'first' : 'single', step, count);}const key = labelActivities.get(message.label) || {- starting: 'prepare', prepare: 'prepare', prediction: 'prepare', encoding: 'combined',+ starting: 'prepare', prepare: 'prepare', prediction: 'prepare', describe: 'describe', encoding: 'combined',load: 'load', decode: 'decode', save: 'save',}[phase] || labelActivities.get(message.stage);if (!key) return null;@@ -425,7 +429,7 @@ export function createGenerationProgress(t, now = () => Date.now(), {compact = fconst stallText = el('span', ''); stall.append(stallText);const trims = new Map();element.append(heading, track, label, mini, times, compatibilityNote, status, live);- let recovery = '', lowMemory = false, compatibility = null, samplingPlan = {}, secondPass = false, references = false;+ let recovery = '', lowMemory = false, compatibility = null, samplingPlan = {}, secondPass = false, references = false, splitFailed = null;let hasHeartbeat = false;// Mac: the unified-memory notice of this request, and whether its first pass has ended.let memoryTight = null, firstPassOver = false;@@ -698,7 +702,8 @@ export function createGenerationProgress(t, now = () => Date.now(), {compact = fconst progressText = [paused ? pauseText : '', decodeEta].filter(Boolean).join(t(' · ', ','));const level = ended ? '' : recovery ? 'retry' : paused ? 'pause': lowMemory ? 'memory' : memoryTight ? 'unified-memory' : automatic ? 'automatic'- : compatibility && compatibility.level > 0 ? 'compatibility' : trims.size ? 'notice' : '';+ : compatibility && compatibility.level > 0 ? 'compatibility' : trims.size ? 'notice'+ : splitFailed && !progressText ? 'split' : '';const explanation = {retry: recovery,pause: progressText,memory: t('This video uses a memory-saving mode, so it takes longer than usual but will finish.',@@ -714,7 +719,10 @@ export function createGenerationProgress(t, now = () => Date.now(), {compact = fcompatibility: compatibility ? t(`Compatibility setting ${compatibility.name_en} is on, so generation is slower than usual.`,`已开启兼容性设置(${compatibility.name_zh}档),生成会比平时慢。`) : '',automatic: compatibilityText,- notice: trimStatus([...trims.values()], t)}[level] || (!ended ? progressText : '');+ notice: trimStatus([...trims.values()], t),+ // A long video whose part descriptions could not be written: the server's own words stay in the report.+ split: splitFailed === 'model_missing' ? t('Prompt model not installed. Every part uses the same description.', '未安装提示词模型,各段用同一段描述')+ : t('Every part uses the same description.', '各段用同一段描述')}[level] || (!ended ? progressText : '');if (status.textContent !== explanation) status.textContent = explanation;status.hidden = !explanation; status.dataset.level = level;const announcements = [];@@ -847,7 +855,7 @@ export function createGenerationProgress(t, now = () => Date.now(), {compact = fpauseAnnounced = false; lastExplanation = ''; announcedMessages.clear();live.textContent = ''; status.textContent = ''; resetRemaining(); lastActivity = null; resetMini();stopCount(); countShown = null;- recovery = ''; lowMemory = false; compatibility = null; references = false; trims.clear();+ recovery = ''; lowMemory = false; compatibility = null; references = false; trims.clear(); splitFailed = null;memoryTight = null; firstPassOver = false;samplingPlan = {}; secondPass = false; hasHeartbeat = false;detail = null; localShare = null; workShares.clear(); decodeMinutes = null; decodeMinutesAt = -Infinity;@@ -892,6 +900,7 @@ export function createGenerationProgress(t, now = () => Date.now(), {compact = fcompletedSteps = Math.max(completedSteps, message.done);if (message.low_memory && typeof message.low_memory === 'object') lowMemory = true;if (message.compatibility && typeof message.compatibility === 'object') compatibility = message.compatibility;+ if (message.chain && typeof message.chain === 'object') splitFailed = typeof message.chain.split_failed === 'string' ? message.chain.split_failed : null;// Whether the request has reference media (first or last frame, references).if (typeof message.references === 'boolean') references = message.references;if (message.reference_trimmed || REFERENCE_WORK.has(message.label)) references = true;@@ -979,7 +988,7 @@ export function createGenerationProgress(t, now = () => Date.now(), {compact = ftick(); if (timer === null) timer = setInterval(tick, 250);}function hide() {- element.hidden = true; status.hidden = true; recovery = ''; placeholder = false; elapsedLead = 0; trims.clear(); lowMemory = false; compatibility = null; references = false; hasHeartbeat = false;+ element.hidden = true; status.hidden = true; recovery = ''; placeholder = false; elapsedLead = 0; trims.clear(); lowMemory = false; compatibility = null; references = false; hasHeartbeat = false; splitFailed = null;compatibilityNote.hidden = true; compatibilityNote.textContent = '';memoryTight = null; firstPassOver = false;elapsedShown = 0;diff --git a/web/studio.css b/web/studio.cssindex 1a8b7b6..5f9c822 100644--- a/web/studio.css+++ b/web/studio.css@@ -186,3 +186,18 @@.fv-studio .fv-first-frame input:checked{background:var(--fv-accent,#6db8fa)}.fv-studio .fv-first-frame input:checked::before{transform:translateX(10px)}.fv-studio .fv-first-frame:has(input:disabled){opacity:.4}+.fv-studio .fv-chain-parts{display:grid;gap:2px;margin-top:-7px}+.fv-studio .fv-chain-parts[hidden]{display:none}+.fv-studio .fv-chain-part{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:start;gap:14px;padding:4px 4px 4px 12px;border-radius:var(--fv-r-sm);font-size:var(--fv-micro);line-height:20px}+.fv-studio .fv-chain-part-name{padding-top:7px;color:var(--fv-muted);white-space:nowrap}+.fv-studio .fv-chain-part .fv-chain-part-text{display:block;min-width:0;min-height:32px;padding:6px 10px;border-color:transparent;background:transparent;color:var(--fv-ink);font-weight:var(--fv-regular);text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}+.fv-studio .fv-chain-part:has(.fv-chain-part-text:not(:disabled):not([hidden])):hover{background:var(--fv-hover);cursor:text}+.fv-studio .fv-chain-part:has(.fv-chain-part-text:not(:disabled):not([hidden])):hover .fv-chain-part-text{background:transparent;cursor:text}+.fv-studio .fv-chain-part .fv-chain-part-text:disabled{opacity:1;color:var(--fv-disabled)}+.fv-studio .fv-chain-part:has(.fv-chain-part-text:disabled) :is(.fv-chain-part-name,.fv-chain-part-tag:not([data-kind=error])){color:var(--fv-disabled)}+.fv-studio .fv-chain-part-text[hidden]{display:none}+.fv-studio .fv-chain-part .fv-chain-part-editor{min-height:76px;height:96px;max-height:220px;padding:6px 10px;font-size:var(--fv-micro);line-height:20px;outline:none}+.fv-studio .fv-chain-part-tag{padding:7px 8px 0 0;color:var(--fv-muted);white-space:nowrap}+.fv-studio .fv-chain-part-tag:empty{display:none}+.fv-studio .fv-chain-part-tag[data-kind=error]{color:var(--fv-warning);white-space:normal;max-width:16em;text-align:right}+@media(max-width:680px){.fv-studio .fv-chain-part{gap:8px;padding-left:4px}}diff --git a/web/studio.js b/web/studio.jsindex 23f501e..e6533e8 100644--- a/web/studio.js+++ b/web/studio.js@@ -31,7 +31,7 @@ import { frameShapes, frameSize } from './frame_sizes.js';import { createFirstRunGuide } from './first_run_guide.js';import { createStudioLength, savedSeconds } from './studio_length.js?v=20261011-length';import { firstFrameRow } from './first_frame_row.js';-import { createStudioChain, chainPosition, readChainResult, sumPartEstimates, singleRunSnapshot } from './studio_chain.js?v=20261011-length';+import { createStudioChain, chainPosition, chainParts, chainSplit, readChainResult, sumPartEstimates, singleRunSnapshot } from './studio_chain.js?v=20261014-parts';import { createExtendState, extendText, extendSourceExists, readExtendRecord, extendSnapshot, mountExtendThumbnail, videoUnavailableText } from './studio_extend.js';const languageOverride = typeof location !== 'undefined'@@ -43,6 +43,97 @@ const css = document.createElement('link'); css.rel = 'stylesheet'; css.href = nconst effortCss = document.createElement('link'); effortCss.rel = 'stylesheet'; effortCss.href = new URL('./sampling_effort.css', import.meta.url).href; document.head.append(effortCss);const enhanceCss = document.createElement('link'); enhanceCss.rel = 'stylesheet'; enhanceCss.href = new URL('./prompt_enhance.css', import.meta.url).href; document.head.append(enhanceCss);const el = (tag, label, cls) => { const e = document.createElement(tag); if (label != null) e.textContent = label; if (cls) e.className = cls; return e; };+// One line per part of a long video, under the preview. A part that has not started opens in+// place for editing and saves when it loses focus; the server's reply decides what stays.+function createChainPartList(t, save, {onShow = () => {}, onHide = () => {}} = {}) {+ const element = el('div', null, 'fv-chain-parts'); element.hidden = true;+ const rows = new Map(), timers = new Map();+ let editing = null, showing = null;+ function tag(row, text, kind = '') { row.tag.textContent = text; row.tag.dataset.kind = kind; }+ function draw(row) {+ const {part} = row, writing = editing === row;+ row.element.dataset.state = part.editable ? 'pending' : part.state;+ row.text.textContent = part.text;+ row.text.disabled = !part.editable;+ if (!writing && row.editor) { row.editor.remove(); row.editor = null; row.text.hidden = false; }+ // A note about a lost edit stays on its line until that part is done.+ if (row.tag.dataset.kind === 'error' && part.state === 'done') row.tag.dataset.kind = '';+ if (timers.has(part.id) || row.tag.dataset.kind === 'error') return;+ tag(row, part.state === 'done' ? t('Done', '已完成') : part.editable || !['queued', 'running', 'pending'].includes(part.state) ? '' : t('Generating', '生成中'));+ }+ function flash(row, text, kind) {+ clearTimeout(timers.get(row.part.id)); tag(row, text, kind);+ if (kind === 'saved') timers.set(row.part.id, setTimeout(() => { timers.delete(row.part.id); tag(row, ''); draw(row); }, 2000));+ }+ async function finish(row, keep) {+ if (editing !== row) return;+ const before = row.part.text, value = row.editor.value;+ editing = null;+ if (!keep || !value.trim() || value === before) { draw(row); return; }+ row.part = {...row.part, text: value}; row.saving = value; draw(row);+ try {+ await save(row.part.id, value);+ row.saving = null;+ if (rows.get(row.part.id) === row) flash(row, t('Saved', '已保存'), 'saved');+ } catch (error) {+ row.saving = null;+ if (rows.get(row.part.id) !== row) return;+ row.part = {...row.part, text: before}; draw(row);+ flash(row, error.status === 409 ? t('This part has started. Your edit was not saved.', '这一段已开始,修改未保存')+ : t('Your edit was not saved.', '修改未保存'), 'error');+ }+ }+ function open(row) {+ if (!row.part.editable || editing === row) return;+ if (editing) finish(editing, true);+ editing = row; clearTimeout(timers.get(row.part.id)); timers.delete(row.part.id); tag(row, '');+ const editor = row.editor = el('textarea', null, 'fv-chain-part-editor');+ editor.maxLength = 20000; editor.value = row.part.text;+ editor.setAttribute('aria-label', t(`Part ${row.part.index + 1} description`, `第 ${row.part.index + 1} 段描述`));+ editor.addEventListener('blur', () => finish(row, true));+ editor.addEventListener('keydown', event => {+ // Escape leaves the edit, never the studio.+ if (event.key === 'Escape') { event.preventDefault(); event.stopPropagation(); finish(row, false); row.text.focus(); }+ });+ row.text.hidden = true; row.text.after(editor); editor.focus();+ editor.setSelectionRange(editor.value.length, editor.value.length);+ editor.scrollIntoView({block: 'nearest'});+ }+ function clear() {+ if (!element.hidden) onHide();+ element.hidden = true; element.replaceChildren(); rows.clear(); editing = null; showing = null;+ for (const id of timers.values()) clearTimeout(id); timers.clear();+ }+ return {element, clear, update(chain, active) {+ // The list belongs to one generation: it shows once the descriptions are written and closes when that ends.+ if (!active || !chain?.split || chainSplit(chain).writing) { if (!active || showing !== chain?.id) clear(); return; }+ if (showing !== chain.id) clear();+ showing = chain.id;+ const first = element.hidden; element.hidden = false;+ chainParts(chain).forEach((part, index) => {+ part.state = chain.blocks[index].state === 'pending' && chain.blocks[index].prompt_id != null ? 'queued' : chain.blocks[index].state;+ let row = rows.get(part.id);+ if (!row) {+ row = {element: el('div', null, 'fv-chain-part'), tag: el('span', null, 'fv-chain-part-tag')};+ row.text = el('button', null, 'fv-chain-part-text'); row.text.type = 'button';+ row.element.onclick = () => open(row);+ row.element.append(el('span', t(`Part ${index + 1}`, `第 ${index + 1} 段`), 'fv-chain-part-name'), row.text, row.tag);+ rows.set(part.id, row); element.append(row.element);+ }+ if (editing === row && !part.editable) {+ // The part began while it was open: the words typed so far cannot reach it.+ const changed = row.editor.value !== row.part.text;+ editing = null; row.part = part; draw(row);+ if (changed) flash(row, t('This part has started. Your edit was not saved.', '这一段已开始,修改未保存'), 'error');+ return;+ }+ if (editing === row) { row.part = {...part, text: row.part.text}; return; }+ // A poll answered before the save shows the words being saved, not the older ones.+ row.part = row.saving != null ? {...part, text: row.saving} : part; draw(row);+ });+ if (first) onShow();+ }};+}const button = (label, action, cls = '') => { const e = el('button', label, cls); e.type = 'button'; e.onclick = action; return e; };const widget = (node, name) => node?.widgets?.find(w => w.name === name);const linked = (node, name) => node?.inputs?.some(input => input.name === name && input.link != null);@@ -733,6 +824,12 @@ export function openStudio(node, {extendFrom = null} = {}) {extend: (saved, options) => openExtendEditor(saved, node, {studio: dialog, ...options})});})); previewHead.append(previewTools); output.append(previewHead);const previewSpace = el('div', null, 'fv-preview-space'); output.append(previewSpace);+ // The preview keeps the size it has once the list is in; an opened part grows the column, which scrolls.+ const partList = createChainPartList(t, (block, text) => chainController.setText(block, text), {+ onShow: () => { previewSpace.style.flex = `0 0 ${previewSpace.getBoundingClientRect().height}px`; },+ onHide: () => { previewSpace.style.flex = ''; }});+ output.append(partList.element);+ cleanup.push(() => partList.clear());const stage = el('div', null, 'fv-stage');stage.setAttribute('aria-label', t('Video preview', '视频预览'));const stageMedia = el('div', null, 'fv-stage-media');@@ -940,6 +1037,7 @@ export function openStudio(node, {extendFrom = null} = {}) {lastQueueError = null; status.textContent = ''; status.dataset.error = 'false';}chainWasActive = active;+ partList.update(chain, active);busy = active || Boolean(queueState?.running || queueState?.pending.length); queued = chain?.state === 'queued';chainLine.hidden = !active;chainLine.textContent = outcome?.joining ? t('Joining the parts.', '正在接合各段。')diff --git a/web/studio_chain.js b/web/studio_chain.jsindex 7168c41..a611786 100644--- a/web/studio_chain.js+++ b/web/studio_chain.js@@ -29,6 +29,17 @@ export function readChainResult(chain) {error: failedJoin ? chain.output_error || 'join_failed' : chain.error || chain.blocks?.find(block => block.state === 'failed')?.error || null};}+// Before the first part starts the server writes one description per part; until then no part can be changed.+export function chainSplit(chain) {+ const split = chain?.split;+ return {writing: ['pending', 'running'].includes(split?.state), reason: split?.state === 'failed' ? split.reason || 'failed' : null};+}+export function chainParts(chain) {+ const writing = chainSplit(chain).writing;+ return (chain?.blocks || []).map((block, index) => ({id: block.id, index, text: block.inputs?.text ?? '',+ editable: !writing && block.state === 'pending' && block.prompt_id == null}));+}+export function sumPartEstimates(plan, estimate) {if (!plan || plan.count < 2 || typeof estimate !== 'function') return null;const values = plan.blocks.map(block => estimate(block.frames));@@ -80,10 +91,10 @@ export function createStudioChain({api, node, onState = () => {}, onProgress = (if (Object.keys(overall).length) Object.assign(overall, {status: 'running', reset: false, estimated: false, sampling_time_weighted: true});previous = overall;lastMessage = {...lastMessage, ...message};- const phase = readChainResult(chain).joining ? 'save'+ const phase = readChainResult(chain).joining ? 'save' : chain.split?.state === 'running' ? 'describe': ['complete', 'failed', 'cancelled'].includes(lastMessage.phase) ? 'prepare' : lastMessage.phase || 'prepare';onProgress({...lastMessage, phase, result: null, reset: false, new_request: fresh,- chain: {id: chain.id, ...position}, overall}, chain);+ chain: {id: chain.id, ...position, split_failed: chainSplit(chain).reason}, overall}, chain);}function deliver(value, fresh = false) {if (disposed) return false;@@ -182,6 +193,14 @@ export function createStudioChain({api, node, onState = () => {}, onProgress = (} finally { submitting = false; }},refresh,+ // The reply carries the whole chain, so the part shows the words the server keeps.+ async setText(block, text) {+ if (!chain) throw new Error('chain_missing');+ const id = chain.id, version = epoch;+ const value = (await json(chainRoute(id, `blocks/${encodeURIComponent(block)}/text`), post({text})))?.chain;+ if (value?.id === id && version === epoch && !disposed) deliver(value);+ return value;+ },async cancel() {if (!chain) return;await changeState('cancel', {});