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.
Recognise character mentions written back to back
Bowen Xueac73ed61fe5a
diff --git a/web/cast_mention.js b/web/cast_mention.jsindex c49cb54..b332747 100644--- a/web/cast_mention.js+++ b/web/cast_mention.js@@ -72,10 +72,14 @@ export function mentionRanges(text, people) {if (!names.length || !text.includes('@')) return [];// A name written in Latin letters does not end in the middle of a longer word ("@Su Wanda" is not "@Su Wan").const whole = name => escape(name) + (/[A-Za-z0-9_]$/.test(name) ? '(?![A-Za-z0-9_])' : '');- const pattern = new RegExp('(?<![\\w.%+\\-])@(' + names.map(whole).join('|') + ')', 'gu');+ const pattern = new RegExp('@(' + names.map(whole).join('|') + ')', 'gu');const ranges = [];- for (const match of text.matchAll(pattern))+ for (const match of text.matchAll(pattern)) {+ // An @ straight after the end of another mention ("@Ann@Bob") starts a mention too.+ const joined = ranges.length > 0 && ranges[ranges.length - 1].end === match.index;+ if (!joined && match.index > 0 && /[\w.%+\-]/.test(text[match.index - 1])) continue;ranges.push({start: match.index, end: match.index + 1 + match[1].length, name: match[1]});+ }return ranges;}diff --git a/web/prompt_references.js b/web/prompt_references.jsindex e15dae3..dcc4f36 100644--- a/web/prompt_references.js+++ b/web/prompt_references.js@@ -98,7 +98,10 @@ export function syncReferencePrompt(node, t = en => en, reset = false) {export function mentionAt(text, start, end = start, handles = []) {if (start < 1 || start !== end) return null;const at = text.lastIndexOf('@', start - 1);- if (at < 0 || (at > 0 && /[\w.%+\-]/.test(text[at - 1]))) return null;+ if (at < 0) return null;+ // An @ straight after a finished "@name" opens the list again.+ const joined = handles.some(name => name && text.slice(0, at).endsWith('@' + name));+ if (at > 0 && !joined && /[\w.%+\-]/.test(text[at - 1])) return null;const query = text.slice(at + 1, start);const rest = text.slice(at + 1);// A longer name that still begins like what is typed ("苏" and "苏晚") keeps the list open.