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.
Agent films: screenplay errors name the field; unknown shot and line fields are reported
Bowen Xueb35c7d0a314d
diff --git a/freevideo_engine/agent/production.py b/freevideo_engine/agent/production.pyindex 9faf0a2..07a5c72 100644--- a/freevideo_engine/agent/production.py+++ b/freevideo_engine/agent/production.py@@ -71,8 +71,40 @@ def _compiled(play, shot):return drama.prompt(play, shot)-def plan(request):- """Return {'request': normalized copy, 'preview': {'shots': [...], 'total': N}}."""+# What a screenplay shot and a line may say; anything else would be ignored without a word.+SHOT_FIELDS = ('id', 'seconds', 'action', 'idea', 'prompt', 'camera', 'framing', 'sound', 'music', 'takes', 'seed',+ 'continue', 'first', 'references', 'cast', 'lines')+LINE_FIELDS = ('who', 'line', 'how', 'language')+++def _rule(row):+ """A screenplay problem as a rule about its field; the pointer already travels in path.++ A leading pointer in the text would read as a local path once paths are removed."""+ if isinstance(row.get('allowed'), str):+ rule = row['allowed']+ return rule if rule.startswith('must') else 'must be ' + rule+ return re.sub(r'^/\S*\s+', '', row['message']) if isinstance(row.get('message'), str) else 'is not valid'+++def _fields(play, problems):+ for i, shot in enumerate(play.get('shots') or [] if isinstance(play, dict) else []):+ if not isinstance(shot, dict):+ continue+ rows = [('/screenplay/shots/%d/' % i, key, SHOT_FIELDS) for key in shot if key not in SHOT_FIELDS]+ for j, line in enumerate(shot.get('lines') if isinstance(shot.get('lines'), list) else []):+ if isinstance(line, dict):+ rows += [('/screenplay/shots/%d/lines/%d/' % (i, j), key, LINE_FIELDS)+ for key in line if key not in LINE_FIELDS]+ for prefix, key, known in rows:+ name = str(key).replace('~', '~0').replace('/', '~1')+ problems.append(dict(path=prefix + name, message='is not a field here; use ' + ', '.join(known)))+++def plan(request, *, fields=True):+ """Return {'request': normalized copy, 'preview': {'shots': [...], 'total': N}}.++ fields=False rechecks a saved screenplay, which may predate the unknown-field rule."""problems = []if not isinstance(request, dict):_invalid([dict(path='', message='A production request must be an object')])@@ -83,7 +115,9 @@ def plan(request):drama.check(play)except drama.Screenplay as error:play_ok = False- problems.extend(dict(path='/screenplay' + p['path'], message=p['message']) for p in error.problems)+ problems.extend(dict(path='/screenplay' + p['path'], message=_rule(p)) for p in error.problems)+ if fields:+ _fields(play, problems)count = request.get('takes_per_shot', 1)count_ok = _count(count, '/takes_per_shot', problems)director = request.get('director', 'agent')@@ -548,7 +582,8 @@ def reshoot(state, shot, *, by, note=None, changes=None, takes=1, reason=None, nsource = draft['screenplay']['shots'][row['index'] - 1]source.update(deepcopy(changes or {}))# Recheck the complete effective screenplay, transactionally.- plan(dict(screenplay=draft['screenplay'], takes_per_shot=draft['takes_per_shot'], director=draft['director']))+ plan(dict(screenplay=draft['screenplay'], takes_per_shot=draft['takes_per_shot'], director=draft['director']),+ fields=False)_schedule(draft, row, takes, by, note)draft['cancelled'], draft['current_join'] = False, None_decision(draft, now, by, 'reshoot', shot, reason=reason)diff --git a/freevideo_engine/agent/productions.py b/freevideo_engine/agent/productions.pyindex 8d21f09..080d682 100644--- a/freevideo_engine/agent/productions.py+++ b/freevideo_engine/agent/productions.py@@ -84,8 +84,12 @@ class ProductionFailure(JobError):super().__init__(error.code, error.message)self.status = errors.PRODUCTION_STATUS.get(error.code, errors.ERRORS[error.code][0])message = production._public(error.message) if isinstance(error.message, str) else ''- self.error = errors.build(error.code, validation=True, message=message[:300],- details=_rows(error), next_action=(FILM_STOPPED_NEXT if error.code == 'stopped_by_user' else error.next))+ rows = _rows(error)+ if error.code == 'invalid_screenplay' and rows and all('field' in row for row in rows):+ # Like a request validation error: every problem with its field, as the tool text shows only this.+ message = '; '.join(row['message'] for row in rows)[:2000]+ self.error = errors.build(error.code, validation=True, message=message[:2000],+ details=rows, next_action=(FILM_STOPPED_NEXT if error.code == 'stopped_by_user' else error.next))if error.code == 'not_ready':self.error['retryable'] = False@@ -172,7 +176,7 @@ class Productions:raise ValueError('Invalid submission marker')production.view(state)try:- checked = production.plan(request)+ checked = production.plan(request, fields=False)if [s['id'] for s in state['shots']] != [s['id'] for s in checked['preview']['shots']]:raise JobError('internal_error', 'Saved shots differ from the current plan')production.advance(deepcopy(state), deepcopy(record['children']), now=state['updated_at'])diff --git a/freevideo_engine/agent/schema.py b/freevideo_engine/agent/schema.pyindex a4e93ac..af3fc04 100644--- a/freevideo_engine/agent/schema.py+++ b/freevideo_engine/agent/schema.py@@ -427,9 +427,17 @@ DRAMA_OPERATIONS = {}+# The fields are checked when planning; the shape is told here so an agent does not guess it.+SCREENPLAY = {'type': 'object', 'description': (+ 'characters: {key: {card: cast card ID, or name, look, voice, language}}; '+ 'shots: [{id, seconds, action or prompt, camera, framing, sound, takes, seed, '+ 'cast: [character keys], lines: [{who: character key, line, how}], '+ 'continue: true to carry on from the previous shot}]; also title, style, aspect, quality, music.')}++def drama_schema(name):if name in ('plan', 'start'):- return obj(dict(screenplay={'type': 'object'}, takes_per_shot=number(1, 8, integer=True, default=1),+ return obj(dict(screenplay=SCREENPLAY, takes_per_shot=number(1, 8, integer=True, default=1),director=enum(('agent', 'builtin'), default='agent'), ref=REF), ('screenplay',))if name == 'list':return obj(dict(status=enum(('active', 'all'), default='all'), limit=number(1, 200, integer=True, default=50)))