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.
Prompt suggestions for camera and motion words
Bowen Xue4ae8cfa22093
diff --git a/web/health.js b/web/health.jsindex f65766c..aba5c18 100644--- a/web/health.js+++ b/web/health.js@@ -16,7 +16,7 @@ const launchVisit = query.get('freevideo') === 'launch';export const MODULES = ['agent_activity.js', 'agent_connect.js', 'agent_session.js', 'autopilot.js', 'autopilot_chat.js', 'autopilot_conversations.js', 'browser_extension.js', 'chain_support.js', 'capability_view.js', 'compatibility.js', 'error_panel.js', 'first_run_guide.js', 'fonts.js', 'freevideo.js', 'generation_progress.js','editor.js', 'editor_actions.js', 'editor_adjust.js', 'editor_adjust_picture.js', 'editor_picture_fields.js', 'editor_picture_session.js', 'editor_preview_picture.js', 'editor_entry.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_loader.js', 'editor_text_coverage.js', 'editor_text.js', 'editor_text_model.js', 'editor_text_layout.js', 'editor_notes.js', 'editor_icons.js', 'dialog_keys.js', 'done_notify.js', 'frame_sizes.js', 'health.js', 'image_commands.js', 'image_editor.js', 'image_editor_engine.js', 'image_generation.js', 'launcher.js', 'length_plan.js', 'lora_triggers.js', 'library.js', 'motion.js', 'output_download.js', 'port_notice.js', 'preview_scene.js',- 'progress_connection.js', 'prompt_draft.js', 'prompt_enhance.js', 'prompt_references.js', 'report_issue.js', 'studio_recent.js',+ 'progress_connection.js', 'prompt_draft.js', 'prompt_enhance.js', 'prompt_references.js', 'prompt_terms.js', 'report_issue.js', 'studio_recent.js','result_actions.js', 'sampling_effort.js', 'setup.js', 'share.js', 'share_layout.js', 'studio.js', 'studio_chain.js', 'studio_extend.js', 'studio_length.js', 'first_frame_row.js', 'optional_inputs.js', 'studio_queue.js', 'studio_size.js','toolbar_position.js', 'updates.js', 'view_navigation.js', 'wordmark.js'];const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));diff --git a/web/prompt_references.css b/web/prompt_references.cssindex 4720859..476afa4 100644--- a/web/prompt_references.css+++ b/web/prompt_references.css@@ -10,3 +10,6 @@.fv-reference-empty{padding:18px 12px;color:var(--fv-muted,#a9b3c4)}.fv-reference-picker button{margin:0 12px 10px;padding:5px 10px;border:1px solid var(--fv-border,#3a414c);border-radius:8px;background:var(--fv-raised,#252e39);color:inherit;cursor:pointer;font:inherit}@keyframes fv-reference-appear{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}@media(prefers-reduced-motion:reduce){.fv-reference-picker{animation:none}}+.fv-term-picker .fv-reference-options{max-height:220px}+.fv-term-option{min-height:34px;padding:5px 10px}+.fv-term-option strong{flex:none;font-size:13px}diff --git a/web/prompt_terms.js b/web/prompt_terms.jsnew file mode 100644index 0000000..d00db45--- /dev/null+++ b/web/prompt_terms.js@@ -0,0 +1,136 @@+// Camera and motion words offered while a prompt is typed. The list is local; nothing is sent anywhere,+// a word is written only when it is chosen, and the typed language decides which form is inserted.+export const TERMS = [+ ['dolly in', '推镜头'], ['dolly out', '拉镜头'], ['pan left', '左摇镜头'], ['pan right', '右摇镜头'],+ ['tilt up', '上摇镜头'], ['tilt down', '下摇镜头'], ['tracking shot', '跟拍镜头'], ['orbit shot', '环绕镜头'],+ ['crane up', '升镜头'], ['crane down', '降镜头'], ['zoom in', '变焦推近'], ['zoom out', '变焦拉远'],+ ['handheld shot', '手持镜头'], ['static shot', '固定镜头'], ['low angle', '仰拍'], ['high angle', '俯拍'],+ ['aerial shot', '航拍'], ['close-up', '特写'], ['wide shot', '远景'], ['slow motion', '慢动作'],+].map(([en, zh]) => ({en, zh}));+const MAX_ROWS = 6, MIN_LATIN = 3, MIN_WORD_LATER = 4, MIN_CJK = 2, MAX_CJK = 6;+const CJK = /[\u3400-\u9fff]/;++// The words ending at `caret` that begin a known term: {start, end, matches: [{term, form}]} or null.+export function termMatches(text, caret = text.length, terms = TERMS) {+ const before = String(text).slice(0, caret);+ if (!before || /[@<]$/.test(before)) return null;+ const last = before[before.length - 1];+ if (CJK.test(last)) {+ const run = before.match(/[㐀-鿿]+$/)[0];+ for (let length = Math.min(run.length, MAX_CJK); length >= MIN_CJK; length--) {+ const query = run.slice(-length), found = terms.filter(term => term.zh.startsWith(query) && term.zh !== query);+ if (found.length) return {start: caret - length, end: caret, matches: found.slice(0, MAX_ROWS).map(term => ({term, form: 'zh'}))};+ }+ return null;+ }+ // One, two or three trailing words, so that "dolly i" still finds "dolly in" and "dolly " lists what follows.+ const tail = before.match(/[A-Za-z][A-Za-z -]*$/);+ if (!tail) return null;+ const parts = tail[0].split(' ');+ for (const words of [3, 2, 1]) {+ if (parts.length < words) continue;+ const fragment = parts.slice(-words).join(' '), query = fragment.toLowerCase(), start = caret - fragment.length;+ if (query.length < MIN_LATIN || (start > 0 && /[\w@<]/.test(before[start - 1]))) continue;+ const found = terms.filter(term => term.en.startsWith(query) && term.en !== query)+ .concat(words === 1 && query.length >= MIN_WORD_LATER ? terms.filter(term => !term.en.startsWith(query)+ && term.en.split(/[ -]/).some(word => word.startsWith(query))) : []);+ if (found.length) return {start, end: caret, matches: found.slice(0, MAX_ROWS).map(term => ({term, form: 'en'}))};+ }+ return null;+}++let serial = 0;+export function attachTermSuggest(input, {t = en => en, host, suppressed = () => false} = {}) {+ if (!document.querySelector('link[data-freevideo-references]')) {+ const css = document.createElement('link'); css.rel = 'stylesheet';+ css.dataset.freevideoReferences = ''; css.href = new URL('./prompt_references.css', import.meta.url).href;+ document.head.append(css);+ }+ const popup = document.createElement('div'); popup.className = 'fv-reference-picker fv-term-picker';+ popup.setAttribute('popover', 'manual'); popup.hidden = true;+ const list = document.createElement('div'); list.className = 'fv-reference-options';+ list.id = `fv-term-options-${++serial}`; list.setAttribute('role', 'listbox');+ list.setAttribute('aria-label', t('Camera and motion words', '运镜与动作词'));+ popup.append(list); (host || input.closest('dialog') || document.body).append(popup);+ let found = null, active = -1, composing = false, disposed = false, dismissed = null;+ let saved = null;+ const listeners = [];+ const listen = (target, name, fn, options) => { target.addEventListener(name, fn, options); listeners.push(() => target.removeEventListener(name, fn, options)); };+ function close() {+ if (popup.hidePopover && popup.matches(':popover-open')) popup.hidePopover();+ popup.hidden = true; found = null;+ if (saved) {+ for (const [name, value] of saved) { if (value === null) input.removeAttribute(name); else input.setAttribute(name, value); }+ saved = null;+ }+ }+ function place() {+ if (popup.hidden) return;+ const rect = input.getBoundingClientRect();+ popup.style.width = `${Math.min(Math.max(rect.width * .6, 240), innerWidth - 24)}px`;+ const height = Math.min(popup.scrollHeight, 220);+ popup.style.left = `${Math.max(12, Math.min(rect.left, innerWidth - popup.offsetWidth - 12))}px`;+ popup.style.top = `${Math.max(12, rect.bottom + height + 8 < innerHeight ? rect.bottom + 6 : rect.top - height - 6)}px`;+ }+ function select(index) {+ active = index;+ for (const [i, option] of [...list.children].entries()) option.setAttribute('aria-selected', String(i === active));+ if (list.children[active]) input.setAttribute('aria-activedescendant', list.children[active].id);+ else input.removeAttribute('aria-activedescendant');+ }+ function choose(index) {+ const hit = found?.matches[index]; if (!hit) return;+ const {start, end} = found, word = hit.term[hit.form];+ const spacer = hit.form === 'en' && !/^\s/.test(input.value.slice(end)) ? ' ' : '';+ close(); input.focus(); input.setSelectionRange(start, end);+ // The browser's own undo history keeps working: one undo gives back what was typed.+ if (!document.execCommand('insertText', false, word + spacer)) {+ input.setRangeText(word + spacer, start, end, 'end'); input.dispatchEvent(new Event('input', {bubbles: true}));+ }+ }+ function refresh() {+ if (disposed || composing || input.disabled || input.readOnly || document.activeElement !== input+ || input.selectionStart !== input.selectionEnd || suppressed()) { close(); return; }+ const next = termMatches(input.value, input.selectionStart);+ if (!next) { dismissed = null; close(); return; }+ if (dismissed && dismissed.start === next.start && dismissed.value === input.value.slice(next.start, next.end)) { close(); return; }+ dismissed = null; found = next;+ list.replaceChildren();+ for (const [index, hit] of next.matches.entries()) {+ const option = document.createElement('div'); option.id = `${list.id}-${index}`;+ option.className = 'fv-reference-option fv-term-option'; option.setAttribute('role', 'option');+ const main = document.createElement('strong'); main.textContent = hit.term[hit.form];+ option.append(main);+ option.onpointerdown = e => e.preventDefault(); option.onclick = () => choose(index);+ option.onpointermove = () => select(index); list.append(option);+ }+ const wasHidden = popup.hidden; popup.hidden = false;+ if (wasHidden && popup.showPopover) popup.showPopover();+ if (!saved) {+ saved = ['aria-controls', 'aria-expanded', 'aria-activedescendant'].map(name => [name, input.getAttribute(name)]);+ }+ input.setAttribute('aria-controls', list.id); input.setAttribute('aria-expanded', 'true');+ select(-1); place();+ }+ listen(input, 'input', refresh);+ listen(input, 'compositionstart', () => { composing = true; close(); });+ listen(input, 'compositionend', () => { composing = false; refresh(); });+ listen(input, 'keydown', e => {+ if (composing || e.isComposing || e.keyCode === 229 || popup.hidden || !found || e.ctrlKey || e.metaKey || e.altKey) return;+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {+ e.preventDefault(); e.stopPropagation(); const n = found.matches.length;+ select(active < 0 ? (e.key === 'ArrowDown' ? 0 : n - 1) : (active + (e.key === 'ArrowDown' ? 1 : -1) + n) % n);+ } else if ((e.key === 'Tab' || e.key === 'Enter') && !e.shiftKey && active >= 0) {+ // Nothing is highlighted until an arrow key moves into the list, so typing, Enter and Tab keep their usual meaning.+ e.preventDefault(); e.stopPropagation(); choose(active);+ } else if (e.key === 'Escape') {+ e.preventDefault(); e.stopPropagation();+ dismissed = {start: found.start, value: input.value.slice(found.start, found.end)}; close();+ }+ });+ listen(input, 'blur', () => { if (!popup.contains(document.activeElement)) close(); });+ listen(document, 'pointerdown', e => { if (e.target !== input && !popup.contains(e.target)) close(); });+ listen(window, 'resize', place);+ listen(window, 'scroll', e => { if (!popup.contains(e.target)) place(); }, true);+ return {refresh, dispose() { disposed = true; close(); listeners.forEach(stop => stop()); popup.remove(); }};+}diff --git a/web/studio.js b/web/studio.jsindex 4f512c8..702026a 100644--- a/web/studio.js+++ b/web/studio.js@@ -17,7 +17,8 @@ import { openLibrary } from './library.js';import { createRecentVideos } from './studio_recent.js';import { createAgentActivity } from './agent_activity.js';import { createStudioQueue, randomSeed } from './studio_queue.js';-import { attachReferencePicker, referenceItems, syncReferencePrompt, referenceInputs } from './prompt_references.js';+import { attachReferencePicker, referenceItems, syncReferencePrompt, referenceInputs, mentionAt } from './prompt_references.js';+import { attachTermSuggest } from './prompt_terms.js';import { reconcileLoraTriggers } from './lora_triggers.js';import { createSamplingEffort } from './sampling_effort.js';import { resultActions, previewBadge, icon } from './result_actions.js';@@ -412,6 +413,8 @@ export function openStudio(node, {extendFrom = null} = {}) {mention.title = mention.getAttribute('aria-label');mention.disabled = prompt.disabled; mention.onpointerdown = e => e.preventDefault(); promptEditor.append(mention);cleanup.push(() => references.dispose());+ const terms = attachTermSuggest(prompt, {t, host: dialog, suppressed: () => !!mentionAt(prompt.value, prompt.selectionStart, prompt.selectionEnd)});+ cleanup.push(() => terms.dispose());const enhancer = createPromptEnhancer({node, input: prompt, editor: promptEditor, api, t, starter,onReport: row => { node.freevideoReportId = row.report_id; progress.updateReport(row); },onChange: () => rememberPromptDraft(api, node),