Merge main into one-click detail-page generation
This commit is contained in:
commit
d503bfc3f3
@ -614,7 +614,7 @@ export class DetailPiAgent {
|
||||
}
|
||||
async readEnterpriseRules() {
|
||||
const template = this.currentWorkflow?.template;
|
||||
if (!this.currentWorkflow.available || !template?.enterprise) return null;
|
||||
if (!this.currentWorkflow?.available || !template?.enterprise) return null;
|
||||
const product = this.productEvidence.product;
|
||||
this.enterpriseContext ??= new EnterpriseContext(this.store);
|
||||
return this.enterpriseContext.load({task:this.task || 'chat',
|
||||
|
||||
@ -337,3 +337,51 @@ test('legacy migration rejects a pre-existing target with different bytes and ne
|
||||
await assert.rejects(fs.access(path.join(stableDir,'session.json')),error=>error.code==='ENOENT');
|
||||
}finally{await cleanup(root);}
|
||||
});
|
||||
|
||||
test('a plain image count reads every slot without dispatching to the selected model',async()=>{
|
||||
const x=await fixture(()=>sse({content:'可以讨论这些图。'}));
|
||||
const slots=Array.from({length:27},(_,index)=>({
|
||||
id:'slot-'+index,
|
||||
selectedCandidateId:index<2?'accepted-'+index:null,
|
||||
candidates:index===2?[{status:'complete'}]:index===3?[{status:'unknown'}]:[],
|
||||
}));
|
||||
const offsets=[];
|
||||
x.native.workflowRead=async({section,offset=0})=>{
|
||||
if(section==='slots')offsets.push(offset);
|
||||
return {available:true,version:18,section,canvasFirst:true,outputId:'detail',productVariantId:'brown',
|
||||
totalSlots:slots.length,slots:slots.slice(offset,offset+12),productEvidence:evidence(x.identity.project)};
|
||||
};
|
||||
try{
|
||||
const result=await x.host.prompt('后面还有几张图没有完成的');
|
||||
assert.match(result.text,/27 个图位,已回填 2 个,还有 25 个未回填/);
|
||||
assert.match(result.text,/1 个已有候选,1 个正在生成或待核查,23 个暂无可用候选/);
|
||||
assert.deepEqual(offsets,[0,12,24]);
|
||||
assert.equal(result.rounds,0);
|
||||
assert.equal(x.requests.length,0);
|
||||
assert.equal(x.native.writes,0);
|
||||
await x.host.prompt('后面还有几张图没有完成,麻烦先生成首图');
|
||||
assert.equal(x.requests.length,1);
|
||||
}finally{await x.close();}
|
||||
});
|
||||
|
||||
test('a desktop turn continues past 12 useful model calls',async()=>{
|
||||
const x=await fixture((_payload,n)=>n<=12?tool('workflow_read',{section:'slots',offset:n-1}):sse({content:'逐个核对完了。'}));
|
||||
x.native.workflowRead=async({section,offset=0})=>({available:true,version:1,section,
|
||||
canvasFirst:true,outputId:'detail',offset,productEvidence:evidence(x.identity.project)});
|
||||
try{
|
||||
assert.equal((await x.host.prompt('请逐个核对所有图位的描述')).text,'逐个核对完了。');
|
||||
assert.equal(x.requests.length,13);
|
||||
}finally{await x.close();}
|
||||
});
|
||||
|
||||
test('first reply text reaches the canvas even when a reasoning update just arrived',async()=>{
|
||||
const chunk=delta=>'data: '+JSON.stringify({id:'qa',model:'qa',choices:[{index:0,delta,finish_reason:null}]})+'\n\n';
|
||||
const x=await fixture(()=>chunk({reasoning_content:'检查资料'})+chunk({content:'第一段'})+sse({content:'。第二段。'}));
|
||||
const presented=[];
|
||||
x.native.delta=async text=>{presented.push(text);};
|
||||
try{
|
||||
assert.equal((await x.host.prompt('用两句短话介绍一下你自己')).text,'第一段。第二段。');
|
||||
assert.ok(presented.includes('第一段'));
|
||||
assert.ok(presented.includes('第一段。第二段。'));
|
||||
}finally{await x.close();}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user