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.

Autopilot conversation: the card says what the engine is doing before the first step

Bowen Xuecd00ad1023ba
diff --git a/web/autopilot.js b/web/autopilot.js
index df07286..4cfe7d0 100644
--- a/web/autopilot.js
+++ b/web/autopilot.js
@@ -70,7 +70,7 @@ export function openAutopilotView(node, {studio = null} = {}) {
const fraction = last.fraction || 0, running = job.status === 'running';
currentId = job.id; name.textContent = jobName(job, t); more.textContent = last.active > 1 ? `+${last.active - 1}` : '';
percent.textContent = running && fraction >= .01 ? `${Math.floor(fraction * 100)}%` : '';
- eta.textContent = running && job.progress?.remaining_seconds > 0 ? about(job.progress.remaining_seconds, t) : '';
+ eta.textContent = running && last.left != null ? about(last.left, t) : '';
ring.style.setProperty('--p', String(fraction * 100)); line.style.width = `${fraction * 100}%`;
}
card.sync();
diff --git a/web/autopilot_chat.js b/web/autopilot_chat.js
index fe667cd..f39a5ca 100644
--- a/web/autopilot_chat.js
+++ b/web/autopilot_chat.js
@@ -1,7 +1,7 @@
// The conversation with the connected agent: what the user says, what the agent answers, and the agent's jobs as
// cards at the place they happened. Reads and sends use the page session; the agent's token never enters the page.
import {agentGet, agentPost} from './agent_session.js';
-import { estimatedFraction } from './generation_progress.js';
+import { estimatedFraction, remainingShown } from './generation_progress.js';
const css = document.createElement('link'); css.rel = 'stylesheet'; css.href = new URL('./autopilot_chat.css', import.meta.url).href; document.head.append(css);
@@ -42,6 +42,8 @@ export function jobLine(job, t) {
if (job.status !== 'running') return t('Queued', '排队中');
if (p.phase === 'sampling' && p.step?.total && p.step.done >= 1) return t(`Step ${p.step.done} / ${p.step.total}`, `生成 ${p.step.done} / ${p.step.total}`);
if (['decode', 'finishing', 'assembling'].includes(p.phase)) return t('Saving', '保存中');
+ if (p.phase === 'encoding') return t('Reading the prompt', '读取提示词');
+ if (['load', 'loading'].includes(p.phase)) return t('Loading the model', '加载模型');
return t('Preparing', '准备中');
}
export function jobMeta(job, t) {
@@ -117,6 +119,22 @@ export function agentChat(t, api, {open, edit, shown = () => true, changed = ()
if (job.status === 'running') row.value = Math.max(row.value, Math.min(.99, jobEstimate(row.job, time - row.at, time - row.since)));
return row.value;
}
+ // The time left each job shows, by the creation panel's rule: never raised, and gone once its last minute has passed.
+ const times = new Map();
+ function leftOf(job) {
+ const time = performance.now() / 1000, sent = job.progress?.remaining_seconds;
+ if (job.status !== 'running') { times.delete(job.id); return null; }
+ let row = times.get(job.id);
+ if (!row) {
+ if (!(sent > 0)) return null;
+ times.set(job.id, row = {seconds: sent, at: time, minute: null, last: 0});
+ }
+ if (row.seconds === null) return null;
+ row.seconds = remainingShown(row.seconds, sent > 0 ? sent : null, time - row.at); row.at = time;
+ if (row.seconds < 60 && row.minute === null) { row.minute = time; row.last = row.seconds; }
+ if (row.seconds <= 0 || row.minute !== null && time - row.minute >= row.last) row.seconds = null;
+ return row.seconds;
+ }
const active = () => !stopped && element.isConnected && !document.hidden && shown();
// ---- one entry of the conversation each ----
@@ -149,10 +167,12 @@ export function agentChat(t, api, {open, edit, shown = () => true, changed = ()
percent.textContent = next.status === 'running' && fraction >= .01 ? `${Math.floor(fraction * 100)}%` : '';
const high = box.clientHeight;
box.dataset.under = String(high > 0 && high * (1 - fraction) < percent.offsetHeight + 10);
+ const seconds = leftOf(next);
+ left.textContent = seconds === null ? '' : about(seconds, t);
};
item.tick = () => level(state.jobs[job.id] || job);
return next => {
- const cells = jobParts(next), queued = next.status !== 'running';
+ const cells = jobParts(next);
level(next);
name.textContent = jobName(next, t); meta.textContent = jobMeta(next, t); meta.hidden = !meta.textContent;
while (parts.children.length > cells.length) parts.lastChild.remove();
@@ -162,7 +182,6 @@ export function agentChat(t, api, {open, edit, shown = () => true, changed = ()
const block = next.progress?.block;
part.textContent = cells.length ? t(`Part ${block.index} / ${block.total}`, `第 ${block.index} / ${block.total} 段`) : jobLine(next, t);
step.textContent = cells.length ? jobLine(next, t) : '';
- left.textContent = !queued && next.progress?.remaining_seconds > 0 ? about(next.progress.remaining_seconds, t) : '';
const going = stopping.has(next.id);
stop.disabled = going; stop.textContent = going ? t('Stopping', '正在停止') : t('Stop', '停止');
stop.setAttribute('aria-label', t('Stop ', '停止 ') + jobName(next, t));
@@ -329,7 +348,7 @@ export function agentChat(t, api, {open, edit, shown = () => true, changed = ()
function report() {
const current = state.current ? state.jobs[state.current] || null : null;
- changed({known, agent: state.agent, current, fraction: current ? fractionOf(current) : 0, active: state.active,
+ changed({known, agent: state.agent, current, fraction: current ? fractionOf(current) : 0, left: current ? leftOf(current) : null, active: state.active,
any: state.items.size > 0 || pending.length > 0});
}
async function send(text) {
diff --git a/web/generation_progress.js b/web/generation_progress.js
index ccf9085..2fee372 100644
--- a/web/generation_progress.js
+++ b/web/generation_progress.js
@@ -216,6 +216,17 @@ export function referenceTrimText(row, t) {
`${name} 比生成的视频长,已截取前 ${used} 秒${rule}`);
}
+// The time left on show `dt` seconds on, given the engine's newest estimate (null when it sent none). Never raised:
+// an estimate at or above the shown time holds it, so a slower run does not count down to "less than a minute"
+// early. A lower one is eased into.
+export function remainingShown(shown, target, dt) {
+ if (target === null) return Math.max(0, shown - dt);
+ if (target < shown - dt) {
+ const counted = Math.max(0, shown - dt);
+ return counted + (target - counted) * (1 - Math.exp(-dt / 15));
+ }
+ return target < shown ? target : shown;
+}
// The whole-video fraction the engine's last message stands for now: its estimate moved on by the seconds since the
// step sample (stateAge) and the whole-video sample (overallAge) arrived. Null when the message carries none.
export function estimatedFraction(state, overall, stateAge, overallAge) {
@@ -624,15 +635,7 @@ export function createGenerationProgress(t, now = () => Date.now(), {compact = f
elapsed.textContent = `${t('Elapsed', '已用时')} ${duration(Math.max(0, seconds))}`;
if (ended) remainingSeconds = null;
if (remainingSeconds !== null) {
- // Never raised. An estimate at or above the shown time holds it, so
- // a slower run does not count down to "less than a minute" early.
- const dt = Math.max(0, (now() - remainingAt) / 1000);
- const target = rawRemaining();
- if (target === null) remainingSeconds = Math.max(0, remainingSeconds - dt);
- else if (target < remainingSeconds - dt) {
- const counted = Math.max(0, remainingSeconds - dt);
- remainingSeconds = counted + (target - counted) * (1 - Math.exp(-dt / 15));
- } else if (target < remainingSeconds) remainingSeconds = target;
+ remainingSeconds = remainingShown(remainingSeconds, rawRemaining(), Math.max(0, (now() - remainingAt) / 1000));
if (remainingSeconds < 60 && lastMinuteAt === null) { lastMinuteAt = now(); lastMinute = remainingSeconds; }
// A run slower than estimated would leave "less than a minute" up for minutes:
// once that minute has passed, or the time reaches zero, stop showing it.