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.

Recover from a script that fails to load once, and say why the creative workspace is missing (0.3.14) (#120)

Bowen Xue1b2a62cc9d5b
diff --git a/freevideo_engine/comfy_launcher_api.py b/freevideo_engine/comfy_launcher_api.py
index ca719f4..bea7005 100644
--- a/freevideo_engine/comfy_launcher_api.py
+++ b/freevideo_engine/comfy_launcher_api.py
@@ -7,15 +7,41 @@ from pathlib import Path
def page_report(value):
- """The browser page's own check, bounded; None for anything else."""
- if not isinstance(value, dict) or value.get('state') not in ('ready', 'error'):
+ """The browser page's own check, bounded; None for anything else.
+
+ 'loading' arrives as soon as FreeVideo's page script starts, before its
+ check ends with 'ready' or 'error'.
+ """
+ if not isinstance(value, dict) or value.get('state') not in ('loading', 'ready', 'error'):
return None
rows = lambda key, count, limit: ([p[:limit] for p in value[key][:count] if isinstance(p, str)]
if isinstance(value.get(key), list) else [])
text = lambda key, limit: value.get(key)[:limit] if isinstance(value.get(key), str) else ''
return dict(state=value['state'], problems=rows('problems', 8, 500), errors=rows('errors', 40, 300),
ready=value.get('ready') is True, launch=value.get('launch') is True, view=text('view', 20),
- agent=text('agent', 300), frontend=text('frontend', 40), page=text('page', 200), at=time.time())
+ agent=text('agent', 300), frontend=text('frontend', 40), page=text('page', 200),
+ client=text('client', 80), at=time.time())
+
+
+PAGE_SCRIPTS_MISSING = (
+ 'FreeVideo’s page scripts have not run in this browser, so the creative workspace is missing. '
+ 'Press Ctrl+F5 to reload the page. If it stays missing, open the FreeVideo launcher, '
+ 'click Settings › Install / repair, and open FreeVideo again. '
+ '浏览器没有运行 FreeVideo 的页面脚本,所以看不到创作面板。请按 Ctrl+F5 强制刷新页面;'
+ '仍然没有时,请在 FreeVideo 启动器的“设置”里点击“安装 / 修复”,然后重新打开 FreeVideo。')
+
+
+def page_notice(server):
+ """Text for the generating node when no FreeVideo page has reported to this ComfyUI.
+
+ The page check names its problems on the page, but it is itself one of
+ FreeVideo's page scripts. When none of them runs, the nodes still generate
+ and nothing on the page says the workspace is missing; ComfyUI's own node
+ text is then the only place left to say so.
+ """
+ if server is None or getattr(server, '_freevideo_launcher', None) is None:
+ return ''
+ return '' if getattr(server, '_freevideo_page_reported', None) else PAGE_SCRIPTS_MISSING
def save_page_report(engine_root, report):
@@ -72,9 +98,10 @@ def register():
except ValueError:
report = None
if report is None:
- return web.json_response(dict(error='Expected {"state": "ready" | "error", "problems": [...]}'), status=400)
+ return web.json_response(dict(error='Expected {"state": "loading" | "ready" | "error", "problems": [...]}'), status=400)
report['source'] = info['source']
page.clear(); page.update(report)
+ server._freevideo_page_reported = report['at']
try:
save_page_report(info['engine_root'], report)
except OSError as error:
diff --git a/freevideo_engine/comfy_nodes.py b/freevideo_engine/comfy_nodes.py
index 74dff8f..4134fcf 100644
--- a/freevideo_engine/comfy_nodes.py
+++ b/freevideo_engine/comfy_nodes.py
@@ -1,4 +1,5 @@
"""Optional ComfyUI V3 nodes. Never import these from the standalone CLI."""
+import logging
from pathlib import Path
from comfy_api.latest import ComfyExtension, InputImpl, io, ui
@@ -100,6 +101,14 @@ class FreeVideoGenerate(io.ComfyNode):
bar = ProgressBar(base_steps + (refine_steps if two_pass and not preview else 0), node_id=node_id)
last_message = [None]
last_count = [None]
+ # Without FreeVideo's page scripts the nodes still generate; say why the
+ # creative workspace is missing in ComfyUI's own node text.
+ from .comfy_launcher_api import page_notice
+ notice = page_notice(PromptServer.instance)
+ if notice:
+ logging.warning('[FreeVideo] %s', notice)
+ PromptServer.instance.send_progress_text(notice, node_id)
+ notice = notice + '\n' if notice else ''
def progress(message):
if message.get('result_cache_hit'):
result_reused[0] = True
@@ -113,7 +122,7 @@ class FreeVideoGenerate(io.ComfyNode):
publish(server, node_id, message)
if server is not None:
detail = message.get('detail')
- server.send_progress_text(label + (' · ' + detail if detail else ''), node_id)
+ server.send_progress_text(notice + label + (' · ' + detail if detail else ''), node_id)
last_message[0] = dict(message)
def release():
cpu_prewarm = IDLE.stop()
diff --git a/freevideo_engine/release_notes.json b/freevideo_engine/release_notes.json
index 51d1d1c..7759005 100644
--- a/freevideo_engine/release_notes.json
+++ b/freevideo_engine/release_notes.json
@@ -1,21 +1,42 @@
{
"schema": 1,
- "product_version": "0.3.13",
+ "product_version": "0.3.14",
"en": {
- "summary": "Choosing another location for an automatic installation after an offline one now installs there.",
+ "summary": "When a FreeVideo script fails to load once, the page now recovers by itself, and when the creative workspace cannot be seen, the page or the node says why.",
"changes": [
- "After an installation from offline packages, an automatic installation set up in another folder installs into that folder. It no longer reuses the offline installation's engine folder and stops at \"Failed step: vdn-source\".",
- "An automatic installation pointed at an offline installation's own folder is explained before it starts, with the choice to open that installation or pick another folder."
+ "If the browser fails to load one of FreeVideo's scripts while the ComfyUI page opens, the page refreshes its copies of FreeVideo's files and reloads itself once, returning to the address it was opened with. Before, the page stayed incomplete until a hard reload. The automatic reload is skipped once you have clicked or typed on the page.",
+ "If the scripts still fail after that reload, the message says so and suggests Ctrl+F5 or checking browser extensions, and the copied details include what the browser cache held for each failed file.",
+ "If a FreeVideo node is on the canvas but neither the creative workspace nor the toolbar that opens it can be seen, the page now says so and names the cause, such as a stylesheet that did not load. This is checked on every visit and whenever another workflow comes to the front, not only when the launcher opens the page.",
+ "If FreeVideo’s page scripts do not run in the browser at all, the generating node now shows the cause and what to do in its progress text, since the page itself cannot."
]
},
"zh": {
- "summary": "离线安装之后改用自动安装并选择其他位置时,会安装到新选的位置。",
+ "summary": "FreeVideo 的脚本在页面打开时偶尔加载失败,现在页面会自行恢复;看不到创作面板时,页面或节点会说明原因。",
"changes": [
- "用离线包安装后,在安装设置里换一个位置进行自动安装,会安装到新选的位置;不再沿用离线安装的引擎目录,也不再停在“Failed step: vdn-source”。",
- "如果自动安装指向离线安装所在的位置,安装计划页会在开始前说明,并提示在启动页直接打开这份安装或换一个位置。"
+ "打开 ComfyUI 页面时,如果浏览器有一个 FreeVideo 脚本没能加载,页面会重新下载 FreeVideo 的文件并自动刷新一次,回到最初打开的地址。之前页面会一直不完整,直到手动强制刷新。如果你已经在页面上点击或输入过,就不会自动刷新。",
+ "自动刷新后仍然失败时,提示会说明已经刷新过,并建议按 Ctrl+F5 或检查浏览器插件;复制的详情里还会列出每个失败文件在浏览器缓存中的情况。",
+ "画布上有 FreeVideo 节点、却看不到创作面板和打开它的工具栏时,页面会提示并写明原因,例如某个样式文件没有加载。每次打开页面、切换工作流时都会检查,不再只在从启动器打开时检查。",
+ "如果浏览器完全没有运行 FreeVideo 的页面脚本,页面本身无法提示,生成节点会在进度文字里说明原因和处理办法。"
]
},
"history": [
+ {
+ "product_version": "0.3.13",
+ "en": {
+ "summary": "Choosing another location for an automatic installation after an offline one now installs there.",
+ "changes": [
+ "After an installation from offline packages, an automatic installation set up in another folder installs into that folder. It no longer reuses the offline installation's engine folder and stops at \"Failed step: vdn-source\".",
+ "An automatic installation pointed at an offline installation's own folder is explained before it starts, with the choice to open that installation or pick another folder."
+ ]
+ },
+ "zh": {
+ "summary": "离线安装之后改用自动安装并选择其他位置时,会安装到新选的位置。",
+ "changes": [
+ "用离线包安装后,在安装设置里换一个位置进行自动安装,会安装到新选的位置;不再沿用离线安装的引擎目录,也不再停在“Failed step: vdn-source”。",
+ "如果自动安装指向离线安装所在的位置,安装计划页会在开始前说明,并提示在启动页直接打开这份安装或换一个位置。"
+ ]
+ }
+ },
{
"product_version": "0.3.12",
"en": {
@@ -250,23 +271,6 @@
"安装位置的路径中有空格(例如「Comfy UI」)时,安装会停在 PyTorch 步骤并报「File not found」。现在可以正常安装。"
]
}
- },
- {
- "product_version": "0.3.1",
- "en": {
- "summary": "Fixes the int8 upgrade on older installations and importing the Environment ZIP.",
- "changes": [
- "Older installations could not upgrade to the int8 model: the upgrade stopped with \"The download is larger than shown\". The size shown now includes every file the upgrade downloads, such as the sampling tables, so the upgrade goes through.",
- "Importing the Environment ZIP failed with \"No such file or directory: windows-portable.txt\". It imports again."
- ]
- },
- "zh": {
- "summary": "修复较早安装的用户无法升级到 int8 模型,以及运行环境包无法导入的问题。",
- "changes": [
- "较早安装的用户升级到 int8 模型时,会停在「下载比显示的大」。现在显示的下载量包含升级要下载的全部文件(例如采样表),可以正常完成升级。",
- "导入运行环境包时会报「找不到 windows-portable.txt」,现在可以正常导入。"
- ]
- }
}
]
}
diff --git a/web/health.js b/web/health.js
index 009c21e..a775997 100644
--- a/web/health.js
+++ b/web/health.js
@@ -16,6 +16,19 @@ export const MODULES = ['branding.js', 'compatibility.js', 'error_panel.js', 'fr
'result_actions.js', 'sampling_effort.js', 'setup.js', 'share.js', 'studio.js', 'studio_queue.js',
'updates.js', 'view_navigation.js'];
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
+// A file the browser failed to load stays failed for the page's lifetime even
+// once the server sends it again, and a plain reload can take the same broken
+// copy from the HTTP cache. So when every script is reachable but some would
+// not run, the page refreshes the cache and reloads itself once.
+const RETRY_KEY = 'freevideo.page-retry';
+const RETRY_WINDOW = 5 * 60000;
+// null when this browser keeps no session storage: then nothing retries.
+const retryRecord = (() => {
+ try { return JSON.parse(sessionStorage.getItem(RETRY_KEY) || '{}') || {}; } catch { return null; }
+})();
+const retried = !!retryRecord && Date.now() - (Number(retryRecord.at) || 0) < RETRY_WINDOW;
+// Any click or key outside FreeVideo's own panels: a reload could lose edits.
+let touched = false;
const fileName = url => decodeURIComponent(String(url).split(/[?#]/)[0].split('/').pop() || String(url));
const ours = url => typeof url === 'string' && url.startsWith(base.href);
@@ -37,6 +50,8 @@ function receive(item) {
// Only the first copy of this file listens; see the end of the file.
function install() {
+ const touch = event => { if (!event.target?.closest?.('.fv-studio, .fv-health')) touched = true; };
+ addEventListener('pointerdown', touch, true); addEventListener('keydown', touch, true);
addEventListener('error', event => {
const target = event.target;
if (target && target !== window && (target.href || target.src)) note('resource', target.href || target.src, {url: target.href || target.src});
@@ -61,8 +76,8 @@ function install() {
}
const comfy = () => window.app?.graph ? window.app : window.comfyAPI?.app?.app?.graph ? window.comfyAPI.app.app : null;
-const studioWorkflow = graph => (graph?._nodes || graph?.nodes || []).some(n => n.comfyClass === 'FreeVideoGenerate' || n.type === 'FreeVideoGenerate')
- && !!graph?.extra?.freevideo_studio;
+const hasGenerate = graph => (graph?._nodes || graph?.nodes || []).some(n => n.comfyClass === 'FreeVideoGenerate' || n.type === 'FreeVideoGenerate');
+const studioWorkflow = graph => hasGenerate(graph) && !!graph?.extra?.freevideo_studio;
const preferredView = () => { try { return localStorage.getItem('freevideo.view'); } catch { return null; } };
async function waitFor(test, ms) {
const end = Date.now() + ms;
@@ -97,9 +112,20 @@ const ADVICE = {
'同时有其他 ComfyUI 插件报错。可在 ComfyUI“设置 › 扩展”里暂时停用它,然后刷新页面。'),
reload: t('Reload the page. If it happens again, copy the details and send them to us.',
'请刷新页面。仍然出现时,复制详情发给我们。'),
+ cache: t('FreeVideo already reloaded this page once with fresh copies of its files. Press Ctrl+F5. If it still fails, turn off browser extensions that block scripts on this page or open the same address in another browser, then copy the details and send them to us.',
+ 'FreeVideo 已经用重新下载的文件自动刷新过一次页面。请按 Ctrl+F5 强制刷新;仍然出现时,请停用会拦截此页面脚本的浏览器插件,或换一个浏览器打开同一地址,然后复制详情发给我们。'),
relaunch: t('Click Start in the FreeVideo launcher again.', '请在 FreeVideo 启动器里重新点击“启动”。'),
};
+// What the HTTP cache holds for a file, which is what a module load reads.
+async function cachedCopy(url) {
+ try {
+ const response = await fetch(url, {cache: 'only-if-cached', mode: 'same-origin'});
+ const type = (response.headers.get('content-type') || '').split(';')[0].trim() || 'no type';
+ return `HTTP ${response.status} ${type}, ${(await response.arrayBuffer()).byteLength} bytes`;
+ } catch { return 'none'; }
+}
+
// One sentence per finding, naming the file and the reason.
async function diagnoseModules() {
const found = [];
@@ -125,9 +151,15 @@ async function diagnoseModules() {
}
for (const [message, names] of failed) {
const list = names.length > 3 ? `${names.slice(0, 3).join(cn ? '、' : ', ')}${t(` and ${names.length - 3} more`, ` 等 ${names.length} 个文件`)}` : names.join(cn ? '、' : ', ');
+ const kind = /does not provide an export/.test(message) ? 'mixed'
+ : /SyntaxError|Unexpected token|Unexpected identifier|is not a function|is not defined|is not a constructor/.test(message) ? 'browser' : 'reload';
+ const cache = [];
+ for (const name of names) cache.push(`${name}: ${await cachedCopy(new URL(name, base).href)}`);
+ // Reachable files the browser would not run, or old and new copies mixed:
+ // fresh copies and one reload resolve both.
+ const retry = kind !== 'browser';
found.push({text: t(`The browser could not run ${list}: ${message}`, `浏览器无法运行 ${list}:${message}`),
- advice: /does not provide an export/.test(message) ? 'mixed'
- : /SyntaxError|Unexpected token|Unexpected identifier|is not a function|is not defined|is not a constructor/.test(message) ? 'browser' : 'reload'});
+ advice: retry && retried ? 'cache' : kind, retry, cache});
}
return found;
}
@@ -192,6 +224,72 @@ function pluginErrors() {
text: t(`Extension ${fileName(name)} reported an error: ${text.slice(0, 240)}`, `插件 ${fileName(name)} 报错:${text.slice(0, 240)}`), advice: 'plugin'}));
}
+// Whenever the workflow in front has a FreeVideo node, the creative workspace
+// or the toolbar that opens it must be on screen. The nodes still generate
+// without them, so a page missing both looks like it works.
+function onScreen(element) {
+ if (!element?.isConnected || element.hidden) return false;
+ const style = getComputedStyle(element);
+ if (style.display === 'none' || style.visibility === 'hidden' || Number(style.opacity) === 0) return false;
+ const box = element.getBoundingClientRect();
+ return box.width > 0 && box.height > 0 && box.bottom > 0 && box.right > 0 && box.top < innerHeight && box.left < innerWidth;
+}
+
+// Unstyled, the toolbar sits in the page's flow under ComfyUI's full-window
+// canvas: inside the window, sized, and invisible. Look at what is on top of
+// its view switch; a dialog, menu, toast or this card only passes over it.
+const OVERLAYS = 'dialog, [role="dialog"], [role="menu"], .p-dialog-mask, .p-overlay-mask, .p-toast, .litecontextmenu, .fv-health';
+function covered(bar) {
+ const box = (bar.querySelector('.fv-view-switch') || bar).getBoundingClientRect();
+ const top = document.elementFromPoint(Math.min(innerWidth - 1, Math.max(0, box.left + box.width / 2)),
+ Math.min(innerHeight - 1, Math.max(0, box.top + box.height / 2)));
+ return !!top && !bar.contains(top) && !top.closest(OVERLAYS);
+}
+
+// Our sheets are same-origin and never empty: rules that cannot be read were not loaded.
+function sheetLoaded(name) {
+ const link = [...document.querySelectorAll('link[rel="stylesheet"]')].find(item => ours(item.href) && fileName(item.href) === name);
+ if (!link || seen.some(row => row.kind === 'resource' && fileName(row.url || '') === name)) return false;
+ try { return link.sheet.cssRules.length > 0; } catch { return false; }
+}
+
+function workspaceProblem(app) {
+ // Scripts that never started are already named by the load check.
+ if (!window.FreeVideoUI?.ready || !hasGenerate(app.graph)) return null;
+ const studio = document.querySelector('dialog.fv-studio[open]');
+ if (studio) return onScreen(studio) ? null
+ : {text: t('The creative workspace is open but cannot be seen on the page.', '创作面板已经打开,但页面上看不到。'), advice: 'reload'};
+ const bar = document.querySelector('.fv-view-navigation');
+ if (!bar) return {text: t('The FreeVideo toolbar that opens the creative workspace is missing from the page.', '页面上没有打开创作面板的 FreeVideo 工具栏。'), advice: 'reload'};
+ if (onScreen(bar) && !covered(bar)) return null;
+ // Its own stylesheet places it above the canvas.
+ return sheetLoaded('view_navigation.css')
+ ? {text: t('The FreeVideo toolbar that opens the creative workspace is hidden or covered by other page elements.', '打开创作面板的 FreeVideo 工具栏被页面上的其他元素隐藏或遮挡了。'), advice: 'plugin'}
+ : {text: t('The FreeVideo toolbar that opens the creative workspace cannot be seen: its stylesheet view_navigation.css did not load.',
+ '看不到打开创作面板的 FreeVideo 工具栏:样式文件 view_navigation.css 没有加载。'), advice: 'reload'};
+}
+
+// Looks again as the page changes, such as another workflow coming to the
+// front. A miss counts once it persists after the toolbar was asked to refresh.
+async function watchWorkspace(app) {
+ let missed = '', shown = '';
+ for (;;) {
+ await sleep(2500);
+ if (document.hidden) continue;
+ const problem = workspaceProblem(app);
+ if (!problem) { missed = ''; continue; }
+ if (missed !== problem.text) {
+ missed = problem.text;
+ window.dispatchEvent(new CustomEvent('freevideo-navigation-refresh'));
+ continue;
+ }
+ if (shown === problem.text) continue;
+ shown = problem.text;
+ const problems = distinct([...lastProblems, problem, ...reports.filter(item => item.type === 'error').map(reportText), ...pluginErrors()]);
+ show(problems); send('error', problems);
+ }
+}
+
function reportText(item) {
const where = {studio: t('The creative workspace could not open', '创作面板打不开'),
navigation: t('The FreeVideo toolbar could not be added', 'FreeVideo 工具栏没有加载'),
@@ -204,15 +302,34 @@ function reportText(item) {
const distinct = problems => problems.filter((problem, index) => problems.findIndex(other => other.text === problem.text) === index);
let card = null, lastProblems = [];
function details(problems) {
+ const cache = problems.flatMap(p => p.cache || []);
+ const before = retried && Array.isArray(retryRecord.before) ? retryRecord.before : [];
return [`FreeVideo page check · ${new Date().toISOString()}`,
`Page: ${location.origin}${location.pathname}`,
`Browser: ${navigator.userAgent}`,
`ComfyUI frontend: ${window.__COMFYUI_FRONTEND_VERSION__ || 'unknown'}`,
`FreeVideo UI: ${JSON.stringify(window.FreeVideoUI || {})}`,
+ `Automatic reload: ${retried ? new Date(Number(retryRecord.at)).toISOString() : retryRecord ? 'not needed' : 'unavailable (no session storage)'}`,
'', 'Problems:', ...problems.map(p => `- ${p.text}`),
+ ...(cache.length ? ['', 'Browser cache:', ...cache.map(row => `- ${row}`)] : []),
+ ...(before.length ? ['', 'Browser cache before the automatic reload:', ...before.map(row => `- ${row}`)] : []),
'', 'Errors seen while loading:', ...(seen.length ? seen.map(row => `- [${row.kind}] ${row.text}`) : ['- none'])].join('\n');
}
+// The automatic reload: fresh copies into the HTTP cache, then the address the
+// page was opened with, before launcher.js removed its launch flag. Reported to
+// the launcher only if it fails again, so its card does not flash.
+async function reloadOnce(problems) {
+ if (!retryRecord || retried || touched) return false;
+ try {
+ sessionStorage.setItem(RETRY_KEY, JSON.stringify({at: Date.now(), before: problems.flatMap(p => p.cache || [])}));
+ } catch { return false; }
+ await Promise.all(MODULES.map(name => fetch(new URL(name, base), {cache: 'reload'}).catch(() => null)));
+ if (touched) return false;
+ location.replace(performance.getEntriesByType('navigation')[0]?.name || location.href);
+ return true;
+}
+
function show(problems) {
lastProblems = problems;
card?.remove();
@@ -271,12 +388,16 @@ new MutationObserver(() => {
try { card.hidePopover(); card.showPopover(); } catch { /* Shown below the dialog instead. */ }
}).observe(document.documentElement, {subtree: true, attributeFilter: ['open']});
-let sent = '';
+let sent = '', latest = null;
+const comfyApi = () => comfy()?.api || window.comfyAPI?.api?.api;
function send(state, problems) {
// Kept with diagnostic reports, so a report from this computer names the cause.
+ // 'loading' tells ComfyUI this page runs FreeVideo's scripts before the check ends.
+ latest = {state, problems};
const body = JSON.stringify({state, problems: problems.map(p => p.text), errors: seen.map(row => `[${row.kind}] ${row.text}`),
ready: !!window.FreeVideoUI?.ready, launch: launchVisit, view: preferredView() || '',
- agent: navigator.userAgent, frontend: String(window.__COMFYUI_FRONTEND_VERSION__ || ''), page: location.pathname});
+ agent: navigator.userAgent, frontend: String(window.__COMFYUI_FRONTEND_VERSION__ || ''), page: location.pathname,
+ client: String(comfyApi()?.clientId || '')});
if (body === sent) return;
sent = body;
fetch(new URL('../../api/freevideo/launcher/ui', base), {method: 'POST', headers: {'Content-Type': 'application/json'}, body, keepalive: true})
@@ -284,11 +405,14 @@ function send(state, problems) {
}
async function check() {
+ send('loading', []);
const app = await waitFor(comfy, 60000);
if (!app) {
const problems = [{text: t('The ComfyUI page did not finish loading within a minute.', 'ComfyUI 页面在一分钟内没有加载完成。'), advice: 'browser'}];
show(problems); send('error', problems); return;
}
+ // A restarted ComfyUI has not heard from this page; tell it again.
+ comfyApi()?.addEventListener?.('reconnected', () => { if (latest) { sent = ''; send(latest.state, latest.problems); } });
// freevideo.js marks itself ready in its setup; launcher.js reports once
// the workflow is open and in front.
await waitFor(() => window.FreeVideoUI?.ready, 10000);
@@ -297,7 +421,10 @@ async function check() {
await sleep(1500);
const problems = [];
const ui = window.FreeVideoUI || {};
- if (!ui.ready) problems.push(...await diagnoseModules());
+ if (!ui.ready) {
+ problems.push(...await diagnoseModules());
+ if (problems.length && problems.every(p => p.retry) && await reloadOnce(problems)) return;
+ }
if (!ui.ready && !problems.length) problems.push({text: t('FreeVideo’s scripts loaded, but ComfyUI did not start them.', 'FreeVideo 的脚本已下载,但 ComfyUI 没有启动它们。'), advice: 'reload'});
if (!problems.length) problems.push(...await diagnoseStyles());
if (launchVisit && !problems.length) {
@@ -327,6 +454,7 @@ async function check() {
const problems = distinct([...lastProblems, reportText(item)]);
show(problems); send('error', problems);
};
+ watchWorkspace(app).catch(error => consoleError.call(console, '[FreeVideo] Workspace check failed:', error));
}
// A second FreeVideo folder loads this file again; one check covers both.
diff --git a/web/view_navigation.js b/web/view_navigation.js
index 3a05ae8..30805cf 100644
--- a/web/view_navigation.js
+++ b/web/view_navigation.js
@@ -91,4 +91,10 @@ export function installNavigation(openStudio) {
}
toolbar.append(createUpdateNotice(cn).element);
document.body.append(toolbar); refreshNavigation();
+ // health.js asks for this before it reports the toolbar missing. A
+ // workspace removed without closing must not keep the toolbar hidden.
+ globalThis.window?.addEventListener('freevideo-navigation-refresh', () => {
+ if (currentView === 'studio' && !document.querySelector('dialog.fv-studio[open]')) currentView = 'nodes';
+ refreshNavigation();
+ });
}