Skip to content

Text to vertical video in 100+ styles: AI codes each scene (HTML/SVG/WebGL), renders a 9:16 MP4 with music and English/Vietnamese voice. MCP, CLI and REST for AI agents.

Thẻ "Làm video đầu tiên": máy đủ mục bắt buộc mà chưa có video → 1 nút dựng mẫu 009, dọc 9:16, 10 giây

Lumtek42fd3d1952ae
diff --git a/README.md b/README.md
index 3abf975..22acdd9 100644
--- a/README.md
+++ b/README.md
@@ -81,10 +81,22 @@ Pick a style, type your content, choose length, music and voice, then hit **Crea
**Which AI writes the scenes?** LumReels picks the first one available:
-1. `api`: an `ANTHROPIC_API_KEY` in `.env`.
-2. `claude`: [Claude Code](https://claude.com/claude-code) installed on the machine.
+1. `api`: an Anthropic key (see below).
+2. `claude`: [Claude Code](https://claude.com/claude-code) installed and signed in (`claude auth login`).
3. `agent`: neither, so the job waits for an outside agent to submit the scene over MCP/REST, then renders it.
+If the Anthropic key is wrong or revoked (401/403) and Claude Code is available, an *Auto* job switches to Claude Code; otherwise the job fails with a plain message on how to fix it.
+
+**Anthropic key.** Paste it in the app: **System check** → *Paste your Anthropic key* → **Save and check** (the app calls `GET /v1/models`, which costs no tokens, and tells you whether the key works). The key is stored in `~/.lumreels/credentials.json` (move it with `LUMREELS_HOME`), readable only by your account (Windows `icacls`, macOS/Linux `chmod 600`), never written to the repo's `.env`, and never shown in logs or the UI beyond its last 4 characters. When several sources exist, LumReels uses:
+
+1. the key set in the app (`~/.lumreels/credentials.json`);
+2. the process environment variable `ANTHROPIC_API_KEY`;
+3. `ANTHROPIC_API_KEY` in the `.env` file in the LumReels folder.
+
+**Remove key from app** falls back to 2 or 3 if present. Changing the key in the app takes effect immediately, no restart.
+
+**System check** (`GET /api/doctor`) lists Node, ffmpeg, Chrome, free disk space, an AI scene writer (required) and the API key, Claude Code, voices, Git, Ollama (optional), each with a fix. It opens by itself on first launch when something required is missing; once everything required is there and you have no videos yet, a **Make your first video** card appears (template 009, vertical 9:16, 10 seconds, sample text included) that builds with one click.
+
**Voice-over** is optional. Music and sound effects need nothing extra.
```bash
diff --git a/README.vi.md b/README.vi.md
index 30f4aff..1d983d3 100644
--- a/README.vi.md
+++ b/README.vi.md
@@ -81,10 +81,22 @@ Chọn mẫu → gõ nội dung → chọn thời lượng, nhạc, giọng →
**AI nào dựng cảnh?** LumReels tự chọn theo thứ tự:
-1. `api`: có `ANTHROPIC_API_KEY` trong `.env`.
-2. `claude`: máy có [Claude Code](https://claude.com/claude-code).
+1. `api`: có khoá Anthropic (xem dưới).
+2. `claude`: máy có [Claude Code](https://claude.com/claude-code) đã đăng nhập (`claude auth login`).
3. `agent`: không có cả hai thì job dừng chờ, agent bên ngoài viết cảnh qua MCP/REST rồi render.
+Khoá Anthropic sai hoặc bị thu hồi (lỗi 401/403) mà máy có Claude Code thì job ở chế độ *Tự động* tự chuyển sang Claude Code; không có thì job báo lỗi kèm cách sửa.
+
+**Khoá Anthropic.** Dán khoá trong app: nút **Kiểm tra máy** → ô *Dán khoá Anthropic* → **Lưu và kiểm tra** (app gọi `GET /v1/models`, không tốn token, báo khoá hợp lệ hay không). Khoá lưu ở `~/.lumreels/credentials.json` (đổi thư mục bằng `LUMREELS_HOME`), chỉ tài khoản của bạn đọc được (Windows: `icacls`, macOS/Linux: `chmod 600`), không ghi vào `.env` của repo, không hiện ra log hay giao diện (chỉ 4 ký tự cuối). Khi có nhiều nguồn, LumReels dùng theo thứ tự:
+
+1. khoá nhập trong app (`~/.lumreels/credentials.json`);
+2. biến môi trường `ANTHROPIC_API_KEY` của tiến trình;
+3. `ANTHROPIC_API_KEY` trong file `.env` ở thư mục LumReels.
+
+Bấm **Xoá khoá trong app** thì quay về khoá ở mục 2 hoặc 3 (nếu có). Đổi khoá trong app có hiệu lực ngay, không cần khởi động lại.
+
+**Kiểm tra máy** (`GET /api/doctor`) liệt kê Node, ffmpeg, Chrome, ổ đĩa trống, AI dựng cảnh (bắt buộc) và khoá API, Claude Code, giọng đọc, Git, Ollama (tuỳ chọn), mỗi mục có cách sửa. Lần đầu mở app mà thiếu mục bắt buộc thì màn này tự hiện; đủ rồi mà chưa có video nào thì app hiện thẻ **Làm video đầu tiên** (mẫu 009, dọc 9:16, 10 giây, nội dung mẫu sẵn), bấm một nút là dựng.
+
**Giọng đọc** là tuỳ chọn: `pip install vieneu` (tiếng Việt), `pip install kokoro soundfile` (tiếng Anh), đều chạy trên máy; `pip install edge-tts` để dự phòng qua mạng. Nhạc và tiếng động không cần cài gì thêm.
## Nối với AI agent
diff --git a/server/doctor.mjs b/server/doctor.mjs
index 66bd4ee..7ab106a 100644
--- a/server/doctor.mjs
+++ b/server/doctor.mjs
@@ -1,5 +1,5 @@
// Màn "Kiểm tra máy": GET /api/doctor + nhập/kiểm khoá Anthropic.
-// GET /api/doctor → { requiredOk, items[], key, jobsCount } (?refresh=1: dò lại giọng đọc)
+// GET /api/doctor → { requiredOk, items[], key, jobsCount, firstVideo } (?refresh=1: dò lại giọng đọc)
// POST /api/doctor/key { key } → lưu khoá vào ~/.lumreels/credentials.json rồi kiểm ngay
// POST /api/doctor/key/test → kiểm khoá đang dùng (GET /v1/models, không tốn token)
// DELETE /api/doctor/key → xoá khoá đã nhập trong app (quay về biến môi trường / .env nếu có)
@@ -21,6 +21,17 @@ export const MIN_FREE_GB = 2; // dưới mức này: thiếu (bắt buộc); dư
const WIN = process.platform === 'win32';
const MAC = process.platform === 'darwin';
+/** Video đầu tiên: 1 mẫu 2D nhẹ (009, độ khó 2, SVG/DOM), nội dung mẫu ngắn tiếng Việt, dọc 9:16, 10 giây. */
+export const FIRST_VIDEO = {
+ templateId: '009',
+ durationS: 10,
+ aspect: '9:16',
+ content: {
+ vi: 'Mỗi tháng để dành 2 triệu, lãi giả định 6%/năm, gộp lãi hằng tháng. Sau 10 năm có khoảng 328 triệu, trong đó tiền tự bỏ vào là 240 triệu, phần lãi khoảng 88 triệu. Kênh: LumReels. CTA: Theo dõi để xem thêm mẹo tiền.',
+ en: 'Save $200 a month at an assumed 6% a year, compounded monthly. After 10 years you have about $32,800: $24,000 you put in and about $8,800 of interest. Channel: LumReels. CTA: Follow for more money tips.',
+ },
+};
+
const FIX = {
node: WIN ? { cmd: 'winget install --id OpenJS.NodeJS.LTS -e', url: 'https://nodejs.org' } : MAC ? { cmd: 'brew install node', url: 'https://nodejs.org' } : { url: 'https://nodejs.org' },
ffmpeg: WIN ? { cmd: 'winget install --id Gyan.FFmpeg -e' } : MAC ? { cmd: 'brew install ffmpeg' } : { cmd: 'sudo apt install ffmpeg' },
@@ -151,6 +162,7 @@ export async function doctor({ refresh = false, deep = true } = {}) {
items,
key: { ...keyInfo(), check: apikey.check || null },
jobsCount,
+ firstVideo: FIRST_VIDEO,
checkedAt: new Date().toISOString(),
};
}
diff --git a/server/public/app.js b/server/public/app.js
index 95523a2..6c00780 100644
--- a/server/public/app.js
+++ b/server/public/app.js
@@ -582,8 +582,20 @@
}).catch(() => {});
}
loadConfig(true);
- // doctor-panel.js: khoá vừa lưu/xoá → bật/tắt lại ô "Claude API"
+ // doctor-panel.js: khoá vừa lưu/xoá → bật/tắt lại ô "Claude API"; vừa tạo job "Video đầu tiên" → nạp lại danh sách
window.addEventListener('lumreels:config', () => loadConfig(false));
+ window.addEventListener('lumreels:jobs-reload', () => loadJobs());
+ // "Sửa nội dung trước" của thẻ Video đầu tiên: điền sẵn form (mẫu, nội dung, thời lượng, khung)
+ window.addEventListener('lumreels:prefill', (e) => {
+ const d = e.detail || {};
+ if (multi) setMulti(false);
+ if (d.templateId && !picks.some((x) => x.id === d.templateId)) pick(d.templateId);
+ if (typeof d.content === 'string') { $('#content').value = d.content; $('#content').dispatchEvent(new Event('input', { bubbles: true })); }
+ if (d.durationS) { $('#duration').value = String(d.durationS); $('#duration').dispatchEvent(new Event('input', { bubbles: true })); }
+ if (d.ratio) setRatio(d.ratio);
+ $('#content').focus();
+ $('#content').scrollIntoView({ behavior: 'smooth', block: 'center' });
+ });
// Đổi VI/EN: vẽ lại mọi chữ do JS sinh (chữ tĩnh trong HTML đã được i18n.js đổi).
window.addEventListener('lumreels:lang', () => {
diff --git a/server/public/doctor-panel.css b/server/public/doctor-panel.css
index cc3625b..c4fe2bf 100644
--- a/server/public/doctor-panel.css
+++ b/server/public/doctor-panel.css
@@ -1,4 +1,4 @@
-/* Kiểm tra máy (doctor-panel.js). Dùng token của style.css, khung hộp của packs-panel.css (.pk-dlg). */
+/* Kiểm tra máy + thẻ "Làm video đầu tiên" (doctor-panel.js). Dùng token của style.css, khung hộp của packs-panel.css (.pk-dlg). */
.dr-open { align-self: center; min-height: 44px; margin: 0 0 0 auto; }
.dr-open + .packs-open { margin-left: 0; }
.dr-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); flex: none; }
@@ -11,7 +11,7 @@ dialog.dr-dlg { width: min(760px, calc(100vw - 16px)); }
.dr-head-act .x { min-width: 44px; min-height: 44px; border: 0; background: none; color: var(--ink-2); font-size: 26px; cursor: pointer; border-radius: 10px; }
.dr-head-act .x:hover { color: var(--ink); background: var(--panel-2); }
.dr-refresh { display: inline-flex; align-items: center; gap: 6px; }
-.dr-refresh svg, .dr-sum svg, .dr-pri svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; flex: none; }
+.dr-refresh svg, .dr-sum svg, .dr-pri svg, .fv-ok svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.dr-sum { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; padding: 12px 14px; border-radius: 12px; font-weight: 600; }
.dr-sum.ok { color: var(--ok); background: rgba(93,211,158,.08); border: 1px solid rgba(93,211,158,.3); }
@@ -64,8 +64,34 @@ dialog.dr-dlg { width: min(760px, calc(100vw - 16px)); }
.dr-key-note a { color: var(--accent); }
.dr-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); flex: none; flex-wrap: wrap; }
+/* ---- thẻ Video đầu tiên ---- */
+#firstVideo { margin-bottom: 16px; }
+.fv { position: relative; display: flex; gap: 20px; padding: 20px; border-radius: var(--r); background: linear-gradient(135deg, rgba(255,107,44,.14), rgba(255,107,44,.03) 55%), var(--panel); border: 1px solid rgba(255,107,44,.45); animation: fv-in .28s ease-out; }
+@keyframes fv-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
+.fv-thumb { position: relative; flex: none; width: 90px; height: 160px; border-radius: 10px; overflow: hidden; background: var(--panel-2); border: 1px solid var(--line); }
+.fv-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
+.fv-ratio { position: absolute; left: 6px; bottom: 6px; font: 600 11px/1 var(--mono); background: rgba(0,0,0,.7); padding: 4px 6px; border-radius: 4px; }
+.fv-body { flex: 1; min-width: 0; }
+.fv-badge { display: inline-block; font: 600 12px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
+.fv-h { margin: 6px 0 4px; font: 700 28px/1.1 var(--cond); text-transform: uppercase; letter-spacing: .02em; }
+.fv-sub { margin: 0; color: var(--ink-2); }
+.fv-meta { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 12px 0; }
+.fv-meta li { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); color: var(--ink-2); }
+.fv-q { margin: 0 0 14px; }
+.fv-q figcaption { font-size: 13px; color: var(--ink-3); margin-bottom: 4px; }
+.fv-q blockquote { margin: 0; padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--bg); border-radius: 0 8px 8px 0; color: var(--ink); font-size: 15px; }
+.fv-act { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
+.fv-act .go { position: static; width: auto; margin: 0; padding: 0 22px; min-height: 52px; font-size: 22px; }
+.fv-act .mini { min-height: 48px; }
+.fv-ok { display: flex; gap: 8px; align-items: center; color: var(--ok); margin: 0 0 12px; font-weight: 600; }
+.fv-err { color: var(--bad); margin: 0 0 12px; overflow-wrap: anywhere; }
+.fv-x { position: absolute; top: 8px; right: 8px; min-width: 44px; min-height: 44px; border: 0; background: none; color: var(--ink-3); font-size: 24px; cursor: pointer; border-radius: 10px; }
+.fv-x:hover { color: var(--ink); background: var(--panel-2); }
+
@media (max-width: 640px) {
+ .fv { flex-direction: column; padding: 16px; }
+ .fv-thumb { width: 72px; height: 128px; }
.dr-row { padding: 12px; }
.dr-badge { margin-left: 0; }
}
-@media (prefers-reduced-motion: reduce) { .dr-dot.wait { animation: none; } }
+@media (prefers-reduced-motion: reduce) { .fv, .dr-dot.wait { animation: none; } }
diff --git a/server/public/doctor-panel.js b/server/public/doctor-panel.js
index 7cca92c..9ec79d7 100644
--- a/server/public/doctor-panel.js
+++ b/server/public/doctor-panel.js
@@ -1,7 +1,8 @@
-// "Kiểm tra máy".
+// "Kiểm tra máy" + thẻ "Làm video đầu tiên".
// - Nút "Kiểm tra máy" trên thanh trên (chấm xanh/đỏ), mở hộp liệt kê từng mục: Đạt / Thiếu (bắt buộc) / Tuỳ chọn,
// 1 câu giải thích, cách sửa (lệnh copy được, link, hoặc ô nhập khoá Anthropic).
// - Tự mở khi lần đầu vào app mà thiếu mục bắt buộc (nhớ theo bộ mục thiếu, đóng rồi thì không tự mở lại cho cùng bộ đó).
+// - Đủ mục bắt buộc mà chưa có video nào → thẻ "Làm video đầu tiên" trên danh sách video: 1 nút là dựng.
// API: /api/doctor, /api/doctor/key, /api/doctor/key/test (server/doctor.mjs). Chuỗi từ server chỉ vào textContent.
(() => {
const I = window.I18N;
@@ -48,6 +49,13 @@
'dr.key.server': 'Máy chủ Anthropic đang lỗi. Khoá {hint} đã lưu, kiểm lại sau.',
'dr.key.unknown': 'Chưa rõ kết quả (mã {status}).', 'dr.key.missing': 'Chưa có khoá nào.',
'dr.key.removed': 'Đã xoá khoá trong app.', 'dr.key.nowUsing': ' Đang dùng khoá {hint} từ {src}.',
+ 'dr.first': 'Làm video đầu tiên', 'dr.done': 'Xong',
+ 'fv.badge': 'Bắt đầu ở đây', 'fv.h': 'Làm video đầu tiên',
+ 'fv.sub': 'Một nút bấm: mẫu nhẹ, nội dung có sẵn, video dọc {n} giây. Khoảng 3–6 phút là xong.',
+ 'fv.tplName': 'Bảng terminal xanh lãi kép', 'fv.tpl': 'Mẫu {id} · {name}', 'fv.ratio': 'Dọc 9:16', 'fv.dur': '{n} giây',
+ 'fv.contentH': 'Nội dung mẫu', 'fv.go': 'Dựng video đầu tiên', 'fv.edit': 'Sửa nội dung trước', 'fv.sending': 'Đang gửi…',
+ 'fv.started': 'Đã bắt đầu dựng. Video hiện ở danh sách bên dưới, khoảng 3–6 phút nữa xong.',
+ 'fv.err': 'Chưa dựng được: {msg}', 'fv.hide': 'Ẩn thẻ này',
}, {
'dr.btn': 'System check',
'dr.title': 'System check',
@@ -91,6 +99,13 @@
'dr.key.server': 'Anthropic servers are having trouble. Key {hint} is saved; check again later.',
'dr.key.unknown': 'Unclear result (code {status}).', 'dr.key.missing': 'No key yet.',
'dr.key.removed': 'Key removed from the app.', 'dr.key.nowUsing': ' Now using key {hint} from the {src}.',
+ 'dr.first': 'Make your first video', 'dr.done': 'Done',
+ 'fv.badge': 'Start here', 'fv.h': 'Make your first video',
+ 'fv.sub': 'One click: a light template, ready-made text, a {n}-second vertical video. Done in about 3–6 minutes.',
+ 'fv.tplName': 'Green terminal compound-interest board', 'fv.tpl': 'Template {id} · {name}', 'fv.ratio': 'Vertical 9:16', 'fv.dur': '{n} seconds',
+ 'fv.contentH': 'Sample text', 'fv.go': 'Build my first video', 'fv.edit': 'Edit the text first', 'fv.sending': 'Sending…',
+ 'fv.started': 'Building now. The video appears in the list below in about 3–6 minutes.',
+ 'fv.err': 'Could not start: {msg}', 'fv.hide': 'Hide this card',
});
const t = (k, v) => I.t(k, v);
@@ -123,8 +138,11 @@
let data = null; // kết quả /api/doctor
let loading = false;
let keyMsg = null; // { cls, text }
+ let fvState = { hidden: false, sending: false, started: false, err: '', forced: false };
const SEEN = 'lumreels.doctor.seen';
+ const FV_HIDE = 'lumreels.firstVideo.hidden';
const store = { get(k) { try { return localStorage.getItem(k); } catch { return null; } }, set(k, v) { try { localStorage.setItem(k, v); } catch { /* bỏ qua */ } } };
+ fvState.hidden = store.get(FV_HIDE) === '1';
// ---------- nút trên thanh trên ----------
const btn = h('button.ghost.dr-open', { type: 'button', id: 'doctorOpen', 'aria-haspopup': 'dialog' },
@@ -273,6 +291,11 @@
}
dlg.append(body);
const foot = h('div.dr-foot');
+ if (data?.requiredOk) {
+ const first = h('button.dr-pri', { type: 'button', icon: IC.play }, t('dr.first'));
+ first.addEventListener('click', () => { dlg.close(); fvState = { ...fvState, hidden: false, forced: true, started: false, err: '' }; store.set(FV_HIDE, '0'); renderCard(); document.getElementById('firstVideo')?.scrollIntoView({ behavior: 'smooth', block: 'center' }); document.querySelector('#firstVideo .fv-go')?.focus({ preventScroll: true }); });
+ foot.append(first);
+ }
const done = h('button.mini', { type: 'button' }, t('dr.done'));
done.addEventListener('click', () => dlg.close());
foot.append(done);
@@ -291,6 +314,7 @@
loading = false;
if (dlg.open) render();
paintBtn();
+ renderCard();
return data;
}
@@ -300,7 +324,59 @@
if (user) load();
}
- window.addEventListener('lumreels:lang', () => { paintBtn(); if (dlg.open) render(); });
+ // ---------- thẻ "Làm video đầu tiên" ----------
+ const slot = document.getElementById('firstVideo');
+ function fvContent() { return data?.firstVideo?.content?.[I.lang] || data?.firstVideo?.content?.vi || ''; }
+ function renderCard() {
+ if (!slot) return;
+ const fv = data?.firstVideo;
+ const show = !!fv && data.requiredOk && !fvState.hidden && (fvState.forced || fvState.started || data.jobsCount === 0);
+ slot.hidden = !show;
+ if (!show) { slot.replaceChildren(); return; }
+ const hide = h('button.x.fv-x', { type: 'button', 'aria-label': t('fv.hide') }, '×');
+ hide.addEventListener('click', () => { fvState.hidden = true; store.set(FV_HIDE, '1'); renderCard(); });
+ const go = h('button.go.fv-go', { type: 'button', icon: IC.play, disabled: fvState.sending || fvState.started }, h('span', {}, fvState.sending ? t('fv.sending') : t('fv.go')));
+ go.addEventListener('click', startFirst);
+ const edit = h('button.mini.fv-edit', { type: 'button' }, t('fv.edit'));
+ edit.addEventListener('click', () => window.dispatchEvent(new CustomEvent('lumreels:prefill', { detail: { templateId: fv.templateId, content: fvContent(), durationS: fv.durationS, ratio: fv.aspect } })));
+ const thumb = h('img', { src: `/thumbs/${fv.templateId}.webp`, alt: '', width: '90', height: '160', loading: 'lazy' });
+ thumb.addEventListener('error', () => { if (!thumb.dataset.f) { thumb.dataset.f = '1'; thumb.src = `/poster/${fv.templateId}.svg`; } }, { once: false });
+ const card = h('article.fv', { 'aria-labelledby': 'fvH' },
+ h('div.fv-thumb', {}, thumb, h('span.fv-ratio', {}, '9:16')),
+ h('div.fv-body', {},
+ h('span.fv-badge', {}, t('fv.badge')),
+ h('h3.fv-h', { id: 'fvH' }, t('fv.h')),
+ h('p.fv-sub', {}, t('fv.sub', { n: fv.durationS })),
+ h('ul.fv-meta', {}, h('li', {}, t('fv.tpl', { id: fv.templateId, name: t('fv.tplName') })), h('li', {}, t('fv.ratio')), h('li', {}, t('fv.dur', { n: fv.durationS }))),
+ h('figure.fv-q', {}, h('figcaption', {}, t('fv.contentH')), h('blockquote', {}, fvContent())),
+ fvState.started ? h('p.fv-ok', { role: 'status', icon: IC.check }, t('fv.started')) : null,
+ fvState.err ? h('p.fv-err', { role: 'alert' }, t('fv.err', { msg: fvState.err })) : null,
+ h('div.fv-act', {}, go, fvState.started ? null : edit)),
+ hide);
+ slot.replaceChildren(card);
+ }
+ async function startFirst() {
+ const fv = data?.firstVideo;
+ if (!fv || fvState.sending) return;
+ fvState = { ...fvState, sending: true, err: '' };
+ renderCard();
+ try {
+ const r = await fetch('/api/jobs', {
+ method: 'POST', headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ templateId: fv.templateId, content: fvContent(), durationS: fv.durationS, aspect: fv.aspect, mode: 'auto', model: 'auto', source: 'first-video', audio: { music: 'auto', voice: 'auto', sfx: true } }),
+ });
+ const j = await r.json().catch(() => ({}));
+ if (!r.ok) throw new Error(I.srv(j.error) || String(r.status));
+ fvState = { ...fvState, sending: false, started: true };
+ window.dispatchEvent(new Event('lumreels:jobs-reload'));
+ } catch (e) {
+ fvState = { ...fvState, sending: false, err: e.message };
+ }
+ renderCard();
+ slot.querySelector('.fv-ok, .fv-err')?.focus?.();
+ }
+
+ window.addEventListener('lumreels:lang', () => { paintBtn(); if (dlg.open) render(); renderCard(); });
// ---------- lần đầu ----------
paintBtn();
diff --git a/server/public/index.html b/server/public/index.html
index 772f4dd..31c32ac 100644
--- a/server/public/index.html
+++ b/server/public/index.html
@@ -142,6 +142,7 @@
<section class="jobs" aria-labelledby="h-jobs">
<div class="sec-head"><h2 id="h-jobs" data-i18n="jobs.h">Video đã dựng</h2></div>
+ <div id="firstVideo" hidden></div>
<div id="jobs" class="job-list"></div>
</section>
</main>
diff --git a/server/test/doctor-check.mjs b/server/test/doctor-check.mjs
index dc718b5..f64c4f0 100644
--- a/server/test/doctor-check.mjs
+++ b/server/test/doctor-check.mjs
@@ -90,6 +90,7 @@ try {
ok((j.items || []).every((i) => ['required', 'optional'].includes(i.level) && ['ok', 'missing', 'warn', 'off', 'bad'].includes(i.status) && (i.fix === null || typeof i.fix === 'object')), 'mỗi mục có level/status/fix đúng dạng');
ok(['node', 'ffmpeg', 'chrome', 'disk', 'ai'].every((id) => j.items.find((i) => i.id === id)?.level === 'required'), 'node/ffmpeg/chrome/disk/ai là bắt buộc');
ok(typeof j.requiredOk === 'boolean' && typeof j.jobsCount === 'number' && typeof j.platform === 'string', 'requiredOk/jobsCount/platform');
+ ok(j.firstVideo?.templateId === '009' && j.firstVideo.aspect === '9:16' && j.firstVideo.durationS >= 8 && j.firstVideo.durationS <= 15 && /[ạảãàáâậầấẩẫăắằặẳẵ]/.test(j.firstVideo.content?.vi || ''), 'firstVideo: mẫu 009, 9:16, 8–15 s, nội dung tiếng Việt');
const ai1 = j.items.find((i) => i.id === 'ai');
ok(j.key?.present === false && ai1.status === 'missing' && j.requiredOk === false, 'không khoá + không Claude Code → AI dựng cảnh thiếu, requiredOk=false', JSON.stringify({ key: j.key, ai: ai1 }));
ok(j.items.find((i) => i.id === 'claude')?.status === 'off' && j.items.find((i) => i.id === 'claude').fix?.cmd, 'Claude Code chưa cài → có lệnh cài');