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.
Editor: a failed save before export names a full disk
Bowen Xue30edc7f35623
diff --git a/freevideo_engine/comfy_editor.py b/freevideo_engine/comfy_editor.pyindex 619b9b2..57053c6 100644--- a/freevideo_engine/comfy_editor.py+++ b/freevideo_engine/comfy_editor.py@@ -5,6 +5,7 @@ creations, and their names, contents and decoding errors are never logged."""import asyncioimport copy+import errnoimport hashlibimport jsonimport logging@@ -48,6 +49,11 @@ _HEADERS = {'Cache-Control': 'no-store'}_LOG = logging.getLogger(__name__)+def _disk_full(error):+ # The page names a full disk; other write errors stay a plain retry.+ return {'reason': 'disk_full'} if getattr(error, 'errno', None) == errno.ENOSPC else {}++class Conflict(ValueError):def __init__(self, revision, identity=None):super().__init__('Editor project has changed')@@ -1173,8 +1179,8 @@ def register():return web.json_response(dict(error='Editor request is too large'), status=413, headers=_HEADERS)except FileNotFoundError:return web.json_response(dict(error='Editor item unavailable'), status=404, headers=_HEADERS)- except OSError:- return web.json_response(dict(saved=False, retry=True), status=503, headers=_HEADERS)+ except OSError as error:+ return web.json_response(dict(saved=False, retry=True, **_disk_full(error)), status=503, headers=_HEADERS)except (ValueError, TypeError, KeyError, RecursionError):return web.json_response(dict(error='Invalid editor request'), status=400, headers=_HEADERS)except Exception:@@ -1205,9 +1211,9 @@ def register():result = await asyncio.to_thread(save, root(), body.get('project'), body.get('create'), body.get('operation'))except MissingProject:raise- except OSError:+ except OSError as error:# A missing staging directory is a retryable write error, not 404.- return web.json_response(dict(saved=False, retry=True), status=503, headers=_HEADERS)+ return web.json_response(dict(saved=False, retry=True, **_disk_full(error)), status=503, headers=_HEADERS)return web.json_response(dict(project=result), headers=_HEADERS)@endpoint('get', '/freevideo/editor/sources')diff --git a/web/editor.js b/web/editor.jsindex 385f35f..28bfca7 100644--- a/web/editor.js+++ b/web/editor.js@@ -71,6 +71,11 @@ function exportErrorText(value, t) {// A bare status code means nothing to the user; the server's own words do.return message ? t(`Export failed: ${message}`, `导出时出错:${message}`) : t('Export failed. Try again.', '导出时出错,请再试一次。');}+// The save route's own messages are internal English, so only a full disk is named.+function saveErrorText(value, t) {+ return value?.reason === 'disk_full' ? t('Saving changes failed: the disk is full. Free some space, then export again.', '保存改动时出错:磁盘空间不够,空出空间后再导出。')+ : t('Saving changes failed. Please export again.', '保存改动时出错,请再导出一次。');+}function restoreGeneration(record, before, prepared) {const same = (a, b) => JSON.stringify(a) === JSON.stringify(b);const entries = value => new Map(value.tracks.flatMap(track => track.clips.map(clip => [clip.id, {track: track.id, clip}])));@@ -260,11 +265,12 @@ export function openEditor({api, app, from = null, panel = {}, components: given: t(en || 'Each continued part must be at least 10 seconds. Make it longer.', zh || '接着生成的每一段至少 10 秒,请加长一些。');notify(text); return {ok: false, reason: code, say: text};}- if (['busy', 'locked', 'text', 'audio_full', 'overlap', 'range'].includes(code)) {+ if (['busy', 'locked', 'text', 'audio_full', 'overlap', 'range', 'no_audio'].includes(code)) {if (['locked', 'audio_full', 'overlap', 'range'].includes(code)) tracks?.flashBlocked?.(value.displayFrame);const said = {busy: t('This part is generating.', '这一段正在生成。'), locked: t('This track is locked.', '这条轨道已锁定。'),text: t('Write a description first.', '先写一句描述。'), overlap: t('That spot is taken. Use an empty spot.', '这里已经有片段了,请放到空白处。'),- audio_full: t('Both audio tracks are full here. Move an audio clip first.', '这里两条声音轨都满了,请先挪开一段声音。')}[code];+ audio_full: t('Both audio tracks are full here. Move an audio clip first.', '这里两条声音轨都满了,请先挪开一段声音。'),+ no_audio: t('This clip has no sound. Please choose one with sound.', '这个素材没有声音,请选一段有声音的。')}[code];if (said) notify(said);return {ok: false, reason: code};}@@ -443,10 +449,7 @@ export function openEditor({api, app, from = null, panel = {}, components: givenawait queue.flush();}if (disposed || closing || epoch !== projectEpoch) return false;- if (queue.dirty) {- notify(t('Changes could not be saved after three tries. Check disk space, then export again.', '改动没有保存成功,已重试三次。请检查磁盘空间后再导出。'));- return false;- }+ if (queue.dirty) { notify(saveErrorText(queue.failure, t)); return false; }return !!state.record.id;}function updateTop() {diff --git a/web/editor_audio.js b/web/editor_audio.jsindex 0a61969..ec0e232 100644--- a/web/editor_audio.js+++ b/web/editor_audio.js@@ -66,7 +66,7 @@ export function createAudioIntegration({state, player, t, error, adjust, libraryconst unregisterMenu = () => { unregisterItem?.(); unregisterItem = null; stopMenu(); };const stopMenu = state.subscribe(event => { if (event.type === 'record') syncMenu(); });syncMenu();- const detachPicker = library && store ? attachReplacePicker({state, library, store, actions: integration.actions, t}) : null;+ const detachPicker = library && store ? attachReplacePicker({state, library, store, actions: integration.actions, t, error}) : null;const showJunction = () => { if (value.junction) { adjust?.element.querySelector('[data-adjust-tab="audio"]').click(); adjust?.open(); } };if (adjust) {unregister = adjust.register('audio', {diff --git a/web/editor_audio_replace.js b/web/editor_audio_replace.jsindex f61e6d3..cf07a1d 100644--- a/web/editor_audio_replace.js+++ b/web/editor_audio_replace.js@@ -25,14 +25,15 @@ const payloadOf = (key, metadata) => {return {source: {kind: key.slice(0, separator), id: key.slice(separator + 1)}, frames: metadata.frames, hasAudio: true, hasVideo: false};};// The library cards keep their own gestures; while the mode is on, "add" gestures pick instead.-export function attachReplacePicker({state, library, store, actions, t}) {+export function attachReplacePicker({state, library, store, actions, t, error = () => {}}) {const mode = replaceMode(state);async function pick(key) {const id = mode.id;await store.getSources([key]);if (mode.id !== id || id === null) return;- const payload = payloadOf(key, store.sources.get(key));- if (!payload) return;+ const metadata = store.sources.get(key), payload = payloadOf(key, metadata);+ // A pick that cannot replace says why; the mode stays on for another pick.+ if (!payload) { error(metadata && !metadata._fallback ? {reason: 'no_audio'} : new Error('source')); return; }if (actions.replaceAudio(id, payload).ok !== false) mode.cancel();}const choose = event => {@@ -40,7 +41,7 @@ export function attachReplacePicker({state, library, store, actions, t}) {const button = event.target.closest?.('.fv-ed-source-card')?.querySelector('.fv-ed-source');if (!button || button.disabled) return;event.preventDefault(); event.stopImmediatePropagation();- pick(button.dataset.key).catch(() => {});+ pick(button.dataset.key).catch(value => error(value));};const onClick = event => { if (event.target.closest?.('.fv-ed-source-add')) choose(event); };// The keys a card answers to: Enter on the card, Enter or Space on its add button.diff --git a/web/editor_store.js b/web/editor_store.jsindex ea90d2c..16f5e52 100644--- a/web/editor_store.js+++ b/web/editor_store.js@@ -5,6 +5,11 @@ const clockDefault = {now: () => Date.now(), setTimeout: (fn, ms) => setTimeout(const copy = value => structuredClone(value);const memoryProjects = new Map();const errorFor = response => Object.assign(new Error('editor_request'), {status: response.status});+// A failed save keeps the server's reason so the page can say what went wrong.+async function saveFailure(response) {+ let body = null; try { body = await response.json(); } catch {}+ return Object.assign(errorFor(response), body && typeof body === 'object' ? {reason: body.reason, response: body} : {});+}const post = value => ({method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(value)});export const sourceKey = source => source ? `${source.kind}:${source.id}` : null;import {chainRoute, createPoller, interpolate, capabilityPoints} from './chain_support.js';@@ -57,7 +62,7 @@ export function createSaveQueue({write, read, onSaved = () => {}, onConflict = (initial = null, getRecord = null, copySuffix = ' (copy)', session = null, create = null, attempt: resumedAttempt = null}) {const owner = session || holdSession();let pending = null, inFlight = null, timer = null, heartbeat = null, meta = null, retry = 0, disposed = false;- let memory = false, memoryNoticed = false, lastSaved = initial && copy(initial), failed = false, copied = false, retained = false;+ let memory = false, memoryNoticed = false, lastSaved = initial && copy(initial), failed = false, failure = null, copied = false, retained = false;let createOperation = create || (initial?.id ? null : operationId());let attempt = resumedAttempt && copy(resumedAttempt);const localKey = owner.session;@@ -108,7 +113,7 @@ export function createSaveQueue({write, read, onSaved = () => {}, onConflict = (}attempt = null; pending = {...latest, ...meta}; retain(pending); retry = 0; return;}- if (!response.ok) throw errorFor(response);+ if (!response.ok) throw await saveFailure(response);const saved = (await response.json()).project;if (disposed) return;attempt = null;@@ -119,7 +124,7 @@ export function createSaveQueue({write, read, onSaved = () => {}, onConflict = (if (pending) retain({...pending, ...meta});else { saveOutbox(localKey, null); retained = false; clock.clearTimeout(heartbeat); heartbeat = null; }} catch (error) {- failed = true;+ failed = true; failure = error;if (!disposed) {retain({...(pending || sent), ...(meta || {})});schedule(Math.min(30000, 1000 * 2 ** retry++)); onError(error);@@ -154,6 +159,8 @@ export function createSaveQueue({write, read, onSaved = () => {}, onConflict = (get recovery() { return {project: copy({...(pending || attempt?.project), ...(meta || {})}), baseline: copy(lastSaved), create: createOperation, attempt: copy(attempt)}; },dispose({discard = false} = {}) { disposed = true; clock.clearTimeout(timer); timer = null; clock.clearTimeout(heartbeat); heartbeat = null; if (discard) saveOutbox(localKey, null); if (!session) owner.dispose(); },get dirty() { return !!pending || !!attempt || !!inFlight; },+ // Why the last write failed, while that failure still stands.+ get failure() { return failed ? failure : null; },get locallyRetained() { return retained; },};}