Files
aigc-home/docs/hel-892/director-timeline-document-evidence/browser-initial-generator.py.txt
T

33 lines
5.7 KiB
Plaintext

from pathlib import Path
R=Path.cwd();s=(R/'e2e/director-project-document.mjs').read_text().replace('director-project','director-timeline').replace('new_director_project','new_director_timeline').replace('old_one_hundred_twenty_seven','old_one_hundred_twenty_eight').replace('details.length===128','details.length===129').replace('===7641','===7694').replace('128图7641保存位置','129图7694保存位置').replace('===221','===222').replace('128图221源注释','129图222源注释')
s=s.replace("const names=['","const names=['MiniMax_H3_导演台时间线素材_双采样潜空间放大_多分段拼接','",1)
a=s.index(' check(b.counts.saved_fields===65');b=s.index(" await dialog.getByText('版本、源图与连线依据'",a)
s=s[:a]+''' check(b.counts.saved_fields===53&&b.comments.length===1&&b.boundaries.length===0&&b.zero_saved_nodes.length===0,`${width}53位置/一MarkdownNote/零缺控件/无子图`);
check(b.fields.every(f=>f.scope==='root'&&f.named_pointer&&JSON.stringify(f.value)===JSON.stringify(f.named_value)),`${width}53原类型/具名/双指针`);
check(b.node_bindings.length===16&&b.node_bindings.filter(x=>x.candidates.length===1).length===14&&b.node_bindings.filter(x=>x.source_id==='unresolved-timeline').length===2,`${width}14准确/Planner与FiniteSampler缺口`);
const source=JSON.parse(fs.readFileSync('docs/hel-892/director-timeline-document-evidence/source-check.json'));
assert.deepEqual(JSON.parse(field('7','timeline_data').value),source.texts.timeline_data.state);check(true,`${width}timeline全部嵌套原值全等`);
check(field('7','timeline_data').value.length===12314&&field('7','generation_seconds').value===11.5&&field('8','seed').json_type==='int'&&field('8','control_after_generate').value==='fixed',`${width}完整timeline12314/11.5缓存/seed42固定辅助`);
check(field('18','shift_video').json_type==='int'&&field('20','selection.keep_percent').json_type==='int'&&field('20','end_percent').json_type==='int'&&field('20','start_percent').json_type==='float',`${width}原整数/浮点不归一化`);
check(field('24','aspect_ratio').value==='9:16 (Portrait Widescreen)'&&b.comments[0].text.includes('16:9'),`${width}9:16当前缓存与16:9作者表分列`);
for(const phrase of ['14准确类与2 unresolved','两个出口links=[]','width44/height45','再41/42同时给5Scheduler与8.model','Last Sampled Latent与Sampling Status原links=null','fps原link=null未接外线','本版bit_depth已是COMBO','源h264扁平字符串不能等同','本版有optional vae及audio_vae','extra_tokens非零会忽略并置0','无前图双出口冲突','同树pnpm-lock'])check(b.steps.some(x=>x.includes(phrase)),`${width}准确/缺口/扇出/接口边界 ${phrase}`);
check(b.zero_saved_nodes.length===0&&b.counts.source_nodes===17,`${width}全部17节点具名/保存无缺键`);
const notesBox=dialog.locator('.card').filter({has:page.getByText('源文件注释',{exact:true})});
for(const n of b.comments){
const nd=notesBox.locator('details').filter({has:page.getByText(`节点 ${n.node_id}`,{exact:true})});await nd.locator('summary').click();const renderedJSON=await nd.locator('pre').textContent();
const sourceNote=d.doc_json.source_notes.find(x=>String(x.node_id)===n.node_id);assert.equal(renderedJSON,JSON.stringify(sourceNote.content,null,2));
const decoded=JSON.parse(renderedJSON)[0];assert.equal(decoded,n.text);const rawSha=crypto.createHash('sha256').update(decoded,'utf8').digest('hex');
check(decoded.length===325&&decoded.split('\\n').length-1===10&&!decoded.endsWith('\\n')&&rawSha===source.note.sha256,`${width}MarkdownNote25全文/LF10/无尾LF/原SHA`);
textRenderings.push({viewport:width,kind:`Note${n.node_id}`,raw_sha256:rawSha,rendered_json_sha256:crypto.createHash('sha256').update(renderedJSON,'utf8').digest('hex'),decoded_sha256:rawSha,tail_LF:false});
await nd.evaluate(el=>el.scrollIntoView({block:'start'}));await page.screenshot({path:`${out}/${width}-${d.id}-note-${n.node_id}.png`});await nd.locator('summary').click();
}
check(await dialog.locator('img,canvas,video,audio,iframe').count()===0,`${width}只文本无媒体/编辑器`);
await fixedCard.getByText(b.flow.find(x=>x.includes('但准确__init__只注册MiniMaxH3TimelineDirector')),{exact:true}).first().evaluate(el=>el.scrollIntoView({block:'start'}));await page.screenshot({path:`${out}/${width}-${d.id}-timeline-gap.png`});
await fixedCard.getByText(b.flow.find(x=>x.includes('MODEL1UNET→36→21普通8step')),{exact:true}).first().evaluate(el=>el.scrollIntoView({block:'start'}));await page.screenshot({path:`${out}/${width}-${d.id}-model-chain.png`});
'''+s[b:]
s=s.replace("['track_data','project_data'].includes(f.field)","f.field==='timeline_data'")
s=s.replace("['14.track_data','14.resolution.megapixels','17.project_data','15.project_name','15.fixed','15.enabled_tiling','15.sampling_mode.transition_ratio','15.easy-media-sampling-preview','36.overlay_preset','36.block_range_start','26.preview','26.tiny_vae','41.head_chunks','34.chunks','40.type','25.input_mode']","['7.timeline_data','7.width','7.generation_seconds','7.minimax_h3_timeline','8.control_after_generate','8.continue_audio_latent','24.aspect_ratio','24.megapixels','20.selection.keep_percent','20.extra_tokens','18.shift_video','22.preview','9.bit_depth','9.codec','10.codec','10.codec.encoding']")
s=s.replace('Local GET-only:65 saved positions,one Note','Local GET-only:53 saved positions,one MarkdownNote')
(R/'e2e/director-timeline-document.mjs').write_text(s)
for name in ['run-director-project-document.py','director-project-document-server.py']:(R/'e2e'/name.replace('director-project','director-timeline')).write_text((R/'e2e'/name).read_text().replace('director-project','director-timeline'))