From 087e74a025a683223fd79c1cf5b5fa2d021e9cfc Mon Sep 17 00:00:00 2001 From: jinghui Date: Tue, 17 Nov 2026 23:50:03 +0800 Subject: [PATCH] =?UTF-8?q?feat(AI=E4=B8=80=E9=94=AE=E5=87=BA=E7=89=87):?= =?UTF-8?q?=20=E7=94=A8=E6=88=B7=E8=BE=93=E5=85=A5=E7=9A=84=E6=A0=87?= =?UTF-8?q?=E9=A2=98=E5=86=99=E5=85=A5=E9=A1=B9=E7=9B=AE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=90=8D=E2=80=94=E2=80=94=E9=A1=B6=E6=A0=8Ftitle+=E5=B7=A5?= =?UTF-8?q?=E7=A8=8B=E6=95=B0=E6=8D=AE+=E9=A1=B9=E7=9B=AE=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=8D=A1=E7=89=87=E5=90=8D=E4=B8=89=E5=A4=84=E5=90=8C?= =?UTF-8?q?=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/e2e_quickvideo_cover.py | 23 +++++++++++++++++- .../components/sources/ai/QuickVideo.tsx | 24 +++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/scripts/e2e_quickvideo_cover.py b/scripts/e2e_quickvideo_cover.py index d4bdbf9..49e315e 100644 --- a/scripts/e2e_quickvideo_cover.py +++ b/scripts/e2e_quickvideo_cover.py @@ -248,6 +248,7 @@ def main(): } catch (e) { resUrl = 'ERR:' + e; } } return { + title: d.title, first: f, coverResourceUrl: resUrl.slice(0, 40), imgCount: imgs.length, @@ -307,7 +308,7 @@ def main(): const d = (window.__editor && window.__editor.movie && window.__editor.movie.data) || {}; const els = (d.elements || []).slice().sort((a,b) => (a.startTime||0) - (b.startTime||0)); const f = els[0] || {}; - return { firstName: f.name, firstT: f.startTime, firstD: f.duration, + return { title: d.title, firstName: f.name, firstT: f.startTime, firstD: f.duration, els: els.length, caps: (d.captions||[]).length }; }""") log("刷新后: " + json.dumps(after, ensure_ascii=False)) @@ -316,6 +317,26 @@ def main(): and after.get("firstT") is not None and abs(float(after.get("firstT"))) < 0.01 ) + # 断言:用户输入的标题 → 项目文件名(顶栏 title + 刷新后持久化) + res_title = res.get("title") + log("构建后 title: %s" % res_title) + checks["title_applied_after_build"] = res_title == "封面功能端到端验证" + checks["title_persist_after_reload"] = after.get("title") == "封面功能端到端验证" + # 项目列表卡片名(meta.name) + meta_name = page.evaluate("""async () => { + try { + const rq = indexedDB.open('H5VideoLocalDB'); + const db = await new Promise((res, rej) => { rq.onsuccess = () => res(rq.result); rq.onerror = () => rej(rq.error); }); + const id = window.__editor && window.__editor.appid; + const tx = db.transaction('projects', 'readonly'); + const g = tx.objectStore('projects').get(id); + const rec = await new Promise((res, rej) => { g.onsuccess = () => res(g.result); g.onerror = () => rej(g.error); }); + return (rec && rec.name) || ''; + } catch (e) { return 'ERR:' + e; } + }""") + log("项目卡片名: %s" % meta_name) + checks["project_card_name"] = meta_name == "封面功能端到端验证" + ok = all(checks.values()) print(json.dumps({"ok": ok, "checks": checks, "errors": errors[-5:]}, ensure_ascii=False)) browser.close() diff --git a/src/pages/editor/components/sources/ai/QuickVideo.tsx b/src/pages/editor/components/sources/ai/QuickVideo.tsx index ac86fc5..c998655 100644 --- a/src/pages/editor/components/sources/ai/QuickVideo.tsx +++ b/src/pages/editor/components/sources/ai/QuickVideo.tsx @@ -772,6 +772,30 @@ export default function QuickVideo({ if (captions.length) editor.setContorlAndSelectedElemenent?.([]); const transCount = fxTrans === 'none' ? 0 : Math.max(0, segs.length - 1); + + // 项目文件名 = 用户输入的标题:顶栏标题、工程数据、项目列表卡片名三处同步 + const projTitle = title.trim(); + if (projTitle) { + editor.data.title = projTitle; + // movie.data 若是独立引用,一并改掉(保存走 sortZIndexNewData) + const md: any = (editor as any).movie?.data; + if (md && md !== editor.data) md.title = projTitle; + try { + if (typeof (editor as any).saveApp === 'function') { + await (editor as any).saveApp(); + } + } catch (e) { + console.warn('[qv] 保存标题失败', e); + } + try { + // 本地模式:项目卡片名存的是 meta.name(saveProject 不会用 title 覆盖),需单独同步 + const { updateLocalProjectMeta } = await import('@services/localStorageService'); + await updateLocalProjectMeta(editor.appid, { name: projTitle }).catch(() => {}); + } catch (e) { + console.warn('[qv] 同步项目名失败', e); + } + } + Toast.success( (cover ? '封面 + ' : '') + `已生成 ${segs.length} 段:图片${fxMotion === 'none' ? '' : '(带动效)'}、配音、字幕已就位` +