From 9d6a2c696ef0ea472304abcea90f84f5b5b0a7c6 Mon Sep 17 00:00:00 2001 From: WuYongJie <549727955@qq.com> Date: Sun, 29 Nov 2026 07:17:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=9A=E6=97=A0=E5=AE=9E=E6=97=B6=E6=96=87?= =?UTF-8?q?=E6=A1=88=E6=97=B6=E5=80=99=E9=80=89=E5=A4=8D=E6=A0=B8=E7=9C=81?= =?UTF-8?q?=E7=95=A5=E6=96=87=E6=A1=88=E5=AF=B9=E7=85=A7=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E5=86=8D=E5=8F=8D=E5=A4=8D=E9=80=80=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 第 24 轮复核子代理在文案未写入时引用整屏字段编号(如 M01-T01),候选文案清单为空,连续多次被判不在清单中。现在清单为空时提示省略 shownFields,提交时忽略该项;有实时文案时仍严格校验。补测试。 --- apps/detail-agent-pi/src/candidate-review.mjs | 8 +++++++- .../test/candidate-review.test.mjs | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/apps/detail-agent-pi/src/candidate-review.mjs b/apps/detail-agent-pi/src/candidate-review.mjs index ea365b08..e810e3b1 100644 --- a/apps/detail-agent-pi/src/candidate-review.mjs +++ b/apps/detail-agent-pi/src/candidate-review.mjs @@ -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 提交结论。', diff --git a/apps/detail-agent-pi/test/candidate-review.test.mjs b/apps/detail-agent-pi/test/candidate-review.test.mjs index c6546653..059e7164 100644 --- a/apps/detail-agent-pi/test/candidate-review.test.mjs +++ b/apps/detail-agent-pi/test/candidate-review.test.mjs @@ -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,[]); +});