保留小壹复核中可定位的问题并记录无效引用
This commit is contained in:
parent
15c1c1baf2
commit
f88e2d8fe4
@ -3,7 +3,7 @@ import { productRequestScope } from './production-recovery.mjs';
|
||||
import { InvalidToolReply } from './response-audit.mjs';
|
||||
import { mergeReviewCopy } from './copy-image-alignment.mjs';
|
||||
import { validateWorkerArguments } from './worker-receipts.mjs';
|
||||
import { screenAssessment, screenFindings, numberScreenCopy, numberScreenSlots, TEMPLATE_REVIEW_GUIDANCE } from './screen-review.mjs';
|
||||
import { screenAssessment, screenFindings, numberScreenCopy, numberScreenSlots, resolveReviewField, TEMPLATE_REVIEW_GUIDANCE } from './screen-review.mjs';
|
||||
|
||||
const params = properties => Type.Object(properties,{additionalProperties:false});
|
||||
const tool = (name, description, parameters, execute) => ({
|
||||
@ -95,7 +95,6 @@ export async function reviewProductionCandidate({
|
||||
[id,Type.Array(guidePoint,{description:typeof spec==='string'?spec:spec.target})]))))}:null),
|
||||
});
|
||||
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,找不到对应字段时省略该项。'
|
||||
@ -111,7 +110,7 @@ export async function reviewProductionCandidate({
|
||||
...(guides.length?[`本次结构标注编号 ${JSON.stringify(guides.map(([id])=>id))}`]:[]),
|
||||
].join('\n');
|
||||
function normalize(value) {
|
||||
const {screenReview,summary,...args}=value;
|
||||
const {screenReview,summary,templateFidelity,...args}=value;
|
||||
if (screenReview) {
|
||||
args.screenVerdict??=screenReview.verdict;
|
||||
args.screenSummary??=screenReview.summary;
|
||||
@ -122,7 +121,6 @@ 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??[])];
|
||||
@ -138,14 +136,22 @@ export async function reviewProductionCandidate({
|
||||
return args;
|
||||
}
|
||||
let receipt;
|
||||
const prepare=raw=>validateWorkerArguments('review_candidate',assessment,normalize(raw),facts);
|
||||
const review=tool('review_candidate',requirementsText+' '+example,assessment,raw=>{
|
||||
const value=normalize(raw);
|
||||
const droppedReferences=[];
|
||||
const value=findings.normalize(prepare(raw),droppedReferences);
|
||||
if (Array.isArray(value.shownFields)) {
|
||||
value.shownFields=value.shownFields.flatMap((entry,index)=>{
|
||||
if (!entry || typeof entry!=='object' || Array.isArray(entry)) return [entry];
|
||||
const field=resolveReviewField(fieldList,entry.field);
|
||||
if (field!==undefined) return [{...entry,field}];
|
||||
droppedReferences.push({path:'shownFields['+index+'].field',value:entry.field});
|
||||
return [];
|
||||
});
|
||||
}
|
||||
const audit=droppedReferences.length?{droppedReferences}:{};
|
||||
const errors=[];
|
||||
if(value.candidateId!==undefined&&value.candidateId!==candidateId)errors.push(`candidateId ${JSON.stringify(value.candidateId)} 与本次受审候选不一致`);
|
||||
value.shownFields?.forEach((entry,index)=>{
|
||||
const {field}=entry;
|
||||
if(!fields.has(field))errors.push(`shownFields[${index}].field ${JSON.stringify(field)} 不在本次文案清单中。请原样复制清单中的单个 field;没有对应字段时删除这一项。`);
|
||||
});
|
||||
if(errors.length)throw new InvalidToolReply([...errors,facts()].join('\n'));
|
||||
const {screenVerdict,screenSummary,templateStyle,imageIssues,overlayFixes,copyFixes}=value;
|
||||
const hasFindings=[imageIssues,overlayFixes,copyFixes].some(list=>list?.length);
|
||||
@ -156,7 +162,7 @@ export async function reviewProductionCandidate({
|
||||
verdict,summary:screenSummary??value.reason,templateStyle,imageIssues,overlayFixes,copyFixes,
|
||||
};
|
||||
if (screenReview) findings.validate(screenReview,{example,verdictKey:'screenVerdict'});
|
||||
receipt={candidateId,verdict:value.verdict,recommendedAction:value.recommendedAction,canvasTransform:value.canvasTransform,
|
||||
receipt={candidateId,...audit,verdict:value.verdict,recommendedAction:value.recommendedAction,canvasTransform:value.canvasTransform,
|
||||
checks:{...Object.fromEntries(Object.keys(visualReviewChecks).map(key=>[key,null])),...value.checks},reason:value.reason,shownSubject:value.shownSubject,observation:{
|
||||
source,shownSubject:value.shownSubject,reviewedCopy,visualEvidence:value.shownFields??[],
|
||||
screenReview,
|
||||
@ -164,10 +170,10 @@ export async function reviewProductionCandidate({
|
||||
generationFixes:value.generationFixes??value.mustRedo?.map(issue=>issue.suggestion),structureGuides:value.structureGuides,
|
||||
...(adopted?{adoptedCanvas:true}:null),...(originalReference?{originalReference}:null),
|
||||
}};
|
||||
const details={verdict:receipt.verdict,recommendedAction:value.recommendedAction,canvasTransform:value.canvasTransform};
|
||||
const details={...audit,verdict:receipt.verdict,recommendedAction:value.recommendedAction,canvasTransform:value.canvasTransform};
|
||||
return {content:[{type:'text',text:JSON.stringify(details)}],details,terminate:true};
|
||||
});
|
||||
review.prepareArguments=value=>validateWorkerArguments(review.name,assessment,normalize(value),facts);
|
||||
review.prepareArguments=prepare;
|
||||
const requirements=rule?.focus??input.prompt??input.requirements;
|
||||
const prompt=JSON.stringify({candidateId,fieldId:slot.fieldId,slot:slot.label,rule,requirements,
|
||||
templateContext:requirements===input.requirements?undefined:input.requirements,
|
||||
|
||||
@ -23,12 +23,12 @@ export const screenAssessment = object({
|
||||
summary:Type.String({minLength:1,maxLength:280,description:'必填。简述整屏结论及画面依据。'}),
|
||||
templateStyle:Type.Optional(Type.Union([Type.Boolean(),Type.Null()])),
|
||||
imageIssues:finding({
|
||||
slotId:Type.Optional(Type.String({minLength:1,maxLength:200,description:'可选。只填本屏清单里的 slotId。不知道编号时省略 slotId,只填写 location。'})),
|
||||
slotNumber:Type.Optional(Type.Integer({minimum:1,description:'本屏 slots 清单中的序号,可替代 slotId。'})),
|
||||
location:text(160),
|
||||
slotId:Type.Optional(Type.String({description:'可选。只填本屏清单里的 slotId。不知道编号时省略 slotId,只填写 location。'})),
|
||||
slotNumber:Type.Optional(Type.Integer({description:'本屏 slots 清单中的序号,可替代 slotId。'})),
|
||||
location:Type.Optional(text(160)),
|
||||
}),
|
||||
overlayFixes:finding({nativeLayerId:Type.Optional(Type.Integer({minimum:1})),location:Type.Optional(text(160))}),
|
||||
copyFixes:finding({field:Type.Optional(text(200)),screenFieldNumber:Type.Optional(Type.Integer({minimum:1,description:'本屏 screenCopy 清单中的序号。'})),location:Type.Optional(text(160))}),
|
||||
overlayFixes:finding({nativeLayerId:Type.Optional(Type.Integer()),location:Type.Optional(text(160))}),
|
||||
copyFixes:finding({field:Type.Optional(Type.String()),screenFieldNumber:Type.Optional(Type.Integer({description:'本屏 screenCopy 清单中的序号。'})),location:Type.Optional(text(160))}),
|
||||
});
|
||||
|
||||
export const TEMPLATE_REVIEW_GUIDANCE = field => `对照当前整屏、模板原屏和项目锁定的品牌资料判断 ${field}。用 templateFidelity.changes 定位丢失元素、样式和位置变化,注明 nativeLayerId 和恢复方法。隐藏摘要列出需要恢复可见性的编号,删除的图层可从原稿复制,清除的样式可从原稿复制并粘贴。字号、颜色、字体或位置可按原值恢复。完整参数可用 read_output_screen 的 templateLayerId 查询。结合本款 product、fieldRequirements 和 templateFidelity.factConflicts 核对 retainedTemplateText 中的数值、材质及品牌信息。原文相同是线索,按本款证据确认冲突。没有原屏时 ${field} 填 null,并说明依据缺失。`;
|
||||
@ -43,6 +43,20 @@ export function numberScreenSlots(slots) {
|
||||
|
||||
export const SCREEN_REVIEW_REQUIREMENTS = '整屏结论必填 verdict 和非空 summary。通过填 pass,可省略三组问题列表。有问题填 needs_fix,并在 imageIssues、overlayFixes 或 copyFixes 中填写至少一项 issue 和 suggestion。每项使用对应清单中的 slotNumber、nativeLayerId 或 screenFieldNumber,找不到对应编号时用 location 描述。';
|
||||
|
||||
export function resolveReviewField(rows,value) {
|
||||
if (typeof value!=='string' || !value.trim()) return undefined;
|
||||
if (rows.some(row=>row.field===value)) return value;
|
||||
const matches=rows.filter(row=>row.label===value);
|
||||
return matches.length===1?matches[0].field:undefined;
|
||||
}
|
||||
|
||||
export function normalizeScreenReview({screenReview,templateFidelity,...args}) {
|
||||
for (const key of ['verdict','summary','templateStyle','imageIssues','overlayFixes','copyFixes']) {
|
||||
if (args[key]===undefined && screenReview?.[key]!==undefined) args[key]=screenReview[key];
|
||||
}
|
||||
return args;
|
||||
}
|
||||
|
||||
export function screenFindings({overlayLayers,screenCopy,slots,templateFidelity}) {
|
||||
const layerIds = new Set([...overlayLayers,...(templateFidelity?.changes??[]),...(templateFidelity?.retainedTemplateText??[])].map(layer => layer.nativeLayerId));
|
||||
for (const row of templateFidelity?.factConflicts??[]) {
|
||||
@ -60,30 +74,43 @@ export function screenFindings({overlayLayers,screenCopy,slots,templateFidelity}
|
||||
'copyFixes 使用当前清单的 screenFieldNumber。换用编号时删除 field;找不到对应编号时只填 location。',
|
||||
'找不到对应条目时,省略编号并填写 location。',
|
||||
].join('\n');
|
||||
return {facts,validate(value,{example,verdictKey='verdict'}={}) {
|
||||
function normalize(value,dropped) {
|
||||
const args={...value};
|
||||
for (const [group,key,resolve,numberKey,resolveNumber] of [
|
||||
['imageIssues','slotId',id=>slotIds.has(id)?id:undefined,'slotNumber',n=>slots[n-1]?.id],
|
||||
['overlayFixes','nativeLayerId',id=>layerIds.has(id)?id:undefined],
|
||||
['copyFixes','field',id=>resolveReviewField(numberedCopy,id),'screenFieldNumber',n=>numberedCopy[n-1]?.field],
|
||||
]) {
|
||||
if (!Array.isArray(args[group])) continue;
|
||||
args[group]=args[group].map((entry,index)=>{
|
||||
if (!entry || typeof entry!=='object' || Array.isArray(entry)) return entry;
|
||||
const finding={...entry};
|
||||
const located=[finding.location,finding.issue,finding.suggestion].every(text=>typeof text==='string'&&text.trim());
|
||||
const id=resolve(finding[key]);
|
||||
const number=numberKey?finding[numberKey]:undefined;
|
||||
const numberedId=Number.isInteger(number)?resolveNumber(number):undefined;
|
||||
const drop=ref=>{
|
||||
dropped.push({path:group+'['+index+'].'+ref,value:finding[ref]});
|
||||
delete finding[ref];
|
||||
};
|
||||
if (id!==undefined) finding[key]=id;
|
||||
else if (located && finding[key]!==undefined) drop(key);
|
||||
if (number!==undefined) {
|
||||
if (numberedId!==undefined && (id===numberedId || entry[key]===undefined || !located && id===undefined)) {
|
||||
if (id===undefined && finding[key]!==undefined) drop(key);
|
||||
finding[key]=numberedId;
|
||||
delete finding[numberKey];
|
||||
} else if (located || id!==undefined) drop(numberKey);
|
||||
}
|
||||
return finding;
|
||||
});
|
||||
}
|
||||
return args;
|
||||
}
|
||||
return {facts,normalize,validate(value,{example,verdictKey='verdict'}={}) {
|
||||
const {verdict,imageIssues=[],overlayFixes=[],copyFixes=[]} = value;
|
||||
const hasIssues = imageIssues.length + overlayFixes.length + copyFixes.length > 0;
|
||||
const errors=[];
|
||||
for (const [index, issue] of imageIssues.entries()) {
|
||||
if (issue.slotNumber === undefined) continue;
|
||||
const slot = slots[issue.slotNumber - 1];
|
||||
if (!slot || issue.slotId !== undefined && issue.slotId !== slot.id) {
|
||||
errors.push(`imageIssues[${index}].slotNumber ${issue.slotNumber} 与本屏图位不匹配。请只保留清单中正确的引用,或删除该项的编号和 ID,仅用 location 定位。`);
|
||||
} else {
|
||||
issue.slotId = slot.id;
|
||||
delete issue.slotNumber;
|
||||
}
|
||||
}
|
||||
for (const [index, issue] of copyFixes.entries()) {
|
||||
if (issue.screenFieldNumber === undefined) continue;
|
||||
const field = numberedCopy[issue.screenFieldNumber - 1]?.field;
|
||||
if (!field || issue.field !== undefined && issue.field !== field) {
|
||||
errors.push(`copyFixes[${index}].screenFieldNumber ${issue.screenFieldNumber} 与本屏文案不匹配。请只保留清单中正确的引用,或删除该项的编号和 ID,仅用 location 定位。`);
|
||||
} else {
|
||||
issue.field = field;
|
||||
delete issue.screenFieldNumber;
|
||||
}
|
||||
}
|
||||
if (hasIssues !== (verdict === 'needs_fix')) {
|
||||
errors.push(hasIssues?`${verdictKey} 为 pass,但问题列表有内容。若这些是实际问题,将 ${verdictKey} 改为 needs_fix;若通过,省略问题列表。`:`${verdictKey} 为 needs_fix,但三组问题列表均为空。请添加至少一项实际问题和修改建议;若整屏通过,将 ${verdictKey} 改为 pass。`);
|
||||
}
|
||||
@ -95,6 +122,8 @@ export function screenFindings({overlayLayers,screenCopy,slots,templateFidelity}
|
||||
findings.forEach((finding,index)=>{
|
||||
const id=finding[key];
|
||||
if (id===undefined && !finding.location?.trim()) {
|
||||
const numberKey=group==='imageIssues'?'slotNumber':'screenFieldNumber';
|
||||
if (finding[numberKey]!==undefined) errors.push(`${group}[${index}].${numberKey} ${finding[numberKey]} 与本屏清单不匹配`);
|
||||
errors.push(`${group}[${index}].location 缺少画面位置,未填写 ${key} 时必填`);
|
||||
}
|
||||
if (id!==undefined && !allowed.has(id)) {
|
||||
@ -119,19 +148,26 @@ export async function reviewOutputScreen({runAgent, page, screen, references, sl
|
||||
const {product,photos} = await references();
|
||||
signal?.throwIfAborted();
|
||||
const example='最小提交示例 '+JSON.stringify({verdict:'pass',summary:'标注与商品部位对齐,文案符合商品资料。'});
|
||||
const {facts,validate} = screenFindings({overlayLayers,screenCopy,slots,templateFidelity});
|
||||
const {facts,normalize,validate} = screenFindings({overlayLayers,screenCopy,slots,templateFidelity});
|
||||
let receipt;
|
||||
function prepare(raw) {
|
||||
return validateWorkerArguments('review_output_screen',screenAssessment,
|
||||
normalizeScreenReview(raw),()=>[example,facts()].join('\n'));
|
||||
}
|
||||
const tool = {
|
||||
name:'review_output_screen',
|
||||
label:'提交本屏复核',
|
||||
description:SCREEN_REVIEW_REQUIREMENTS+' 提交整屏实际画面的复核结论、位置与建议。图像和叠层对位有误时,可对照 overlayLayers 的 bounds 和 subjectBounds,建议用 native_call 的 edit.transform 移动或缩放叠层,或用 transform_slot_image 调整候选并采纳,再重新复核。slotId 可省略,找不到图位编号时只填写 location。',
|
||||
parameters:screenAssessment,
|
||||
prepareArguments:value=>validateWorkerArguments('review_output_screen',screenAssessment,value,()=>[example,facts()].join('\n')),
|
||||
execute:(_id, value) => {
|
||||
prepareArguments:prepare,
|
||||
execute:(_id, raw) => {
|
||||
const droppedReferences=[];
|
||||
const value=normalize(prepare(raw),droppedReferences);
|
||||
const audit=droppedReferences.length?{droppedReferences}:{};
|
||||
validate(value,{example});
|
||||
const {verdict} = value;
|
||||
receipt = {page,revision,screenFingerprint,...value};
|
||||
return {content:[{type:'text',text:'已收到本屏复核结论'}],details:{verdict},terminate:true};
|
||||
receipt = {page,revision,screenFingerprint,...value,...audit};
|
||||
return {content:[{type:'text',text:'已收到本屏复核结论'}],details:{verdict,...audit},terminate:true};
|
||||
},
|
||||
};
|
||||
const scope = screenReviewScope(variantId,outputId,page);
|
||||
|
||||
@ -16,21 +16,23 @@ test('candidate review binds the candidate and separates shown fields from numbe
|
||||
assert.match(system,/顶层 templateStyle/u);
|
||||
assert.match(system,/checks.templateStyle/u);
|
||||
const result={verdict:'pass',reason:'颜色与文案相符',
|
||||
screenVerdict:'pass',templateStyle:null};
|
||||
assert.throws(()=>review.execute('',{...result,shownFields:[{field:'颜色名称',evidence:'橡木色'}]}),
|
||||
/"field":"K02","label":"颜色名称"/u);
|
||||
screenVerdict:'needs_fix',screenSummary:'文案位置需调整',templateStyle:null,
|
||||
copyFixes:[{field:'颜色名称',issue:'位置偏低',suggestion:'向上移动'}]};
|
||||
for(const [change,error] of [[{reason:''},/reason:/u],[{verdict:undefined},/verdict:/u]]) {
|
||||
assert.throws(()=>review.prepareArguments({...result,...change}),error);
|
||||
}
|
||||
assert.throws(()=>review.prepareArguments({...result,unknownField:true}),/unknownField/u);
|
||||
assert.equal(review.prepareArguments({recommendedAction:'regenerate',reason:'结构不符'}).verdict,'revise');
|
||||
assert.equal(review.prepareArguments({verdict:'pass',reason:'匹配实拍',checks:{color:true}}).checks.color,true);
|
||||
assert.deepEqual(review.prepareArguments({verdict:'revise',reason:'标注偏移',screenReview:{imageIssues:[{nativeLayerId:12,location:'底部',issue:'偏移',suggestion:'移动'}]}}).overlayFixes,
|
||||
[{nativeLayerId:12,location:'底部',issue:'偏移',suggestion:'移动'}]);
|
||||
review.execute('',review.prepareArguments({...result,shownFields:[{field:'K02',location:'画面中央'}]}));
|
||||
review.execute('',review.prepareArguments({...result,templateFidelity:{},shownFields:[{field:'颜色名称',location:'画面中央'},{field:'颜色名称 ',location:'底部'}]}));
|
||||
};
|
||||
const result=await reviewProductionCandidate({canvas,runAgent,slot,screen,candidateId:'photo',liveScreenCopy:screenCopy});
|
||||
assert.equal(result.verdict,'pass');
|
||||
assert.deepEqual(result.droppedReferences,[{path:'shownFields[1].field',value:'颜色名称 '}]);
|
||||
assert.equal(result.observation.screenReview.templateStyle,null);
|
||||
assert.equal(result.observation.screenReview.copyFixes[0].field,'K02');
|
||||
assert.deepEqual(result.observation.visualEvidence,[{field:'K02',location:'画面中央'}]);
|
||||
});
|
||||
|
||||
|
||||
@ -285,37 +285,33 @@ test('screen reviews keep images in the worker and persist findings and passes',
|
||||
}
|
||||
});
|
||||
|
||||
test('Pi returns all invalid screen targets and accepts the corrected and location-only findings', {timeout:10_000}, async t=>{
|
||||
test('Pi drops invalid references and keeps located findings', {timeout:10_000}, async t=>{
|
||||
const {host,actions}=await fixture(t);
|
||||
const locationOnly={...needsFix,
|
||||
imageIssues:needsFix.imageIssues.map(({slotId,...issue})=>issue),
|
||||
overlayFixes:[{location:'右上方角标',issue:'角标压住标题',suggestion:'挪到标题上方'}],
|
||||
copyFixes:[{location:'图片下沿',issue:'合成图残留旧规格',suggestion:'改为实际规格'}],
|
||||
};
|
||||
const worker=await usePiWorker(t,host,'review_output_screen',(round,previous)=>{
|
||||
if(round===1)return {...needsFix,verdict:'pass',
|
||||
imageIssues:[{...needsFix.imageIssues[0],slotId:'wrong-slot'}],
|
||||
overlayFixes:[{...needsFix.overlayFixes[0],nativeLayerId:999}],
|
||||
copyFixes:[{...needsFix.copyFixes[0],field:'wrong-field'},{issue:'规格错误',suggestion:'改成实际规格'}],
|
||||
};
|
||||
assert.equal(round,2);
|
||||
assert.equal(previous.isError,true);
|
||||
const reason=previous.content[0].text;
|
||||
for(const fact of ['verdict 为 pass','imageIssues[0].slotId "wrong-slot"','overlayFixes[0].nativeLayerId 999',
|
||||
'copyFixes[0].field "wrong-field"','copyFixes[1].location','"nativeLayerId":202','"name":"尺寸标注"',
|
||||
'"text":"旧尺寸"','"slotId":"slot-2"','"field":"title-2"'])assert.ok(reason.includes(fact),reason);
|
||||
return {...locationOnly,imageIssues:[{...locationOnly.imageIssues[0],slotNumber:1}],copyFixes:[{...locationOnly.copyFixes[0],screenFieldNumber:1}]};
|
||||
});
|
||||
assert.deepEqual(await actions.check_output_screens({pages:[2],wait:true}),
|
||||
[{page:2,revision:7,screenFingerprint:'screen-P2',...locationOnly,imageIssues:[{...locationOnly.imageIssues[0],slotId:'slot-2'}],
|
||||
copyFixes:[{...locationOnly.copyFixes[0],field:'title-2'}]}]);
|
||||
assert.equal(worker.calls(),2);
|
||||
const worker=await usePiWorker(t,host,'review_output_screen',()=>({
|
||||
...locationOnly,
|
||||
imageIssues:[{...locationOnly.imageIssues[0],slotId:' ',slotNumber:999}],
|
||||
overlayFixes:[{...locationOnly.overlayFixes[0],nativeLayerId:999}],
|
||||
copyFixes:[{...locationOnly.copyFixes[0],field:'wrong-field',screenFieldNumber:999}],
|
||||
}));
|
||||
const [receipt]=await actions.check_output_screens({pages:[2],wait:true});
|
||||
assert.deepEqual(receipt,{page:2,revision:7,screenFingerprint:'screen-P2',...locationOnly,
|
||||
droppedReferences:[
|
||||
{path:'imageIssues[0].slotId',value:' '},{path:'imageIssues[0].slotNumber',value:999},
|
||||
{path:'overlayFixes[0].nativeLayerId',value:999},{path:'copyFixes[0].field',value:'wrong-field'},
|
||||
{path:'copyFixes[0].screenFieldNumber',value:999},
|
||||
]});
|
||||
assert.equal(worker.calls(),1);
|
||||
});
|
||||
|
||||
test('waiting screen review returns its last rejection when Pi reaches the turn limit', {timeout:10_000}, async t=>{
|
||||
const {host,actions}=await fixture(t);
|
||||
const worker=await usePiWorker(t,host,'review_output_screen',round=>({
|
||||
...needsFix,overlayFixes:[{...needsFix.overlayFixes[0],nativeLayerId:900+round}],
|
||||
...needsFix,overlayFixes:[{...needsFix.overlayFixes[0],nativeLayerId:900+round,location:undefined}],
|
||||
}));
|
||||
const [receipt]=await actions.check_output_screens({pages:[2],wait:true});
|
||||
assert.equal(worker.calls(),WORKER_TURN_LIMIT);
|
||||
@ -349,7 +345,7 @@ test('await_image_slots releases a candidate review that never submits a valid c
|
||||
if(round>1){
|
||||
const reason=previous.content[0].text;
|
||||
for(const fact of [`candidateId "wrong-${round-1}"`,`本次可用 candidateId "${candidateId}"`,
|
||||
'shownFields[0].field "unknown"','本次可用 field [{"field":"wood","label":"木材"},{"field":"title-2"}]'])assert.ok(reason.includes(fact),reason);
|
||||
'本次可用 field [{"field":"wood","label":"木材"},{"field":"title-2"}]'])assert.ok(reason.includes(fact),reason);
|
||||
}
|
||||
return {screenReview:pass,candidateId:`wrong-${round}`,verdict:'pass',reason:'与原图相符',
|
||||
checks:{structure:true,color:true,composition:true,evidence:true},shownFields:[{field:'unknown',location:'画面中央'}]};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user