Skip to content

Make videos on the computer you already own. FreeVideo runs MiniMax H3 in as little as 8 GB of VRAM and 16 GB of RAM, and adapts its acceleration path to your hardware.

White-model scene: say which failure happened and show rendering progress

Bowen Xuedcd804c15b6d
diff --git a/web/autopilot_chat.js b/web/autopilot_chat.js
index 1fcd5d2..8731fa0 100644
--- a/web/autopilot_chat.js
+++ b/web/autopilot_chat.js
@@ -310,9 +310,12 @@ export function agentChat(t, api, {open, edit, shown = () => true, changed = ()
say(t(...SCENE_TEXT.preparing)); sceneWaiting = true;
try {
const id = await startScene(api, preset, session);
- const result = id ? await watchScene(api, id, {stopped: () => stopped}) : {status: 'ready'};
- if (result.status === 'failed') { sceneWaiting = false; say(t(...SCENE_TEXT.failed) + (result.error || '')); }
- else if (result.status === 'timeout') { sceneWaiting = false; say(t(...SCENE_TEXT.timeout)); }
+ const result = id ? await watchScene(api, id, {stopped: () => stopped, onState: value => { if (value.status === 'rendering') say(t(...SCENE_TEXT.rendering)); }}) : {status: 'ready'};
+ if (result.status === 'failed') { sceneWaiting = false; say(t(...SCENE_TEXT.failed) + (result.error || '').replace(/[.。]+$/, '') + t(...SCENE_TEXT.retry)); }
+ else if (result.status === 'timeout') {
+ sceneWaiting = false;
+ say(t(...(result.last === 'rendering' ? SCENE_TEXT.timeout : result.page_open ? SCENE_TEXT.notStarted : SCENE_TEXT.noPage)));
+ }
} 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);
diff --git a/web/whitebox_scenes.js b/web/whitebox_scenes.js
index bec4a06..f098620 100644
--- a/web/whitebox_scenes.js
+++ b/web/whitebox_scenes.js
@@ -6,7 +6,10 @@ export const SCENE_TEXT = Object.freeze({
icon: 'M4 5h7v6H4zM13 5h7v6h-7zM4 13h7v6H4zM13 13h7v6h-7z',
label: ['Ready-made', '现成场景'], name: ['Start from a ready-made white-model scene', '用现成的白模场景开始'],
preparing: ['Preparing the white model…', '正在准备白模…'], failed: ['The white model could not be made: ', '白模没有做成:'],
- timeout: ['The white model took too long and was not made. Try again.', '白模等了太久,没有做成,请重试。'],
+ rendering: ['Rendering the white model…', '正在渲染白模…'], retry: ['. Try again.', '。请重试。'],
+ noPage: ['The white-model renderer is not running in this page, so nothing was made. Reload the page and try again.', '这个页面里的白模渲染没有运行,没有做成。请刷新页面后重试。'],
+ notStarted: ['Rendering did not start within 3 minutes, so no white model was made. Try again.', '等了三分钟渲染仍没有开始,没有做成白模。请重试。'],
+ timeout: ['Rendering did not finish within 3 minutes, so no white model was made. Try again.', '渲染三分钟内没有完成,没有做成白模。请重试。'],
});
export async function sceneList(api) {
@@ -23,17 +26,21 @@ export async function startScene(api, preset, session) {
return value?.id || null;
}
-// Resolves with the scene's last state: 'ready' (the card follows), 'failed' (with error), or 'timeout'.
-export async function watchScene(api, id, {every = 3000, limit = 180000, stopped = () => false, wait = ms => new Promise(done => setTimeout(done, ms))} = {}) {
+// Resolves with the scene's last state: 'ready' (the card follows), 'failed' (with error), or 'timeout' (with the
+// last state seen: 'waiting' nobody claimed it, 'rendering' it did not finish, page_open false no page was asking).
+// onState hears every state seen, so the page can say what is happening.
+export async function watchScene(api, id, {every = 3000, limit = 180000, stopped = () => false, onState = () => {}, wait = ms => new Promise(done => setTimeout(done, ms))} = {}) {
+ let last = {};
for (let waited = 0; waited < limit && !stopped(); waited += every) {
try {
const response = await agentGet(api, `/freevideo/agent/whitebox/${encodeURIComponent(id)}`);
if (response.ok) {
const value = await response.json();
if (value?.status === 'ready' || value?.status === 'failed') return value;
+ last = value || {}; onState(last);
}
} catch { /* Asked again on the next turn. */ }
await wait(every);
}
- return {status: 'timeout'};
+ return {status: 'timeout', last: last.status || '', page_open: last.page_open !== false};
}