记录小壹逐字段填写依据和模板旧值冲突
This commit is contained in:
parent
2aed7dc1cf
commit
1974159caa
@ -93,6 +93,7 @@ const PRODUCTION_SYSTEM = `你是小壹的制作助手。依据本项目发布
|
||||
当前为无人值守制作,没有可询问的人,也没有人工后期;用户启动制作即授权你代为决定。小壹原生画布完成合成和导出,交付目录已由界面指定。指引要求用户事先选择、确认或交人工处理的事项,由你依据商品资料和模板自行决定并继续制作,所作选择和确实无法处理的事项在交付回执中如实列出。
|
||||
${PRODUCT_VOICE}
|
||||
用 plan_production 查看待交付项,open_production_output 切换可写画布,保留各成品在途工作。用 list_project_images 查询本项目可复用的候选。用户附带引用时,用其中的输出、花色、图位、候选或原生图层身份定位目标。
|
||||
模板样例只用于理解版式和字段用途。写文案前,按企业字段适配规则逐字段用 record_field_requirements 登记保留、改写或待核实及本款依据。资料已明确给出对应数值、单位、材质、颜色或规格时,可在 facts 登记对应值;有多个模板值时注明确切的模板值。用计划回执的 fieldConflicts 核对旧值,复核时结合字段依据与实际画面,用交稿回执的 visibleConflicts 查残留文字。
|
||||
读实时文案并使画面与对应卖点一致。子代理读取本屏实时文案,验图回执绑定当时的文案签名。文案更新后可按新文案复核。安排图位任务时写清需呈现的内容,避免把模板原文当成当前卖点。
|
||||
一屏文案定下来就可以参考 dispatchReady 分派这屏图位,后台生图期间继续制作其他屏或成品。用 review_image_slots 查看各成品回执,waiting_canvas 表示切回后可继续处理的图位。
|
||||
用 tool_search 查找按需工具。企业指引中的命令行编修可用等价的画布命令完成。通过 native_catalog 查原生命令与完整参数,复用已取得的 parameterDocs。连续的确定操作可用 codemode 依次 await,用真实回执衔接各步。脚本可用 store() 留存需要复用的大对象,只输出本次判断所需的字段、状态和失败原因。查图层树时可用 layer.list,并在脚本内筛选目标。
|
||||
@ -109,7 +110,7 @@ const inactiveDocument = error => error?.category === 'scope_changed';
|
||||
const sequentialTools = new Set([
|
||||
'memory_set', 'canvas_edit', 'canvas_preview', 'copywriting_options', 'copywriting_fields',
|
||||
'workflow_navigate', 'workflow_execute', 'workflow_propose',
|
||||
'open_production_output', 'write_copy_fields', 'use_product_image', 'transform_slot_image', 'prepare_image_request',
|
||||
'open_production_output', 'record_field_requirements', 'write_copy_fields', 'use_product_image', 'transform_slot_image', 'prepare_image_request',
|
||||
'dispatch_image_request', 'delegate_image_slots', 'stage_archived_image', 'check_image_slots', 'check_output_screens',
|
||||
'adopt_production_image', 'retire_production_image', 'reconcile_image_slots', 'record_screen_check',
|
||||
'defer_production_output', 'finish_production',
|
||||
|
||||
44
apps/detail-agent-pi/src/field-requirements.mjs
Normal file
44
apps/detail-agent-pi/src/field-requirements.mjs
Normal file
@ -0,0 +1,44 @@
|
||||
const units = {mm:1,cm:10,m:1000,'毫米':1,'厘米':10,'米':1000};
|
||||
const quantities = /(?<![\d.])\d+(?:\.\d+)?\s*(?:mm|cm|m|毫米|厘米|米)(?![a-z])/giu;
|
||||
const magnitude = value => {
|
||||
const unit = value.match(/[^\d.\s]+$/u)?.[0].toLowerCase();
|
||||
return Number.parseFloat(value) * units[unit];
|
||||
};
|
||||
const tokens = value => [...String(value ?? '').matchAll(quantities)].map(match=>match[0]);
|
||||
|
||||
export function compareTemplateFields(fields, facts, requirements) {
|
||||
const byLayer = new Map(requirements.map(row=>[row.layer,row.facts]));
|
||||
return fields.flatMap(field=>{
|
||||
const declared = byLayer.get(field.layer);
|
||||
const matches = declared ?? (Object.hasOwn(facts,field.label) ? [facts[field.label]] : []);
|
||||
return matches.flatMap(fact=>{
|
||||
const templateSample = field.originalText;
|
||||
if (!templateSample) return [];
|
||||
const {kind,productValue} = fact;
|
||||
const quantitiesInSample = tokens(templateSample);
|
||||
const templateValue = fact.templateValue ?? (kind==='quantity'
|
||||
? quantitiesInSample.length===1 ? quantitiesInSample[0] : undefined
|
||||
: templateSample.trim());
|
||||
if (!templateValue || !templateSample.includes(templateValue)) return [];
|
||||
if (kind==='quantity') {
|
||||
if (!tokens(productValue).includes(productValue) || !quantitiesInSample.includes(templateValue)
|
||||
|| magnitude(productValue)===magnitude(templateValue)) return [];
|
||||
} else if (templateValue===productValue) return [];
|
||||
return [{field:field.field,layer:field.layer,page:field.page,kind,templateSample,templateValue,productValue}];
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export function visibleTemplateConflicts(conflicts, textLayers) {
|
||||
return conflicts.flatMap(conflict=>{
|
||||
const {kind,templateValue,productValue} = conflict;
|
||||
const hasValue = (text,value) => kind==='quantity'
|
||||
? tokens(text).some(token=>magnitude(token)===magnitude(value))
|
||||
: text.includes(value);
|
||||
const layers = textLayers.filter(row=>row.page===conflict.page && row.text && (row.layer===conflict.layer || row.overlay));
|
||||
const oldLayers = layers.filter(row=>hasValue(row.text,templateValue));
|
||||
if (!oldLayers.length) return [];
|
||||
return [{...conflict,state:layers.some(row=>hasValue(row.text,productValue))?'both_visible':'old_visible',
|
||||
oldLayers:oldLayers.map(({layer,text})=>({layer,text}))}];
|
||||
});
|
||||
}
|
||||
@ -255,7 +255,9 @@ export async function unfinishedProductionTurn(host) {
|
||||
}
|
||||
|
||||
async function submitProduction(host, input, signal) {
|
||||
const result = await host.canvas.finishProduction(input,signal);
|
||||
const {fieldRequirements,visibleConflicts,visibleConflictCount,...request}=input;
|
||||
const result = await host.canvas.finishProduction(request,signal);
|
||||
if(fieldRequirements)Object.assign(result,{fieldRequirements,visibleConflicts,visibleConflictCount});
|
||||
const receipt = result.stageStatus==='hard-blocked'
|
||||
? {...result,availableOutputs:result.pendingOutputs} : result;
|
||||
const goal=host.productionGoal;
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import { compareTemplateFields, visibleTemplateConflicts } from './field-requirements.mjs';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { CanvasOperations } from './canvas-operations.mjs';
|
||||
@ -83,6 +84,11 @@ export const productionOperationTools = [
|
||||
['read_copy_fields','省略 pageId 和 fieldId 返回全页字段身份、当前文字、约束及修订号;指定页面或字段可读取图层样式、范围及关联字段。',obj({
|
||||
pageId:optional(Type.String()),fieldId:optional(Type.String()),
|
||||
})],
|
||||
['record_field_requirements','逐字段登记本款填写要求和依据。facts 用于登记资料中已明确的对应值,数字须带单位;模板内有多个值时填写确切的 templateValue。',obj({
|
||||
items:Type.Array(obj({layer:Type.Integer({minimum:1}),decision:Type.Union(['保留','改写','待核实'].map(value=>Type.Literal(value))),
|
||||
basis:text,facts:optional(Type.Array(obj({kind:Type.Union(['quantity','material','color','specification'].map(value=>Type.Literal(value))),
|
||||
productValue:text,templateValue:optional(text)})))})),
|
||||
})],
|
||||
['write_copy_fields','按 revision 原位写入指定文字格。可传 expectedText 核对原文,每个 layer 只传一次。原生命令已写过时可用 recordOnly 登记。某一屏文案定下来就可以按 dispatchReady 派这一屏的图位,不必等整页文案;子代理在后台生图时继续写下一屏。retryWrite 表示画布暂不可写,rejected 列出保留原文的格子。模板规定缺资料时留空的字段,可传空文字并用 reason 记录依据。',obj({
|
||||
revision:rev,recordOnly:optional(Type.Boolean()),items:optional(Type.Array(obj({layer,text:Type.String(),expectedText:optional(Type.String()),sources:ids,pictures:ids,reason:optional(Type.String())}))),
|
||||
})],
|
||||
@ -403,7 +409,10 @@ export async function openProductionOperations(host,{target=host.productionGoal,
|
||||
?record.copyInputs===productionInputs(value,variantId)
|
||||
:record.creationRevision===value.revisions?.creation;
|
||||
const syncCopyEvidence=(record,value)=>{
|
||||
if(!evidenceMatches(value,record))delete record.copyEvidence;
|
||||
if(!evidenceMatches(value,record)){
|
||||
delete record.copyEvidence;
|
||||
delete record.fieldRequirements;
|
||||
}
|
||||
record.copyInputs=productionInputs(value,variantId);
|
||||
record.creationRevision=value.revisions?.creation;
|
||||
};
|
||||
@ -560,13 +569,29 @@ export async function openProductionOperations(host,{target=host.productionGoal,
|
||||
const snapshot=await trackCanvas(canvas.detailCopyFields({includeFilled:true,...options}));
|
||||
return Array.isArray(snapshot)?{fields:snapshot}:snapshot??{};
|
||||
};
|
||||
const fieldRequirements=value=>Object.values(evidenceMatches(value)?journal.fieldRequirements??{}:{});
|
||||
const fieldConflicts=async(snapshot,value)=>{
|
||||
const brief=value.productEvidence?.brief??{};
|
||||
const dimensions=brief.dimensions??{};
|
||||
const variant=brief.variants?.find(row=>row.id===variantId);
|
||||
const facts=Object.fromEntries([
|
||||
...Object.entries(dimensions).filter(([key,number])=>key!=='unit'&&String(number??'').trim()&&dimensions.unit)
|
||||
.map(([key,number])=>[({length:'长',width:'宽',height:'高'})[key]??key,
|
||||
{kind:'quantity',productValue:`${number} ${dimensions.unit}`}]),
|
||||
...(variant?.materialName?[['材质',{kind:'material',productValue:variant.materialName}]]:[]),
|
||||
...(variant?.colorName?[['颜色',{kind:'color',productValue:variant.colorName}]]:[]),
|
||||
]);
|
||||
const pages=await Promise.all((snapshot.pages??[]).map(pageId=>copySnapshot({pageId})));
|
||||
return compareTemplateFields(pages.length?pages.flatMap(page=>page.fields??[]):snapshot.fields??[],
|
||||
facts,fieldRequirements(value));
|
||||
};
|
||||
const pendingCopyBySlot=async selected=>{
|
||||
const linked=selected.filter(slot=>slot.relatedFields?.length);
|
||||
if(!linked.length)return new Map();
|
||||
const pending=canvasReady?(await suspendedCopy)?.pending:await trackCanvas(canvas.detailCopyFields({includeFilled:false}));
|
||||
if(!pending)return new Map();
|
||||
return new Map(linked.map(slot=>[slot.id,pending.filter(row=>slot.relatedFields.includes(row.field))
|
||||
.map(({field,label,currentText})=>({fieldId:field,label,currentText}))]));
|
||||
.map(({field,label,currentText,templateSample})=>({fieldId:field,label,...(templateSample?{templateExample:currentText}:null)}))]));
|
||||
};
|
||||
const dispatchReady=(selected,pending)=>selected.filter(slot=>
|
||||
(!slot.relatedFields?.length||pending.has(slot.id)&&!pending.get(slot.id).length)
|
||||
@ -1065,6 +1090,7 @@ export async function openProductionOperations(host,{target=host.productionGoal,
|
||||
const {production,skillSources,resourceSetId,...template}=plan.template;
|
||||
const {outputId:workingOutputId,variantId:workingVariantId}=host.productionGoal;
|
||||
return {outputId,variantId,workingOutput:workingOutputId?{outputId:workingOutputId,variantId:workingVariantId}:null,
|
||||
fieldConflicts:await fieldConflicts(await copySnapshot(),plan),fieldRequirements:fieldRequirements(plan),
|
||||
template,product:{name,dimensions,note,variant:variant&&{id:variant.id,colorName:variant.colorName}},
|
||||
maxGenerationAttempts,generationLimitSource,pictures,dispatchReady:dispatchReady(selected,pendingCopy),
|
||||
inFlightImages:(await pendingNative()).map(row=>row.candidateId),
|
||||
@ -1083,6 +1109,25 @@ export async function openProductionOperations(host,{target=host.productionGoal,
|
||||
const fields=snapshot.fields?.map(({nativeFrame,textSafeFrame,styleRoles,relatedFields,...field})=>field);
|
||||
return {...snapshot,outputId,variantId,fields};
|
||||
},
|
||||
record_field_requirements({items}){
|
||||
return serialize(async()=>{
|
||||
const inputPlan=await current({refresh:true});
|
||||
const {fields=[]}=await copySnapshot();
|
||||
const byLayer=new Map(fields.map(field=>[field.layer,field]));
|
||||
for(const {layer} of items){
|
||||
if(!byLayer.has(layer))throw Error(`当前画布没有文字格 ${layer}`);
|
||||
}
|
||||
await update(record=>{
|
||||
syncCopyEvidence(record,inputPlan);
|
||||
record.fieldRequirements??={};
|
||||
for(const row of items){
|
||||
const {field,page}=byLayer.get(row.layer);
|
||||
record.fieldRequirements[row.layer]={...row,field,page};
|
||||
}
|
||||
});
|
||||
return {fieldRequirements:fieldRequirements(inputPlan)};
|
||||
});
|
||||
},
|
||||
write_copy_fields({revision,recordOnly,items=[]},signal){
|
||||
return serialize(async()=>{
|
||||
const noUpdates={total:0,truncated:false,items:[]};
|
||||
@ -1266,7 +1311,7 @@ export async function openProductionOperations(host,{target=host.productionGoal,
|
||||
}
|
||||
const live=await liveSlot(slot);
|
||||
const status=slotDrawStatus(live);
|
||||
const instructions='完成主代理委托的图位。goal 是本次任务,screenCopy 是画布实时文案。可用 transform_slot_image 调整已有图像并查看像素指标。派发回执会带原请求号,宿主继续跟踪结果。'+
|
||||
const instructions='完成主代理委托的图位。goal 是本次任务,screenCopy 是画布实时文案。pendingCopyFields 中的 templateExample 是模板样例,仅供参考。可用 transform_slot_image 调整已有图像并查看像素指标。派发回执会带原请求号,宿主继续跟踪结果。'+
|
||||
(rework?'\n先看随消息附上的退回图、验图回执和上次实发提示词。按发布规则处理,用 reworkChange 记录改动。':'');
|
||||
const screenCopy=await liveSlotCopy(slot);
|
||||
delegateSignal.throwIfAborted();
|
||||
@ -1291,7 +1336,7 @@ export async function openProductionOperations(host,{target=host.productionGoal,
|
||||
}
|
||||
if(assigned.some(row=>row.state==='assigned'))notice('图位已排队');
|
||||
return {assigned,...(unmatched.length?{unmatched}:null),
|
||||
...(assigned.some(row=>row.pendingCopyFields)?{copyContext:'子代理按本屏实时已写文案理解卖点和验图。待写字段仍为模板原文或空白,写进 goal 的模板原文会作为制作要求传给子代理。'}:null)};
|
||||
...(assigned.some(row=>row.pendingCopyFields)?{copyContext:'子代理按本屏实时已写文案理解卖点和验图。待写字段的 templateExample 是模板样例,仅供参考。goal 请引用已核实的本款资料和字段填写要求。'}:null)};
|
||||
},
|
||||
async await_image_slots({slotIds}){
|
||||
const wanted=new Set(selections(slotIds).map(slot=>slot.id));
|
||||
@ -1490,10 +1535,12 @@ export async function openProductionOperations(host,{target=host.productionGoal,
|
||||
return {image:{type:'image',data:resized.data,mimeType:resized.mimeType},note:formatDimensionNote(resized)};
|
||||
}));
|
||||
const notes=previews.map(preview=>preview.note).filter(Boolean);
|
||||
const requirements=fieldRequirements(plan).filter(row=>row.page===pageId);
|
||||
return imageResult({...details,...(overlayLayers===undefined?null:{overlayLayers}),
|
||||
...(snapshot.revision!=null&&snapshot.revision!==details.revision?{copyRevision:snapshot.revision}:null),
|
||||
...(snapshot.screenFingerprint!==details.screenFingerprint?{screenChanged:true}:null),
|
||||
...(screenCopy.length?{screenCopy}:null),
|
||||
...(requirements.length?{fieldRequirements:requirements}:null),
|
||||
...(notes.length?{previewDimensions:notes}:null),images:previews.map(preview=>preview.image)});
|
||||
};
|
||||
if(!pages?.length){
|
||||
@ -1553,7 +1600,7 @@ export async function openProductionOperations(host,{target=host.productionGoal,
|
||||
if(previous?.candidateReview && !screen.details.screenChanged &&
|
||||
previous.screenFingerprint===screen.details.screenFingerprint &&
|
||||
previous.copyInputs===productionInputs(await current({refresh:true}),variantId)){
|
||||
job.receipt={...previous.candidateReview,revision:screen.details.revision,reused:true};
|
||||
job.receipt={...previous.candidateReview,revision:screen.details.revision,...(screen.details.fieldRequirements?{fieldRequirements:screen.details.fieldRequirements}:null),reused:true};
|
||||
return;
|
||||
}
|
||||
const screenSlots=slots.filter(slot=>screen.details.fields?.includes(slot.fieldId))
|
||||
@ -1565,7 +1612,7 @@ export async function openProductionOperations(host,{target=host.productionGoal,
|
||||
page:page-1,screenFingerprint:receipt.screenFingerprint,
|
||||
issues:[...receipt.imageIssues,...receipt.overlayFixes,...receipt.copyFixes],
|
||||
},activeSignal,inputSignature));
|
||||
job.receipt=receipt;
|
||||
job.receipt=screen.details.fieldRequirements?{...receipt,fieldRequirements:screen.details.fieldRequirements}:receipt;
|
||||
}).catch(error=>{
|
||||
job.receipt={page,error:error.message};
|
||||
}).finally(()=>{
|
||||
@ -1615,8 +1662,25 @@ export async function openProductionOperations(host,{target=host.productionGoal,
|
||||
if(originals.images.length){
|
||||
return {text:'制作请求正在核查,已保留当前进度。',production:{...unfinished(originals),...screenEvidence}};
|
||||
}
|
||||
const snapshot=await copySnapshot();
|
||||
const conflicts=await fieldConflicts(snapshot,inputPlan);
|
||||
const visibleConflicts=[];
|
||||
for(const pageId of new Set(conflicts.map(row=>row.page))){
|
||||
const page=snapshot.pages?.indexOf(pageId)??-1;
|
||||
const fields=(snapshot.fields??[]).filter(row=>row.page===pageId&&row.currentText?.trim());
|
||||
const mapped=await Promise.all(fields.map(async row=>{
|
||||
const visible=row.visible??(await canvas.readCanvas({layer:row.layer})).context?.layers?.[0]?.effectiveVisible;
|
||||
return visible?{page:pageId,layer:row.layer,text:row.currentText}:null;
|
||||
}));
|
||||
const {overlayLayers=[]}=page<0?{}:await canvas.detailRender({page});
|
||||
const overlays=overlayLayers.filter(row=>!row.mapped).map(row=>({page:pageId,layer:row.nativeLayerId,text:row.text,overlay:true}));
|
||||
visibleConflicts.push(...visibleTemplateConflicts(conflicts.filter(row=>row.page===pageId),
|
||||
[...new Map([...mapped.filter(Boolean),...overlays].map(row=>[row.layer,row])).values()]));
|
||||
}
|
||||
if((await canvas.read()).revision!==revision)throw Error('画布已更新,请读取当前画面再提交导出');
|
||||
return {text:'已提交当前画布,正在保存和导出。',production:{
|
||||
outputId,variantId,complete:true,canvasRevision:revision,issues,...screenEvidence,
|
||||
fieldRequirements:fieldRequirements(inputPlan),visibleConflicts,visibleConflictCount:visibleConflicts.length,
|
||||
}};
|
||||
},
|
||||
};
|
||||
|
||||
@ -65,7 +65,7 @@ export function screenFindings({overlayLayers,screenCopy,slots}) {
|
||||
}
|
||||
|
||||
export async function reviewOutputScreen({runAgent, page, screen, references, slots, outputId, variantId, signal}) {
|
||||
const {revision,screenFingerprint,screenChanged,overlayLayers,slotGeometry,screenCopy=[]} = screen.details;
|
||||
const {revision,screenFingerprint,screenChanged,overlayLayers,slotGeometry,fieldRequirements,screenCopy=[]} = screen.details;
|
||||
const images = screen.content.filter(item => item.type === 'image');
|
||||
if (!screenFingerprint || images.length !== 1) throw Error('未读取到当前屏的实际画面和内容指纹');
|
||||
if (screenChanged) throw Error('读取画面后本屏已变化,请复查当前屏');
|
||||
@ -94,7 +94,7 @@ export async function reviewOutputScreen({runAgent, page, screen, references, sl
|
||||
'找不到对应图位、叠层或文案字段时,省略编号并用 location 描述在画面中的具体位置。',
|
||||
'有问题时填写 needs_fix 和至少一项问题。通过时三组问题均为空。',
|
||||
].join('\n');
|
||||
const prompt = JSON.stringify({page,revision,product,slots,slotGeometry,screenCopy,overlayLayers,productReferenceCount:photos.length});
|
||||
const prompt = JSON.stringify({page,revision,product,slots,slotGeometry,screenCopy,fieldRequirements,overlayLayers,productReferenceCount:photos.length});
|
||||
const captions = ['当前整屏成片', ...photos.map((_,index) => `本款实拍 ${index + 1}`)];
|
||||
await runAgent(`screen-${page}`, instructions, prompt, [tool], [...images,...photos], scope, captions,signal);
|
||||
signal?.throwIfAborted();
|
||||
|
||||
@ -216,3 +216,45 @@ test('switching outputs discards the prior canvas copy reads and uses the new li
|
||||
const journal=host.store.ledger('main_images',variantId).read();
|
||||
assert.deepEqual(journal.items[slot.id].review.observation.reviewedCopy,[['title','圆角桌面']]);
|
||||
});
|
||||
|
||||
test('field decisions persist across turns and visible old values are reported through handoff',async t=>{
|
||||
const dir=await fs.mkdtemp(path.join(os.tmpdir(),'jiansun-pi-field-requirements-'));
|
||||
t.after(()=>cleanup(dir));
|
||||
const sample='座高62.26cm';
|
||||
const live=[
|
||||
{layer:1,page:'P01',field:'seat',label:'座高',originalText:sample,currentText:sample,visible:true},
|
||||
{layer:2,page:'P01',field:'title',currentText:'标题',visible:true},
|
||||
{layer:3,page:'P01',field:'material',currentText:'',visible:true},
|
||||
];
|
||||
let overlayLayers=[];
|
||||
const host={store:productionStore(dir),productionGoal:{outputId:'detail',variantId:'oak'},canvas:{
|
||||
imageRequest:async()=>[],
|
||||
workflowRead:async()=>({available:true,canvasFirst:true,outputId:'detail',productVariantId:'oak',
|
||||
template:{contentHash:'fixture'},totalSlots:0,slots:[],productEvidence:{brief:{dimensions:{座高:'450',unit:'mm'}}}}),
|
||||
detailCopyFields:async({pageId})=>({fields:live.map(({originalText,...row})=>pageId?{...row,originalText}:row),pages:['P01'],revision:1}),
|
||||
detailRender:async()=>({revision:1,overlayLayers,images:[]}),
|
||||
}};
|
||||
completeCanvas(host.canvas);
|
||||
let actions=await openProductionOperations(host);
|
||||
const plan=await actions.plan_production();
|
||||
assert.deepEqual(plan.fieldConflicts.map(({field,templateValue,productValue})=>[field,templateValue,productValue]),
|
||||
[['seat','62.26cm','450 mm']]);
|
||||
const {fieldRequirements}=await actions.record_field_requirements({items:[
|
||||
{layer:1,decision:'改写',basis:'本款规格表座高 450 mm'},
|
||||
{layer:2,decision:'保留',basis:'标题适用于本款'},
|
||||
{layer:3,decision:'待核实',basis:'规格表未列材质'},
|
||||
]});
|
||||
await actions.close();
|
||||
actions=await openProductionOperations(host);
|
||||
t.after(()=>actions.close());
|
||||
assert.deepEqual((await actions.read_output_screen({})).details.fieldRequirements,fieldRequirements);
|
||||
const finish=async()=> (await actions.finish_production({revision:1})).production;
|
||||
assert.equal((await finish()).visibleConflicts[0].state,'old_visible');
|
||||
live[0].currentText='座高 450 mm';
|
||||
overlayLayers=[{nativeLayerId:4,text:sample,mapped:false}];
|
||||
assert.equal((await finish()).visibleConflicts[0].state,'both_visible');
|
||||
overlayLayers=[];
|
||||
const delivered=await finish();
|
||||
assert.equal(delivered.visibleConflictCount,0);
|
||||
assert.deepEqual(delivered.fieldRequirements,fieldRequirements);
|
||||
});
|
||||
|
||||
@ -1076,13 +1076,13 @@ test('plans and delegate receipts report only linked pending copy and enqueue ev
|
||||
const receipt=await actions.delegate_image_slots({jobs:slots.map(({fieldId})=>({slotId:fieldId,goal:'展示本款实拍细节'}))});
|
||||
assert.deepEqual(receipt.assigned.map(({id,state,pendingCopyFields})=>({id,state,pendingCopyFields})),[
|
||||
{id:'front',state:'assigned',pendingCopyFields:[
|
||||
{fieldId:'title',label:'标题',currentText:'模板原文'},
|
||||
{fieldId:'tagline',label:'副标题',currentText:''},
|
||||
{fieldId:'title',label:'标题',templateExample:'模板原文'},
|
||||
{fieldId:'tagline',label:'副标题'},
|
||||
]},
|
||||
{id:'detail',state:'assigned',pendingCopyFields:undefined},
|
||||
{id:'photo',state:'assigned',pendingCopyFields:undefined},
|
||||
]);
|
||||
assert.match(receipt.copyContext,/实时已写文案.*goal 的模板原文/);
|
||||
assert.match(receipt.copyContext,/templateExample 是模板样例/);
|
||||
await Promise.all(slots.map(({id})=>actions.await_image_slots({slotIds:[id]})));
|
||||
assert.deepEqual(started.sort(([a],[b])=>a.localeCompare(b)),[['detail',['榫接结构']],['front',[]],['photo',[]]]);
|
||||
|
||||
@ -1370,7 +1370,8 @@ test('a sibling variant edit leaves the current plan usable, and a local edit ca
|
||||
const {generation:[completed]}=await actions.await_image_slots({slotIds:[slotId]});
|
||||
assert.equal(completed.phase,'complete');
|
||||
const finish=await actions.finish_production({revision:3,nextOutput});
|
||||
assert.deepEqual(finish.production,{outputId,variantId,complete:true,canvasRevision:3,issues:[]});
|
||||
assert.deepEqual(finish.production,{outputId,variantId,complete:true,canvasRevision:3,issues:[],
|
||||
fieldRequirements:[],visibleConflicts:[],visibleConflictCount:0});
|
||||
const blocker={kind:'missing_required_input',reason:'缺少官方承重参数',requiredAction:'请产品负责人提供官方承重规格'};
|
||||
const defer=await actions.defer_production_output({blocker,nextOutput});
|
||||
assert.deepEqual(defer.production,{outputId,variantId,complete:false,stageStatus:'hard-blocked',blocker,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user