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.
Let the user choose in Settings whether an agent asks before a film or a long reshoot
Bowen Xue1467a9bf3635
diff --git a/web/agent_confirm_settings.js b/web/agent_confirm_settings.jsnew file mode 100644index 0000000..249b661--- /dev/null+++ b/web/agent_confirm_settings.js@@ -0,0 +1,76 @@+import {agentGet, agentSend} from './agent_session.js';+import {agentInterfaceState} from './agent_connect.js';++const PATH = '/freevideo/agent/v1/confirmations';+const DEFAULT_MINUTES = 5, MAX_MINUTES = 1440;+function el(tag, cls, text) { const e = document.createElement(tag); if (cls) e.className = cls; if (text != null) e.textContent = text; return e; }++// What the controls show for the server's policy: whether a film asks first, and whether and after how many minutes+// a reshoot asks. `reshoot_seconds: null` is "never asks"; the minutes then stay at the last value.+export function confirmView(policy, minutes = DEFAULT_MINUTES) {+ const seconds = policy?.reshoot_seconds;+ const long = typeof seconds === 'number';+ return {start: policy?.start !== false, long, minutes: long ? Math.max(1, Math.round(seconds / 60)) : minutes};+}++// The one field that changed; the server keeps the other, so a policy set elsewhere is never overwritten.+export function confirmPatch(field, value) {+ if (field === 'start') return {start: value === true};+ if (field === 'long') return {reshoot_seconds: value.on ? value.minutes * 60 : null};+ throw new Error('Unknown confirmation field');+}++export function validMinutes(value) {+ const minutes = Number(value);+ return Number.isInteger(minutes) && minutes >= 1 && minutes <= MAX_MINUTES;+}++// Settings → AI Agent: when an agent has to wait for the user. The section stays hidden unless the Agent interface+// is on and the policy was read, so a page without it shows nothing half-working.+export function agentConfirmSettings(t, api) {+ const section = el('details'); section.hidden = true;+ section.append(el('summary', null, t('AI Agent', 'AI Agent')));+ const startBox = el('input'); startBox.type = 'checkbox';+ const startLabel = el('label', 'fv-check'); startLabel.append(startBox, el('span', null, t('Ask before an agent starts a film', 'Agent 开拍整部片前先询问')));+ const longBox = el('input'); longBox.type = 'checkbox';+ const minutesField = el('input', 'fv-number'); minutesField.type = 'number'; minutesField.min = '1'; minutesField.max = String(MAX_MINUTES); minutesField.step = '1';+ const longLabel = el('label', 'fv-check');+ longLabel.append(longBox, el('span', null, t('Ask before an agent reshoot that takes more than', 'Agent 重拍预计超过')), minutesField, el('span', null, t('minutes', '分钟时先询问')));+ const status = el('p', 'fv-muted'); status.setAttribute('role', 'status');+ section.append(startLabel, longLabel, status);++ let shown = {start: true, long: true, minutes: DEFAULT_MINUTES}, busy = false;+ const render = () => {+ startBox.checked = shown.start; longBox.checked = shown.long;+ minutesField.value = String(shown.minutes); minutesField.disabled = busy || !shown.long;+ startBox.disabled = longBox.disabled = busy;+ };+ async function save(patch, next) {+ busy = true; render(); status.textContent = '';+ try {+ const response = await agentSend(api, 'PUT', PATH, patch);+ if (!response.ok) throw new Error('Not saved');+ shown = confirmView(await response.json(), next.minutes);+ status.textContent = t('Saved', '已保存');+ } catch { status.textContent = t('Could not save. The previous setting is kept.', '保存失败,仍保留原设置。'); }+ busy = false; render();+ }+ startBox.onchange = () => save(confirmPatch('start', startBox.checked), shown);+ longBox.onchange = () => save(confirmPatch('long', {on: longBox.checked, minutes: shown.minutes}), shown);+ minutesField.onchange = () => {+ if (!validMinutes(minutesField.value)) { render(); status.textContent = t(`Enter a whole number from 1 to ${MAX_MINUTES}.`, `请输入 1 到 ${MAX_MINUTES} 的整数。`); return; }+ const minutes = Number(minutesField.value);+ return save(confirmPatch('long', {on: true, minutes}), {...shown, minutes});+ };++ const ready = (async () => {+ try {+ if (await agentInterfaceState(api) !== 'on') return;+ const response = await agentGet(api, PATH);+ if (!response.ok) return;+ shown = confirmView(await response.json()); render();+ section.hidden = false;+ } catch { /* The section simply stays hidden. */ }+ })();+ return {element: section, ready};+}diff --git a/web/health.js b/web/health.jsindex 314cd1d..77b2500 100644--- a/web/health.js+++ b/web/health.js@@ -13,7 +13,7 @@ const t = (en, zh) => cn ? zh : en;// launcher.js removes this flag during setup; read it before that.const launchVisit = query.get('freevideo') === 'launch';// Every script this folder ships; a test keeps the list in step with web/*.js.-export const MODULES = ['audio_original.js', 'chat_data.js', 'phone_model.js', 'phone.js', 'lan_access.js', 'qrcodegen.js', 'agent_activity.js', 'agent_connect.js', 'agent_session.js', 'autopilot.js', 'autopilot_chat.js', 'chat_attachments.js', 'autopilot_conversations.js', 'browser_extension.js', 'caret_rect.js', 'chain_support.js', 'chain_rules.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',+export const MODULES = ['audio_original.js', 'chat_data.js', 'phone_model.js', 'phone.js', 'lan_access.js', 'qrcodegen.js', 'agent_activity.js', 'agent_confirm_settings.js', 'agent_connect.js', 'agent_session.js', 'autopilot.js', 'autopilot_chat.js', 'chat_attachments.js', 'autopilot_conversations.js', 'browser_extension.js', 'caret_rect.js', 'chain_support.js', 'chain_rules.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_sections.js', 'prompt_terms.js', 'request_assets.js', 'repair_hint.js', 'report_issue.js', 'issue_button.js', 'studio_recent.js',diff --git a/web/setup.js b/web/setup.jsindex 22b0b8d..2d860f1 100644--- a/web/setup.js+++ b/web/setup.js@@ -4,6 +4,7 @@ import { openCompatibility } from './compatibility.js';import { animateDetails, closeDialog } from './motion.js';import { createGuideReplayEntry } from './first_run_guide.js';import { issueButton } from './issue_button.js';+import { agentConfirmSettings } from './agent_confirm_settings.js';const css = document.createElement('link');css.rel = 'stylesheet'; css.href = new URL('./setup.css', import.meta.url).href;@@ -165,7 +166,8 @@ export async function openSetup() {const {openCreativeWorkspace} = await import('./view_navigation.js');return openCreativeWorkspace();}});- dialog.append(heading, installation, downloads, advanced, guideReplay);+ const agentConfirm = agentConfirmSettings(t, api);+ dialog.append(heading, installation, downloads, agentConfirm.element, advanced, guideReplay);const motions = [...dialog.querySelectorAll('details')].map(animateDetails);dialog.addEventListener('cancel', e => { e.preventDefault(); closeDialog(dialog); });document.body.append(dialog); dialog.showModal();