Skip to content

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 a plain sentence when the connection drops; report export interruption and cancellation

Bowen Xuef54c7965a940
diff --git a/web/browser_extension.js b/web/browser_extension.js
index 7059a23..da8c7b9 100644
--- a/web/browser_extension.js
+++ b/web/browser_extension.js
@@ -47,6 +47,9 @@ export function isNetworkTypeError(error) {
return (type === 'TypeError' || /^TypeError:\s*/i.test(text))
&& /Failed to fetch|fetch failed|NetworkError(?: when attempting to fetch resource)?|network request failed|Load failed/i.test(text);
}
+// One sentence for a dropped connection (engine closed, network lost); the raw
+// browser wording stays in the technical details.
+export function connectionLostText(t) { return t('Lost the connection to FreeVideo. Try again once it is back.', '与 FreeVideo 的连接已断开,恢复后请重试。'); }
export function nativeFetch(fetchFunction = globalThis.fetch) {
try { return typeof fetchFunction === 'function' && /\[native code\]/.test(Function.prototype.toString.call(fetchFunction)); }
catch { return false; }
diff --git a/web/editor.js b/web/editor.js
index f57847c..a4807c8 100644
--- a/web/editor.js
+++ b/web/editor.js
@@ -1,4 +1,5 @@
import {createEditorText} from './editor_text.js';
+import {isNetworkTypeError, connectionLostText} from './browser_extension.js';
import {createToolbarMore} from './editor_toolbar_more.js';
import {isText} from './editor_text_model.js';
import {viewSwitch, viewChanged} from './view_navigation.js';
@@ -40,6 +41,7 @@ const el = (tag, cls, text) => { const e = document.createElement(tag); if (cls)
const language = () => new URLSearchParams(location.search).get('freevideo_lang') || navigator.language;
// Shared by error() and actions.reasonText: one sentence naming the failed step.
export function editorErrorText(value, t = en => en) {
+ if (isNetworkTypeError(value) || isNetworkTypeError(value?.detail)) return connectionLostText(t);
const oneLine = value => typeof value === 'string' ? value.trim().split(/[\r\n]+/).find(line => line.trim())?.trim() || '' : '';
const detail = value?.detail || (value?.error && typeof value.error === 'object' ? value.error : value);
const raw = [detail?.response?.error?.message, detail?.response?.error, detail?.response?.message,
@@ -71,6 +73,7 @@ export function editorErrorText(value, t = en => en) {
: t(`${generating} failed. Try again.`, `${generating}时出错,请再试一次。`);
}
function exportErrorText(value, t) {
+ if (isNetworkTypeError(value)) return connectionLostText(t);
const message = [value?.response?.error?.message, value?.response?.error, value?.response?.message, value?.message]
.find(text => typeof text === 'string' && text.trim() && text !== 'editor_request')?.trim().split(/[\r\n]+/)[0];
// A bare status code means nothing to the user; the server's own words do.
@@ -1036,7 +1039,7 @@ export function openEditor({api, app, from = null, panel = {}, components: given
}
if (!exportStatus) return;
updateExport(exportStatus); stopExport?.();
- stopExport = store.watchExport(exportStatus.id, updateExport);
+ stopExport = store.watchExport(exportStatus.id, updateExport, exportLost);
} finally { exportPreparing = false; updateTop(); }
},
};
@@ -1050,6 +1053,12 @@ export function openEditor({api, app, from = null, panel = {}, components: given
return (await import('./studio.js')).openExtendEditor(record, undefined, options);
}});
}
+ // The engine stopped answering mid-export: leave the percentage and say so.
+ function exportLost() {
+ if (disposed) return;
+ exportStatus = null; exportCancel.hidden = true; updateTop();
+ notify(t('Lost the connection to FreeVideo, so the export progress cannot be read. Export again once it is back.', '与 FreeVideo 的连接已断开,无法读取导出进度。恢复后请重新导出。'));
+ }
function updateExport(value) {
if (!value) return false;
if (exportSnapshot) exportSnapshot = {...exportSnapshot, id: value.project_id, revision: value.revision};
@@ -1063,6 +1072,7 @@ export function openEditor({api, app, from = null, panel = {}, components: given
: value.reason === 'unreadable' ? t('Export failed: a source file cannot be read. Import it again from the library.', '导出时出错:有素材读不出来,请在素材库重新导入。')
: t('Export failed. Try again.', '导出时出错,请再试一次。'));
}
+ if (value.state === 'cancelled') notify(t('Export cancelled. No unfinished file is kept.', '已取消导出,没有留下不完整的文件。'));
window.FreeVideoNotifyTaskDone?.({kind: 'export', id: value.id, ok: value.state === 'done'});
}
return running;
diff --git a/web/editor_store.js b/web/editor_store.js
index d24c54d..bd952b5 100644
--- a/web/editor_store.js
+++ b/web/editor_store.js
@@ -210,9 +210,14 @@ export function createEditorStore(api, {t = en => en, notify = () => {}, onGener
if (query.id) return copy(memoryProjects.get(query.id) || (query.id === 'memory' ? memoryProjects.get('memory') : null));
return copy([...memoryProjects.values()].find(record => record.tracks[0].clips[0]?.source?.id === query.work) || null);
}
- function watch(read, deliver) {
- const poller = createPoller(read, deliver, {clock, interval: pollMs}); pollers.add(poller);
- return () => { poller.dispose(); pollers.delete(poller); };
+ // lost: called once after three reads in a row fail; the watch then stops.
+ function watch(read, deliver, lost = null) {
+ let failures = 0, poller = null;
+ const stop = () => { poller?.dispose(); pollers.delete(poller); };
+ poller = createPoller(async () => { const value = await read(); failures = 0; return value; }, deliver, {clock, interval: pollMs,
+ onError: error => { if (lost && ++failures >= 3) { stop(); lost(error); } }});
+ pollers.add(poller);
+ return stop;
}
function generationAbsent() {
generationGone = true; generationRetry?.dispose();
@@ -469,7 +474,7 @@ export function createEditorStore(api, {t = en => en, notify = () => {}, onGener
if (response.status === 404 || !value) { notice('export', 'To export, update FreeVideo and restart it.', '请更新 FreeVideo 并重新启动后再导出。'); return null; }
return value?.export || null;
},
- watchExport(id, fn) { return watch(async () => (await json('/freevideo/editor/export?' + new URLSearchParams({id})))?.export || null, fn); },
+ watchExport(id, fn, lost) { return watch(async () => (await json('/freevideo/editor/export?' + new URLSearchParams({id})))?.export || null, fn, lost); },
cancelExport: id => json('/freevideo/editor/export/cancel', post({id})),
// Subtitles from speech. What this computer can recognise; null where it cannot or the server is older.
async ears() { return (await json('/freevideo/editor/ears'))?.available || null; },
diff --git a/web/error_panel.js b/web/error_panel.js
index c445225..0aeb80e 100644
--- a/web/error_panel.js
+++ b/web/error_panel.js
@@ -1,5 +1,5 @@
// Shared by the Studio and graph view. Text only; never render exception HTML.
-import {detectBrowserExtension, browserExtensionAdvice, extensionSteps} from './browser_extension.js';
+import {detectBrowserExtension, browserExtensionAdvice, extensionSteps, isNetworkTypeError, connectionLostText} from './browser_extension.js';
import {SAMPLING_EFFORTS, STEP_CACHES, UPSCALE_FACTORS, tableLevel} from './sampling_effort.js';
import {failureIssue, failureStage} from './failure_issue.js';
const reports = new WeakSet();
@@ -416,10 +416,14 @@ function showFailureDialog(report, t) {
const shownCause = text => text.replace(/\s*Use PYTORCH_MPS_HIGH_WATERMARK_RATIO=[\d.]+ to disable upper limit for memory allocations(?: \(may cause system failure\))?\.?/g, '');
/** The written title and explanation for a report, and whether it gets the packaged layout (not a rejected input). */
-export function adviceFor(report, t) {
+export function adviceFor(report, t, value) {
const advice = report.browser_extension
? browserExtensionAdvice(report.browser_extension, t)
: failureAdvice(report.details, t, report.known_error ?? null);
+ // A dropped connection reads as one sentence; the browser's own wording stays in the details.
+ if (advice.kind === 'unknown' && isNetworkTypeError(value) && ['submission', 'queue'].includes(report.stage)) {
+ Object.assign(advice, {kind: 'connection', title: t('Lost the connection to FreeVideo', '与 FreeVideo 的连接已断开'), summary: connectionLostText(t), action: ''});
+ }
if (report.stage === 'submission' && advice.kind === 'unknown') {
advice.title = t('The task could not be submitted', '任务提交失败');
advice.summary = '';
@@ -534,7 +538,7 @@ export function createErrorPanel(t) {
head.append(title, actions); element.append(head, explanation, location, cause, action, disclosure, privacy, downloadStatus);
return {element, show(value, popup = true, context = {}) {
const report = createErrorReport(value, context); currentReport = report;
- const {advice, generated} = adviceFor(report, t);
+ const {advice, generated} = adviceFor(report, t, value);
title.textContent = advice.title; explanation.textContent = advice.summary; explanation.hidden = !advice.summary; action.textContent = advice.action;
element.querySelector('.fv-extension-steps')?.remove();
if (advice.kind === 'browser-extension') action.after(extensionSteps(advice));
diff --git a/web/library.js b/web/library.js
index 6073271..98814f0 100644
--- a/web/library.js
+++ b/web/library.js
@@ -3,6 +3,7 @@ import { closeDialog } from './motion.js';
import { resultActions, previewBadge, icon } from './result_actions.js';
import { videoUnavailableText } from './studio_extend.js';
import { topDialog } from './dialog_keys.js';
+import { isNetworkTypeError, connectionLostText } from './browser_extension.js';
const style = document.createElement('link');
style.rel = 'stylesheet'; style.href = new URL('./library.css', import.meta.url).href; document.head.append(style);
@@ -660,7 +661,7 @@ export function openLibrary(t, {upscale = null, selectedWork = null, extend = nu
} else select(rows.get(selected), false);
ok = true; regroup();
if (selectedWork) { const row = [...rows.values()].find(row => row.id === selectedWork || row.video === selectedWork); if (row) { select(row); selectedWork = null; } else if (next) queueMicrotask(() => load(true)); }
- } catch (error) { if (!disposed && error.name !== 'AbortError') message.textContent = error.message; }
+ } catch (error) { if (!disposed && error.name !== 'AbortError') message.textContent = isNetworkTypeError(error) ? connectionLostText(t) : error.message; }
finally { if (!disposed) { loading = false; refresh.disabled = more.disabled = false; } }
return ok;
}
diff --git a/web/studio.js b/web/studio.js
index 111c1c8..0e72658 100644
--- a/web/studio.js
+++ b/web/studio.js
@@ -19,6 +19,7 @@ import { openLibrary } from './library.js';
import { createRecentVideos } from './studio_recent.js';
import { createAgentActivity } from './agent_activity.js';
import { createStudioQueue, randomSeed, turnNodeOn } from './studio_queue.js';
+import { isNetworkTypeError, connectionLostText } from './browser_extension.js';
import { attachReferencePicker, referenceItems, syncReferencePrompt, referenceInputs, mentionAt, handleNames, mediaRows } from './prompt_references.js';
import { attachTermSuggest } from './prompt_terms.js';
import { castInRows, expandCast, mentionHandle, mentionState, mentionedIds, withCharacter, MAX_PICTURES_EACH } from './cast_mention.js';
@@ -48,6 +49,8 @@ const languageOverride = typeof location !== 'undefined'
const cn = languageOverride === 'zh' || (languageOverride !== 'en'
&& String(navigator.language || '').toLowerCase().startsWith('zh'));
const t = (en, zh) => cn ? zh : en;
+// A dropped connection gets one plain sentence, not the browser's "Failed to fetch".
+const shownMessage = error => isNetworkTypeError(error) ? connectionLostText(t) : error.message;
// The usual LoRA strength range is -4 to 4; a value the user types by hand may go further, up to 100.
const LORA_USUAL = 4, LORA_LIMIT = 100;
let loraRangeCount = 0;
@@ -479,7 +482,7 @@ export function loraPanel(node, panel, {promptNode = null} = {}) {
});
async function refresh() {
try { const response = await api.fetchApi('/models/loras', {cache: 'no-store'}); if (!response.ok) throw new Error(response.statusText); const listed = await response.json(); verdicts.clear(); skipped = (Array.isArray(listed) ? listed : []).filter(n => typeof n === 'string' && /\.(ckpt|pt|pth|bin|sft)$/i.test(n)).length; names = (Array.isArray(listed) ? listed : []).filter(n => typeof n === 'string' && n.toLowerCase().endsWith('.safetensors')); render(); }
- catch (error) { if (!disposed) note.textContent = error.message; }
+ catch (error) { if (!disposed) note.textContent = shownMessage(error); }
}
// Only deselects: the files stay in the folder and the recent names are kept.
const clear = button(t('Clear', '清空'), () => { write([]); });
@@ -1162,7 +1165,7 @@ export function openStudio(node, {extendFrom = null} = {}) {
// A browser extension gets the shared card; other failures stay in the status line.
function resultActionFailed(error) {
if (extensionCause(error)) { showQueueError(error); return; }
- status.dataset.error = 'true'; status.textContent = error.message;
+ status.dataset.error = 'true'; status.textContent = shownMessage(error);
}
const trimNote = el('div', '', 'fv-note fv-trim-note'); trimNote.hidden = true; trimNote.setAttribute('role', 'status');
// Run second pass is the preview's primary action in the result bar.
@@ -1386,7 +1389,7 @@ export function openStudio(node, {extendFrom = null} = {}) {
missing_node: t('This node is disabled or no longer in the workflow.', '该节点已禁用或已从工作流移除。'),
chain_cancel_failed: t('Could not cancel. Refresh the page and try again.', '没有取消成功,请刷新页面后再试。'),
chain_resume_failed: t('Could not continue. Refresh the page and try again.', '没有继续生成,请刷新页面后再试。'),
- }[error?.message] || (error?.said ? t(error.said[0], error.said[1]) : null) || error?.message || String(error));
+ }[error?.message] || (error?.said ? t(error.said[0], error.said[1]) : null) || (isNetworkTypeError(error) ? connectionLostText(t) : error?.message) || String(error));
let lastQueueError = null;
function showQueueError(error) {
if (disposed) return;