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.
Report a problem next to failures everywhere
Bowen Xueaaccdf213393
diff --git a/freevideo_engine/agent/routes.py b/freevideo_engine/agent/routes.pyindex 7bd133f..1b5995c 100644--- a/freevideo_engine/agent/routes.py+++ b/freevideo_engine/agent/routes.py@@ -1078,12 +1078,24 @@ def register():raise JobError('not_found', 'No conversation')# Work in progress still writes into its conversation; finished videos stay in the library.# New work is refused first, so what is counted below cannot grow before the file goes.+ def busy(leaving=()):+ return (any(r.get('session') == sid and r['status'] in ACTIVE and r['status'] not in leaving for r in jobs.rows())+ or any(f['session'] == sid and not f['paused']+ for f in jobs.productions.list(status='active', limit=None)))+ stop = value.get('stop') is True+ if stop: # The user confirmed: stop its jobs and pause its films first, as the stop button does.+ jobs.stop_session(sid)+ for _ in range(20): # A running job takes a moment to reach its cancelled state.+ with jobs.lock:+ if not busy():+ break+ time.sleep(0.25)store.begin_delete(sid)try:with jobs.lock: # Productions share it.- if (any(r.get('session') == sid and r['status'] in ACTIVE for r in jobs.rows())- or any(f['session'] == sid and not f['paused']- for f in jobs.productions.list(status='active', limit=None))):+ # After the user's stop, a job still winding down no longer holds the conversation: its+ # writes are refused once deletion begins, so a stuck one cannot block deleting forever.+ if busy(('cancelling',) if stop else ()):raise JobError('conflict', 'Work is in progress in this conversation')store.delete(sid)except BaseException:diff --git a/freevideo_engine/agent/schema.py b/freevideo_engine/agent/schema.pyindex 79fa2b4..d49a475 100644--- a/freevideo_engine/agent/schema.py+++ b/freevideo_engine/agent/schema.py@@ -437,7 +437,7 @@ def contracts(*, local=False):('/activity/cancel', 'POST', obj({'id': JOB}, ('id',))), ('/connect', 'GET', None),('/connect/reset', 'POST', EMPTY), ('/chat', 'GET', None), ('/chat/now', 'GET', None),('/chat/video', 'GET', None), ('/chat/list', 'GET', None), ('/chat/new', 'POST', EMPTY),- ('/chat/delete', 'POST', obj({'session': SESSION}, ('session',))),+ ('/chat/delete', 'POST', obj({'session': SESSION, 'stop': {'type': 'boolean'}}, ('session',))),('/chat', 'POST', obj({'text': string(8000), 'id': CHAT_ID, 'session': SESSION, 'whitebox': {'type': 'boolean'}}, ('text', 'id'))),('/chat/confirm', 'POST', obj({'id': string(12, pattern=r'^cf[0-9a-f]{10}$'), 'approve': {'type': 'boolean'},'session': SESSION}, ('id', 'approve')))):diff --git a/freevideo_engine/comfy_launcher.py b/freevideo_engine/comfy_launcher.pyindex 345fd9c..6fb0265 100644--- a/freevideo_engine/comfy_launcher.py+++ b/freevideo_engine/comfy_launcher.py@@ -587,9 +587,10 @@ class Launcher:row['shortcut']['error'], '安装已完成,但无法创建桌面快捷方式。可继续使用启动器。\n' + row['shortcut']['error'])if self.error_text:self.copy_error_button.pack(side='left', padx=6)+ self.report_error_button.pack(side='left', padx=6)self.review_card.pack(fill='x', pady=12)else:- self.copy_error_button.pack_forget(); self.review_card.pack_forget()+ self.copy_error_button.pack_forget(); self.report_error_button.pack_forget(); self.review_card.pack_forget()self.review.configure(state='normal'); self.review.delete('1.0', 'end')self.review.insert('1.0', self.error_text)# Only as tall as the retained text, so a one-line failure is one line.@@ -691,6 +692,12 @@ class Launcher:self.window.clipboard_clear()self.window.clipboard_append(self.error_text)+ def report_error(self):+ if self.error_text:+ from .launcher_issue import issue_url+ from .windows_ux import open_browser+ open_browser(issue_url(self.error_text, __version__, None, zh=self.zh))+def show_details(self):dialog = self.tk.Toplevel(self.window); dialog.title(self.t('FreeVideo · Details', 'FreeVideo · 详情'))dialog.configure(bg=branding.BACKGROUND)diff --git a/freevideo_engine/launcher/Main.qml b/freevideo_engine/launcher/Main.qmlindex e8578e2..a904505 100644--- a/freevideo_engine/launcher/Main.qml+++ b/freevideo_engine/launcher/Main.qml@@ -446,6 +446,7 @@ ApplicationWindow {text: t("Download the latest ↗", "下载最新版 ↗"); onClicked: backend.link("https://github.com/FlashML-org/FreeVideo/releases/latest") }FButton { objectName: "copyError"; visible: !diskFailure; text: t("Copy details", "复制详情"); onClicked: backend.copy(s.error) }FButton { objectName: "showError"; text: errorDetailsOpen ? t("Hide details", "收起详情") : t("Show details", "查看详情"); flat: true; onClicked: errorDetailsOpen = !errorDetailsOpen }+ FButton { objectName: "reportProblem"; visible: !diskFailure; text: t("Report a problem", "提交问题"); onClicked: backend.reportProblem(s.error, s.failure.title || "") }FButton { objectName: "exportError"; visible: !diskFailure; text: t("Export report", "导出报告"); enabled: s.report.status !== "running"; onClicked: backend.exportReport() }}ScrollView {@@ -830,6 +831,7 @@ ApplicationWindow {FText { visible: !s.update.phase && !!text; text: releaseSummary(availableRelease); Layout.fillWidth: true; color: theme.muted; font.pixelSize: theme.micro }FButton { text: t("What's new", "更新内容"); flat: true; visible: !s.update.phase && !!availableRelease; implicitHeight: theme.heightSm; onClicked: releaseNotesOpen = true }FButton { objectName: "updateBannerManualDownload"; text: t("Download from the release page ↗", "去发布页手动下载 ↗"); flat: true; visible: s.update.status === "error" && !!s.update.release_page; implicitHeight: theme.heightSm; onClicked: backend.link(s.update.release_page) }+ FButton { objectName: "updateBannerReport"; text: t("Report a problem", "提交问题"); flat: true; visible: s.update.status === "error" && !!s.update.error; implicitHeight: theme.heightSm; onClicked: backend.reportProblem(s.update.error, t("Update", "更新")) }}FCard {objectName: "modelUpgradeCard"@@ -848,6 +850,7 @@ ApplicationWindow {FButton { objectName: "modelUpgradeLater"; visible: ["available", "low-disk", "releasable", "complete", "failed"].indexOf(upgrade.status) >= 0; flat: truetext: upgrade.status === "complete" || upgrade.status === "low-disk" ? t("Close", "关闭") : t("Later", "稍后"); onClicked: backend.dismissModelUpgrade() }FButton { objectName: "modelUpgradeStop"; visible: upgrade.status === "downloading"; flat: true; text: t("Stop download", "停止下载"); onClicked: backend.cancelModelUpgrade() }+ FButton { objectName: "modelUpgradeReport"; visible: upgrade.status === "failed"; flat: true; text: t("Report a problem", "提交问题"); onClicked: backend.reportProblem(upgradeExplanation(), t("Model upgrade", "模型升级")) }FButton {objectName: "modelUpgradeButton"; primary: truevisible: upgrade.status === "available" || upgrade.status === "releasable"@@ -951,6 +954,7 @@ ApplicationWindow {FButton { objectName: "imagePackRemove"; visible: s.image_pack.removable_bytes > 0 && !s.image_pack.busy; text: t("Remove", "删除"); flat: true; enabled: s.image_pack.can_act; onClicked: backend.imagePackAction("remove") }}FText { objectName: "imagePackFailureReason"; visible: s.image_pack.install.state === "failed"; text: s.image_pack.detail; color: theme.danger; Layout.fillWidth: true }+ FButton { objectName: "imagePackReport"; visible: s.image_pack.install.state === "failed"; text: t("Report a problem", "提交问题"); onClicked: backend.reportProblem(s.image_pack.detail || "", t("Image pack", "图像模型包")) }Flow {visible: s.image_pack.install.state === "failed" && !!s.image_pack.report_idLayout.fillWidth: true; spacing: 8@@ -980,6 +984,7 @@ ApplicationWindow {text: s.prompt_model.suggest ? t("Download", "下载") : t("Resume", "继续"); enabled: !s.busy; onClicked: backend.promptModelAction("install") }FButton { objectName: "promptModelPause"; visible: s.prompt_model.busy; text: t("Pause", "暂停"); onClicked: backend.promptModelAction("cancel") }FButton { objectName: "promptModelDismiss"; visible: s.prompt_model.suggest; text: t("Don't ask again", "不再提示"); flat: true; onClicked: backend.dismissPromptHint() }+ FButton { objectName: "promptModelReport"; visible: s.prompt_model.install.state === "failed"; text: t("Report a problem", "提交问题"); flat: true; onClicked: backend.reportProblem(win.promptModelLine(), t("Prompt model", "提示词模型")) }}}}@@ -1399,6 +1404,7 @@ ApplicationWindow {Layout.fillWidth: true; spacing: 8FButton { text: t("Copy details", "复制详情"); implicitHeight: theme.heightSm; font.pixelSize: theme.micro + 1; onClicked: backend.copy(s.error) }FButton { text: t("Export report", "导出报告"); implicitHeight: theme.heightSm; font.pixelSize: theme.micro + 1; enabled: s.report.status !== "running"; onClicked: backend.exportReport() }+ FButton { objectName: "settingsReportProblem"; text: t("Report a problem", "提交问题"); implicitHeight: theme.heightSm; font.pixelSize: theme.micro + 1; onClicked: backend.reportProblem(s.error, s.failure.title || "") }}FText {visible: s.report.status !== "idle"; Layout.fillWidth: true; font.pixelSize: theme.micro; color: theme.muted@@ -1659,6 +1665,7 @@ ApplicationWindow {FButton { text: t("Version & release notes", "版本与更新说明"); flat: true; onClicked: releaseNotesOpen = true }FText { visible: !!s.update.error; text: s.update.error || ""; color: theme.danger; Layout.fillWidth: true; font.pixelSize: theme.micro }FButton { objectName: "updateManualDownloadButton"; text: t("Download from the release page ↗", "去发布页手动下载 ↗"); flat: true; Layout.fillWidth: true; visible: s.update.status === "error" && !!s.update.release_page; onClicked: backend.link(s.update.release_page) }+ FButton { objectName: "updateDialogReport"; text: t("Report a problem", "提交问题"); flat: true; Layout.fillWidth: true; visible: s.update.status === "error" && !!s.update.error; onClicked: backend.reportProblem(s.update.error, t("Update", "更新")) }}}RowLayout {diff --git a/freevideo_engine/launcher_issue.py b/freevideo_engine/launcher_issue.pynew file mode 100644index 0000000..f0e393e--- /dev/null+++ b/freevideo_engine/launcher_issue.py@@ -0,0 +1,41 @@+"""The launcher's "Report a problem" page: the installation/launcher form with the failure already in it.++Only the sentence the failure card shows travels. It has gone through the launcher's redaction already;+paths and long tokens are removed once more here, and the end of a long log gives way to fit the address.+"""+from urllib.parse import urlencode++from .feedback import scrub++ISSUE_FORM = 'https://github.com/FlashML-org/FreeVideo/issues/new'+# GitHub refuses very long addresses.+MAX_ADDRESS = 7000+MAX_PROBLEM = 600+MAX_REPORT = 2500+++def _lines(error):+ return [line for line in scrub(error).splitlines() if line.strip()]+++def issue_url(error, version=None, title=None, zh=False):+ lines = _lines(error)+ first = (lines[-1] if lines and lines[0].startswith('Traceback') else (lines[0] if lines else '')).strip()+ place = '启动器' if zh else 'Launcher'+ problem = ('FreeVideo 启动器显示了一个错误。\n' if zh else 'The FreeVideo launcher showed an error.\n') + first[:300]+ report = '\n'.join(lines)++ def fit(limit):+ return report if len(report) <= limit else report[:limit // 3] + '\n...\n' + report[-(limit - limit // 3 - 5):]++ def build(body):+ params = {'template': 'bug_launcher.yml', 'title': f'[{place}] ' + (str(title).strip() if title else place),+ 'problem': problem[:MAX_PROBLEM], 'report': body}+ if version:+ params['version'] = 'v' + str(version).lstrip('v')+ return ISSUE_FORM + '?' + urlencode(params)++ limit = MAX_REPORT+ while len(build(fit(limit))) > MAX_ADDRESS and limit > 50:+ limit = int(limit * 0.8)+ return build(fit(limit))diff --git a/freevideo_engine/launcher_view.py b/freevideo_engine/launcher_view.pyindex 2309c2b..9ce1793 100644--- a/freevideo_engine/launcher_view.py+++ b/freevideo_engine/launcher_view.py@@ -198,6 +198,8 @@ def build(app):app.detail_button.configure(style='Quiet.TButton'); app.detail_button.pack(side='left')app.copy_error_button = app.button(tools, 'Copy error', '复制错误', app.copy_error)app.copy_error_button.configure(style='Quiet.TButton')+ app.report_error_button = app.button(tools, 'Report a problem', '提交问题', app.report_error)+ app.report_error_button.configure(style='Quiet.TButton')from . import __version__ttk.Label(tools, text=__version__, style='Meta.TLabel').pack(side='right')app.update_row = toolsdiff --git a/freevideo_engine/modern_launcher.py b/freevideo_engine/modern_launcher.pyindex e3890af..744bf27 100644--- a/freevideo_engine/modern_launcher.py+++ b/freevideo_engine/modern_launcher.py@@ -291,6 +291,15 @@ def create_ui(session, *, show=True):else:self.invoke(open_browser, value)+ @Slot(str, str)+ def reportProblem(self, error, title):+ from . import __version__+ from .launcher_issue import issue_url+ from .windows_ux import open_browser+ url = issue_url(error, session.installed_product_version() or __version__, title,+ zh=session.language.startswith('zh'))+ self.invoke(open_browser, url)+@Slot()def openDownloadFolder(self):from PySide6.QtGui import QDesktopServicesdiff --git a/scripts/test_freevideo_entry.mjs b/scripts/test_freevideo_entry.mjsindex dc1ee8a..8a28957 100644--- a/scripts/test_freevideo_entry.mjs+++ b/scripts/test_freevideo_entry.mjs@@ -1,6 +1,10 @@import assert from 'node:assert/strict';import {readFile} from 'node:fs/promises';import test from 'node:test';+import * as modules from 'node:module';+import {resolve} from './editor_test_hooks.mjs';+if (modules.registerHooks) modules.registerHooks({resolve});+else modules.register('./editor_test_hooks.mjs', import.meta.url);import {uploadMedia} from '../web/media_upload.js';import {outputDownloadURL} from '../web/output_download.js';import {regenerateResult, upscaleResult, createSecondPassQueue, enableNode} from '../web/studio_queue.js';@@ -14,7 +18,14 @@ class Element {this.classList = {toggle() {}, add() {}};this.style = {setProperty(name, value) { this[name] = value; }}; this.offsetHeight = 66;}- append(...children) { this.children.push(...children); }+ append(...children) { for (const child of children) { child.parentNode = this; this.children.push(child); } }+ after(...children) {+ if (!this.parentNode) return;+ const parent = this.parentNode, index = parent.children.indexOf(this);+ for (const child of children) { child.remove?.(); child.parentNode = parent; }+ parent.children.splice(index + 1, 0, ...children);+ }+ remove() { if (this.parentNode) this.parentNode.children = this.parentNode.children.filter(child => child !== this); this.parentNode = null; }prepend(...children) { this.children.unshift(...children); }replaceChildren(...children) { this.children = [...children]; }setAttribute(name, value) { this.attributes[name] = value; }@@ -24,23 +35,27 @@ class Element {getClientRects() { return this.unrendered ? [] : [{}]; }get childElementCount() { return this.children.length; }click() { this.clicked = true; }+ showModal() { this.open = true; }+ close() { this.open = false; this.onclose?.(); }}test('main browser entry registers both views and preserves node hooks', async t => {const extensions = [], opened = [], installed = [], events = new EventTarget();+ const issueURLs = [];let refreshed = 0, compatibilityChecks = 0, updateChecks = 0, doneNotifyStarts = 0, rememberedView = null;const openingEvents = [];let restoreReleases = 0;let launchReady = null;const opening = {setName: name => openingEvents.push(['name', name]), cover: () => openingEvents.push(['cover']), finish: () => openingEvents.push(['finish'])};const casts = [];- let progressView, progressOptions, realProgressFactory;+ let progressView, progressOptions, realProgressFactory, studioView;const app = {registerExtension(extension) { extensions.push(extension); },graph: {extra: {freevideo_studio: true}, _nodes: [], getNodeById() {}},};const api = Object.assign(events, {apiURL: value => value});- const document = {head: new Element('head'), createElement: tag => new Element(tag),+ const document = {head: new Element('head'), body: new Element('body'), createElement: tag => new Element(tag),+ createElementNS: (namespaceURI, tag) => Object.assign(new Element(tag), {namespaceURI}),createRange: () => ({createContextualFragment: () => new Element('span')})};const dependencies = {app, api, uploadMedia, outputDownloadURL, regenerateResult, upscaleResult, createSecondPassQueue, enableNode, referenceInputs, mediaRows, expandCast, cleanOptionalPrompt, cleanOptionalWidgets, optionalInputValue,@@ -52,7 +67,7 @@ test('main browser entry registers both views and preserves node hooks', async tcreateErrorPanel: () => ({element: new Element('error'), show() {}, clear() {}}),createErrorReport: () => ({}), adviceFor: () => ({advice: {}}),errorText: value => String(value),- openStudio: node => opened.push(node),+ openStudio: node => { opened.push(node); return studioView; },loraPanel: () => () => {}, loraWarning: () => 'LoRA warning', promptGuide: () => new Element('guide'),createGenerationProgress: (_t, _now, options) => {if (realProgressFactory) {@@ -85,7 +100,7 @@ test('main browser entry registers both views and preserves node hooks', async t};const previous = new Map();for (const [name, value] of Object.entries({- document, navigator: {language: 'en'}, window: events, addEventListener: (type, fn, options) => events.addEventListener(type, fn, options),+ document, navigator: {language: 'en'}, window: events, open: url => issueURLs.push(new URL(url)), addEventListener: (type, fn, options) => events.addEventListener(type, fn, options),getComputedStyle: element => ({marginTop: '8px', marginBottom: '8px', display: element.hidden ? 'none' : 'block', ...element.style}),CustomEvent: class extends Event { constructor(name, options) { super(name); this.detail = options?.detail; } },requestAnimationFrame: callback => callback(), __freevideoEntryTest: dependencies,@@ -97,6 +112,7 @@ test('main browser entry registers both views and preserves node hooks', async tlet source = await readFile(new URL('../web/freevideo.js', import.meta.url), 'utf8');source = source.replace("import { beginWorkspaceRestore, finishWorkspaceRestore, waitForLauncherRestore } from './workspace_restore.js';", 'const {beginWorkspaceRestore,finishWorkspaceRestore,waitForLauncherRestore} = globalThis.__freevideoEntryTest;');source = source.replace("import { openEditorView } from './editor_loader.js';", 'const openEditorView = (...args) => globalThis.__freevideoEntryTest.openEditorView?.(...args);');+ source = source.replace("from './issue_button.js'", `from '${new URL('../web/issue_button.js', import.meta.url).href}'`);source = source.replace("import { createErrorPanel, errorText, createErrorReport, adviceFor } from './error_panel.js';", 'const {createErrorPanel,errorText,createErrorReport,adviceFor} = globalThis.__freevideoEntryTest;').replace('import { app } from "../../scripts/app.js";', 'const {app} = globalThis.__freevideoEntryTest;')@@ -258,6 +274,18 @@ test('main browser entry registers both views and preserves node hooks', async tapp.graph._nodes = nodes;await entry.function();assert.equal(workflows, 1); assert.equal(opened.length, before + 2);+ app.graph._nodes = [];+ dependencies.openFreeVideoWorkflow = async () => { throw new Error('workflow fixture unavailable'); };+ const warn = console.warn; console.warn = () => {};+ try { await entry.function(); } finally { console.warn = warn; }+ const menuFailure = document.body.children.find(child => child.className?.includes('fv-menu-failure'));+ assert.ok(menuFailure.open);+ const menuIssue = menuFailure.children[1].children[0];+ assert.ok(menuIssue.className.includes('fv-issue-button')); assert.notEqual(menuIssue.hidden, true);+ await menuIssue.onclick();+ assert.match(issueURLs.at(-1).searchParams.get('feedback'), /Error: Could not complete\. Try again\./);+ app.graph._nodes = nodes; await entry.function();+ assert.equal(document.body.children.includes(menuFailure), false, 'successful opening clears the failure and its report button');rememberedView = 'editor';const restored = [];let finishLaunch, finishEditor;@@ -304,10 +332,19 @@ test('main browser entry registers both views and preserves node hooks', async tapp.graph._nodes = nodes;});// The lazy loader owns failed imports: it notifies, reports through onFailure and resolves null.+ const studioStatus = new Element('div'); studioView = {querySelector: () => studioStatus};dependencies.openEditorView = async (node, options) => { options.onFailure(new Error('editor unavailable')); return null; };- extension.afterConfigureGraph(); await Promise.resolve();+ extension.afterConfigureGraph(); for (let i = 0; i < 10; i++) await Promise.resolve();assert.ok(window.__freevideoHealth.some(row => row.where === 'editor'));assert.equal(opened.at(-1), node, 'editor failure leaves the restored studio available');+ const editorIssue = studioStatus.children.find(child => child.className?.includes('fv-issue-button'));+ assert.ok(editorIssue); assert.notEqual(editorIssue.hidden, true);+ await editorIssue.onclick();+ assert.match(issueURLs.at(-1).searchParams.get('feedback'), /Where: Open editor\nError: Could not complete\. Try again\./);+ studioStatus.replaceChildren(); dependencies.openEditorView = async () => ({ready: Promise.resolve()});+ extension.afterConfigureGraph(); for (let i = 0; i < 10; i++) await Promise.resolve();+ assert.equal(studioStatus.children.length, 0, 'successful editor opening adds no issue button');+ studioView = null;rememberedView = 'nodes';const count = opened.length; extension.afterConfigureGraph();assert.equal(opened.length, count, 'remembered Nodes does not open either dialog');diff --git a/web/agent_activity.js b/web/agent_activity.jsindex 4c60ddf..37c7507 100644--- a/web/agent_activity.js+++ b/web/agent_activity.js@@ -1,4 +1,5 @@import {retryAgentPost} from './agent_session.js';+import {issueButton} from './issue_button.js';// What agents connected to this FreeVideo are doing. Their requests share the// studio's queue, so people can see them, follow progress and stop them.const css = document.createElement('link'); css.rel = 'stylesheet'; css.href = new URL('./agent_activity.css', import.meta.url).href; document.head.append(css);@@ -82,6 +83,8 @@ function row(job, t, api, refresh, open, cancellationErrors) {const details = el('p', 'fv-agent-meta', meta.join(' · '));if (reason && job.error?.message) details.title = job.error.message;foot.append(details);+ const issue = issueButton(t, () => ({where: ['Agent activity', 'Agent 任务'], message: details.textContent}));+ issue.hidden = !cancellationErrors.has(job.id); foot.append(issue);if (['waiting', 'queued', 'running'].includes(job.status)) {const stop = el('button', 'fv-agent-stop', t('Stop', '停止')); stop.type = 'button';stop.setAttribute('aria-label', t('Stop ', '停止 ') + title(job, t));@@ -93,7 +96,8 @@ function row(job, t, api, refresh, open, cancellationErrors) {const message = t('Could not stop. Click again.', '没能停止,请再点一次。');details.textContent = message;cancellationErrors.set(job.id, message);- } else cancellationErrors.delete(job.id);+ issue.hidden = false;+ } else { cancellationErrors.delete(job.id); issue.hidden = true; }} finally { refresh(); }stop.disabled = false; stop.textContent = t('Stop', '停止');};diff --git a/web/agent_connect.js b/web/agent_connect.jsindex 085c713..1bee48b 100644--- a/web/agent_connect.js+++ b/web/agent_connect.js@@ -1,3 +1,4 @@+import {issueButton} from './issue_button.js';function el(tag, cls, text) { const e = document.createElement(tag); if (cls) e.className = cls; if (text != null) e.textContent = text; return e; }// The one place a page says whether an agent is connected: its name while it is, never a client id.@@ -41,6 +42,7 @@ export function agentConnectCard(t, api, shown = () => true) {const actions = el('div', 'fv-agent-connect-actions');const button = el('button', 'fv-primary'); button.type = 'button'; button.disabled = true;const label = el('span'); button.append(icon('copy'), label);+ let issue = null;const arrow = el('span', 'fv-agent-connect-arrow', '→'); arrow.setAttribute('aria-hidden', 'true');actions.append(button, arrow, el('span', 'fv-agent-connect-hint', t('Paste to your agent', '粘贴给 Agent')));const sentence = el('p', 'fv-agent-sentence'); sentence.hidden = true;@@ -52,6 +54,9 @@ export function agentConnectCard(t, api, shown = () => true) {const active = () => body.isConnected && shown();const render = () => {label.textContent = !text && failures >= 3 ? t('Could not get address. Retry', '获取失败,重试') : feedback ? t('Copied', '已复制') : t('Copy', '复制');+ if (!text && failures >= 3) {+ if (!issue) { issue = issueButton(t, () => ({where: ['Agent connection', 'Agent 连接'], message: label.textContent})); button.after(issue); }+ } else if (issue) { issue.remove(); issue = null; }button.disabled = !text && failures < 3;button.title = !text && failures < 3 ? t('Getting the connection address…', '正在获取连接地址…') : '';status.hidden = !!text; status.textContent = !text && failures < 3 ? t('Getting the connection address…', '正在获取连接地址…') : '';diff --git a/web/autopilot_chat.css b/web/autopilot_chat.cssindex dab04da..8e5edad 100644--- a/web/autopilot_chat.css+++ b/web/autopilot_chat.css@@ -125,13 +125,14 @@.fv-studio .fv-chat-down{position:absolute;right:max(40px,calc(50% - 360px));bottom:96px;width:34px;height:34px;min-height:0;padding:0;border-radius:50%;background:var(--fv-raised);box-shadow:0 6px 18px #0008}.fv-chat svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round}.fv-chat-input{box-sizing:border-box;justify-self:center;width:100%;max-width:720px;min-height:54px;display:grid;grid-template-columns:minmax(0,1fr) auto auto auto;gap:10px;align-items:end;border:1px solid var(--fv-border);background:#0e151e;border-radius:14px;padding:8px 8px 8px 16px;transition:border-color var(--fv-quick),box-shadow var(--fv-quick)}-.fv-chat-notice{justify-self:center;width:100%;max-width:720px;margin:6px 0;font-size:14px;color:var(--fv-ink)}+.fv-chat-notice-row{justify-self:center;width:100%;max-width:720px;display:flex;align-items:center;flex-wrap:wrap;gap:4px 12px}.fv-chat-notice-row>.fv-issue-button{margin:6px 0}+.fv-chat-notice{flex:0 1 auto;margin:6px 0;font-size:14px;color:var(--fv-ink)}.fv-chat-preview[data-loading=true] .fv-chat-play::before{border-color:var(--fv-accent);animation:fv-chat-breathe 1s infinite}.fv-chat-job:is([data-mode=failed],[data-mode=stopped]){display:block;width:100%}.fv-chat-job:is([data-mode=failed],[data-mode=stopped]) .fv-chat-actions{margin-top:10px;flex-wrap:wrap}.fv-studio .fv-chat-job:is([data-mode=failed],[data-mode=stopped]) .fv-result-links{justify-content:flex-start}.fv-chat-job .fv-report-tip{max-width:100%}.fv-chat-main{grid-template-rows:auto minmax(0,1fr) auto auto}-.fv-chat-tools{grid-row:1}.fv-chat-scroll{grid-row:2}.fv-chat-notice{grid-row:3}.fv-chat-input{grid-row:4}+.fv-chat-tools{grid-row:1}.fv-chat-scroll{grid-row:2}.fv-chat-notice-row{grid-row:3}.fv-chat-input{grid-row:4}.fv-chat-input:focus-within{border-color:var(--fv-accent-dim);box-shadow:0 0 0 3px color-mix(in srgb,var(--fv-accent) 13%,transparent)}.fv-studio.fv-autopilot .fv-chat-input textarea,.fv-chat-input textarea{box-sizing:border-box;width:100%;height:36px;min-height:36px;max-height:none;padding:7px 0;border:0;border-radius:0;background:none;color:var(--fv-ink);font-size:14.5px;line-height:22px;resize:none;outline:none;overflow-y:auto}.fv-chat-input textarea::placeholder{color:var(--fv-disabled)}@@ -164,6 +165,9 @@/* Request errors use the card's existing actions and retry button. */.fv-chat-error{color:var(--fv-danger);font-size:13px;line-height:1.5;overflow-wrap:anywhere;margin:0}.fv-chat-new-error{padding:0 var(--fv-chats-pad) 6px}+.fv-chat-delete-error{padding:0 var(--fv-chats-pad) 6px}+.fv-chat-delete-error p{margin:0 0 4px}+.fv-chat-delete-actions{display:flex;flex-wrap:wrap;gap:4px}.fv-chat-me>.fv-chat-actions{margin-top:6px;flex-wrap:wrap;justify-content:flex-end}.fv-chat-me .fv-chat-error{flex:1;min-width:0}.fv-chat-keep{white-space:nowrap}diff --git a/web/autopilot_chat.js b/web/autopilot_chat.jsindex 72568ff..78e5a80 100644--- a/web/autopilot_chat.js+++ b/web/autopilot_chat.js@@ -8,10 +8,12 @@ import { estimatedFraction, remainingAbove, remainingShown, createDiagnosticRepoimport {createErrorReport} from './error_panel.js';import {canDeleteConversation, conversationMenu, emptyConversations, hasConversations, mergeConversations, removeConversation, runningElsewhere, selectConversation} from './autopilot_conversations.js';import {renderImageFailure} from './image_generation.js';+import {issueButton} from './issue_button.js';import {about} from './request_assets.js';const css = document.createElement('link'); css.rel = 'stylesheet'; css.href = new URL('./autopilot_chat.css', import.meta.url).href; document.head.append(css);+const CHAT_ISSUE = ['Chat', '对话'];function el(tag, cls, text) { const e = document.createElement(tag); if (cls) e.className = cls; if (text != null) e.textContent = text; return e; }function glyph(path, width = 2.2) {const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');@@ -322,7 +324,8 @@ export function agentChat(t, api, {open, edit, shown = () => true, changed = ()} catch (failure) { sceneWaiting = false; say(t(...SCENE_TEXT.failed) + reason(failure)); }}form.append(input, scenesButton, whiteboxButton, sendButton); scroller.append(log); main.append(scroller, down, sceneMenu, form); element.append(main);- const notice = el('p', 'fv-chat-notice'); notice.hidden = true; notice.setAttribute('role', 'status'); main.insertBefore(notice, form);+ const notice = el('p', 'fv-chat-notice'); notice.hidden = true; notice.setAttribute('role', 'status');+ const noticeRow = el('div', 'fv-chat-notice-row'); noticeRow.append(notice); main.insertBefore(noticeRow, form);// What the next video would download first, the studio's line, above the box the request is typed in.if (hint) main.insertBefore(hint.element, form);// A quoted button name stays on one line, so “新对话” never wraps in the middle.@@ -331,7 +334,10 @@ export function agentChat(t, api, {open, edit, shown = () => true, changed = ()node.textContent = text;if (parts.length > 1) node.replaceChildren(...parts.flatMap((part, index) => part ? [el('span', index % 2 ? 'fv-chat-keep' : '', part)] : []));}- function say(text) { quoted(notice, text); notice.hidden = !text; }+ // `failure`: the line reports a fault, so the button sits beside it.+ const noticeIssue = issueButton(t, () => ({where: CHAT_ISSUE, message: notice.textContent})); noticeIssue.hidden = true;+ noticeRow.append(noticeIssue);+ function say(text, failure = false) { quoted(notice, text); notice.hidden = !text; noticeIssue.hidden = !text || !failure; }let dismissImage = null;let state = emptyChat(), pending = [], known = false, stopped = false, timer = null, busy = false, failures = 0;@@ -378,12 +384,21 @@ export function agentChat(t, api, {open, edit, shown = () => true, changed = ()const newChat = press('fv-chat-new', t('New chat', '新对话'), () => void startChat());newChat.prepend(glyph('M12 5v14M5 12h14')); newChat.title = t('New chat', '新对话');const newError = el('p', 'fv-chat-error fv-chat-new-error'); newError.hidden = true; newError.setAttribute('role', 'alert');+ const newIssue = issueButton(t, () => ({where: CHAT_ISSUE, message: newError.textContent})); newIssue.hidden = true;+ // Why a deletion did not happen, with what can be done next; never left silent.+ const deleteError = el('div', 'fv-chat-error fv-chat-delete-error'); deleteError.hidden = true; deleteError.setAttribute('role', 'alert');+ function deleteFailed(session, error, stop = false, report = true) {+ const text = el('p', null, error), actions = el('div', 'fv-chat-delete-actions');+ if (stop) actions.append(press('fv-chat-menu-item', t('Stop and delete', '停止并删除'), () => { deleteError.hidden = true; void deleteChat(session, true, true); }));+ if (report) actions.append(issueButton(t, () => ({where: CHAT_ISSUE, message: text.textContent})));+ deleteError.replaceChildren(text, actions); deleteError.hidden = false;+ }const chats = press('fv-chat-chats', null, () => drawer(chats.getAttribute('aria-expanded') !== 'true'));const chatsDot = el('i', 'fv-chat-running'); chatsDot.setAttribute('aria-hidden', 'true'); chatsDot.hidden = true;chats.append(glyph('M4 5h16v12H9l-5 4V5M8 9h8M8 13h5'), chatsDot);chats.title = t('Chats', '对话'); chats.setAttribute('aria-label', chats.title);chats.setAttribute('aria-controls', sidebar.id); chats.setAttribute('aria-expanded', 'false');- tools.hidden = true; tools.append(chats); main.prepend(tools); sidebar.append(newChat, newError, list); element.prepend(sidebar);+ tools.hidden = true; tools.append(chats); main.prepend(tools); sidebar.append(newChat, newError, newIssue, deleteError, list); element.prepend(sidebar);const listNodes = new Map(), narrow = () => window.matchMedia('(max-width: 720px)').matches;let menuState = null, changingMenu = false;const deleting = new Set(), deleted = new Set();@@ -513,15 +528,16 @@ export function agentChat(t, api, {open, edit, shown = () => true, changed = ()updateMenu();if (lostFocus && !menuState) (listNodes.get(previous.session)?.button || (visible ? newChat : input)).focus({preventScroll: true});}- async function deleteChat(session) {- if (!menuState || deleting.has(session) || menuState.session !== session || menuState.stage !== 'confirm' || !active()) return;+ async function deleteChat(session, stop = false, again = false) {+ if (!again && (!menuState || deleting.has(session) || menuState.session !== session || menuState.stage !== 'confirm') || deleting.has(session) || !active()) return;+ deleteError.hidden = true;const ids = conversations.conversations.map(row => row.id), index = ids.indexOf(session);const neighbor = ids[index + 1] || ids[index - 1];deleting.add(session);// A disabled focused button can lose native focus. Keep it on the origin while awaiting the request.menuOrigin()?.focus({preventScroll: true}); updateMenu();try {- const response = await agentPost(api, '/freevideo/agent/chat/delete', {session});+ const response = await agentPost(api, '/freevideo/agent/chat/delete', stop ? {session, stop: true} : {session});if (stopped) return;const data = await response.json().catch(() => ({}));if (stopped) return;@@ -542,9 +558,13 @@ export function agentChat(t, api, {open, edit, shown = () => true, changed = ()} else if (response.status === 409) {if (menuState?.session === session) closeMenu();if (data.error?.code === 'not_connected') { state = {...state, agent: {connected: false, name: null}}; render(); report(); }- else void readConversations(true);- }- } catch { /* Keep the row available for another try, without interrupting the conversation. */ }+ else {+ void readConversations(true);+ if (stop) deleteFailed(session, t('Still stopping. Try deleting again in a moment.', '正在停止,请稍后再删除。'), false, false);+ else deleteFailed(session, t('This chat still has work in progress, so it was not deleted.', '这段对话里还有在生成的内容,没有删除。'), true);+ }+ } else deleteFailed(session, t('Could not delete: ', '没有删除成功:') + (data.error?.message || data.error?.code || `HTTP ${response.status}`));+ } catch (error) { if (!stopped) deleteFailed(session, t('Could not delete: ', '没有删除成功:') + reason(error)); }finally {deleting.delete(session);if (menuState?.session === session) closeMenu();@@ -552,7 +572,7 @@ export function agentChat(t, api, {open, edit, shown = () => true, changed = ()}}function chooseChat(session, focus = false) {- closeMenu(); say('');+ closeMenu(); say(''); deleteError.hidden = true;showDraft(session); rememberSelection(session);selectedSession = session; selection++; pinned = true; away = null;conversations = selectConversation(conversations, session); renderConversations();@@ -565,7 +585,7 @@ export function agentChat(t, api, {open, edit, shown = () => true, changed = ()async function startChat(from = null) {closeMenu();if (creating || !active() || conversations.supported !== true) return;- creating = true; newError.hidden = true; renderConversations(); render();+ creating = true; newError.hidden = newIssue.hidden = true; renderConversations(); render();try {const response = await agentPost(api, '/freevideo/agent/chat/new', {});if (stopped) return;@@ -576,7 +596,7 @@ export function agentChat(t, api, {open, edit, shown = () => true, changed = ()} else throw await requestError(response);} catch (error) {if (!stopped) {- newError.textContent = t('Could not start a new chat: ', '没有新建成功:') + reason(error); newError.hidden = false;+ newError.textContent = t('Could not start a new chat: ', '没有新建成功:') + reason(error); newError.hidden = newIssue.hidden = false;if (from) from.error = newError.textContent;}}@@ -675,7 +695,7 @@ export function agentChat(t, api, {open, edit, shown = () => true, changed = ()ids.forEach(id => stopping.add(id)); render(); report();const results = await Promise.all(ids.map(id => retryAgentPost(api, '/freevideo/agent/activity/cancel', {id})));results.forEach((response, index) => { if (!response?.ok) stopping.delete(ids[index]); });- if (results.some(response => !response?.ok)) say(t('Could not stop. Click again.', '没能停止,请再点一次。'));+ if (results.some(response => !response?.ok)) say(t('Could not stop. Click again.', '没能停止,请再点一次。'), true);else say('');if (!stopped) { render(); report(); void poll(); }}@@ -689,7 +709,7 @@ export function agentChat(t, api, {open, edit, shown = () => true, changed = ()// ---- one entry of the conversation each ----function message(role) {const item = el('li', role === 'user' ? 'fv-chat-me' : 'fv-chat-ai'), text = el('p'); item.append(text);- let status = null, error = null, retry = null;+ let status = null, error = null, retry = null, report = null;return {element: item, update(entry) {text.textContent = entry.text;if (role !== 'user') return;@@ -704,9 +724,12 @@ export function agentChat(t, api, {open, edit, shown = () => true, changed = ()if (entry.errorCode === 'session_full') { void startChat(original || entry); return; }if (original) void send(original.text, original);});- status.append(error, retry); item.append(status);+ report = issueButton(t, () => ({where: CHAT_ISSUE, message: error.textContent}));+ status.append(error, retry, report); item.append(status);}quoted(error, entry.error || ''); error.hidden = !entry.error;+ // Waiting for the agent to come back is not a fault.+ report.hidden = !entry.error || !!entry.automatic;const full = entry.errorCode === 'session_full';retry.textContent = full ? t('New chat', '新对话') : t('Retry', '重试');retry.disabled = entry.sending || (full ? creating : !sendingAllowed());@@ -995,7 +1018,10 @@ export function agentChat(t, api, {open, edit, shown = () => true, changed = ()const question = el('p', null, entry.question);const estimate = el('p', 'fv-chat-meta', entry.estimate_seconds > 0 ? about(entry.estimate_seconds, t) : ''); estimate.hidden = !estimate.textContent;item.replaceChildren(question, estimate, buttons);- if (error) { const notice = el('p', 'fv-chat-error', error); notice.setAttribute('role', 'alert'); item.append(notice); }+ if (error) {+ const notice = el('p', 'fv-chat-error', error); notice.setAttribute('role', 'alert');+ item.append(notice, issueButton(t, () => ({where: CHAT_ISSUE, message: error})));+ }}};}// Before anything is said: what the agent can do, and sentences that send themselves when clicked.@@ -1166,7 +1192,7 @@ export function agentChat(t, api, {open, edit, shown = () => true, changed = ()if (entry.session === state.session) {if (waiting && error?.code === 'not_connected') state = {...state, agent: {connected: false, name: null}};if (waiting && error?.code === 'not_listening') state = {...state, agent: {...state.agent, listening: false}};- say(entry.errorCode === 'session_full' ? '' : explanation);+ say(entry.errorCode === 'session_full' ? '' : explanation); // the failed bubble carries the report button}return false;} finally {diff --git a/web/cast_library.css b/web/cast_library.cssindex 51a833d..ccab799 100644--- a/web/cast_library.css+++ b/web/cast_library.css@@ -38,6 +38,7 @@.fv-cast-dialog .fv-cast-bad .fv-cast-choose{border:1px solid var(--fv-danger)}.fv-cast-slot-error{position:absolute;left:1px;right:1px;bottom:1px;padding:4px 3px;border-radius:0 0 var(--fv-r-sm,8px) var(--fv-r-sm,8px);background:var(--fv-bg);color:var(--fv-danger);font-size:12px;line-height:1.4;word-break:keep-all;overflow:hidden;pointer-events:none}.fv-cast-slot-line{display:block}+.fv-cast-slot-error .fv-issue-button{pointer-events:auto;font-size:11px;min-height:24px;padding:2px 5px;max-width:100%}.fv-cast-message{margin-top:12px;color:var(--fv-danger);white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.fv-cast-message.fv-cast-notice{color:var(--fv-muted)}.fv-cast-dialog .fv-cast-delete.fv-cast-confirm{border-color:#c9414f;background:#c9414f;color:#fff}diff --git a/web/cast_library.js b/web/cast_library.jsindex ead6cb3..65a47f4 100644--- a/web/cast_library.js+++ b/web/cast_library.js@@ -1,5 +1,7 @@import {agentGet, agentPost, agentSend} from './agent_session.js';import {agentInterfaceEnabled} from './agent_connect.js';+import {issueButton} from './issue_button.js';+const CAST_ISSUE = ['Character library', '角色库'];// The optional generator owns its UI and job lifecycle; keep its contract here.async function mountGenerator(options) {@@ -119,12 +121,14 @@ export function createCastLibrary({api, text, viewURL, uploadOne, onChange = ()const cancel = button('', text('Cancel', '取消'), () => close());const save = button('fv-cast-save', text('Save', '保存'), () => saveCard());actions.append(remove, cancel, save);- dialog.append(top, name, tabs, uploadPane, aiPane, status, actions); tabs.append(uploadTab, aiTab);+ const issue = issueButton(text, () => ({where: CAST_ISSUE, message: status.textContent})); issue.hidden = true;+ dialog.append(top, name, tabs, uploadPane, aiPane, status, issue, actions); tabs.append(uploadTab, aiTab);// A refresh notice is plain secondary text; only failures are shown as errors.const message = (content, notice = false) => {if (closed) return;status.textContent = content; status.hidden = !content; status.classList.toggle('fv-cast-notice', notice);+ issue.hidden = !content || notice;};const aiBusy = () => aiState.busy || !!generator?.isBusy();// What is still missing before Save works ('' when nothing is); the button says so on hover and when pressed.@@ -153,9 +157,11 @@ export function createCastLibrary({api, text, viewURL, uploadOne, onChange = ()function mark(index, content = '') {const {slot, problem} = slotUI[index];// Clear the line only while it still holds this tile's words, not a later message.- if (markedBelow === index) { markedBelow = -1; if (status.textContent === problem.textContent) message(''); }+ if (markedBelow === index) { markedBelow = -1; if (status.textContent === problem.dataset.message) message(''); }+ problem.dataset.message = content;// One line per clause, so "这张图片" is never split across lines.problem.replaceChildren(...content.replace(/([,。]|\. )/g, '$1\n').split('\n').filter(Boolean).map(part => el('span', 'fv-cast-slot-line', part)));+ if (content) problem.append(issueButton(text, () => ({where: CAST_ISSUE, message: content})));problem.hidden = !content; slot.classList.toggle('fv-cast-bad', !!content);const width = slot.clientWidth;if (content && width > 0 && (width < 100 || problem.scrollWidth > problem.clientWidth || problem.offsetHeight > slot.clientHeight / 2)) {@@ -260,8 +266,9 @@ export function createCastLibrary({api, text, viewURL, uploadOne, onChange = ()label: picture.label || (index ? 'other' : 'front'),}));const frontNeeded = active === 'ai' || !frontless;- if (!pictures.length || pictures.length > 6 || (frontNeeded && !pictures.some(picture => picture.label === 'front')))- throw new Error(text('Choose one front image and up to 5 more angles', '选一张正面图片,再加最多 5 张其他角度的图片'));+ if (!pictures.length || pictures.length > 6 || (frontNeeded && !pictures.some(picture => picture.label === 'front'))) {+ message(text('Choose one front image and up to 5 more angles', '选一张正面图片,再加最多 5 张其他角度的图片'), true); return;+ }const images = [];for (const picture of pictures) {if (closed) return;diff --git a/web/editor.css b/web/editor.cssindex f796eee..1cb0606 100644--- a/web/editor.css+++ b/web/editor.css@@ -44,6 +44,7 @@.fv-ed-audio-icon{font-size:26px;color:var(--fv-muted)}.fv-editor .fv-ed-import{width:100%;height:auto;aspect-ratio:16/9;border:1px dashed var(--fv-border);border-radius:6px;background:transparent;color:var(--fv-muted);padding:0}.fv-ed-library-message{font-size:12px;color:var(--fv-muted);line-height:1.6}+.fv-ed-source-card .fv-issue-button{font-size:11px;min-height:28px;max-width:100%}.fv-editor .fv-ed-preview{grid-column:2;grid-row:2;min-width:0;min-height:0;display:grid;place-items:center;padding:16px;overflow:hidden;background:var(--fv-bg);container-type:size}.fv-ed-picture{position:relative;width:min(100cqw,calc(100cqh * var(--fv-ed-width,16) / var(--fv-ed-height,9)));aspect-ratio:var(--fv-ed-width,16)/var(--fv-ed-height,9);background:#000;border-radius:8px;overflow:hidden}.fv-ed-picture[data-empty=true]{background:var(--fv-card);border:1px dashed color-mix(in srgb,var(--fv-ink) 28%,transparent)}@@ -75,6 +76,8 @@.fv-ed-genbar[data-mode=running]>button:not(.fv-ed-generate){order:2}.fv-ed-gen-note{font-size:13px;color:var(--fv-ink);flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fv-ed-gen-note[hidden]{display:none}+.fv-ed-gen-note:has(.fv-issue-button){white-space:normal;overflow:visible}+.fv-ed-gen-note .fv-issue-button,.fv-ed-library-message .fv-issue-button{margin-left:8px}.fv-ed-genbar .fv-request-assets{order:-2;flex:1 1 100%;min-width:0;font-size:12px;line-height:1.5}.fv-ed-genbar .fv-request-assets[hidden]{display:none}.fv-editor:has(.fv-ed-gen-failure:not([hidden])){--fv-ed-generation-row:max-content}@@ -100,6 +103,7 @@.fv-ed-refs[hidden],.fv-ed-ref-menu[hidden]{display:none}.fv-ed-ref-notice{position:absolute;bottom:calc(100% + 8px);max-width:min(560px,calc(100% - 24px));border:1px solid var(--fv-border);background:var(--fv-card);padding:10px 14px;border-radius:8px;z-index:9;color:var(--fv-ink);pointer-events:none}.fv-ed-ref-notice[hidden]{display:none}+.fv-ed-ref-notice .fv-issue-button{pointer-events:auto;margin-left:8px}.fv-ed-ref-chips{display:flex;align-items:center;gap:6px;max-width:min(240px,32vw);overflow-x:auto;scrollbar-width:thin;scrollbar-color:var(--fv-border) transparent;padding:1px}.fv-ed-ref-chips:empty{display:none}/* A strip that scrolls fades at the hidden end(s); one that fits is untouched. */@@ -170,6 +174,7 @@.fv-editor .fv-ed-name-menu .fv-ed-delete-confirm:not(:disabled):is(:hover,:focus-visible){background:var(--fv-danger-subtle)}.fv-ed-delete-question{margin:6px 10px 10px;line-height:1.5;overflow-wrap:anywhere;white-space:normal}.fv-ed-notice{position:absolute;bottom:340px;right:16px;max-width:min(560px,calc(100vw - 32px));border:1px solid var(--fv-border);background:var(--fv-card);padding:10px 14px;border-radius:8px;z-index:9;color:var(--fv-ink)}+.fv-ed-notice .fv-issue-button{margin-left:12px;vertical-align:middle;pointer-events:auto}@media(max-width:680px){.fv-studio.fv-editor{grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(max(0px,calc(180px - var(--fv-ed-description-growth,0px))),1fr) 40px var(--fv-ed-generation-row,auto) 40px 236px;overflow:hidden}.fv-editor .fv-header{overflow-x:auto}diff --git a/web/editor.js b/web/editor.jsindex 44230bf..5835991 100644--- a/web/editor.js+++ b/web/editor.js@@ -6,6 +6,7 @@ import {viewSwitch, viewChanged} from './view_navigation.js';import {wordmark} from './wordmark.js';import {openSetup} from './setup.js';import {feedbackButton} from './feedback.js';+import {issueButton} from './issue_button.js';import * as model from './editor_model.js';import {discardEmptyEdit, hiddenEmptyEdit, deleteEditText} from './editor_lifecycle.js';import {createEditorState} from './editor_state.js';@@ -271,7 +272,15 @@ export function openEditor({api, app, from = null, panel = {}, components: givenreturn true;}const content = record => JSON.stringify({...record, id: null, revision: 0});- function notify(text) { if (disposed) return; if (!text) { clearTimeout(noticeTimer); notice.hidden = true; return; } notice.textContent = text; notice.hidden = false; clearTimeout(noticeTimer); noticeTimer = setTimeout(() => { notice.hidden = true; }, 9000); }+ // `where` marks a failure: the notice then carries the "Report a problem" button and stays longer to be reached.+ function notify(text, where = null) {+ if (disposed) return;+ if (!text) { clearTimeout(noticeTimer); notice.hidden = true; return; }+ notice.textContent = text;+ if (where) notice.append(issueButton(t, () => ({where, message: text})));+ notice.hidden = false; clearTimeout(noticeTimer); noticeTimer = setTimeout(() => { notice.hidden = true; }, where ? 20000 : 9000);+ }+ const EDITOR_ISSUE = ['Editor', '编辑器'], EXPORT_ISSUE = ['Export', '导出'];// `step` names what was being done, so a failure there says which step went wrong; `out` is where the line is said (the bar's own line for a reference picture).function error(value, step = null, out = notify) {const code = value?.reason || value?.code || value?.message;@@ -298,7 +307,7 @@ export function openEditor({api, app, from = null, panel = {}, components: givenreturn {ok: false, reason: code};}const text = step === 'generate' ? editorErrorText(value, t) : step === 'export' ? exportErrorText(value, t) : t('Could not complete. Try again.', '没有完成,请重试');- out(text); return {ok: false, reason: code, say: text};+ out(text, step === 'export' ? EXPORT_ISSUE : EDITOR_ISSUE); return {ok: false, reason: code, say: text};}const store = createEditorStore(api, {t, notify, standIn: given?.generationStandIn, onGenerationReady: ready => {if (disposed) return;@@ -471,7 +480,7 @@ export function openEditor({api, app, from = null, panel = {}, components: givenawait queue.flush();}if (disposed || closing || epoch !== projectEpoch) return false;- if (queue.dirty) { notify(saveErrorText(queue.failure, t)); return false; }+ if (queue.dirty) { notify(saveErrorText(queue.failure, t), EDITOR_ISSUE); return false; }return !!state.record.id;}function updateTop() {@@ -684,7 +693,7 @@ export function openEditor({api, app, from = null, panel = {}, components: givenconst words = deleteEditText(t);if (jobActive()) throw {reason: 'generation_active'};await queue.flush(); releaseStamp();- if (queue.dirty) { notify(saveErrorText(queue.failure, t)); return; }+ if (queue.dirty) { notify(saveErrorText(queue.failure, t), EDITOR_ISSUE); return; }// Load the replacement before deleting, so a read failure keeps the edit open.const rows = (await store.projects()).filter(row => row.id !== state.record.id);// Most recently used: the order the edits were opened, then the last save.@@ -695,7 +704,7 @@ export function openEditor({api, app, from = null, panel = {}, components: givenawait discardProject();await replaceProject(record); menu.hidden = true; title.setAttribute('aria-expanded', 'false'); title.focus();} catch (value) {- const words = deleteEditText(t); notify(words[value?.reason] || words.delete_failed);+ const words = deleteEditText(t); notify(words[value?.reason] || words.delete_failed, EDITOR_ISSUE);} finally { switching = false; element.inert = false; updateTop(); }}function confirmDelete() {@@ -1067,7 +1076,7 @@ export function openEditor({api, app, from = null, panel = {}, components: givenfunction 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 的连接已断开,无法读取导出进度。恢复后请重新导出。'));+ notify(t('Lost the connection to FreeVideo, so the export progress cannot be read. Export again once it is back.', '与 FreeVideo 的连接已断开,无法读取导出进度。恢复后请重新导出。'), EXPORT_ISSUE);}function updateExport(value) {if (!value) return false;@@ -1081,7 +1090,7 @@ export function openEditor({api, app, from = null, panel = {}, components: givenelse notify(value.reason === 'not_writable' ? t('Export failed: the output folder cannot be written to. Check that the folder can be written to, then retry.', '导出时出错:输出目录不可写。请检查这个文件夹的写入权限后重试。'): value.reason === 'disk_full' ? t('Export failed: the disk is full. Free some space, then export again.', '导出时出错:磁盘空间不够,空出空间后再导出。'): value.reason === 'unreadable' ? t('Export failed: a source file cannot be read. Import it again from the library.', '导出时出错:有素材读不出来,请在素材库重新导入。')- : t('Export failed. Try again.', '导出时出错,请再试一次。'));+ : t('Export failed. Try again.', '导出时出错,请再试一次。'), EXPORT_ISSUE);}if (value.state === 'cancelled') notify(t('Export cancelled. No unfinished file is kept.', '已取消导出,没有留下不完整的文件。'));window.FreeVideoNotifyTaskDone?.({kind: 'export', id: value.id, ok: value.state === 'done'});@@ -1310,7 +1319,7 @@ export function openEditor({api, app, from = null, panel = {}, components: givenif (!queue.dirty && emptyEdit()) {try { await discardProject({automatic: true}); }catch (value) {- notify(deleteEditText(t)[value?.reason] || deleteEditText(t).delete_failed);+ notify(deleteEditText(t)[value?.reason] || deleteEditText(t).delete_failed, EDITOR_ISSUE);closing = false; element.inert = false; closePromise = null; return false;}}diff --git a/web/editor_genbar.js b/web/editor_genbar.jsindex 0ee2904..59cf5e7 100644--- a/web/editor_genbar.js+++ b/web/editor_genbar.js@@ -3,6 +3,7 @@ import {createFirstFrameSwitch} from './editor_first_frame.js';import {createEditorReferences} from './editor_references.js';import {createExpandButton} from './editor_expand.js';import {createRequestAssets} from './request_assets.js';+import {issueButton} from './issue_button.js';const el = (tag, cls, text) => { const e = document.createElement(tag); if (cls) e.className = cls; if (text != null) e.textContent = text; return e; };export const timeEstimate = (seconds, t) => seconds == null ? '' : seconds < 60? t(`about ${Math.max(1, Math.ceil(seconds))} s`, `约 ${Math.max(1, Math.ceil(seconds))} 秒`)@@ -62,12 +63,13 @@ export function createEditorGenbar(host, {state, t, actions, text = ''}) {// What goes wrong with a reference picture is said above the "+", where the eyes are, not in the page-wide line.const refNotice = el('div', 'fv-ed-ref-notice'); refNotice.hidden = true; refNotice.setAttribute('role', 'status');let refNoticeTimer = null;- const sayAtRefs = text => {+ const sayAtRefs = (text, where = null) => {clearTimeout(refNoticeTimer);if (!text || disposed) { refNotice.hidden = true; return; }refNotice.textContent = text; refNotice.hidden = false;+ if (where) refNotice.append(issueButton(t, () => ({where, message: text})));refNotice.style.left = Math.max(0, (references?.element.getBoundingClientRect().left || 0) - host.getBoundingClientRect().left) + 'px';- refNoticeTimer = setTimeout(() => { refNotice.hidden = true; }, 9000);+ refNoticeTimer = setTimeout(() => { refNotice.hidden = true; }, where ? 20000 : 9000);};const references = actions.references ? createEditorReferences({t, source: actions.references.source, size: actions.references.size, error: value => actions.error(value, null, sayAtRefs), notify: sayAtRefs}) : null;if (references) { description.before(references.element); host.append(refNotice); }@@ -83,15 +85,16 @@ export function createEditorGenbar(host, {state, t, actions, text = ''}) {await actions.downloadFailureReport?.(id, {bar: failureBar, anchor: report.hidden ? failureReason : report, t,current: () => !disposed && failureId === id && !failure.hidden});} catch (value) {- say(t(`Downloading the diagnostic report failed: ${value.message || value}`, `下载诊断报告时出错:${value.message || value}`));+ actions.notify?.(t(`Downloading the diagnostic report failed: ${value.message || value}`, `下载诊断报告时出错:${value.message || value}`), ['Editor diagnostic report', '剪辑器诊断报告']);} finally { downloading = false; report.disabled = false; }}report.onclick = () => downloadFailure();- function say(text, queued = false) {+ function say(text, queued = false, where = null) {if (disposed) return;queuedAt = text && queued ? progressKey() : null;clearTimeout(noteTimer); note.textContent = text || ''; note.hidden = !text;- if (text) noteTimer = setTimeout(() => { note.hidden = true; }, 6000);+ if (text && where) note.append(issueButton(t, () => ({where, message: text})));+ if (text) noteTimer = setTimeout(() => { note.hidden = true; }, where ? 20000 : 6000);}async function render() {if (disposed) return;@@ -210,8 +213,8 @@ export function createEditorGenbar(host, {state, t, actions, text = ''}) {}// A specific reason is said once; the planning limits are already shown above.catch (error) { const result = actions.error(error, 'generate'); reason = result?.say || '';- if (result?.say && !['chain_too_long', 'chain_part_too_short'].includes(result.reason)) say(result.say);- else if (!result && !note.textContent) { reason = t('Could not start. Try again.', '没能开始,请重试。'); say(reason); } }+ if (result?.say && !['chain_too_long', 'chain_part_too_short'].includes(result.reason)) say(result.say, false, ['Editor generation', '剪辑器生成']);+ else if (!result && !note.textContent) { reason = t('Could not start. Try again.', '没能开始,请重试。'); say(reason, false, ['Editor generation', '剪辑器生成']); } }finally { pressing.delete(key); render(); }return reason;};diff --git a/web/editor_library.js b/web/editor_library.jsindex 0a35fdf..cac1cf8 100644--- a/web/editor_library.js+++ b/web/editor_library.js@@ -1,5 +1,7 @@import {editorIcon} from './editor_icons.js';import {sourceKey} from './editor_store.js';+import {issueButton} from './issue_button.js';+const LIBRARY_ISSUE = ['Editor media library', '剪辑器素材库'];const el = (tag, cls, text) => { const e = document.createElement(tag); if (cls) e.className = cls; if (text != null) e.textContent = text; return e; };const stamp = frames => { const seconds = Math.floor((frames || 0) / 24); return `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, '0')}`; };const FORMATS = 'MP4, MOV, WebM, MKV, M4V, WAV, MP3, FLAC, OGG, M4A, AAC, Opus';@@ -43,7 +45,7 @@ export function createEditorLibrary(host, {store, t, actions, state}) {function requestAdd(row, kind, plus = false) {if (disposed) return;if (kind === 'work' || row.state === 'ready') return add(row, kind, plus).catch(actions.error);- if (row.state === 'failed') { actions.notify?.(cannotOpen()); return; }+ if (row.state === 'failed') { actions.notify?.(cannotOpen(), LIBRARY_ISSUE); return; }const key = `${kind}:${row.id}`;if (!pendingAdds.has(key)) pendingAdds.set(key, {plus, project: actions.projectToken?.()});actions.notify?.(preparing());@@ -56,7 +58,7 @@ export function createEditorLibrary(host, {store, t, actions, state}) {if (row.state === 'ready') {pendingAdds.delete(key);add(row, 'import', pending.plus, {...pending, queued: true}).catch(actions.error);- } else if (row.state === 'failed') { pendingAdds.delete(key); actions.notify?.(cannotOpen()); }+ } else if (row.state === 'failed') { pendingAdds.delete(key); actions.notify?.(cannotOpen(), LIBRARY_ISSUE); }}}function card(row, kind) {@@ -95,6 +97,7 @@ export function createEditorLibrary(host, {store, t, actions, state}) {plus.ondblclick = event => { event.preventDefault(); event.stopPropagation(); };plus.onkeydown = event => { if (event.key === 'Enter' || event.key === ' ') insert(event); };container.append(button, plus);+ if (kind !== 'work' && row.state === 'failed') container.append(issueButton(t, () => ({where: LIBRARY_ISSUE, message: t('Cannot open', '打不开')})));return container;}function updateUsed() {@@ -120,6 +123,7 @@ export function createEditorLibrary(host, {store, t, actions, state}) {updateUsed();message.textContent = ''; // Empty states stay silent.for (const row of shown) if (row.state === 'failed') message.textContent = t('This file cannot be opened. Supported formats: ', '这个文件打不开。支持的格式:') + FORMATS;+ if (message.textContent) message.append(issueButton(t, () => ({where: LIBRARY_ISSUE, message: cannotOpen()})));if (scroll > 0) {const replacement = anchor && [...grid.querySelectorAll('.fv-ed-source')].find(node => node.dataset.key === anchor.dataset.key);host.scrollTop = replacement ? scroll + replacement.getBoundingClientRect().top - anchorTop : scroll;@@ -221,7 +225,7 @@ export function createEditorLibrary(host, {store, t, actions, state}) {if (place) { placing.push({id: item.id, place}); placeReady(imported); }else startPending([item]);}- } catch { actions.notify(cannotOpen()); }+ } catch { actions.notify(cannotOpen(), LIBRARY_ISSUE); }finally { pendingAdds.delete(`import:${id}`); uploading.delete(id); render(); }}}diff --git a/web/editor_references.js b/web/editor_references.jsindex df8044f..35c0087 100644--- a/web/editor_references.js+++ b/web/editor_references.js@@ -89,7 +89,7 @@ export function createEditorReferences({t, source, size = () => null, error = ()const result = await source.upload(file);write([...source.rows(), {file: result.file, role: 'reference', enabled: true}]);}- if (skipped && !disposed) notify(t('Could not read this picture. Please choose another one.', '无法读取这张图片,请换一张。'));+ if (skipped && !disposed) notify(t('Could not read this picture. Please choose another one.', '无法读取这张图片,请换一张。'), ['Editor reference images', '剪辑器参考图']);} catch (value) { error(value); }finally { working = false; picker.value = ''; update(); }}diff --git a/web/editor_text.js b/web/editor_text.jsindex bef6503..71e8403 100644--- a/web/editor_text.js+++ b/web/editor_text.js@@ -8,6 +8,8 @@ import {loadCoverage, loadTextFonts, textFontStack, missingGlyphs, missingHint,import {createSelectionActions, isTyping} from './editor_select.js';import {plan} from './editor_geometry.js';import {isolateDialogKeys} from './dialog_keys.js';+import {issueButton} from './issue_button.js';+const SPEECH_ISSUE = ['Auto subtitles', '自动字幕'], FONT_ISSUE = ['Editor text fonts', '剪辑器文字字体'];const el=(tag,cls,text)=>{const e=document.createElement(tag);if(cls)e.className=cls;if(text!=null)e.textContent=text;return e;};const clamp=(v,lo,hi)=>Math.max(lo,Math.min(hi,v));const PRESET_KEY='freevideo.subtitle-presets',PRESET_LIMIT=6;@@ -37,6 +39,8 @@ export function createEditorText({element,state,t,actions,adjust,player,toolbar,const marker=toolbar.querySelector('.fv-ed-marker, .fv-ed-add-marker');if(marker) marker.after(buttons); else toolbar.insertBefore(buttons,toolbar.querySelector('.fv-ed-zoom'));const notice=el('span');notice.setAttribute('role','button');notice.tabIndex=0;notice.onclick=()=>jumpMissing();notice.onkeydown=e=>{if(['Enter',' '].includes(e.key)){e.preventDefault();jumpMissing();}}; notice.classList.add('fv-ed-text-notice'); notice.hidden=true; exportBox.prepend(notice);+ const fontFailure=()=>t('Text fonts could not be loaded','文字字体没能加载');+ let fontIssue=null;const menu=el('div','fv-ed-text-menu'); menu.hidden=true; menu.setAttribute('role','menu'); element.append(menu);const names={sans:t('Sans','黑体'),serif:t('Serif','宋体'),kai:t('Kai','楷体'),mono:t('Mono','等宽')};let disposed=false,ready=false,table=null,loadError=false,draft=null,fresh=null,typing=null,lastStyle={},editing=null,drag=null,raf=null,layouts=new Map(),mapped={x:0,y:0,w:1,h:1};@@ -63,16 +67,16 @@ export function createEditorText({element,state,t,actions,adjust,player,toolbar,// `need` is what has to be downloaded before the first use, in bytes; the same press downloads it and goes on.const speech={buttons:new Set(),available:false,need:0,busy:false,loading:false,shown:null,job:null,stop:null,run:0};function speechLabel(fraction){speech.shown=fraction;const p=Math.round(Math.min(1,Math.max(0,Number(fraction)||0))*100),size=Math.max(1,Math.round(speech.need/1e6)),text=fraction==null?(speech.need?t(`Auto subtitles · Download ${size} MB`,`自动字幕 · 下载 ${size} MB`):t('Auto subtitles','自动字幕')):speech.loading?t(`Cancel · Downloading ${p}%`,`取消 · 下载 ${p}%`):t(`Cancel · ${p}%`,`取消 · ${p}%`);for(const b of speech.buttons){b.textContent=text;b.hidden=!(speech.available||speech.need);}}- function speechEnd(text){speech.stop?.();speech.stop=null;speech.job=null;speech.busy=false;speech.loading=false;speechLabel(null);if(text)actions.notify?.(text);}+ function speechEnd(text,where=null){speech.stop?.();speech.stop=null;speech.job=null;speech.busy=false;speech.loading=false;speechLabel(null);if(text)actions.notify?.(text,where);}const speechFailed=()=>t('Could not create subtitles','没能生成字幕'),speechSilent=()=>t('No speech found','没有听到说话声');const speechReason=reason=>reason==='no_sound'?speechSilent():reason==='language'?t('Language not supported yet','暂不支持这种语言'):speechFailed();function speechResult(job){if(job.state==='running'){speechLabel(job.fraction);return true;}- if(job.state!=='done'){speechEnd(job.state==='cancelled'?null:speechReason(job.reason));return false;}+ if(job.state!=='done'){speechEnd(job.state==='cancelled'?null:speechReason(job.reason),job.state==='cancelled'||['no_sound','language'].includes(job.reason)?null:SPEECH_ISSUE);return false;}const cues=(Array.isArray(job.result?.lines)?job.result.lines:[]).filter(l=>typeof l?.text==='string'&&l.text.trim()&&l.end>l.start).map(l=>({start:l.start,frames:l.end-l.start,text:l.text.trim()}));speechEnd();if(!cues.length){actions.notify?.(speechSilent());return false;}finishInline();commitDraft();- if(!apply(t('Auto subtitles','自动字幕'),r=>addSubtitles(r,cues,{replace:true})))actions.notify?.(speechFailed());+ if(!apply(t('Auto subtitles','自动字幕'),r=>addSubtitles(r,cues,{replace:true})))actions.notify?.(speechFailed(),SPEECH_ISSUE);else{const missing=projectMissing(state.record);if(missing.length)actions.notify?.(missingHint([...new Set(missing.flatMap(r=>r.chars))],t));}return false;}@@ -87,17 +91,17 @@ export function createEditorText({element,state,t,actions,adjust,player,toolbar,const ability=done?await actions.speech.ability():null;if(run!==speech.run)return;if(ability){speech.available=ability.available;speech.need=ability.need;}- if(!done||speech.need){speechEnd(t('Could not download. Try again.','没能下载,请再试一次。'));return;}- if(!speech.available){speechEnd(speechFailed());return;}+ if(!done||speech.need){speechEnd(t('Could not download. Try again.','没能下载,请再试一次。'),SPEECH_ISSUE);return;}+ if(!speech.available){speechEnd(speechFailed(),SPEECH_ISSUE);return;}speech.loading=false;}speechLabel(0);const job=await actions.speech.start();if(run!==speech.run){if(job?.id)Promise.resolve(actions.speech.cancel(job.id)).catch(()=>{});return;}- if(!job){speechEnd(speechFailed());return;}+ if(!job){speechEnd(speechFailed(),SPEECH_ISSUE);return;}speech.job=job.id??null;- if(speechResult(job))speech.stop=actions.speech.watch(job.id,value=>{if(run!==speech.run)return false;if(!value){speechEnd(speechFailed());return false;}return speechResult(value);});- }catch{if(run===speech.run)speechEnd(speech.loading?t('Could not download. Try again.','没能下载,请再试一次。'):speechFailed());}+ if(speechResult(job))speech.stop=actions.speech.watch(job.id,value=>{if(run!==speech.run)return false;if(!value){speechEnd(speechFailed(),SPEECH_ISSUE);return false;}return speechResult(value);});+ }catch{if(run===speech.run)speechEnd(speech.loading?t('Could not download. Try again.','没能下载,请再试一次。'):speechFailed(),SPEECH_ISSUE);}}function commitDraft(){if(draft){const change=draft.change;apply(t('Text','文字'),change);const c=selectedText();if(c?.text_kind==='text')lastStyle={...styleOf(state.record,c)};}}// Editing a text ended. One left without words is taken away; one that never had any leaves no step behind.@@ -227,13 +231,18 @@ export function createEditorText({element,state,t,actions,adjust,player,toolbar,function updateWarnings(){const r=record(),c=selectedText(),s=c&&styleOf(r,model.find(r,c.id));const missing=projectMissing(r),chars=[...new Set(missing.flatMap(r=>r.chars))];- notice.hidden=!chars.length&&!loadError;notice.textContent=loadError?t('Text fonts could not be loaded','文字字体没能加载'):missingHint(chars,t);notice.title=notice.textContent;+ notice.hidden=!chars.length&&!loadError;notice.textContent=loadError?fontFailure():missingHint(chars,t);notice.title=notice.textContent;for(const [kind,p]of panels){if(c?.text_kind!==kind)continue;const entry=model.find(r,c.id),absent=table?missingGlyphs(entry.text,s.font,!!s.bold,table):[];- p.warning.hidden=!absent.length&&!loadError;p.warning.textContent=loadError?t('Text fonts could not be loaded','文字字体没能加载'):missingHint(absent,t);+ p.warning.hidden=!absent.length&&!loadError;p.warning.textContent=loadError?fontFailure():missingHint(absent,t);+ if(loadError)p.warning.append(issueButton(t,()=>({where:FONT_ISSUE,message:fontFailure()})));p.overflow.hidden=kind!=='subtitle'||!ready||!metrics||!textLayout(metrics,entry.text,s,kind,r.width,r.height).overTwo;}+ // Both messages can be on screen at once; the button stays with the one nearest the text panel.+ const panelShowing=loadError&&[...panels.values()].some(p=>p.warning.offsetParent!==null);+ if(loadError&&!panelShowing&&!fontIssue){fontIssue=issueButton(t,()=>({where:FONT_ISSUE,message:fontFailure()}));notice.after(fontIssue);}+ if((!loadError||panelShowing)&&fontIssue){fontIssue.remove();fontIssue=null;}}function jumpMissing(){const first=projectMissing(state.record)[0];if(first){const c=model.find(state.record,first.id);state.select({kind:'clip',ids:[c.id]});state.seek(c.start);adjust.open();}}function updateClip(item,r){@@ -368,14 +377,14 @@ export function createEditorText({element,state,t,actions,adjust,player,toolbar,async function beforeExport(){if(!state.record.tracks.some(isTextTrack))return true;finishInline();commitDraft();await ensureFonts();const chars=[...new Set(projectMissing(state.record).flatMap(r=>r.chars))];if(!chars.length&&!loadError)return true;- const dialog=el('dialog','fv-studio fv-ed-text-export-dialog'),title=el('h3','',t('Export','导出')),message=el('p','',loadError?t('Text fonts could not be loaded','文字字体没能加载'):missingHint(chars,t));- const close=button(t('Back to edit','返回修改'),{onClick:()=>dialog.close()});dialog.append(title,message,close);document.body.append(dialog);- const stop=isolateDialogKeys(dialog,(e)=>{if(e.type==='keydown'&&e.key==='Escape'){e.preventDefault();dialog.close();}else if(e.type==='keydown'&&e.key==='Enter'){e.preventDefault();dialog.close();}});+ const dialog=el('dialog','fv-studio fv-ed-text-export-dialog'),title=el('h3','',t('Export','导出')),message=el('p','',loadError?fontFailure():missingHint(chars,t));+ const close=button(t('Back to edit','返回修改'),{onClick:()=>dialog.close()});dialog.append(title,message);if(loadError)dialog.append(issueButton(t,()=>({where:FONT_ISSUE,message:fontFailure()})));dialog.append(close);document.body.append(dialog);+ const stop=isolateDialogKeys(dialog,(e)=>{if(e.type==='keydown'&&e.key==='Escape'){e.preventDefault();dialog.close();}else if(e.type==='keydown'&&e.key==='Enter'&&!e.target.closest?.('.fv-issue-button')){e.preventDefault();dialog.close();}});dialog.onclose=()=>{stop();dialog.remove();jumpMissing();};dialog.showModal();close.focus();return false;}return {get ready(){return ensureFonts();},beforeExport,speech(value){speech.available=value?.available===true;speech.need=Number(value?.need)||0;if(!speech.busy)speechLabel(null);},flush(){finishInline();commitDraft();},keyboard(e){if(isTyping(e.target)||e.ctrlKey||e.metaKey||e.altKey||e.isComposing)return false;if(e.key.toLowerCase()==='t'){e.preventDefault();e.stopPropagation();add('text');return true;}if(e.key==='Escape'&&(drag||!menu.hidden)){e.preventDefault();if(drag)endDrag(e,true);menu.hidden=true;return true;}return false;- },dispose(){disposed=true;if(speech.busy){const id=speech.job;speech.run++;speechEnd();if(id)Promise.resolve(actions.speech.cancel(id)).catch(()=>{});}speech.buttons.clear();player.setTextRenderer?.(null);unsubscribe();resize?.disconnect();cancelAnimationFrame(raf);tracksHost.removeEventListener('contextmenu',contextMenu);element.removeEventListener('pointerdown',outside);frame.removeEventListener('seeked',seeked,true);frame.removeEventListener('loadeddata',seeked,true);canvas.remove();boundsLayer.remove();buttons.remove();notice.remove();menu.remove();}};+ },dispose(){disposed=true;if(speech.busy){const id=speech.job;speech.run++;speechEnd();if(id)Promise.resolve(actions.speech.cancel(id)).catch(()=>{});}speech.buttons.clear();player.setTextRenderer?.(null);unsubscribe();resize?.disconnect();cancelAnimationFrame(raf);tracksHost.removeEventListener('contextmenu',contextMenu);element.removeEventListener('pointerdown',outside);frame.removeEventListener('seeked',seeked,true);frame.removeEventListener('loadeddata',seeked,true);canvas.remove();boundsLayer.remove();buttons.remove();notice.remove();fontIssue?.remove();menu.remove();}};}diff --git a/web/error_panel.js b/web/error_panel.jsindex b803492..6faee1c 100644--- a/web/error_panel.js+++ b/web/error_panel.js@@ -484,7 +484,7 @@ export function createErrorPanel(t) {const download = document.createElement('button'); download.type = 'button'; download.textContent = t('Export report', '导出报告');// A generation that stopped offers two buttons: the report file, or the same facts as a GitHub issue.const github = document.createElement('button'); github.type = 'button'; github.className = 'fv-failure-github';- github.textContent = t('Submit to GitHub', '提交到 GitHub');+ github.textContent = t('Report a problem', '提交问题');// Shown only for a browser extension, whose steps end with a reload.const reload = document.createElement('button'); reload.type = 'button'; reload.className = 'fv-failure-reload';reload.textContent = t('Reload page', '刷新页面'); reload.hidden = true; reload.onclick = () => globalThis.location?.reload();@@ -607,7 +607,7 @@ export function createErrorPanel(t) {const lora = advice.kind === 'lora-unusable' || advice.kind === 'lora-int8';// An int8 limit is not a judgement, so there is no mistake to report.github.hidden = !generated || advice.kind === 'lora-int8'; githubLora = lora;- github.textContent = lora ? t('Report a mistake', '报告误判') : t('Submit to GitHub', '提交到 GitHub');+ github.textContent = lora ? t('Report a mistake', '报告误判') : t('Report a problem', '提交问题');if (generated && typeof window !== 'undefined') loadIssueModules();if (popup) showFailureDialog(report, t);return report;diff --git a/web/freevideo.js b/web/freevideo.jsindex 5f5de11..25ba0a3 100644--- a/web/freevideo.js+++ b/web/freevideo.js@@ -29,6 +29,7 @@ import { openImageEditor, icon } from './image_editor.js';import { imageGenerationSupported } from './image_generation.js';import { createCastLibrary } from './cast_library.js';import { uploadMedia } from './media_upload.js';+import { issueButton } from './issue_button.js';const languageOverride = typeof location !== 'undefined'? new URLSearchParams(location.search).get('freevideo_lang') : null;@@ -47,6 +48,7 @@ style.textContent = `.fv-panel[data-freevideo=result]{display:flex;flex-direction:column;justify-content:center}.fv-panel[data-freevideo=result]:has(>.fv-generation-progress:not([hidden])){justify-content:flex-start}.fv-panel .fv-connected-card{text-align:center;padding:28px 12px;border:1px solid var(--fv-border);border-radius:var(--fv-r-md,12px);color:var(--fv-muted);background:var(--fv-raised)}.fv-panel button,.fv-panel select,.fv-panel a{box-sizing:border-box;min-height:var(--fv-h-sm,32px);border:1px solid var(--fv-border);border-radius:var(--fv-r-sm,8px);background:var(--fv-raised);color:var(--fv-ink);padding:5px 10px;font:inherit;font-weight:var(--fv-medium,500);cursor:pointer;text-decoration:none}.fv-panel button:hover,.fv-panel a:hover{background:var(--fv-hover)}.fv-panel button:disabled{opacity:.45;cursor:wait}+.fv-menu-failure{width:min(460px,calc(100vw - 32px));height:auto}.fv-menu-failure::backdrop{background:#0009}.fv-panel select{max-width:170px}.fv-note{color:var(--fv-muted);font-size:var(--fv-micro,12px);margin:8px 0;white-space:pre-wrap}.fv-error{color:var(--fv-danger)}.fv-mode{font-size:var(--fv-micro,12px);color:var(--fv-accent)}.fv-panel[data-freevideo=media]>.fv-mode{display:inline-block;margin:4px 0 2px;padding:2px 8px;border-radius:var(--fv-r-xs,3px);background:var(--fv-selected);font-weight:var(--fv-medium,500)}.fv-card{border:1px solid var(--fv-border);border-radius:var(--fv-r-md,12px);padding:10px;margin-top:10px;background:var(--fv-raised)}@@ -657,14 +659,24 @@ const launchVisit = isLaunchVisit(globalThis.location?.search, globalThis.sessiolet userActed = false;for (const type of ['pointerdown', 'keydown']) globalThis.addEventListener?.(type, () => { userActed = true; }, {capture: true, once: true});+let menuFailure;async function openFromMenu() {+ menuFailure?.close();try {const node = (app.graph?._nodes || []).find(isGenerate) || await openFreeVideoWorkflow();if (!node) throw new Error('FreeVideo workflow unavailable');showStudio(node);} catch (error) {console.warn('FreeVideo menu:', error);- app.extensionManager?.toast?.add({severity: 'error', summary: 'FreeVideo', detail: text('Could not complete. Try again.', '没有完成,请重试'), life: 9000});+ const message = text('Could not complete. Try again.', '没有完成,请重试');+ const dialog = el('dialog', undefined, 'fv-panel fv-menu-failure'); menuFailure = dialog;+ dialog.setAttribute('aria-label', 'FreeVideo');+ const actions = el('div', undefined, 'fv-row');+ actions.append(issueButton(text, () => ({where: ['Open FreeVideo', '打开 FreeVideo'], message})),+ button(text('Close', '关闭'), '', () => dialog.close()));+ dialog.append(el('p', message), actions);+ dialog.onclose = () => { dialog.remove(); if (menuFailure === dialog) menuFailure = null; };+ document.body.append(dialog); dialog.showModal();}}@@ -819,7 +831,11 @@ app.registerExtension({if (handle) { opening.cover(); await handle.ready; }else {const studio = showStudio(node), status = studio?.querySelector?.('.fv-status');- if (status) { status.dataset.error = 'true'; status.textContent = text('Could not complete. Try again.', '没有完成,请重试'); }+ if (status) {+ const message = text('Could not complete. Try again.', '没有完成,请重试');+ status.dataset.error = 'true'; status.textContent = message;+ status.append(issueButton(text, () => ({where: ['Open editor', '打开剪辑'], message})));+ }}} finally { if (epoch === configuration) opening.finish(); }});diff --git a/web/generation_progress.css b/web/generation_progress.cssindex bd3c974..2485fd5 100644--- a/web/generation_progress.css+++ b/web/generation_progress.css@@ -71,3 +71,4 @@@keyframes fv-generation-mini-sweep{0%{left:-40px}100%{left:100%}}@keyframes fv-generation-mini-light{0%{transform:translateX(-40px)}100%{transform:translateX(160px)}}@media (prefers-reduced-motion:reduce){.fv-generation-mini[data-mode=indeterminate] .fv-generation-mini-fill{left:60px;animation:none}.fv-generation-mini[data-shimmer=true]::after{animation:none;opacity:0}}+.fv-generation-progress>.fv-issue-button{margin-top:6px;align-self:center}diff --git a/web/generation_progress.js b/web/generation_progress.jsindex 1547c4d..31df724 100644--- a/web/generation_progress.js+++ b/web/generation_progress.js@@ -1,5 +1,6 @@// One whole-video estimate and the same five rows in Studio and the node view.import { saveReport, reportIssue, showReportTip } from './report_issue.js';+import { issueButton } from './issue_button.js';const css = document.createElement('link');css.rel = 'stylesheet'; css.href = new URL('./generation_progress.css', import.meta.url).href;document.head.append(css);@@ -370,15 +371,17 @@ export function createDiagnosticReportControl(t, {api = null, fallback = null, t}}const report = el('button', 'fv-report-download fv-quiet'); report.type = 'button'; report.hidden = true;+ let problem;// A finished video's report is fetched once and kept: the file saved and the one sent are the same.let reportId = null, revision = 0, pinned = false, pinnedBlob = null;report.textContent = label();function updateReport(message) {if (message.new_request === true || message.overall?.reset === true || message.reset === true && !message.phase) {+ problem?.remove();reportId = null; revision++; report.hidden = true; pinned = false; pinnedBlob = null;}if (typeof message.report_id === 'string' && /^[a-f0-9]{32}$/.test(message.report_id)) {- if (reportId !== message.report_id) { revision++; pinned = false; pinnedBlob = null; report.disabled = false; report.textContent = label(); }+ if (reportId !== message.report_id) { problem?.remove(); revision++; pinned = false; pinnedBlob = null; report.disabled = false; report.textContent = label(); }reportId = message.report_id;}report.hidden = !reportId && !fallback;@@ -400,6 +403,7 @@ export function createDiagnosticReportControl(t, {api = null, fallback = null, tasync function downloadReport() { await saveReport(await fetchReport()); }report.onclick = async () => {if (report.disabled || report.hidden) return;+ problem?.remove();const current = revision;report.disabled = true; report.textContent = t('Preparing report…', '正在整理报告…');try {@@ -410,7 +414,11 @@ export function createDiagnosticReportControl(t, {api = null, fallback = null, tsubmit: () => reportIssue(fetchReport, typeof version === 'function' ? version() : version, {save: false})});}} catch {- if (current === revision) report.textContent = t('Report unavailable · retry', '报告暂不可用 · 重试');+ if (current === revision) {+ report.textContent = t('Report unavailable · retry', '报告暂不可用 · 重试');+ problem = issueButton(t, () => ({where: ['Diagnostic report', '诊断报告'], message: report.textContent}));+ report.after(problem);+ }} finally { if (current === revision) report.disabled = false; }};return {report, updateReport, fetchReport, downloadReport, hasReport: () => reportId !== null, pin: () => { pinned = true; }};diff --git a/web/health.js b/web/health.jsindex 050c2f6..e1bf094 100644--- a/web/health.js+++ b/web/health.js@@ -16,7 +16,7 @@ const launchVisit = query.get('freevideo') === 'launch';export const MODULES = ['agent_activity.js', 'agent_connect.js', 'agent_session.js', 'autopilot.js', 'autopilot_chat.js', 'autopilot_conversations.js', 'browser_extension.js', 'caret_rect.js', 'chain_support.js', 'capability_view.js', 'cast_generate.js', 'cast_mention.js', 'cast_overlay.js', 'cast_source.js', 'compatibility.js', 'entry_showcase.js', 'error_panel.js', 'first_run_guide.js', 'fonts.js', 'freevideo.js', 'generation_progress.js','editor.js', 'editor_actions.js', 'editor_lifecycle.js', 'editor_adjust.js', 'editor_adjust_picture.js', 'editor_picture_fields.js', 'editor_picture_session.js', 'editor_preview_picture.js', 'editor_entry.js', 'editor_expand.js', 'editor_export_dialog.js', 'editor_first_frame.js', 'editor_media_references.js', 'editor_references.js', 'editor_genbar.js', 'editor_geometry.js', 'editor_library.js', 'editor_menu.js', 'editor_model.js', 'editor_frame.js', 'editor_player.js', 'editor_room.js', 'editor_select.js', 'editor_state.js', 'editor_store.js', 'editor_tracks.js', 'editor_generation.js', 'editor_transport.js', 'editor_transport_model.js', 'editor_audio.js', 'editor_audio_model.js', 'editor_audio_notes.js', 'editor_audio_replace.js', 'editor_audio_rules.js', 'editor_speed.js', 'editor_speed_model.js', 'editor_failure.js', 'editor_header_fit.js','editor_loader.js', 'editor_text_coverage.js', 'editor_text.js', 'editor_toolbar_more.js', 'editor_text_model.js', 'editor_text_layout.js', 'editor_notes.js', 'editor_icons.js', 'dialog_keys.js', 'done_notify.js', 'failure_issue.js', 'feedback.js', 'frame_sizes.js', 'health.js', 'image_commands.js', 'image_editor.js', 'image_editor_engine.js', 'image_generation.js', 'launch_visit.js', 'launcher.js', 'length_plan.js', 'lora_triggers.js', 'lora_check.js', 'library.js', 'motion.js', 'native_errors.js', 'translate_guard.js', 'output_download.js', 'port_notice.js', 'preview_scene.js',- 'progress_connection.js', 'prompt_draft.js', 'prompt_enhance.js', 'prompt_references.js', 'prompt_terms.js', 'request_assets.js', 'repair_hint.js', 'report_issue.js', 'studio_recent.js',+ 'progress_connection.js', 'prompt_draft.js', 'prompt_enhance.js', 'prompt_references.js', 'prompt_terms.js', 'request_assets.js', 'repair_hint.js', 'report_issue.js', 'issue_button.js', 'studio_recent.js','result_actions.js', 'sampling_effort.js', 'setup.js', 'share.js', 'share_layout.js', 'studio.js', 'studio_chain.js', 'studio_extend.js', 'studio_length.js', 'first_frame_row.js', 'optional_inputs.js', 'studio_queue.js', 'studio_size.js','toolbar_position.js', 'updates.js', 'view_navigation.js', 'wordmark.js', 'workspace_restore.js', 'cast_library.js', 'media_upload.js', 'whitebox_encode.js', 'whitebox_mp4.js', 'whitebox_recording.js', 'whitebox_render.js', 'whitebox_scenes.js', 'whitebox_worker.js'];const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));@@ -134,8 +134,8 @@ async function probe(url) {const ADVICE = {files: t('FreeVideo’s page files are missing or unreadable. In the FreeVideo launcher, open Settings and click Repair, then open FreeVideo again. Without the launcher, update the FreeVideo node and restart ComfyUI.','FreeVideo 的网页文件缺失或无法读取。请在 FreeVideo 启动器的“设置”里点击“修复”,完成后重新打开。没有使用启动器时,请更新 FreeVideo 节点并重启 ComfyUI。'),- type: t('ComfyUI sent the file with the wrong type, so the browser refused it. Restart ComfyUI. If it persists, copy the details and submit them in a GitHub issue; we will look into it and work on a fix for you.',- 'ComfyUI 发给浏览器的文件类型不对,浏览器拒绝使用。请重启 ComfyUI;仍然出现时,请复制详情并提交到 GitHub issue,我们会专门排查,为您解决这个问题。'),+ type: t('ComfyUI sent the file with the wrong type, so the browser refused it. Restart ComfyUI. If it persists, use Report a problem.',+ 'ComfyUI 发给浏览器的文件类型不对,浏览器拒绝使用。请重启 ComfyUI;仍然出现时,请点“提交问题”。'),browser: t('This browser cannot run FreeVideo. Open the same address in a current Chrome or Edge.','当前浏览器无法运行 FreeVideo。请用最新版 Chrome 或 Edge 打开同一个地址。'),mixed: t('The browser mixed files from two FreeVideo versions. Press Ctrl+F5 to reload without the cache.',@@ -144,10 +144,10 @@ const ADVICE = {'请保留 custom_nodes/FreeVideo,把其他 FreeVideo 文件夹移出 custom_nodes,然后重启 ComfyUI。'),plugin: t('Another ComfyUI extension reported an error at the same time. Turn it off in ComfyUI Settings › Extensions, then reload.','同时有其他 ComfyUI 插件报错。可在 ComfyUI“设置 › 扩展”里暂时停用它,然后刷新页面。'),- reload: t('Reload the page. If it happens again, copy the details and submit them in a GitHub issue; we will look into it and work on a fix for you.',- '请刷新页面。仍然出现时,请复制详情并提交到 GitHub issue,我们会专门排查,为您解决这个问题。'),- 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. If that does not help, copy the details and submit them in a GitHub issue; we will look into it and work on a fix for you.',- 'FreeVideo 已经用重新下载的文件自动刷新过一次页面。请按 Ctrl+F5 强制刷新;仍然出现时,请停用会拦截此页面脚本的浏览器插件,或换一个浏览器打开同一地址。仍未解决时,请复制详情并提交到 GitHub issue,我们会专门排查,为您解决这个问题。'),+ reload: t('Reload the page. If it happens again, use Report a problem.',+ '请刷新页面。仍然出现时,请点“提交问题”。'),+ 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. If that does not help, use Report a problem.',+ 'FreeVideo 已经用重新下载的文件自动刷新过一次页面。请按 Ctrl+F5 强制刷新;仍然出现时,请停用会拦截此页面脚本的浏览器插件,或换一个浏览器打开同一地址。仍未解决时,请点“提交问题”。'),relaunch: t('Click Start in the FreeVideo launcher again.', '请在 FreeVideo 启动器里重新点击“启动”。'),};@@ -458,6 +458,25 @@ function details(problems) {'', 'Errors seen while loading:', ...(seen.length ? seen.map(row => `- [${row.kind}] ${row.text}`) : ['- none'])].join('\n');}+// "Report a problem": the feedback form with the failed checks in it. This card runs when other files+// fail to load, so it builds the address itself (no shared module) and removes places and addresses.+const ISSUE_FORM = 'https://github.com/FlashML-org/FreeVideo/issues/new';+const forgetPlaces = text => String(text)+ .replace(/https?:\/\/[^\s'"<>)]+/g, '<url>')+ .replace(/\b\d{1,3}(?:\.\d{1,3}){3}(?::\d+)?\b/g, '<address>')+ .replace(/(?:[A-Za-z]:[\\/]|\\\\|~[\\/])[^'"<>|\r\n]+/g, '<path>')+ .replace(/(^|[\s('"])\/[\w.-]+(?:\/[^\s'"<>)]*)+/g, '$1<path>');+function issueAddress(problems) {+ const summary = forgetPlaces(details(problems)).split('\n').filter(line => !line.startsWith('Page:')).join('\n');+ const feedback = ['FreeVideo showed an error.', 'Where: Page check',+ `Error: ${forgetPlaces(problems[0]?.text || '').slice(0, 300)}`].join('\n');+ const build = text => `${ISSUE_FORM}?${new URLSearchParams({template: 'feedback.yml', title: '[Feedback] Page check',+ feedback, diagnostics: text})}`;+ let text = summary.slice(0, 2500);+ while (build(text).length > 7000 && text) text = text.slice(0, Math.floor(text.length * 0.8));+ return build(text);+}+// 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.@@ -527,6 +546,7 @@ function show(problems) {}copy.textContent = t('Copied', '已复制');});+ action(t('Report a problem', '提交问题'), () => window.open(issueAddress(problems), '_blank', 'noopener'));action(t('Close', '关闭'), () => { card?.remove(); card = null; });if (extensionAdvice) {const first = document.createElement('p'); first.textContent = extensionAdvice.summary;diff --git a/web/image_editor.css b/web/image_editor.cssindex 6f4c949..52e0ffc 100644--- a/web/image_editor.css+++ b/web/image_editor.css@@ -254,6 +254,7 @@ button.fv-ie-size:hover{background:var(--fv-hover);color:var(--fv-ink)}.fv-ie-confirm span{flex:1 1 220px}.fv-ie-status{padding:0 16px;color:var(--fv-muted);font-size:var(--fv-micro)}.fv-ie-status:empty{display:none}+.fv-ie-status .fv-issue-button{pointer-events:auto;margin-left:8px}.fv-ie-status:not(:empty){position:absolute;left:0;right:0;bottom:0;padding:7px 16px;border-top:1px solid var(--fv-border);background:var(--fv-panel,#0f1620);z-index:3;pointer-events:none}@media (max-width:900px){diff --git a/web/image_editor.js b/web/image_editor.jsindex f13ffaf..4cd1efc 100644--- a/web/image_editor.js+++ b/web/image_editor.js@@ -10,6 +10,7 @@ import {FONT_KEYS, fontStack, fontLoaded, loadFont, loadFonts} from './fonts.js'import {api} from '../../scripts/api.js';import {createImageGenClient, createImageGeneration, imageGenerationSupported, blankCanvasSize, blankCanvasRatio, segmentAt} from './image_generation.js';import {productVersion} from './updates.js';+import {issueButton} from './issue_button.js';const css = document.createElement('link');css.rel = 'stylesheet'; css.href = new URL('./image_editor.css', import.meta.url).href;@@ -921,14 +922,14 @@ export async function openImageEditor({source = null, name = source || '', targecommitInserted(commands.addImageLayer(doc, {src: file, nw: img.naturalWidth, nh: img.naturalHeight,name: label || file.split('/').pop()}));select('move');- } catch { message(t('The image could not be added. Choose another one.', '图片没能添加,请换一张。')); }+ } catch { message(t('The image could not be added. Choose another one.', '图片没能添加,请换一张。'), ['Image editor', '图片编辑器']); }}filePicker.onchange = async () => {const file = filePicker.files?.[0]; filePicker.value = '';if (!file || !upload) return;message(t('Uploading the image…', '正在上传图片…'));try { const result = await upload(file); message(''); await addImageLayer(result.file, file.name); }- catch (error) { message(error.message || t('Upload failed.', '上传失败。')); }+ catch (error) { message(error.message || t('Upload failed.', '上传失败。'), ['Image editor upload', '图片编辑器上传']); }};function duplicateLayer() {const layer = active();@@ -1254,7 +1255,7 @@ export async function openImageEditor({source = null, name = source || '', targeaddPart({shape: 'mask', layer: src.id, file, upto: src.ops.length}, how); message('');}).catch(error => {message(error?.code === 'busy_video' ? t('A video is generating. Try again when it finishes.', '视频正在生成,完成后再试。')- : t('Could not find an object here. Try again.', '没能在这里找出物体,请再试一次。'));+ : t('Could not find an object here. Try again.', '没能在这里找出物体,请再试一次。'), error?.code === 'busy_video' ? null : ['Image object selection', '图片智能抠图']);}).finally(() => { pointBusy = false; });return null;}@@ -1548,6 +1549,7 @@ export async function openImageEditor({source = null, name = source || '', targeconst mod = event.ctrlKey || event.metaKey, key = event.key.toLowerCase();// Nothing typed here reaches ComfyUI's canvas shortcuts behind the dialog.if (event.key !== 'Escape' && event.key !== 'Tab') event.stopPropagation();+ if (event.target.closest?.('.fv-issue-button')) return;if (typing) { if (mod && key === 'enter') { event.preventDefault(); finish(); } return; }if (mod && key === 'z') { event.preventDefault(); step(event.shiftKey ? 1 : -1); return; }if (mod && key === 'y') { event.preventDefault(); step(1); return; }@@ -1608,7 +1610,12 @@ export async function openImageEditor({source = null, name = source || '', targelet resolveResult;const result = new Promise(r => { resolveResult = r; });let messageTimer = null;- function message(text) { status.textContent = text; clearTimeout(messageTimer); if (text) messageTimer = setTimeout(() => { status.textContent = ''; }, 5000); }+ function message(text, where = null) {+ status.textContent = text;+ if (text && where) status.append(issueButton(t, () => ({where, message: text})));+ clearTimeout(messageTimer);+ if (text) messageTimer = setTimeout(() => { status.textContent = ''; }, where ? 20000 : 5000);+ }async function leave() {void generation.cancel();if (healing) await healing;@@ -1628,7 +1635,7 @@ export async function openImageEditor({source = null, name = source || '', targeconst {blob, width, height} = await renderer.export(doc, extension === 'jpg' ? 'image/jpeg' : 'image/png');close({blob, name: name ? `${stem}-edit.${extension}` : `${stem}.${extension}`, edit: doc, width, height});} catch {- message(t('The image could not be saved. Try a smaller canvas or reload the page.', '图片没能保存,请缩小画布或刷新页面后重试。'));+ message(t('The image could not be saved. Try a smaller canvas or reload the page.', '图片没能保存,请缩小画布或刷新页面后重试。'), ['Image editor save', '图片编辑器保存']);save.disabled = cancel.disabled = false;}}diff --git a/web/image_generation.js b/web/image_generation.jsindex d1ea405..2481c6c 100644--- a/web/image_generation.js+++ b/web/image_generation.js@@ -3,6 +3,7 @@import * as commands from './image_commands.js';import {orientMatrix, rasterKinds, scaleSelection} from './image_editor_engine.js';import {saveReport, reportIssue, showReportTip} from './report_issue.js';+import {issueButton} from './issue_button.js';import {about} from './request_assets.js';export const IMAGE_GEN_PROTOCOL = Object.freeze({@@ -222,16 +223,19 @@ export function renderImageFailure(host, {error, report_id, stage, fitted} = {},const anchor = doc.createElement('button'); anchor.type = 'button';anchor.className = 'fv-action fv-action-secondary fv-action-report';anchor.textContent = t(...REPORT_LABELS.download); anchor.title = t(...REPORT_LABELS.description);+ const issue = issueButton(t, () => ({where: ['Image diagnostic report', '生图诊断报告'], message: t(...REPORT_LABELS.unavailable)}));+ issue.hidden = true;anchor.onclick = async () => {if (anchor.disabled) return;const restoreFocus = doc.activeElement === anchor;+ issue.hidden = true;anchor.disabled = true; anchor.textContent = t(...REPORT_LABELS.preparing);try {await saveReport(await fetchReport());if (card.isConnected) showReportTip(bar, anchor, t, {mode: 'downloaded',submit: () => reportIssue(fetchReport, version(), {save: false}), onHide: () => anchor.focus()});anchor.textContent = t(...REPORT_LABELS.download);- } catch { anchor.textContent = t(...REPORT_LABELS.unavailable); }+ } catch { anchor.textContent = t(...REPORT_LABELS.unavailable); issue.hidden = false; }finally {anchor.disabled = false;if (restoreFocus && card.isConnected && doc.activeElement === doc.body) anchor.focus({preventScroll: true});@@ -242,7 +246,7 @@ export function renderImageFailure(host, {error, report_id, stage, fitted} = {},card.addEventListener('keydown', event => {if (event.key === 'Enter' || event.key === ' ') event.stopPropagation();});- bar.append(anchor); card.append(bar);+ bar.append(anchor, issue); card.append(bar);return card;}export function imagePackUnavailableMessage(info, t) {diff --git a/web/issue_button.js b/web/issue_button.jsnew file mode 100644index 0000000..0eeaf64--- /dev/null+++ b/web/issue_button.js@@ -0,0 +1,69 @@+// The "Report a problem" button that sits beside a failure message: one component for every place that+// shows one. A click opens the GitHub feedback form with the error sentence already in it; the report+// and typed text never travel (the message goes through the same redaction as the failure card's report).+import {createErrorReport} from './error_panel.js';++const MESSAGE = 300, TAIL = 1500;+const ISSUE_FORM = 'https://github.com/FlashML-org/FreeVideo/issues/new';++/**+ * Title, text and summary for the prefilled form. `where` is [English, Chinese] words for the place+ * ("Export", "导出"); `message` is the sentence the user sees.+ */+export function issueDraft({where, message, kind = null}, t = en => en) {+ const place = Array.isArray(where) ? where : [String(where || 'FreeVideo'), String(where || 'FreeVideo')];+ const clean = createErrorReport({exception_message: String(message || '')}).message;+ const lines = clean.split(/\r?\n/).filter(line => line.trim());+ // A traceback ends with the line that names the error; any other message starts with it.+ const first = (/^Traceback/.test(lines[0] || '') ? lines[lines.length - 1] : lines[0]) || '';+ const text = [t('FreeVideo showed an error.', 'FreeVideo 显示了一个错误。'),+ `Where: ${place[0]}`, `Error: ${first.trim().slice(0, MESSAGE)}`, ...(kind ? [`Kind: ${kind}`] : [])].join('\n');+ const tail = clean.length <= TAIL ? clean : clean.slice(0, 500) + '\n...\n' + clean.slice(-(TAIL - 505));+ return {title: `[Feedback] ${t(place[0], place[1])}`, text, summary: JSON.stringify({where: place[0], kind, tail})};+}++// Browser-only modules, loaded as the button appears so the click opens the page at once+// (a page opened after waiting can be blocked as a pop-up).+let modules = null;+const load = () => modules || (modules = Promise.all([import('./feedback.js'), import('./updates.js')])+ .then(([feedback, updates]) => ({feedback, updates})).catch(() => null));++function icon() {+ const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');+ svg.setAttribute('viewBox', '0 0 16 16'); svg.setAttribute('aria-hidden', 'true'); svg.setAttribute('focusable', 'false');+ const path = document.createElementNS(svg.namespaceURI, 'path');+ path.setAttribute('d', 'M13.5 2.5h-11a1 1 0 0 0-1 1v7a1 1 0 0 0 1 1h2v3l3.5-3h5.5a1 1 0 0 0 1-1v-7a1 1 0 0 0-1-1Z');+ svg.append(path);+ return svg;+}++let sheet = null;+function style() {+ if (sheet?.parentNode) return;+ sheet = document.createElement('style'); sheet.id = 'freevideo-issue-button-style';+ sheet.textContent = `.fv-issue-button{display:inline-flex;align-items:center;gap:6px;min-height:var(--fv-h-sm,32px);box-sizing:border-box;border:1px solid var(--fv-border,#45454a);border-radius:var(--fv-r-sm,8px);background:transparent;color:var(--fv-muted,#bbb);padding:4px 11px;font:inherit;font-size:13px;cursor:pointer}+.fv-issue-button:hover{color:var(--fv-ink,#eee);border-color:var(--fv-ink,#eee)}.fv-issue-button svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linejoin:round}+.fv-issue-button[hidden]{display:none!important}`;+ document.head.append(sheet);+}++/** The button. `source` is {where, message, kind} or a function returning it when clicked (null: nothing to send). */+export function issueButton(t, source, {className = '', open = (url, features) => globalThis.open?.(url, '_blank', features)} = {}) {+ style();+ const button = document.createElement('button'); button.type = 'button';+ button.className = `fv-issue-button ${className}`.trim();+ const label = t('Report a problem', '提交问题');+ const text = document.createElement('span'); text.textContent = label;+ button.append(icon(), text);+ load();+ button.onclick = async () => {+ const value = typeof source === 'function' ? source() : source;+ if (!value) return;+ const ready = await load();+ const draft = issueDraft(value, t);+ // Modules that did not load still leave the blank form reachable.+ if (!ready) return open(`${ISSUE_FORM}?${new URLSearchParams({template: 'feedback.yml', title: draft.title, feedback: draft.text})}`, 'noopener');+ open(ready.feedback.feedbackIssueURL(draft.text, ready.updates.productVersion(), draft.summary, draft.title), 'noopener');+ };+ return button;+}diff --git a/web/library.css b/web/library.cssindex bebe158..c347424 100644--- a/web/library.css+++ b/web/library.css@@ -72,3 +72,4 @@.fv-library .fv-library-undo button{min-height:28px;padding:2px 10px;font-size:13px;color:var(--fv-accent)}.fv-library .fv-library-skipped{flex-basis:100%;font-size:12px;color:var(--fv-muted)}@media(max-width:680px){.fv-library-tools{gap:0}.fv-library .fv-library-header{grid-template-columns:auto minmax(0,1fr) auto}.fv-library-header h2{text-align:center}.fv-library-header button{white-space:nowrap}.fv-studio.fv-library .fv-library-header button{padding-left:6px;padding-right:6px}}+.fv-library-message .fv-issue-button{margin:4px 0 4px 8px;vertical-align:middle}diff --git a/web/library.js b/web/library.jsindex 98814f0..957bc7d 100644--- a/web/library.js+++ b/web/library.js@@ -4,6 +4,7 @@ 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';+import { issueButton } from './issue_button.js';const style = document.createElement('link');style.rel = 'stylesheet'; style.href = new URL('./library.css', import.meta.url).href; document.head.append(style);@@ -165,6 +166,10 @@ async function workflowBackfill(collection, t) {export function openLibrary(t, {upscale = null, selectedWork = null, extend = null, back: backLabel = null} = {}) {if (opened?.open) { if (selectedWork) opened.close(); else { opened.focus(); return; } }const dialog = el('dialog', null, 'fv-studio fv-library'); opened = dialog;+ const fault = (target, text, where = ['Creations', '作品库']) => {+ target.textContent = text;+ target.append(issueButton(t, () => ({where, message: text})));+ };dialog.setAttribute('aria-label', t('Your creations', '我的作品'));const header = el('header', null, 'fv-library-header');// Closing returns to the view this was opened from; that view names itself on the button.@@ -243,6 +248,7 @@ export function openLibrary(t, {upscale = null, selectedWork = null, extend = nuplayer.addEventListener('error', event => {if (!disposed && selected === row.video && event.currentTarget === player) {const note = el('p', videoUnavailableText(t), 'fv-library-message');+ fault(note, videoUnavailableText(t));frame.replaceChildren(note);}}, {once: true});@@ -264,7 +270,7 @@ export function openLibrary(t, {upscale = null, selectedWork = null, extend = nuif (editor && !disposed) { dialog.close(); editor.element?.focus({preventScroll: true}); }return editor;}- catch (error) { notice.textContent = error.message; }+ catch (error) { fault(notice, error.message, ['Continue video', '延长视频']); }},secondPass: row.preview && upscale ? () => secondPass(row) : null,remove: () => remove(row)}));@@ -297,7 +303,7 @@ export function openLibrary(t, {upscale = null, selectedWork = null, extend = nuawait upscale(row);if (!disposed && selected === row.video) notice.textContent = t('Queued. It appears in "Creations" when done.', '已加入队列,完成后在“作品”里。');} catch (error) {- if (!disposed && selected === row.video) notice.textContent = t('Could not start the second pass: ', '无法继续二采:') + error.message;+ if (!disposed && selected === row.video) fault(notice, t('Could not start the second pass: ', '无法继续二采:') + error.message, ['Second pass', '二采']);throw error;}}@@ -314,13 +320,15 @@ export function openLibrary(t, {upscale = null, selectedWork = null, extend = nuif (!response.ok || !value.deleted) throw new Error(value.reason || 'failed');} catch (error) {if (!disposed && selected === row.video) mountPlayer(row);- throw new Error(error.message === 'foreign-files'+ throw Object.assign(new Error(error.message === 'foreign-files'? t('Not deleted: the folder also holds files FreeVideo did not write: ', '未删除:文件夹里还有不是 FreeVideo 生成的文件:') + (value.kept || []).join(', '): error.message === 'editor-in-use' ? t('Not deleted: these edits use it: ', '未删除:这些剪辑正在使用它:') + (value.kept || []).join(', '): error.message === 'editor-unavailable' ? t('Not deleted: saved edits could not be checked. Try again in a moment.', '未删除:暂时无法检查已保存的剪辑,请稍后再试。'): error.message === 'continuation-in-use' ? t('Not deleted: a video continuing from it is running or queued. Try again after it finishes.', '未删除:接在这条视频后面的生成正在运行或排队,请等它完成后再试。'): error.message === 'in-use' ? t('Not deleted: its second pass is running, or the video is still open. Try again in a moment.', '未删除:正在用它跑二采,或视频仍被占用,请稍后再试。')- : t('Could not delete this creation.', '无法删除这条作品。'));+ : t('Could not delete this creation.', '无法删除这条作品。')), {+ reportable: !['foreign-files', 'editor-in-use', 'continuation-in-use', 'in-use'].includes(error.message),+ });}// Other views of the library (the studio's Recent videos) drop it too.window.dispatchEvent(new CustomEvent('freevideo-library-deleted', {detail: {video: row.video}}));@@ -470,6 +478,7 @@ export function openLibrary(t, {upscale = null, selectedWork = null, extend = nuif (disposed) return;const live = offeredUndoRows(), deletedCount = live.reduce((sum, row) => sum + row.count, 0);const notes = [undoNote ? el('span', undoNote, 'fv-library-skipped') : null, undoFailure ? el('span', undoFailure, 'fv-library-skipped') : null].filter(Boolean);+ if (undoFailure) notes.push(issueButton(t, () => ({where: ['Delete or restore creations', '删除或恢复作品'], message: undoFailure})));const settle = () => { if (undoRows().length) { showUndo(); return; } undoNote = null; undoFailure = ''; undoBar.replaceChildren(); undoBar.hidden = true; };undoBar.replaceChildren(); undoBar.hidden = !deletedCount && !notes.length;if (!deletedCount) { undoBar.append(...notes); return; }@@ -500,6 +509,10 @@ export function openLibrary(t, {upscale = null, selectedWork = null, extend = nuundoFailure = '';undoBar.replaceChildren(el('span', expired ? t('The undo time has passed.', '已过了撤销时间。'): lost ? t(`Restored, but ${lost} could not be brought back.`, `已恢复,其中 ${lost} 个没能恢复。`) : t('Restored.', '已恢复。')));+ if (lost && !expired) {+ const message = undoBar.firstElementChild.textContent;+ undoBar.append(issueButton(t, () => ({where: ['Restore creations', '恢复作品'], message})));+ }undoTimer = setTimeout(settle, 4000);load(false);}, 'fv-quiet');@@ -661,7 +674,12 @@ 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 = isNetworkTypeError(error) ? connectionLostText(t) : error.message; }+ } catch (error) {+ if (!disposed && error.name !== 'AbortError') {+ if (error.restart) message.textContent = error.message;+ else fault(message, isNetworkTypeError(error) ? connectionLostText(t) : error.message);+ }+ }finally { if (!disposed) { loading = false; refresh.disabled = more.disabled = false; } }return ok;}diff --git a/web/prompt_enhance.css b/web/prompt_enhance.cssindex 30e08f2..4c24391 100644--- a/web/prompt_enhance.css+++ b/web/prompt_enhance.css@@ -17,6 +17,7 @@.fv-enhance-status{display:none;padding:9px 12px 10px;line-height:1.6;border-top:1px solid #ffffff08;font-size:11px}.fv-enhance-status:is([data-state=progress],[data-state=error],[data-state=note]){display:block}.fv-enhance-status[data-state=error]{color:var(--fv-danger,#ff8a80);background:color-mix(in srgb,var(--fv-danger,#ff8a80) 7%,transparent)}+.fv-enhance-status .fv-issue-button{min-height:26px;margin-top:7px;padding:3px 9px;font-size:11px}.fv-enhance-meter{position:relative;height:3px;margin-top:7px;border-radius:2px;background:#ffffff12;overflow:hidden}.fv-enhance-meter>i{position:absolute;inset:0 auto 0 0;width:0;border-radius:inherit;background:var(--fv-accent,#6db8fa);transition:width .4s ease-out}.fv-enhance-meter[data-indeterminate=true]>i{width:32%;animation:fv-enhance-sweep 1.4s ease-in-out infinite}diff --git a/web/prompt_enhance.js b/web/prompt_enhance.jsindex 28d2168..3193315 100644--- a/web/prompt_enhance.js+++ b/web/prompt_enhance.js@@ -65,7 +65,7 @@ export function promptPrestart(api, nodeId, enabled, alive = () => true) {// An empty box is never rewritten, the untouched starter prompt included:// enhancement waits for the user's own scene.// `prepare` turns the user's text into what the model reads (character mentions written out with their pictures).-export function createPromptEnhancer({node, input, editor, api, context, setText, t, starter = '', prepare = text => text, onReport = () => {}, onChange = () => {}}) {+export function createPromptEnhancer({node, input, editor, api, context, setText, t, starter = '', prepare = text => text, onReport = () => {}, onChange = () => {}, issueButton = null}) {const saved = node.properties?.freevideo_prompt_versions;// Drafts saved before the starter became a placeholder hold it as the original.const versions = new PromptVersions(starter && saved?.original === starter ? {...saved, original: ''} : saved, input.value);@@ -91,11 +91,15 @@ export function createPromptEnhancer({node, input, editor, api, context, setTextconst statusText = el('span', null, 'fv-enhance-status-text');const meter = el('div', null, 'fv-enhance-meter'), fill = el('i');meter.setAttribute('role', 'progressbar'); meter.setAttribute('aria-valuemin', '0'); meter.setAttribute('aria-valuemax', '100');- meter.append(fill); status.append(statusText, meter);+ // The shared "Report a problem" button, handed in by the page (this file loads without imports).+ const report = issueButton ? issueButton(t, () => ({where: ['Prompt enhancement', '提示词增强'], message: statusText.textContent})) : document.createElement('span');+ report.hidden = true;+ meter.append(fill); status.append(statusText, meter, report);// One place sets what the status line says and how it looks.function show(text, state = '', fraction = null) {statusText.textContent = text || '';status.dataset.state = text ? state : '';+ report.hidden = !text || state !== 'error';meter.hidden = state !== 'progress';meter.dataset.indeterminate = String(fraction === null);if (fraction === null) { meter.removeAttribute('aria-valuenow'); fill.style.width = ''; }diff --git a/web/result_actions.js b/web/result_actions.jsindex bfa1eb6..2a22572 100644--- a/web/result_actions.js+++ b/web/result_actions.js@@ -2,6 +2,7 @@ import { api } from '../../scripts/api.js';import { outputDownloadURL } from './output_download.js';import { shareButton } from './share.js';import { canExtend, extendText, extendSourceExists } from './studio_extend.js';+import { issueButton } from './issue_button.js';const css = document.createElement('link');css.rel = 'stylesheet'; css.href = new URL('./result_actions.css', import.meta.url).href; document.head.append(css);@@ -62,16 +63,20 @@ function popover(menu, summary, onClose = () => {}) {export function secondPassAction(t, run) {const button = action('button', t('Run second pass', '继续二采'), 'expand', 'fv-action-primary fv-action-second-pass');const label = button.lastElementChild;+ let problem;button.title = t('Continue from this preview to the full-resolution video.','从这个预览继续生成全分辨率视频。');button.onclick = async () => {if (button.disabled) return;+ problem?.remove();button.disabled = true; button.setAttribute('aria-busy', 'true');label.textContent = button.title = t('Adding…', '正在添加…');try { await run(); label.textContent = button.title = t('Queued', '已加入队列'); }catch {button.disabled = false;label.textContent = button.title = t('Second pass did not start · Retry', '二采没有开始 · 重试');+ problem = issueButton(t, () => ({where: ['Second pass', '二采'], message: label.textContent}));+ button.after(problem);} finally { button.removeAttribute('aria-busy'); }};return button;@@ -89,20 +94,28 @@ function deleteAction(t, remove) {hint.textContent = t('The video and its files will be deleted.','视频和相关文件都会删除。');const problem = document.createElement('small'); problem.className = 'fv-confirm-problem'; problem.hidden = true;+ let problemIssue;const row = document.createElement('div'); row.className = 'fv-confirm-actions';const cancel = action('button', t('Cancel', '取消'), null, 'fv-action-secondary');const confirm = action('button', t('Delete', '删除'), 'trash', 'fv-action-danger');cancel.onclick = () => { menu.open = false; summary.focus(); };confirm.onclick = async () => {+ problem.hidden = true; problemIssue?.remove();confirm.disabled = cancel.disabled = true; confirm.lastElementChild.textContent = t('Deleting…', '正在删除…');try { await remove(); menu.open = false; }- catch (error) { problem.textContent = error.message; problem.hidden = false; }+ catch (error) {+ problem.textContent = error.message; problem.hidden = false;+ if (error.reportable !== false) {+ problemIssue = issueButton(t, () => ({where: ['Delete creation', '删除作品'], message: problem.textContent}));+ problem.after(problemIssue);+ }+ }finally { confirm.disabled = cancel.disabled = false; confirm.lastElementChild.textContent = t('Delete', '删除'); }};row.append(cancel, confirm);panel.append(title, hint, problem, row);menu.append(summary, panel);- popover(menu, summary, () => { problem.hidden = true; });+ popover(menu, summary, () => { problem.hidden = true; problemIssue?.remove(); });menu.addEventListener('toggle', () => { if (menu.open) cancel.focus(); });return menu;}@@ -133,13 +146,21 @@ export function resultActions(record, t, {diagnostic = null, secondPass = null,if (extend && canExtend(record)) {const button = action('button', extendText(t, 'action'), 'extend', 'fv-action-secondary fv-action-extend');const label = button.lastElementChild;+ let problem;+ const fault = () => {+ problem?.remove();+ problem = issueButton(t, () => ({where: ['Continue video', '延长视频'], message: label.textContent}));+ button.after(problem);+ };const available = exists => {label.textContent = exists ? extendText(t, 'action') : t('Video unavailable · retry', '视频不可用 · 重试');button.title = '';+ if (exists) problem?.remove(); else fault();};extendSourceExists(api, record).then(available);button.onclick = async () => {if (button.disabled) return;+ problem?.remove();button.disabled = true;button.title = t('Checking video…', '正在检查视频…');try {@@ -149,6 +170,7 @@ export function resultActions(record, t, {diagnostic = null, secondPass = null,} catch (error) {label.textContent = error.message || t('Could not open the editor. Try again.', '无法打开剪辑,请重试。');button.title = label.textContent;+ fault();} finally { button.disabled = false; }};bar.append(button);@@ -163,11 +185,17 @@ export function resultActions(record, t, {diagnostic = null, secondPass = null,const report = action('button', reportLabel, 'report', 'fv-action-secondary fv-action-report');report.title = t('Diagnostic report: hardware, settings and timings', '诊断报告:硬件、设置和耗时');const text = report.lastElementChild;+ let problem;report.onclick = async () => {if (report.disabled) return;+ problem?.remove();report.disabled = true; text.textContent = t('Preparing…', '正在整理…');try { await diagnostic(); text.textContent = reportLabel; }- catch { text.textContent = t('Report unavailable · retry', '报告暂不可用 · 重试'); }+ catch {+ text.textContent = t('Report unavailable · retry', '报告暂不可用 · 重试');+ problem = issueButton(t, () => ({where: ['Diagnostic report', '诊断报告'], message: text.textContent}));+ report.after(problem);+ }finally { report.disabled = false; }};bar.append(report);diff --git a/web/setup.css b/web/setup.cssindex 2fff248..db8bed7 100644--- a/web/setup.css+++ b/web/setup.css@@ -97,3 +97,4 @@.fv-setup .fv-folder-save .fv-folder-path{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.fv-setup .fv-folder-save p{flex:1 1 240px;min-width:0;margin:0;padding-top:7px;line-height:1.6}@media(max-width:480px){.fv-setup{padding:0 16px 18px}.fv-setup-head{margin:0 -16px 8px;padding:14px 12px 12px 16px}.fv-setup-head .fv-wordmark{width:92px}.fv-setup>details,.fv-setup>section{padding:14px}}+.fv-setup p .fv-issue-button{margin:4px 0 4px 8px;vertical-align:middle}diff --git a/web/setup.js b/web/setup.jsindex 05d2703..e775cfa 100644--- a/web/setup.js+++ b/web/setup.js@@ -3,6 +3,7 @@ import { wordmark } from './wordmark.js';import { openCompatibility } from './compatibility.js';import { animateDetails, closeDialog } from './motion.js';import { createGuideReplayEntry } from './first_run_guide.js';+import { issueButton } from './issue_button.js';const css = document.createElement('link');css.rel = 'stylesheet'; css.href = new URL('./setup.css', import.meta.url).href;@@ -16,6 +17,7 @@ const t = (en, zh) => cn ? zh : en;const INSTALLED_HINT = {en: 'Already installed. To reinstall, click Detect & review first.', zh: '已装好。要重装,请先点“检测并预览”。'};const gib = n => Number.isFinite(n) ? (n / 2 ** 30).toFixed(1) + " GiB" : "—";const SPEED_TEST_FAILED = 'The speed test did not finish. Click "Test source speeds".';+const reportable = value => !/The installation plan changed\. Detect configuration again|MODEL_MISMATCH_REPAIR:/.test(String(value || ''));const failureText = value => {const text = String(value || ''), matches = [...text.matchAll(/MODEL_MISMATCH_REPAIR: ([^\r\n]+)/g)];if (!matches.length && text.includes('The installation plan changed. Detect configuration again')) {@@ -40,6 +42,10 @@ export async function openSetup() {dialog.className = "fv-setup";const node = (tag, label) => { const e = document.createElement(tag); if (label) e.textContent = label; return e; };const note = label => { const e = node("p", label); e.className = "fv-muted"; return e; };+ const fault = (target, message) => {+ const text = failureText(message); target.textContent = text;+ if (text && reportable(message)) target.append(issueButton(t, () => ({where: ['Settings / installation', '设置/安装'], message: text})));+ };const heading = node('header'); heading.className = 'fv-setup-head';const dismiss = node('button', '×'); dismiss.type = 'button'; dismiss.className = 'fv-close';dismiss.setAttribute('aria-label', t('Close', '关闭')); dismiss.onclick = () => closeDialog(dialog);@@ -167,7 +173,7 @@ export async function openSetup() {let token, planId, busy = false, probeBusy = false, pollTimer, lastPlanId, planErrors = false, planStale = false, ready = false, waitSince;// A click names what is happening at once, before the server has answered.const doing = (en, zh) => { waitSince ??= Date.now(); state.className = ''; state.textContent = t(en, zh); };- const fail = error => { waitSince = undefined; installation.open = true; state.textContent = failureText(error.message); state.className = "fv-failure"; state.scrollIntoView({block:'nearest'}); };+ const fail = error => { waitSince = undefined; installation.open = true; fault(state, error.message); state.className = "fv-failure"; state.scrollIntoView({block:'nearest'}); };const request = async (action, value) => {const response = await api.fetchApi("/freevideo/setup" + (action ? "/" + action : root.value ? '?root='+encodeURIComponent(root.value) : ""), action ? {method: "POST", headers: { "Content-Type": "application/json", "X-FreeVideo-Setup": token }, body: JSON.stringify(value || {}),@@ -205,7 +211,7 @@ export async function openSetup() {cancel.scrollIntoView({block: 'center'});} catch (error) {calibrateStatus.className = 'fv-failure';- calibrateStatus.textContent = failureText(error.message);+ fault(calibrateStatus, error.message);} finally { calibrateButton.disabled = false; }};saveReserve.onclick = async () => {@@ -221,7 +227,7 @@ export async function openSetup() {try {showResources(await request('resources', {[reserveField]: reserveAuto.checked ? null : Number(reserve.value)}));reserveStatus.textContent = t('Saved · applies to the next request', '已保存 · 下次生成生效');- } catch (error) { reserveStatus.className = 'fv-failure'; reserveStatus.textContent = failureText(error.message); }+ } catch (error) { reserveStatus.className = 'fv-failure'; fault(reserveStatus, error.message); }finally { saveReserve.disabled = false; }};function showDownloads(value) {@@ -237,6 +243,7 @@ export async function openSetup() {sourceStatus.textContent = failureText(value.probe?.error) || (probeBusy ? t('Testing sources… ','正在测速… ') + `${progress?.done || 0}/${progress?.total || '…'}` : '');const measured = value.probe?.status === 'complete' ? value.probe : value.preferences?.probe;if (measured?.network_unavailable && !probeBusy) sourceStatus.textContent = t('No sources reachable. Check your network or connection mode.', '下载源均无法连接,请检查网络或切换连接模式。');+ if (value.probe?.error || measured?.network_unavailable && !probeBusy) fault(sourceStatus, sourceStatus.textContent);speeds.replaceChildren();if (!measured?.sources) return;const table = node('table'); table.className = 'fv-speed';@@ -342,6 +349,7 @@ export async function openSetup() {const p = task.progress || {};state.className = task.status === "failed" ? "fv-failure" : task.ready && !savedMissing ? "fv-ready" : "";state.textContent = failureText(task.error) || (task.ready ? t("Ready to generate.", "准备就绪,可以开始生成。") : busy ? p.label || t("Checking configuration and local models…", "正在检查配置和本地模型…") : task.status === "complete" && task.action === "plan" ? (planId ? t("Review the plan, then install.", "请确认计划后安装。") : "") : task.status === "cancelled" ? t("Stopped. Files retained for resuming.", "已停止,文件保留,可继续安装。") : "");+ if (task.error) fault(state, task.error);const phases = task.phase_progress || {}, valid = Number.isFinite(p.total) && p.total > 0 && Number.isFinite(p.done) && p.done >= 0 && p.done <= p.total;overall.hidden = !busy;overallBar.max = phases.total > 0 ? phases.total : 1; overallBar.value = phases.done || 0;@@ -381,10 +389,10 @@ export async function openSetup() {}saveFolders.onclick = async () => {invalidate(true); busy = true; controls();- const before = [state.textContent, state.className]; doing('Saving model folders…', '正在保存模型目录…');+ const before = [[...state.childNodes], state.className]; doing('Saving model folders…', '正在保存模型目录…');try { await saveModelFolders(); }- catch (error) { savedFolders = ''; savedMissing = false; folderStatus.textContent = failureText(error.message); folderStatus.className = 'fv-failure'; }- finally { busy = false; waitSince = undefined; [state.textContent, state.className] = before; controls(); }+ catch (error) { savedFolders = ''; savedMissing = false; fault(folderStatus, error.message); folderStatus.className = 'fv-failure'; }+ finally { busy = false; waitSince = undefined; state.replaceChildren(...before[0]); state.className = before[1]; controls(); }};inspect.onclick = async () => {invalidate(); busy = true; controls(); doing('Checking installation…', '正在检查安装…');diff --git a/web/share.css b/web/share.cssindex 67fc8a4..9105e63 100644--- a/web/share.css+++ b/web/share.css@@ -12,7 +12,7 @@.fv-share-preview{position:relative;align-self:start;width:auto;max-width:100%;max-height:calc(100dvh - 256px);box-shadow:0 18px 50px #0007,0 0 0 1px #ffffff14;overflow:hidden;border-radius:14px}.fv-share-preview canvas{position:relative;display:block;max-width:100%;max-height:calc(100dvh - 256px);width:auto;height:auto;pointer-events:none}.fv-share-preview video{position:absolute;object-fit:contain;background:#000}.fv-share-preview video[hidden]{display:none}-.fv-share-footer{display:flex;flex-shrink:0;align-items:center;justify-content:flex-end;gap:12px;padding:18px 26px;border-top:1px solid var(--fv-border)}+.fv-share-footer{display:flex;flex-wrap:wrap;flex-shrink:0;align-items:center;justify-content:flex-end;gap:12px;padding:18px 26px;border-top:1px solid var(--fv-border)}.fv-share-status{font-size:12px;color:var(--fv-muted);margin-right:auto;max-width:65%}.fv-share[data-busy=true] .fv-share-status:before{content:'';display:inline-block;width:10px;height:10px;margin-right:8px;border:1.5px solid #fff3;border-top-color:var(--fv-accent);border-radius:50%;animation:fv-share-spin .8s linear infinite}.fv-share[data-error=true] .fv-share-status{color:var(--fv-danger)}diff --git a/web/share.js b/web/share.jsindex cbe45c2..7b66491 100644--- a/web/share.js+++ b/web/share.js@@ -4,6 +4,7 @@ import {effortName, resultEffort} from './sampling_effort.js';import {fontCSS as bundledFontCSS, fontLoaded, loadFont} from './fonts.js';import {shareLayout} from './share_layout.js';import {videoUnavailableText} from './studio_extend.js';+import {issueButton} from './issue_button.js';const css=document.createElement('link'); css.rel='stylesheet'; css.href=new URL('./share.css',import.meta.url).href; document.head.append(css);const el=(tag,cls,text)=>{const e=document.createElement(tag);if(cls)e.className=cls;if(text)e.textContent=text;return e;};@@ -104,13 +105,15 @@ export async function openShare(record,t){player.src=api.apiURL('/view?'+new URLSearchParams({filename:record.video.slice(split+1),subfolder:record.video.slice(0,split),type:'output'}));preview.append(player,canvas);panel.append(preview);const footer=el('footer','fv-share-footer'),message=el('span','fv-share-status');message.setAttribute('role','status');+ const problem=issueButton(t,()=>({where:['Share','分享'],message:message.textContent}));problem.hidden=true;+ const say=(text,fault=false)=>{message.textContent=text;problem.hidden=!fault||!text;if(fault&&text)dialog.dataset.error='true';else delete dialog.dataset.error;};const save=button(t('Save image','保存分享图'),download,'fv-primary');save.disabled=true;const cancel=button(t('Cancel','取消'),()=>exportRequest?.abort());cancel.hidden=true;- footer.append(message,cancel,save);heading.append(title,tabs,close);dialog.append(heading,panel,footer);+ footer.append(message,problem,cancel,save);heading.append(title,tabs,close);dialog.append(heading,panel,footer);const videoError=()=>{if(disposed)return;videoFailed=true;- if(kind==='video'&&!busy){message.textContent=videoUnavailableText(t);dialog.dataset.error='true';}+ if(kind==='video'&&!busy)say(videoUnavailableText(t),true);};player.addEventListener('error',videoError);const choose=next=>{@@ -121,8 +124,7 @@ export async function openShare(record,t){save.textContent=kind==='image'?t('Save image','保存分享图'):t('Save video','保存分享视频');slide();if(!ready)return;- message.textContent=kind==='video'&&videoFailed?videoUnavailableText(t):'';- if(kind==='video'&&videoFailed)dialog.dataset.error='true';else delete dialog.dataset.error;+ say(kind==='video'&&videoFailed?videoUnavailableText(t):'',kind==='video'&&videoFailed);drawShareCard(canvas,kind==='image'?first:null,logo,metadata,t);player.hidden=kind!=='video';if(kind==='video')player.play().catch(error=>{if(!['AbortError','NotAllowedError'].includes(error.name))videoError();});else player.pause();@@ -138,7 +140,7 @@ export async function openShare(record,t){async function download(){if(!ready||busy)return;busy=true;save.disabled=true;cancel.hidden=kind==='image';tabs.querySelectorAll('button').forEach(b=>b.disabled=true);- message.textContent=kind==='image'?t('Saving the share image…','正在保存分享图…'):t('Exporting the share video…','正在导出分享视频…');+ say(kind==='image'?t('Saving the share image…','正在保存分享图…'):t('Exporting the share video…','正在导出分享视频…'));dialog.dataset.busy='true';delete dialog.dataset.error;exportRequest=new AbortController();try{@@ -151,21 +153,19 @@ export async function openShare(record,t){if(disposed)return;const url=URL.createObjectURL(blob),a=el('a');a.href=url;a.download=`FreeVideo_share_${id.split('/')[1].slice(0,12)}.png`;a.click();- setTimeout(()=>URL.revokeObjectURL(url),60000);message.textContent='';return;+ setTimeout(()=>URL.revokeObjectURL(url),60000);say('');return;}if(!exported){const response=await api.fetchApi('/freevideo/share/video',{method:'POST',headers:{'Content-Type':'application/json'},signal:exportRequest.signal,body:JSON.stringify({id,template,rect:shape.rect})});- if(response.status===409)throw new Error(t('Another export is running. Try again shortly.','已有分享视频正在导出,请稍后再试。'));+ if(response.status===409)throw Object.assign(new Error(t('Another export is running. Try again shortly.','已有分享视频正在导出,请稍后再试。')),{reportable:false});if(!response.ok)throw new Error(t('Export could not complete. Try again.','分享视频导出未完成,请重试。'));exported=await response.json();}if(disposed)return;- const a=el('a');a.href=api.apiURL('/freevideo/share/video?'+new URLSearchParams(exported));a.download='';a.click();message.textContent='';+ const a=el('a');a.href=api.apiURL('/freevideo/share/video?'+new URLSearchParams(exported));a.download='';a.click();say('');}catch(error){if(!disposed){- message.textContent=kind==='image'?t('Could not save the share image. Try again.','分享图没有保存成功,请重试。')- :error.name==='AbortError'?'':error.message;- if(message.textContent)dialog.dataset.error='true';+ say(error.name==='AbortError'?'':kind==='image'?t('Could not save the share image. Try again.','分享图没有保存成功,请重试。'):error.message,error.reportable!==false);}}finally{busy=false;if(!disposed){save.disabled=false;cancel.hidden=true;delete dialog.dataset.busy;tabs.querySelectorAll('button').forEach(b=>b.disabled=false);}}}@@ -184,5 +184,5 @@ export async function openShare(record,t){preview.style.aspectRatio=`${shape.width}/${shape.height}`;player.style.cssText=`left:${shape.rect[0]/shape.width*100}%;top:0;width:${shape.rect[2]/shape.width*100}%;height:${shape.rect[3]/shape.height*100}%`;ready=true;choose(kind);save.disabled=false;- }catch(error){if(!disposed){message.textContent=error.message||t('Preview unavailable. Close and try again.','预览暂时无法读取,请关闭后重试。');dialog.dataset.error='true';}}+ }catch(error){if(!disposed)say(error.message||t('Preview unavailable. Close and try again.','预览暂时无法读取,请关闭后重试。'),true);}}diff --git a/web/studio.css b/web/studio.cssindex 360665d..3eb8aef 100644--- a/web/studio.css+++ b/web/studio.css@@ -134,6 +134,7 @@.fv-studio .fv-queue-chip{flex:none;color:var(--fv-accent)}.fv-studio .fv-queue-item button{flex:none}.fv-studio .fv-status{min-height:22px;text-align:center;font-size:var(--fv-micro);color:var(--fv-muted);overflow-wrap:anywhere}.fv-studio .fv-status[data-error=true]{color:var(--fv-danger)}+.fv-studio .fv-status>.fv-issue-button{display:flex;margin:8px auto 0}.fv-studio .fv-progress{width:100%;height:4px;accent-color:var(--fv-accent);border:0;margin:0 0 10px}.fv-studio .fv-budget,.fv-studio .fv-prewarm{text-align:center;font-size:var(--fv-micro);color:var(--fv-muted)}.fv-studio .fv-panel{height:auto;padding:0;border:none;border-radius:0;background:transparent;color:var(--fv-ink);font-size:var(--fv-micro);overflow:visible}.fv-studio .fv-panel .fv-toolbar{justify-content:flex-start}.fv-studio .fv-panel .fv-note{font-size:var(--fv-micro);margin:8px 0;text-align:left}diff --git a/web/studio.js b/web/studio.jsindex 3e732d4..ecc8c57 100644--- a/web/studio.js+++ b/web/studio.js@@ -13,6 +13,7 @@ import { agentInterfaceEnabled } from './agent_connect.js';import { createUpdateNotice, createVersionInfo, productVersion } from './updates.js';import { createPortNotice } from './port_notice.js';import { reportIssue, reportTipClosed, showReportTip } from './report_issue.js';+import { issueButton } from './issue_button.js';import { createPreviewScene } from './preview_scene.js?v=20260929-swell';import { animateDetails, closeDialog } from './motion.js';import { openLibrary } from './library.js';@@ -675,7 +676,7 @@ export function openStudio(node, {extendFrom = null} = {}) {target.field.value = JSON.stringify(withCharacter(rows, card, typed));target.owner.graph?.change?.();window.dispatchEvent(new CustomEvent('freevideo-media', {detail: target.owner.id}));- }).catch(() => { if (!disposed) { status.dataset.error = 'true'; status.textContent = t('Could not add the character\'s pictures', '无法加入角色的图片'); } })+ }).catch(() => { if (!disposed) fault(t('Could not add the character\'s pictures', '无法加入角色的图片')); }).finally(() => castPending.delete(person.id));return true;}@@ -705,7 +706,7 @@ export function openStudio(node, {extendFrom = null} = {}) {openCastLibrary({api, text: t, viewURL: view, uploadOne: castUpload, onChange: () => { castOverlay.refresh(); references.refresh(); }}).then(library => { if (disposed) library?.destroy?.(); else castLibrary = library; });let requestAssets = null;- const enhancer = createPromptEnhancer({node, input: prompt, editor: promptEditor, api, t, starter,+ const enhancer = createPromptEnhancer({node, input: prompt, editor: promptEditor, api, t, starter, issueButton,prepare: text => expandCast(text, mediaRows(node), {continued: Boolean(extension.source)}).text,// The rewrite has its own report; the video's report entry is not touched.onReport: row => { node.freevideoPromptReportId = row.rewrite_report_id || row.report_id; },@@ -1170,6 +1171,9 @@ export function openStudio(node, {extendFrom = null} = {}) {progress.update(message);}const status = el('div', '', 'fv-status'); status.setAttribute('role', 'status');+ // A fault in the status line carries the report button; the next text written to the line removes it.+ const statusIssue = issueButton(t, () => ({where: ['Generate', '生成'], message: status.firstChild?.textContent}), {className: 'fv-status-issue'});+ function fault(text) { status.dataset.error = 'true'; status.textContent = text; status.append(statusIssue); }const stats = el('div', null, 'fv-stats'), budget = el('div', '', 'fv-budget'), links = el('div', null, 'fv-result-links');stats.hidden = true;const metrics = [], metricLabels = [];@@ -1190,7 +1194,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 = shownMessage(error);+ fault(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.@@ -1614,7 +1618,7 @@ export function openStudio(node, {extendFrom = null} = {}) {held = turnNodeOn(node);const snapshot = singleRunSnapshot(extendSnapshot(cleanOptionalPrompt(structuredClone(await app.graphToPrompt())), node.id, source,{multiple: lengthPlan?.count > 1}), node.id, lengthPlan);- if (!snapshot) { status.textContent = t('Could not prepare this run. Try again.', '没能准备这次生成,请重试。'); return; }+ if (!snapshot) { fault(t('Could not prepare this run. Try again.', '没能准备这次生成,请重试。')); return; }const seedIndex = node.widgets.findIndex(w => w.name === 'seed');capturing = false;for (const section of controls.querySelectorAll('.fv-section')) section.inert = false;diff --git a/web/studio_length.js b/web/studio_length.jsindex 05344b8..5cfa1c3 100644--- a/web/studio_length.js+++ b/web/studio_length.js@@ -1,4 +1,5 @@import {capabilityPoints, interpolate} from './chain_support.js';+import {issueButton} from './issue_button.js';import {buildPlanRequest, readLengthPlan, classifyPlanError, singleLimitSeconds, defaultBlockSeconds} from './length_plan.js?v=20261011-length';export const LENGTH_PROPERTIES = Object.freeze({seconds: 'freevideo_seconds', single: 'freevideo_single', block: 'freevideo_block_seconds'});@@ -82,6 +83,7 @@ export function createStudioLength({api, node, seconds, advanced, fields, t, fiehint.hidden = absent || (noParts && Boolean(error));note.hidden = absent || !error;note.textContent = error ? errorMessage(error) : '';+ if (error === 'other') note.append(issueButton(t, () => ({where: ['Video length planning', '视频分段规划'], message: errorMessage('other')})));note.style.margin = noParts && error === 'continuation_unavailable' ? '12px 0' : ''; // as spaced as the line it replaces}function errorMessage(kind) {diff --git a/web/updates.js b/web/updates.jsindex 84d55cf..c9e7081 100644--- a/web/updates.js+++ b/web/updates.js@@ -1,5 +1,6 @@import { api } from '../../scripts/api.js';import { setLauncherPresent } from './repair_hint.js';+import { issueButton } from './issue_button.js';// Every platform downloads from one release: the latest vX.Y.Z.const releasePage = 'https://github.com/FlashML-org/FreeVideo/releases/latest';@@ -116,6 +117,7 @@ export function createUpdateNotice(cn) {const element = document.createElement('aside'); element.className = 'fv-update-notice';element.hidden = true; element.setAttribute('role', 'status');const label = document.createElement('span');+ let problem;const summary = document.createElement('small'); summary.className = 'fv-update-summary';const details = document.createElement('button'); details.type = 'button';details.textContent = t("What's new", '更新内容');@@ -178,6 +180,12 @@ export function createUpdateNotice(cn) {element.hidden = !text;element.classList.toggle('fv-update-working', busy);label.textContent = text;+ const failed = failure === 'cancel' || failure === 'launcher' && !busy && phase !== 'review'+ || actions && launcher?.status === 'error' && !!launcher.error;+ if (failed) {+ problem ||= issueButton(t, () => ({where: ['Update FreeVideo', '更新 FreeVideo'], message: label.textContent}));+ element.append(problem);+ } else problem?.remove();const skipped = actions ? earlierNotes(candidate, productVersion()).length : 0;summary.textContent = actions ? (localizedNotes(candidate, cn)?.summary || '')+ (skipped ? ' ' + t(`Includes the changes of ${skipped} earlier version${skipped > 1 ? 's' : ''}.`, `另含此前 ${skipped} 个版本的更新。`) : '') : '';@@ -233,7 +241,11 @@ function showReleaseNotes(cn) {}body.append(section);}- if (!body.childElementCount) body.textContent = t('Version information is not available yet.', '暂时无法获取版本信息。');+ if (!body.childElementCount) {+ const message = t('Version information is not available yet.', '暂时无法获取版本信息。');+ body.textContent = message;+ body.append(issueButton(t, () => ({where: ['Version information', '版本信息'], message})));+ }};const dispose = () => { listeners.delete(render); dialog.remove(); };dialog.addEventListener('close', dispose, {once: true});