尚无实时文案时候选复核省略文案对照,不再反复退回
第 24 轮复核子代理在文案未写入时引用整屏字段编号(如 M01-T01),候选文案清单为空,连续多次被判不在清单中。现在清单为空时提示省略 shownFields,提交时忽略该项;有实时文案时仍严格校验。补测试。
This commit is contained in:
parent
51364cb865
commit
9d6a2c696e
@ -96,13 +96,17 @@ export async function reviewProductionCandidate({
|
||||
});
|
||||
const fieldList=screenCopy.filter(row=>row.field).map(({field,label})=>({field,label}));
|
||||
const fields=new Set(fieldList.map(row=>row.field));
|
||||
// Template sample text and unwritten fields are not live copy, so there is nothing to align yet.
|
||||
const shownFieldsGuide=fieldList.length
|
||||
?'shownFields 只用 shownFieldOptions 的 field。删除 fieldNumber,找不到对应字段时省略该项。'
|
||||
:'本次还没有已写入的实时文案,shownFieldOptions 为空,省略 shownFields。';
|
||||
const facts=()=>[
|
||||
`本次可用 candidateId ${JSON.stringify(candidateId)}`,
|
||||
`本次图位 slotId ${JSON.stringify(slot.id)}`,
|
||||
`本次可用 field ${JSON.stringify(fieldList)}`,
|
||||
requirementsText,
|
||||
example,
|
||||
'shownFields 只用 shownFieldOptions 的 field。删除 fieldNumber,找不到对应字段时省略该项。',
|
||||
shownFieldsGuide,
|
||||
findings.facts(),
|
||||
...(guides.length?[`本次结构标注编号 ${JSON.stringify(guides.map(([id])=>id))}`]:[]),
|
||||
].join('\n');
|
||||
@ -118,6 +122,7 @@ export async function reviewProductionCandidate({
|
||||
args.verdict=args.recommendedAction==='adopt'?'pass':'revise';
|
||||
}
|
||||
if (summary!==undefined && !args.reason) args.reason=summary;
|
||||
if (!fieldList.length) delete args.shownFields;
|
||||
if (Array.isArray(args.imageIssues) && args.imageIssues.some(issue=>issue?.nativeLayerId!==undefined)) {
|
||||
const imageIssues=[];
|
||||
const overlayFixes=[...(args.overlayFixes??[])];
|
||||
@ -189,6 +194,7 @@ export async function reviewProductionCandidate({
|
||||
'subjectBounds 是按放置后像素与边缘背景色差估测的画布坐标 [x,y,w,h],并已裁到可见图框。',
|
||||
'原件信息见 candidateFile,图框见 frame。requirements 是当前图位的要求,screenCopy 是实时文案。',
|
||||
'用 shownSubject 描述实际画面。shownFields 只填写 screenCopy 中存在且有画面依据的条目。每项原样复制 shownFieldOptions 中的一个 field。mustRedo 和 canvasFixes 分别记录建议重做和能用画布处理的问题。裁切坐标以未裁切原图为准。',
|
||||
...(fieldList.length?[]:[shownFieldsGuide]),
|
||||
...(guides.length?['模板要求的结构标注落点用图框内 [0,0] 到 [1000,1000] 的坐标。']:[]),
|
||||
'按 checks 逐项记录结论,比较同款实拍和模板参考。允许 null 的检查在不适用或缺乏证据时填 null,并在 reason 说明。检查 generationEvidence 中的实发模型、参数和像素。根据本款 product 资料和已发布的企业 Skill 判定禁止标识,查看主体和配饰上的铭牌、文字及 logo。未读到模板原图时记录依据缺失。暗中遮住标题,描述仍能看出的用途。任何实际问题要记录位置和依据。',
|
||||
'调用 review_candidate 提交结论。',
|
||||
|
||||
@ -33,3 +33,22 @@ test('candidate review binds the candidate and separates shown fields from numbe
|
||||
assert.equal(result.observation.screenReview.templateStyle,null);
|
||||
assert.deepEqual(result.observation.visualEvidence,[{field:'K02',location:'画面中央'}]);
|
||||
});
|
||||
|
||||
test('before any copy is written the review omits shown fields instead of rejecting screen field IDs',async()=>{
|
||||
const slot={id:'cover',fieldId:'M01-I01',label:'主图'};
|
||||
const pixels={type:'image',mimeType:'image/png',data:'fixture'};
|
||||
// The screen still shows the template's sample text: nothing is live copy yet.
|
||||
const screenCopy=[{field:'M01-T01',label:'产品名称',text:'模板标题',templateSample:true},{field:'M01-T02',label:'卖点',text:''}];
|
||||
const canvas={detailImages:async()=>({candidateId:'photo',referenceCount:1,images:[pixels,pixels]})};
|
||||
const screen={image:pixels,details:{page:0,screenFingerprint:'fixture',slots:[slot],screenCopy,overlayLayers:[]}};
|
||||
const runAgent=async(_slot,system,prompt,[review])=>{
|
||||
assert.deepEqual(JSON.parse(prompt).shownFieldOptions,[]);
|
||||
assert.match(system,/省略 shownFields/u);
|
||||
const args=review.prepareArguments({verdict:'pass',reason:'外形与实拍一致',screenVerdict:'pass',
|
||||
shownFields:[{field:'M01-T01',location:'左上'},{field:'M01-T02',location:'右侧'}]});
|
||||
review.execute('',args);
|
||||
};
|
||||
const result=await reviewProductionCandidate({canvas,runAgent,slot,screen,candidateId:'photo',liveScreenCopy:screenCopy});
|
||||
assert.equal(result.verdict,'pass');
|
||||
assert.deepEqual(result.observation.visualEvidence,[]);
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user