From 3522962d368d1f703127f9ceb535ecbabb9fa4de Mon Sep 17 00:00:00 2001 From: Bowen Xue Date: Sun, 29 Nov 2026 00:57:16 +0000 Subject: [PATCH 01/33] Built-in director: what it says about a shot is in English, as the rest of what the connected... Built-in director: what it says about a shot is in English, as the rest of what the connected agent reads - Built-in director: what it says about a shot is in English, as the rest of what the connected agent reads - Director tests: a run that waits for a change the test board never makes fails at once instead of hanging --- freevideo_engine/agent/builtin_director.py | 37 ++++++++++++---------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/freevideo_engine/agent/builtin_director.py b/freevideo_engine/agent/builtin_director.py index 0d84486e..735d6366 100644 --- a/freevideo_engine/agent/builtin_director.py +++ b/freevideo_engine/agent/builtin_director.py @@ -357,6 +357,11 @@ def _take_count(shot): return max(1, min(8, sum(t['generation'] == first for t in shot['takes']))) +# What the director says about a choice is read by the connected agent and the log, as the rest of the agent's +# interface is: in English. The model writes its reason for a take in English, in one sentence of this length. +REASON_LIMIT = 120 + + def judge(shot_view, sheets, *, ask): """Score all selectable takes; invalid/missing evidence leaves a human choice. @@ -366,22 +371,22 @@ def judge(shot_view, sheets, *, ask): """ shot = shot_view if shot.get('chosen_by') == 'user' or shot.get('chosen') is not None: - return Decision('keep', shot['id'], '保留已选定的版本。') + return Decision('keep', shot['id'], 'The chosen take stays.') shooting = shot.get('state') in ('waiting', 'shooting') - uncertain = Decision('ask_user', shot['id'], '拿不准,请挑一版。') + uncertain = Decision('ask_user', shot['id'], 'No take is clearly best; the user picks one.') finished = _selectable(shot) unchecked = any('qa' in t and t['qa'] is None for t in finished) if shooting and (not finished or any(t.get('qa') is None for t in finished)) or unchecked: - return Decision('wait', shot['id'], '等待这一镜的各版完成并质检。') + return Decision('wait', shot['id'], 'Waiting for every take of this shot to finish and be checked.') # A take that failed the picture or sound check is never chosen; a shot still shooting is judged as takes arrive. takes = [t for t in finished if (t.get('qa') or {}).get('ok', True)] if not takes: if shooting: - return Decision('wait', shot['id'], '已完成的版本没有通过质检,等待其余版本。') + return Decision('wait', shot['id'], 'The finished takes failed the check; waiting for the others.') if not finished or _retaken(shot): return uncertain faults = ';'.join(sorted({p for t in finished for p in t['qa']['problems']})) - return Decision('reshoot', shot['id'], '各版都没有通过质检。', + return Decision('reshoot', shot['id'], 'No take passed the check.', note=('上一次的问题:' + faults)[:300], takes=_take_count(shot)) try: rows = sheets['takes'] @@ -395,14 +400,14 @@ def judge(shot_view, sheets, *, ask): for start in range(0, len(numbers), batch_size): batch = numbers[start:start + batch_size] rating = _object(dict(take=dict(type='integer', enum=batch), score=dict(type='number', minimum=0, maximum=10), - reason=_string(30), note=_string(300), captions=dict(type='boolean')), + reason=_string(REASON_LIMIT), note=_string(300), captions=dict(type='boolean')), ('take', 'score', 'reason', 'note', 'captions')) schema = _object(dict(ratings=dict(type='array', minItems=len(batch), maxItems=len(batch), items=rating)), ('ratings',)) - prompt = ('评价这一镜的每个版本:0–10 分,reason 用不超过30字的中文指出具体优点或问题' - '(多余的字、人物变形、和描述不符等);note 给下一次生成能用的具体修正。' + prompt = ('评价这一镜的每个版本:0–10 分;reason 用一句英文写出具体的优点或问题' + '(多余的字、人物变形、和描述不符等),%d 个字符以内;note 给下一次生成能用的具体修正。' 'captions 表示有叠加字幕/文字,场景内真实招牌不算。声音由自动质检评价,这里不评价。' - '\n镜头描述:' + _dump({k: shot[k] for k in ('screenplay', 'characters', 'style', 'captions') if k in shot}) + '\n镜头描述:' % REASON_LIMIT + _dump({k: shot[k] for k in ('screenplay', 'characters', 'style', 'captions') if k in shot}) + '\n图片顺序对应版号:' + _dump(batch) + ''.join('\n版%d的%s' % (t['take'], take_qa.summary(t.get('qa'))) for t in takes if t['take'] in batch and t.get('qa')) @@ -412,17 +417,17 @@ def judge(shot_view, sheets, *, ask): return uncertain ratings.extend(reply['ratings']) for row in ratings: - spec._text(row['reason'], '/reason', 30) + spec._text(row['reason'], '/reason', REASON_LIMIT) spec._text(row['note'], '/note', 300) if row['captions'] and not shot.get('captions', False): row['score'] = min(row['score'], 3) best = max(ratings, key=lambda r: (r['score'], -r['take'])) if best['score'] < 7 and shooting: - return Decision('wait', shot['id'], '已完成的版本不够好,等待其余版本。') + return Decision('wait', shot['id'], 'The finished takes are not good enough; waiting for the others.') if best['score'] >= 7: return Decision('choose', shot['id'], best['reason'], take=best['take']) if _retaken(shot): - return Decision('choose', shot['id'], '重拍后仍不理想:' + best['reason'], take=best['take']) + return Decision('choose', shot['id'], 'Still not good after a reshoot: ' + best['reason'], take=best['take']) return Decision('reshoot', shot['id'], best['reason'], note=best['note'], takes=_take_count(shot)) except (KeyError, TypeError, ValueError): return uncertain @@ -559,7 +564,7 @@ def _with_stitch(tools, production_id, shot, sheets, decision, ask): if pieces is None: return decision, None parts = [dict(take=p['take'], start=p['start'], end=p['end']) for p in pieces['pieces']] - return replace(decision, take=parts[-1]['take'], reason=(decision.reason + ';各切镜取最好的一版拼接')[:300]), parts + return replace(decision, take=parts[-1]['take'], reason=(decision.reason + '; joined from the best take of each cut')[:300]), parts def run(tools, production_id, *, ask, stop, wait=25): @@ -591,7 +596,7 @@ def run(tools, production_id, *, ask, stop, wait=25): chosen = dict(snapshot) # The parts of a shot are kept with its chosen take in the production. tools.finish(production_id, by='builtin', ref=_ref(production_id, 'finish', snapshot)) - yield dict(shot=None, action='finish', reason='每镜已选定,开始接成影片。') + yield dict(shot=None, action='finish', reason='Every shot has its take; joining the film.') return if action not in ('choose', 'reshoot'): continue @@ -654,12 +659,12 @@ def run(tools, production_id, *, ask, stop, wait=25): conflicts += 1 errors, since = 0, None if conflicts >= 5: - yield dict(shot=None, action='error', reason='多次和已有的选择冲突,已停止:' + code) + yield dict(shot=None, action='error', reason='Stopped after repeated conflicts with choices already made: ' + code) return continue errors += 1 since = None if errors >= 3: label = code if isinstance(code, str) and re.fullmatch(r'[a-z_]{1,80}', code) else type(error).__name__ - yield dict(shot=None, action='error', reason='连续三次操作失败,已停止:' + label) + yield dict(shot=None, action='error', reason='Stopped after three failed operations in a row: ' + label) return From 72d24f535f894b7a49662913658d8746a5edc4f9 Mon Sep 17 00:00:00 2001 From: Bowen Xue Date: Sun, 29 Nov 2026 00:57:25 +0000 Subject: [PATCH 02/33] Batch, one prompt per line: a line that names media with @ takes only that media, with its... Batch, one prompt per line: a line that names media with @ takes only that media, with its labels numbered for it; a missing label stops the batch and names the line - Batch, one prompt per line: a line that names media with @ takes only that media, with its labels numbered for it; a missing label stops the batch and names the line - Batch, one prompt per line: the switch's hover card also says how a line chooses media, as the tray shows it - Batch, one prompt per line: the @ of the connected-node note stays on one line with the word after it - Batch, one prompt per line: the new sentences in every language - Batch, one prompt per line: the saved work keeps each line as written, lines are checked against the request itself, the @ note holds a whole word in every script, and the page check knows the new module - Batch, one prompt per line: a line with the removed-media word of any language the page has is stopped too --- web/batch_line_media.js | 95 ++++++++++++++++++++++++++++++++++++++++ web/health.js | 2 +- web/locales/de.json | 5 +++ web/locales/es.json | 5 +++ web/locales/fr.json | 5 +++ web/locales/id.json | 5 +++ web/locales/pt-BR.json | 5 +++ web/locales/ru.json | 5 +++ web/locales/tr.json | 5 +++ web/locales/uk.json | 5 +++ web/locales/zh-Hant.json | 9 +++- web/studio.js | 83 ++++++++++++++++++++++++++++++++--- web/studio_queue.js | 19 ++++++-- 13 files changed, 235 insertions(+), 13 deletions(-) create mode 100644 web/batch_line_media.js diff --git a/web/batch_line_media.js b/web/batch_line_media.js new file mode 100644 index 00000000..b07d00d2 --- /dev/null +++ b/web/batch_line_media.js @@ -0,0 +1,95 @@ +// One prompt per line: the media each line's video takes. A line that names media with @ (a ,